Repository: tomwillow/SmartCharsetConverter Branch: master Commit: 5388242a6387 Files: 533 Total size: 4.4 MB Directory structure: gitextract_dzo0glnd/ ├── .clang-format ├── .github/ │ └── workflows/ │ └── cmake-single-platform.yml ├── .gitignore ├── CMakeLists.txt ├── CMakePresets.json ├── README-en.md ├── README.md ├── config_on_win.bat ├── sample/ │ ├── expect_pass/ │ │ ├── [EUC-JP]readme.txt │ │ ├── [Unknown]ubuntu-22.04.2-desktop-amd64.iso.torrent │ │ ├── [gb18030]你还戴着这副眼镜.txt │ │ ├── [utf-16].txt │ │ ├── [utf-16be].txt │ │ ├── [utf-16le].txt │ │ └── [utf-8].txt │ ├── not_pass_yet/ │ │ ├── [GB18030]DialogAnimation.h │ │ ├── [GB18030]LogRecord.h │ │ ├── [GB18030]TBarTool_GB.cpp │ │ ├── [GB18030]TDraw.h │ │ ├── [GB18030]TMenu.cpp │ │ ├── [GB18030]一个字.txt │ │ ├── [GB18030]澤野弘之.lrc │ │ ├── [GB18030]编译说明.txt │ │ ├── [GB18030]连杆.cpp │ │ ├── [UTF-8]CMakeLists.txt │ │ ├── [UTF-8]TBarTool.cpp │ │ └── [UTF-8]虚拟机环境.txt │ ├── tcvn/ │ │ ├── demo1-tcvn.txt │ │ ├── demo1-utf16le.txt │ │ └── demo1-utf8.txt │ └── uchardet_test_samples/ │ ├── ar/ │ │ ├── iso-8859-6.txt │ │ ├── utf-8.txt │ │ └── windows-1256.txt │ ├── be/ │ │ ├── iso-8859-5.txt │ │ ├── utf-8.txt │ │ └── windows-1251.txt │ ├── bg/ │ │ ├── iso-8859-5.txt │ │ ├── utf-8.txt │ │ └── windows-1251.txt │ ├── ca/ │ │ ├── iso-8859-1.txt │ │ ├── utf-8.txt │ │ └── windows-1252.txt │ ├── cs/ │ │ ├── ibm852.txt │ │ ├── iso-8859-2.txt │ │ ├── mac-centraleurope.txt │ │ ├── utf-8.txt │ │ └── windows-1250.txt │ ├── da/ │ │ ├── ibm865.txt │ │ ├── iso-8859-1.txt │ │ ├── iso-8859-15.txt │ │ ├── utf-8.txt │ │ └── windows-1252.txt │ ├── de/ │ │ ├── iso-8859-1.txt │ │ ├── utf-8.txt │ │ └── windows-1252.txt │ ├── el/ │ │ ├── cp737.txt │ │ ├── iso-8859-7.txt │ │ ├── utf-8.txt │ │ └── windows-1253.txt │ ├── en/ │ │ ├── ascii.txt │ │ └── utf-8.txt │ ├── eo/ │ │ ├── iso-8859-3.txt │ │ └── utf-8.txt │ ├── es/ │ │ ├── iso-8859-1.txt │ │ ├── iso-8859-15.txt │ │ ├── utf-8.txt │ │ └── windows-1252.txt │ ├── et/ │ │ ├── iso-8859-13.txt │ │ ├── iso-8859-15.txt │ │ ├── iso-8859-4.txt │ │ ├── utf-8.txt │ │ ├── windows-1252.txt │ │ └── windows-1257.txt │ ├── fi/ │ │ ├── iso-8859-1.txt │ │ └── utf-8.txt │ ├── fr/ │ │ ├── iso-8859-1.txt │ │ ├── iso-8859-15.txt │ │ ├── utf-16.be │ │ ├── utf-32.le │ │ ├── utf-8.txt │ │ └── windows-1252.txt │ ├── ga/ │ │ ├── iso-8859-1.txt │ │ ├── utf-8.txt │ │ └── windows-1252.txt │ ├── he/ │ │ ├── ibm862.logical.txt │ │ ├── ibm862.visual.txt │ │ ├── iso-8859-8.txt │ │ ├── utf-8.txt │ │ └── windows-1255.txt │ ├── hi/ │ │ └── utf-8.txt │ ├── hr/ │ │ ├── ibm852.txt │ │ ├── iso-8859-13.txt │ │ ├── iso-8859-16.txt │ │ ├── iso-8859-2.txt │ │ ├── mac-centraleurope.txt │ │ ├── utf-8.txt │ │ └── windows-1250.txt │ ├── hu/ │ │ ├── iso-8859-2.txt │ │ ├── utf-8.txt │ │ └── windows-1250.txt │ ├── it/ │ │ ├── iso-8859-1.txt │ │ └── utf-8.txt │ ├── ja/ │ │ ├── euc-jp.txt │ │ ├── iso-2022-jp.txt │ │ ├── shift_jis.txt │ │ ├── utf-16be.txt │ │ ├── utf-16le.txt │ │ └── utf-8.txt │ ├── ka/ │ │ ├── georgian-academy.txt │ │ ├── georgian-ps.txt │ │ └── utf-8.txt │ ├── ko/ │ │ ├── iso-2022-kr.txt │ │ ├── johab.txt │ │ ├── uhc.smi │ │ ├── utf-16.le │ │ ├── utf-32.be │ │ └── utf-8.txt │ ├── lt/ │ │ ├── iso-8859-10.txt │ │ ├── iso-8859-13.txt │ │ ├── iso-8859-4.txt │ │ └── utf-8.txt │ ├── lv/ │ │ ├── iso-8859-10.txt │ │ ├── iso-8859-13.txt │ │ ├── iso-8859-4.txt │ │ └── utf-8.txt │ ├── mk/ │ │ ├── ibm855.txt │ │ ├── iso-8859-5.txt │ │ ├── utf-8.txt │ │ └── windows-1251.txt │ ├── mt/ │ │ ├── iso-8859-3.txt │ │ └── utf-8.txt │ ├── no/ │ │ ├── ibm865.txt │ │ ├── iso-8859-1.txt │ │ ├── iso-8859-15.txt │ │ ├── utf-8.txt │ │ └── windows-1252.txt │ ├── pl/ │ │ ├── ibm852.txt │ │ ├── iso-8859-13.txt │ │ ├── iso-8859-16.txt │ │ ├── iso-8859-2.txt │ │ ├── mac-centraleurope.txt │ │ ├── utf-8.txt │ │ └── windows-1250.txt │ ├── pt/ │ │ ├── iso-8859-1.txt │ │ └── utf-8.txt │ ├── ro/ │ │ ├── ibm852.txt │ │ ├── iso-8859-16.txt │ │ ├── utf-8.txt │ │ └── windows-1250.txt │ ├── ru/ │ │ ├── ibm855.txt │ │ ├── ibm866.txt │ │ ├── iso-8859-5.txt │ │ ├── koi8-r.txt │ │ ├── mac-cyrillic.txt │ │ ├── utf-8.txt │ │ └── windows-1251.txt │ ├── sk/ │ │ ├── ibm852.txt │ │ ├── iso-8859-2.txt │ │ ├── mac-centraleurope.txt │ │ ├── utf-8.txt │ │ └── windows-1250.txt │ ├── sl/ │ │ ├── ibm852.txt │ │ ├── iso-8859-16.txt │ │ ├── iso-8859-2.txt │ │ ├── mac-centraleurope.txt │ │ ├── utf-8.txt │ │ └── windows-1250.txt │ ├── sr/ │ │ ├── iso-8859-5.txt │ │ ├── utf-8.txt │ │ └── windows-1251.txt │ ├── sv/ │ │ ├── iso-8859-1.txt │ │ ├── utf-8.txt │ │ └── windows-1252.txt │ ├── th/ │ │ ├── iso-8859-11.txt │ │ ├── tis-620.txt │ │ └── utf-8.txt │ ├── tr/ │ │ ├── iso-8859-3.txt │ │ ├── iso-8859-9.txt │ │ └── utf-8.txt │ ├── uk/ │ │ ├── utf-8.txt │ │ └── windows-1251.txt │ ├── vi/ │ │ ├── utf-8.txt │ │ ├── viscii.txt │ │ └── windows-1258.txt │ └── zh/ │ ├── big5.txt │ ├── euc-tw.txt │ ├── gb18030.txt │ └── utf-8.txt ├── scripts/ │ └── extract_change_log.py ├── src/ │ ├── CMakeLists.txt │ ├── Common/ │ │ ├── CMakeLists.txt │ │ ├── CommandLineParser.cpp │ │ ├── CommandLineParser.h │ │ ├── ConsoleSettings.cpp │ │ ├── ConsoleSettings.h │ │ ├── ErrorFunction.cpp │ │ ├── ErrorFunction.h │ │ ├── FileFunction.cpp │ │ ├── FileFunction.h │ │ ├── ResourceLoader.cpp │ │ ├── ResourceLoader.h │ │ ├── SingleApplication.h │ │ ├── ThreadPool/ │ │ │ ├── SafeQueue.h │ │ │ └── ThreadPool.h │ │ ├── TimeStamp.cpp │ │ ├── TimeStamp.h │ │ ├── noncopyable.h │ │ ├── tstring.cpp │ │ └── tstring.h │ ├── Control/ │ │ ├── CMakeLists.txt │ │ ├── ControlStyle.h │ │ ├── TListView.cpp │ │ ├── TListView.h │ │ ├── TMenu.cpp │ │ └── TMenu.h │ ├── Core/ │ │ ├── CMakeLists.txt │ │ ├── CharsetCode.cpp │ │ ├── CharsetCode.h │ │ ├── Config.cpp │ │ ├── Config.h │ │ ├── Core.cpp │ │ ├── Core.h │ │ ├── Detect.cpp │ │ ├── Detect.h │ │ ├── Exceptions.cpp │ │ ├── Exceptions.h │ │ ├── LineBreaks.cpp │ │ ├── LineBreaks.h │ │ ├── Messages.cpp │ │ ├── Messages.h │ │ ├── TranslatorBase.h │ │ ├── UCNVHelper.cpp │ │ ├── UCNVHelper.h │ │ ├── Vietnamese.cpp │ │ ├── Vietnamese.h │ │ ├── cedHelper.h │ │ └── doublemap.h │ ├── SmartCharsetConverter/ │ │ ├── CLIHandler.cpp │ │ ├── CLIHandler.h │ │ ├── CMakeLists.txt │ │ ├── DialogMain.cpp │ │ ├── DialogMain.h │ │ ├── Resource/ │ │ │ └── lang_embed/ │ │ │ ├── English.json │ │ │ ├── Simplified Chinese.json │ │ │ └── Spanish.json │ │ ├── SmartCharsetConverter.cpp │ │ ├── SmartCharsetConverter.json │ │ ├── SmartCharsetConverter.rc │ │ └── resource.h │ ├── SmartCharsetConverter-imgui/ │ │ ├── CMakeLists.txt │ │ ├── FontAnalyzer.cpp │ │ ├── FontAnalyzer.h │ │ ├── FontLoader.cpp │ │ ├── FontLoader.h │ │ ├── ListView.cpp │ │ ├── ListView.h │ │ ├── MainWindow.cpp │ │ ├── MainWindow.h │ │ ├── Resource/ │ │ │ └── lang_embed/ │ │ │ ├── English.json │ │ │ ├── Simplified Chinese.json │ │ │ └── Spanish.json │ │ ├── SmartCharsetConverter.rc │ │ ├── UnicodeTable.cpp │ │ ├── UnicodeTable.h │ │ ├── main.cpp │ │ └── resource.h │ └── Translator/ │ ├── CMakeLists.txt │ ├── LanguageService.cpp │ ├── LanguageService.h │ ├── StringId.h │ ├── Translator.cpp │ ├── Translator.h │ └── internal/ │ ├── Language.cpp │ └── Language.h ├── tests/ │ ├── CMakeLists.txt │ ├── Core_Vietnamese_test.cpp │ ├── Core_test.cpp │ ├── Helper.cpp │ ├── Helper.h │ ├── LineBreaks_test.cpp │ ├── String_test.cpp │ ├── Vietnamese_test.cpp │ ├── config.h.in │ ├── icu_test.cpp │ ├── memory_leak_detection.h │ ├── memory_leak_detection_win.h │ └── uchardet_samples_test.cpp ├── third_party/ │ ├── CMakeLists.txt │ ├── WTL/ │ │ ├── Include/ │ │ │ ├── atlapp.h │ │ │ ├── atlcrack.h │ │ │ ├── atlctrls.h │ │ │ ├── atlctrlw.h │ │ │ ├── atlctrlx.h │ │ │ ├── atlddx.h │ │ │ ├── atldlgs.h │ │ │ ├── atldwm.h │ │ │ ├── atlfind.h │ │ │ ├── atlframe.h │ │ │ ├── atlgdi.h │ │ │ ├── atlmisc.h │ │ │ ├── atlprint.h │ │ │ ├── atlres.h │ │ │ ├── atlribbon.h │ │ │ ├── atlscrl.h │ │ │ ├── atlsplit.h │ │ │ ├── atltheme.h │ │ │ ├── atluser.h │ │ │ └── atlwinx.h │ │ └── MS-PL.txt │ ├── ced/ │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── README.md │ │ ├── autogen.sh │ │ ├── compact_enc_det/ │ │ │ ├── compact_enc_det.cc │ │ │ ├── compact_enc_det.h │ │ │ ├── compact_enc_det_fuzz_test.cc │ │ │ ├── compact_enc_det_generated_tables.h │ │ │ ├── compact_enc_det_generated_tables2.h │ │ │ ├── compact_enc_det_hint_code.cc │ │ │ ├── compact_enc_det_hint_code.h │ │ │ ├── compact_enc_det_unittest.cc │ │ │ └── detail_head_string.inc │ │ └── util/ │ │ ├── basictypes.h │ │ ├── case_insensitive_hash.h │ │ ├── commandlineflags.h │ │ ├── encodings/ │ │ │ ├── encodings.cc │ │ │ ├── encodings.h │ │ │ ├── encodings.pb.h │ │ │ └── encodings_unittest.cc │ │ ├── languages/ │ │ │ ├── languages.cc │ │ │ ├── languages.h │ │ │ └── languages.pb.h │ │ ├── logging.h │ │ ├── port.h │ │ ├── string_util.h │ │ └── varsetter.h │ ├── guicon/ │ │ ├── CMakeLists.txt │ │ ├── guicon.cpp │ │ └── guicon.h │ └── uchardet/ │ ├── WinCodePage_Identifiers.txt │ ├── uchardet/ │ │ ├── AUTHORS │ │ ├── CMakeLists.txt │ │ ├── COPYING │ │ ├── INSTALL │ │ ├── Origin_GitHub.url │ │ ├── README.md │ │ ├── _GitHub.url │ │ ├── _GitHub_libchardet.url │ │ ├── doc/ │ │ │ ├── CMakeLists.txt │ │ │ ├── README.maintainer │ │ │ └── uchardet.1 │ │ ├── script/ │ │ │ ├── BuildLangModel.py │ │ │ ├── BuildLangModelLogs/ │ │ │ │ ├── LangAfricaansModel.log │ │ │ │ ├── LangArabicModel.log │ │ │ │ ├── LangBelarusianModel.log │ │ │ │ ├── LangCroatianModel.log │ │ │ │ ├── LangCzechModel.log │ │ │ │ ├── LangDanishModel.log │ │ │ │ ├── LangEsperantoModel.log │ │ │ │ ├── LangEstonianModel.log │ │ │ │ ├── LangFinnishModel.log │ │ │ │ ├── LangFrenchModel.log │ │ │ │ ├── LangGermanModel.log │ │ │ │ ├── LangGreekModel.log │ │ │ │ ├── LangHungarianModel.log │ │ │ │ ├── LangIrishModel.log │ │ │ │ ├── LangItalianModel.log │ │ │ │ ├── LangLatvianModel.log │ │ │ │ ├── LangLithuanianModel.log │ │ │ │ ├── LangMalteseModel.log │ │ │ │ ├── LangNederlandsModel.log │ │ │ │ ├── LangPolishModel.log │ │ │ │ ├── LangPortugueseModel.log │ │ │ │ ├── LangRomanianModel.log │ │ │ │ ├── LangSlovakModel.log │ │ │ │ ├── LangSloveneModel.log │ │ │ │ ├── LangSpanishModel.log │ │ │ │ ├── LangSwedishModel.log │ │ │ │ ├── LangThaiModel.log │ │ │ │ ├── LangTurkishModel.log │ │ │ │ └── LangVietnameseModel.log │ │ │ ├── README │ │ │ ├── charsets/ │ │ │ │ ├── codepoints.py │ │ │ │ ├── db.py │ │ │ │ ├── ibm852.py │ │ │ │ ├── iso-8859-1.py │ │ │ │ ├── iso-8859-10.py │ │ │ │ ├── iso-8859-11.py │ │ │ │ ├── iso-8859-13.py │ │ │ │ ├── iso-8859-15.py │ │ │ │ ├── iso-8859-16.py │ │ │ │ ├── iso-8859-2.py │ │ │ │ ├── iso-8859-3.py │ │ │ │ ├── iso-8859-4.py │ │ │ │ ├── iso-8859-6.py │ │ │ │ ├── iso-8859-7.py │ │ │ │ ├── iso-8859-9.py │ │ │ │ ├── mac-centraleurope.py │ │ │ │ ├── tis-620.py │ │ │ │ ├── viscii.py │ │ │ │ ├── windows-1250.py │ │ │ │ ├── windows-1251.py │ │ │ │ ├── windows-1252.py │ │ │ │ ├── windows-1253.py │ │ │ │ ├── windows-1256.py │ │ │ │ ├── windows-1257.py │ │ │ │ └── windows-1258.py │ │ │ ├── debug.sh │ │ │ ├── gen.sh │ │ │ ├── header-template.cpp │ │ │ ├── langs/ │ │ │ │ ├── af.py │ │ │ │ ├── ar.py │ │ │ │ ├── be.py │ │ │ │ ├── cs.py │ │ │ │ ├── da.py │ │ │ │ ├── de.py │ │ │ │ ├── el.py │ │ │ │ ├── eo.py │ │ │ │ ├── es.py │ │ │ │ ├── et.py │ │ │ │ ├── fi.py │ │ │ │ ├── fr.py │ │ │ │ ├── ga.py │ │ │ │ ├── hr.py │ │ │ │ ├── hu.py │ │ │ │ ├── it.py │ │ │ │ ├── lt.py │ │ │ │ ├── lv.py │ │ │ │ ├── mt.py │ │ │ │ ├── nl.py │ │ │ │ ├── pl.py │ │ │ │ ├── pt.py │ │ │ │ ├── ro.py │ │ │ │ ├── sk.py │ │ │ │ ├── sl.py │ │ │ │ ├── sv.py │ │ │ │ ├── th.py │ │ │ │ ├── tr.py │ │ │ │ └── vi.py │ │ │ ├── release.sh │ │ │ ├── requirements.txt │ │ │ └── win32.sh │ │ ├── src/ │ │ │ ├── CMakeLists.txt │ │ │ ├── CharDistribution.cpp │ │ │ ├── CharDistribution.h │ │ │ ├── JpCntx.cpp │ │ │ ├── JpCntx.h │ │ │ ├── LangModels/ │ │ │ │ ├── LangAfricaansModel.cpp │ │ │ │ ├── LangArabicModel.cpp │ │ │ │ ├── LangBelarusianModel.cpp │ │ │ │ ├── LangBulgarianModel.cpp │ │ │ │ ├── LangCroatianModel.cpp │ │ │ │ ├── LangCzechModel.cpp │ │ │ │ ├── LangDanishModel.cpp │ │ │ │ ├── LangEsperantoModel.cpp │ │ │ │ ├── LangEstonianModel.cpp │ │ │ │ ├── LangFinnishModel.cpp │ │ │ │ ├── LangFrenchModel.cpp │ │ │ │ ├── LangGermanModel.cpp │ │ │ │ ├── LangGreekModel.cpp │ │ │ │ ├── LangHebrewModel.cpp │ │ │ │ ├── LangHungarianModel.cpp │ │ │ │ ├── LangIrishModel.cpp │ │ │ │ ├── LangItalianModel.cpp │ │ │ │ ├── LangLatvianModel.cpp │ │ │ │ ├── LangLithuanianModel.cpp │ │ │ │ ├── LangMalteseModel.cpp │ │ │ │ ├── LangNederlandsModel.cpp │ │ │ │ ├── LangPolishModel.cpp │ │ │ │ ├── LangPortugueseModel.cpp │ │ │ │ ├── LangRomanianModel.cpp │ │ │ │ ├── LangRussianModel.cpp │ │ │ │ ├── LangSlovakModel.cpp │ │ │ │ ├── LangSloveneModel.cpp │ │ │ │ ├── LangSpanishModel.cpp │ │ │ │ ├── LangSwedishModel.cpp │ │ │ │ ├── LangThaiModel.cpp │ │ │ │ ├── LangTurkishModel.cpp │ │ │ │ └── LangVietnameseModel.cpp │ │ │ ├── nsBig5Prober.cpp │ │ │ ├── nsBig5Prober.h │ │ │ ├── nsCharSetProber.cpp │ │ │ ├── nsCharSetProber.h │ │ │ ├── nsCodingStateMachine.h │ │ │ ├── nsEUCJPProber.cpp │ │ │ ├── nsEUCJPProber.h │ │ │ ├── nsEUCKRProber.cpp │ │ │ ├── nsEUCKRProber.h │ │ │ ├── nsEUCTWProber.cpp │ │ │ ├── nsEUCTWProber.h │ │ │ ├── nsEscCharsetProber.cpp │ │ │ ├── nsEscCharsetProber.h │ │ │ ├── nsEscSM.cpp │ │ │ ├── nsGB18030Prober.cpp │ │ │ ├── nsGB18030Prober.h │ │ │ ├── nsGB2312Prober.cpp │ │ │ ├── nsGB2312Prober.h │ │ │ ├── nsHebrewProber.cpp │ │ │ ├── nsHebrewProber.h │ │ │ ├── nsLatin1Prober.cpp │ │ │ ├── nsLatin1Prober.h │ │ │ ├── nsMBCSGroupProber.cpp │ │ │ ├── nsMBCSGroupProber.h │ │ │ ├── nsMBCSSM.cpp │ │ │ ├── nsPkgInt.h │ │ │ ├── nsSBCSGroupProber.cpp │ │ │ ├── nsSBCSGroupProber.h │ │ │ ├── nsSBCharSetProber.cpp │ │ │ ├── nsSBCharSetProber.h │ │ │ ├── nsSJISProber.cpp │ │ │ ├── nsSJISProber.h │ │ │ ├── nsUTF8Prober.cpp │ │ │ ├── nsUTF8Prober.h │ │ │ ├── nsUniversalDetector.cpp │ │ │ ├── nsUniversalDetector.h │ │ │ ├── nscore.h │ │ │ ├── prmem.h │ │ │ ├── symbols.cmake │ │ │ ├── tables/ │ │ │ │ ├── Big5Freq.tab │ │ │ │ ├── EUCKRFreq.tab │ │ │ │ ├── EUCTWFreq.tab │ │ │ │ ├── GB18030Freq.tab │ │ │ │ ├── GB2312Freq.tab │ │ │ │ └── JISFreq.tab │ │ │ ├── tools/ │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── uchardet.cpp │ │ │ ├── uchardet.cpp │ │ │ └── uchardet.h │ │ ├── uchardet.doap │ │ └── uchardet.pc.in │ └── version.txt └── vcpkg.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .clang-format ================================================ --- BasedOnStyle: LLVM IndentWidth: 4 # 访问说明符(public、private等)的偏移 AccessModifierOffset: -4 # 允许短的块放在同一行(Always 总是将短块合并成一行,Empty 只合并空块) AllowShortBlocksOnASingleLine: Empty # 允许短的函数放在同一行: None, InlineOnly(定义在类中), Empty(空函数), Inline(定义在类中,空函数), All AllowShortFunctionsOnASingleLine: Empty AllowShortLambdasOnASingleLine: Empty # 总是在template声明后换行 AlwaysBreakTemplateDeclarations: true # 禁用include重排序 SortIncludes: false --- Language: Cpp # Force pointers to the type for C++. DerivePointerAlignment: false PointerAlignment: Right ColumnLimit: 120 --- Language: Proto # Don't format .proto files. DisableFormat: true ================================================ FILE: .github/workflows/cmake-single-platform.yml ================================================ # This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml name: Build On Windows on: push: branches: ["master", "dev"] pull_request: branches: ["master"] # 当创建标签时也触发此工作流 create: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release jobs: build-and-test: # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. # You can convert this to a matrix build if you need cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: windows-latest steps: - uses: actions/checkout@v4 - name: Setup anew (or from cache) vcpkg (and does not build any package) uses: lukka/run-vcpkg@v11 # Always specify the specific _version_ of the # action you need, `v11` in this case to stay up # to date with fixes on the v11 branch. with: doNotCache: false - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: cmake --preset=default -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build # Build your program with the given configuration run: | cmake --build --preset=default --config ${{env.BUILD_TYPE}} --target SmartCharsetConverter cmake --build --preset=default --config ${{env.BUILD_TYPE}} --target CoreUnitTest - name: Test # Execute tests defined by the CMake configuration. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest --preset=default -C ${{env.BUILD_TYPE}} - name: Prepare to Release # 只有在创建标签时才执行发布操作 if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/') run: | cd ${{github.workspace}}/scripts python extract_change_log.py --tag=${{github.ref_name}} cd ${{github.workspace}}/build/src/SmartCharsetConverter/Release mv SmartCharsetConverter.exe 'SmartCharsetConverter ${{github.ref_name}}.exe' Compress-Archive -Path 'SmartCharsetConverter ${{github.ref_name}}.exe' -DestinationPath 'SmartCharsetConverter ${{github.ref_name}}.zip' - name: Release # 只有在创建标签时才执行发布操作 if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: name: SmartCharsetConverter ${{github.ref_name}} fail_on_unmatched_files: true draft: true body_path: ./build/CHANGELOG.txt files: | ./build/src/SmartCharsetConverter/Release/SmartCharsetConverter ${{github.ref_name}}.zip ================================================ FILE: .gitignore ================================================ .idea/ .vscode/ output/ build/ vcpkg_installed/ *.aps ================================================ FILE: CMakeLists.txt ================================================ cmake_minimum_required(VERSION 3.11) # C++17 set(CMAKE_CXX_STANDARD 17) project(SmartCharsetConverter) # 添加unicode宏 add_definitions(-DUNICODE -D_UNICODE) add_compile_options("$<$:/utf-8>") add_compile_options(-WX) if(MSVC) add_compile_options(/MP) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") endif() # ============================================= add_subdirectory(third_party) add_subdirectory(src) enable_testing() add_subdirectory(tests) ================================================ FILE: CMakePresets.json ================================================ { "version": 8, "configurePresets": [ { "name": "default", "binaryDir": "${sourceDir}/build", "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-windows-static", "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" } } ], "buildPresets": [ { "name": "default", "configurePreset": "default" } ], "testPresets": [ { "name": "default", "configurePreset": "default", "output": { "outputOnFailure": true }, "execution": { "noTestsAction": "error", "stopOnFailure": true } } ] } ================================================ FILE: README-en.md ================================================ # SmartCharsetConverter ![workflow](https://github.com/tomwillow/SmartCharsetConverter/actions/workflows/cmake-single-platform.yml/badge.svg) [English](README-en.md) / [Chinese](README.md) This program is used to automatically detect the encoding of files and convert its encoding to UTF-8/UTF-8 BOM/GB18030 etc. Function: - Batch conversion to UTF-8/UTF-8 BOM/GB18030, etc. - Convert line breaks to CRLF/LF/CR - Check whether characters are lost to ensure that the conversion process is reversible - Support command line (use $ ./SmartCharsetConverter --help for details) - Multi-language support (click the "hammer" button in the bottom right corner to switch languages) - Support Vietnamese charset(VNI/VPS/VISCII/TCVN3)(Currently unable to detect these charset. please use the "No File Filter" mode) Supported Platform: - Win10 x64 - Win7 x64 (haven’t tried it yet) ![img](snapshot/v0.8-english.png) # Download [https://github.com/tomwillow/SmartCharsetConverter/releases](https://github.com/tomwillow/SmartCharsetConverter/releases) # Special Advantage Charset detection is a well-known and difficult problem. Therefore, most of the charset convert programs are GBK->UTF-8, GBK->BIG5. In this case, you must know what encoding your text is in advance, otherwise it will be garbled. Moreover, text that has been converted once will be garbled if it is converted again. After comparing many charset detection libraries, I selected the modified version of uchardet used by Notepad3. This modified version of uchardet has been carefully tuned by the author of Notepad3, and its accuracy is higher than the original uchardet! I also used the charset detection function provided by the icu library, and combines the comprehensive judgment of uchardet+icu to give the detection result! Although it cannot be said that the character set detection is 100% correct, the accuracy rate is also very high! You will know exactly how high it is when you try it. Precisely because the biggest problem of character set detection is solved, all the problems of the "traditional transcoding program" mentioned above do not exist in this program! It doesn’t matter what character set you originally used, just say what you want! # Version v0.1 Implements basic functions: can detect charset and convert v0.2 Add windows-1252 support. Add the option of "No Filter Files" and "Smart File Detection". v0.3 "Add Folder" can now remember the last selected path. The list box now supports dragging in files and folders. v0.4 Fix the bug "Reason: ucnv error. code=15". Added ISO-8859-1 support. v0.41 Fix the bug where only BOM text recognition is wrong. Now empty text will not report an error. v0.5 Now you can cancel midway when dragging a large number of files to the list box. Now you can click the Cancel button during the conversion. v0.51 Add multiple supported charset: Big5, SHIFT-JIS, etc. v0.6 Check if characters will be lost when converting. v0.61 Select "No File Filter" mode to forcely join files. Right-click items in the list box can select Original Encoding. v0.62 Support dragging files/folders to the program icon. v0.7 Support command line. Use $ ./SmartCharsetConverter --help to view the command line parameters. v0.71 Fix the bug that the command line not work. v0.72 solves the problem of getting stuck when adding large files (only the first 100KB of the file is detected). The extension filter mode now supports more patterns (supports separation by `*.` `.` `space` `|`). Fixed other issues with extension filtering mode. v0.8 Rearrange the interface (thanks to [Carlos Sánchez](https://github.com/c-sanchez)). Add configuration file, and changing settings will trigger the saving of configuration file. Support multiple languages (built-in Simplified Chinese and English). Add multi-language selection(to click "hammer" button - Language). v0.81 Add Spanish language pack support (thanks to [Carlos Sánchez](https://github.com/c-sanchez)). v0.82 Check if characters will be lost when specifying encoding manually. v0.9 Support multiple Vietnamese charset converting: VNI/VPS/VISICII/TCVN3 v0.9.1 bugfix: fixed the error of "ucnv error. code=11" due to invalid trucated string piece. v0.9.2 Support Win7 x64 OS. Compiles into a single exe file. v0.9.3 [Issue 14]Change the Chinese character "未知" to "Unknown" when the charset is not detected. Fix the issue where error characters during charset detection in "no filtering" mode cause an "UCNV error," preventing files from being added. # Build 1. Confirm the compilation environment: win10+ x64, Visual Studio 2019+, cmake. 2. Install vcpkg and set correct environment variable VCPKG_ROOT. 3. Execute config_on_win.bat to generate .sln. 4. Open ./build/SmartCharsetConverter.sln. # Add language pack > Language packs only affect the interface of the program and have nothing to do with the functions of the program. If you want to add a new language pack to this program, you can follow these steps: 1. Find the xxx.json files under src/Resource/lang_embed. 2. Copy the xxx.json file and modify its content. The new json file can be rename arbitrarily, because the program does not depend on the file name of the language file. > The xxx.json file must be UTF-8 encoding. 3. Modify the `langId` field: Download the pdf from [[MS-LCID]: Windows Language Code Identifier (LCID) Reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f?redirectedfrom=MSDN), find the section `2.2 LCID Structure - Language ID (2 bytes)`, and find the Language ID corresponding to the target language. `For example: 0x409 corresponds to en-US, 0x804 corresponds to zh-CN. `Then convert hexadecimal to decimal and fill in the `langId` field. `For example, 0x409 is filled in with 1033, and 0x804 is filled with 2052`. This Language ID is related to the user's operating system. If filled in correctly, the corresponding language file will be automatically loaded according to the operating system settings when the program starts (the prerequisite is that the language has not been set in the configuration file. If the language has been set in, the `language` field at the configuration file is preferred). 4. Place your xxx.json language file in the `lang` directory of the directory where SmartCharsetConverter.exe is located (if it does not exist, create a new). The program will automatically check and load it when it starts. > Note: There are some language packages built into the program (located in `src/Resource/lang_embed`). If the `language` field of the language package in the lang directory is the same as one built-in language package, the external language package json file will be preferred. Now you can launch the program and see the results! > If you want to make your language pack built into the program, you can submit a pull request or contact the author (tomwillow@qq.com) to make it built-in. # TODO - Check the character set again before conversion to avoid conversion errors after the user changes the character set after loading. - Add "Convert to xxx encoding" to the right-click menu to enable manual converting of single/multiple files. - Add a refresh button. - Add maximize/minimize buttons, and flexibly control the size of ListView while resizing. - Add the main menu bar to display menu items such as "Settings", "About". - Replace the error MessageBox to a custom Dialog for displaying the complete error information and allow copy operation. # Reference [ICU](https://icu.unicode.org/) [WTL](https://sourceforge.net/projects/wtl) [uchardet](https://github.com/rizonesoft/Notepad3/tree/master/src/uchardet) # Thanks Thanks to [Carlos Sánchez](https://github.com/c-sanchez) for providing the interface design and Spanish language pack. # E-mail tomwillow@qq.com # WeChat Group If you have any questions or suggestions, please feel free to add the author on WeChat `tomwillow`. Note: "SmartCharsetConverter" is introduced into the group according to the guidelines. If you think this project is good, please give it a star! ================================================ FILE: README.md ================================================ # 智能编码集转换器 ![workflow](https://github.com/tomwillow/SmartCharsetConverter/actions/workflows/cmake-single-platform.yml/badge.svg) [English](README-en.md) / [Chinese](README.md) 本程序用于自动识别文件夹下所有文本文件,自动识别原编码(不必担心反复转码出错了),批量转换到 UTF-8 等字符集。 功能: - 批量转 UTF-8/UTF-8 BOM/GB18030 等 - 批量转 CRLF/LF/CR 换行符 - 转换时会检查是否丢失字符,确保转换过程可逆 - 支持命令行(使用 $ ./SmartCharsetConverter --help 查看) - 多语言支持(点击右下角“锤子”按钮切换语言) - 支持越南语字符集(VNI/VPS/VISCII/TCVN3)和其他字符集互转(目前还不能自动探测这几个字符集,请使用“不过滤”模式) 运行要求: - Win10 x64 - Win7 x64(理论上可以,没尝试) ![img](snapshot/v0.8-chinese.png "截图") # 下载 [https://github.com/tomwillow/SmartCharsetConverter/releases](https://github.com/tomwillow/SmartCharsetConverter/releases) # 特别优点 字符集探测是著名的老大难问题,就是说,怎样在不知道字符编码的情况下,探测出文本是什么编码,什么字符集。这个问题很难。 所以,你看到的绝大多数转字符集的程序,都是 GBK->UTF-8,GBK->BIG5,这种,必须要你提前知道你的文本是什么编码,否则就会乱码。而且,转过一次的文本,再转一次,也会乱码。 我在对比了诸多字符集探测库之后,选定了 Notepad3 使用的魔改版 uchardet,这个魔改版 uchardet 经过 Notepad3 作者精心调教,精度比原版 uchardet 更高!并且又使用了 icu 库提供的字符集探测功能,结合 uchardet+icu 两者综合判断给出探测结果! 虽然不能说做到百分百地把字符集探测正确,但正确率也是非常高的!具体多高你试试就知道了。 也正因为解决了字符集探测这个最大的问题,所以上面提到的这些“传统转码程序”的问题,在本程序中通通都不存在!不用管你原来是什么字符集,你只说你要什么就行啦! # 版本记录 v0.1 实现基本功能:可以探测字符集,转换字符集 v0.2 增加 windows-1252 支持。文件现在可以选择“不过滤”和“智能识别”。 v0.3 “添加文件夹”现在可以记住上一次选的路径了。现在列表框支持拖入文件和文件夹了。 v0.4 修复“原因: ucnv 出错。code=15”的 bug。增加 ISO-8859-1 支持。 v0.41 修复只有 BOM 的文本识别出错的 bug。现在空文本不会报错了。 v0.5 现在拖动大量文件到列表框时可以中途取消了。现在转换中途可以点取消按钮了。 v0.51 增加多个支持的字符集:Big5, SHIFT-JIS 等。 v0.6 现在转换时会检查是否会丢失字符。 v0.61 现在选择“不过滤”模式可以强行加入文件。并且,在列表框里右键-指定原编码 可以手动指定字符集。 v0.62 现在支持拖拽文件/文件夹到程序图标上了。 v0.7 支持命令行。使用 $ ./SmartCharsetConverter --help 查看命令行参数。 v0.71 修复命令行用不了的 bug。 v0.72 解决添加大文件会卡死的问题(只探测文件前 100KB)。 后缀过滤模式现在支持更多的模式了(支持以 `*.` `.` `空格` `|`分隔)。修复后缀过滤模式的其他问题。 v0.8 重新编排界面(感谢[Carlos Sánchez](https://github.com/c-sanchez))。 增加配置文件,现在界面改动会保留在配置文件中了。 支持多语言(内置简体中文和英文)。增加多语言选择。 v0.81 增加西班牙语支持(感谢[Carlos Sánchez](https://github.com/c-sanchez))。 v0.82 现在手动指定字符集会检查是否丢失字符。 v0.9 支持多个越南语字符集的转换:VNI/VPS/VISICII/TCVN3 v0.9.1 bugfix: 修复由于截取字符片段导致的"ucnv error. code=11"出错。 v0.9.2 现在可以支持Win7 x64系统了。现在程序编译出来只有一个单exe文件了。 v0.9.3 [Issue 14]未探测到字符集时显示的中文字符“未知”改成“Unknown”。 解决“不过滤”模式下,探测字符集报错“UCNV出错”导致无法添加文件的问题。 # 构建方法 1. 确认编译环境:win10+ x64, Visual Studio 2019+, cmake。 2. 安装 vcpkg,正确设置 VCPKG_ROOT 环境变量。 3. 执行 config_on_win.bat 生成.sln。 4. 打开 ./build/SmartCharsetConverter.sln。 # 添加语言包 > 语言包只影响程序的界面,和程序的功能无关。 如果您想为本程序添加新的语言包,可以遵循以下步骤: 1. 在 src/Resource/lang_embed 下找到 xxx.json 文件。 2. 复制 xxx.json 文件并修改内容。文件名可以随意取,程序并不依赖语言文件的文件名。 > xxx.json 文件必须是 utf-8 编码。 3. 修改内容时注意 langId 字段,从[[MS-LCID]: Windows Language Code Identifier (LCID) Reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f?redirectedfrom=MSDN)处下载 pdf,翻阅至 `2.2 LCID Structure - Language ID (2 bytes)`一节,找到目标语言对应的 Language ID。`例如:0x409对应于en-US,0x804对应于zh-CN。`然后把 16 进制转换为 10 进制填入 langId 字段。`例如0x409则填入1033,0x804则填入2052`。 这个 Language ID 和操作系统设置有关,正确填写的话,程序启动时会根据操作系统设置自动加载对应的语言文件(前提条件是没有在程序中设置过语言,如果在程序中设置过语言,那么以设置的为准)。 > 如果你不知道 langId 应该填什么,那么可以填 0。 4. 把你的 xxx.json 语言文件放置在 SmartCharsetConverter.exe 所在目录的 lang 目录(如果没有则新建一个)下,程序启动时会自动检查并加载。 > 注意:程序中内置了一些语言包(位于 `src/Resource/lang_embed`),如果 lang 目录下的语言包的 language 字段和内置的某个语言包一样,那么程序在启动时将以 lang 目录下的语言包文件为准。 现在你可以启动程序查看效果了! > 如果想要让程序内置你的语言包,可以提 pull requests 或者联系作者(tomwillow@qq.com)来给你内置。 # TODO - 转换前再次检查一次字符集,已免出现加载后用户更改了字符集后转换出错的情况。 - 右键菜单加入“转换到 xxx 编码”,以实现单个/多个文件手动转码。 - 增加一个刷新按钮。 - 添加最大化/最小化按钮,程序缩放时弹性控制 ListView 的大小。 - 添加菜单栏以显示“设置”“关于”等菜单项。 - 报错的 MessageBox 修改为自定义的 Dialog,以显示完整的报错信息,并且允许从中复制内容。 # Reference [ICU](https://icu.unicode.org/) [WTL](https://sourceforge.net/projects/wtl) [uchardet](https://github.com/rizonesoft/Notepad3/tree/master/src/uchardet) # 致谢 感谢[Carlos Sánchez](https://github.com/c-sanchez)提供的界面设计和西班牙语语言包。 # E-mail tomwillow@qq.com # 微信交流群 如果您在使用中有疑问,或者有意见建议,欢迎加作者微信 tomwillow。备注“智能编码集转换器”按照指引进群。 如果您觉得此项目不错,请赏颗星吧! ================================================ FILE: config_on_win.bat ================================================ cmake --preset=default pause ================================================ FILE: sample/expect_pass/[EUC-JP]readme.txt ================================================ School DaysΥե˴ޤޤƤư衦ʤwmv˥ݡȤץ ưĶ Microsoft .NET Framework Version 1.1ɬפǤ 󥽡륢ץꥱǤ(ʹӤǤĤäΤǡ) School DaysΥե˴ޤޤƤư衦ʤꤵ줿ե ǥ쥯ȥwmvեǥݡȤޤ Ϥե̾wmvإåˤեɣĤǺޤ ư衦ʤϤ줾̡wmvեˤʤäƤͤǤ åץǡФƤ٥ݡȤľפȻפޤ ưǧϡֽץ v1.05AפǹԤäƤޤ ˡ sd_exp.exe [*.gpk] 㡧 sd_exp SCENE.GPK.010 ================================================ FILE: sample/expect_pass/[gb18030]你还戴着这副眼镜.txt ================================================ --------------------------------------------- 鼮֮TXT ַhttp://www.skyyi.cn/index.php [Ϊ] --------------------------------------------- ѣڿС˵ͬʱעⲻҪ۹ȣ , һǴ¸绪ġ һдŸ, ǰ, ڷɻд, ˵, ϣһԶ¸绪, ̫౯ˡ һ˾ꡣ ڹʶ, ǸŻˡ ˶ܺ, չһ,˵:ҵһܺõˡ˵:ǸΪʲô? ˵仰ʱ, ΢Ц, , ֻ±ܾ ûоܾ ֪߲ûһŮ, ȻһͷԽȥ һ, ȥ, , :ûŮ? ײ ֧, DzҪټ, ȥ߰ɡȻ˵ һ֧, ᲻뿪 ѡߡ 쿪ʼ, ʥ, Ϧ, ˽, ˵, 򶼱µضȹ Ϊһ, ֻռ, ? ÿڶ, ˵Ҫ, ʼջǻصߡʼDz뿪ǸʮŮѵġ ͺˡ˵ ûܵ, 㲻Ҫ˵ʡ Ůʼ֪Ĵ, 绰, ˵:Dz뿪ҵġ еഺ> һ, ᵽԿ, ʹ໻ġ һ˽, ˵:һ, һҪ, ԺҲ㡣 Ӧˡ ˽, ڼֱʮʱûг֡˺ܶܶ,绰̨, :㲻ټҡ ʮӺ, ҴҸ, ݺݵһ, ۾ѵ, һˡ ˵:Ҳܸʲô, Ҳ뵢㡣 ڶ, ۾һµ۾, ȥһơ ûٳ֪֡, ˶ϵʱ ѹȥ, ¸绪̽Ҫõѡ һ֮, ص, ¿ʼ Ŭع, ϣ֪ һ, ڽһǰһ۾ Ҽĸһ? ͷ û뵽Ȼ͵۾, ΨһĶ , ˵, ˡ Ҳ, ޸¸绪ĺѵĸ硣 ȥʥ, ¸绪, Ծɴ͵Ǹ۾ 㻹⸱۾? ͷ Ϊʲôȥ? Ҹ, ڲô۾˵ û˽, Ͳܴ۾΢Ц˵ ò˵ ˡظ ҽˡȻػش ŶӦһ, ײ ˵:ഺ--ҪԵȴ, ѵĵȴ, ʱ䲥Ū --------------------------------------------- 鼮֮TXT ַhttp://www.skyyi.cn/index.php [Ϊ] --------------------------------------------- ѣڿС˵ͬʱעⲻҪ۹ȣ ================================================ FILE: sample/expect_pass/[utf-8].txt ================================================ Språk: Norsk Γλώσσα: Ελληνικά Язык: Русский 언어 : 한국어 言語: 日本語 Langage : Français ================================================ FILE: sample/not_pass_yet/[GB18030]DialogAnimation.h ================================================ #pragma once #include #include #include "..\Common\String.h" class TElement; namespace DialogAnimation { enum enumListBoxItemType{ D, V, A }; String GetTypeName(enumListBoxItemType type); enum enumListBoxItemValueType{ X, Y, PHI }; String GetUnitName(enumListBoxItemType type, enumListBoxItemValueType value_type); struct TListBoxItem { int id; int index_of_point; enumListBoxItemType type;//P,V,A enumListBoxItemValueType value_type;//X,Y,PHI String s;//Ŀ String sUnit; std::vector data; TElement *pElement; }; INT_PTR CALLBACK DlgAnimationProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); } ================================================ FILE: sample/not_pass_yet/[GB18030]LogRecord.h ================================================ #pragma once #include #include #include #include class LogRecord { public: static void SetLogFileName(std::tstring filename); static void AddBuffer(std::tstring content); void flush(); private: static std::tstring filename; static std::mutex m; static std::tstring buf; }; extern LogRecord logRecord; // ָ inline LogRecord &operator<<(LogRecord &logRecord, void *p) { logRecord.AddBuffer(std::to_tstring((INT_PTR)p)); return logRecord; } // LogRecord &operator<<(LogRecord &logRecord, HWND hWnd); // ʱ LogRecord &operator<<(LogRecord &logRecord, TimeStamp timeStamp); // ַ inline LogRecord &operator<<(LogRecord &logRecord, const wchar_t s[]) { logRecord.AddBuffer(to_tstring(s)); return logRecord; } // ansiַ inline LogRecord &operator<<(LogRecord &logRecord, const char s[]) { logRecord.AddBuffer(to_tstring(s)); return logRecord; } inline LogRecord &operator<<(LogRecord &logRecord, const std::tstring &s) { logRecord.AddBuffer(s); return logRecord; } template inline LogRecord &operator<<(LogRecord &logRecord, const T &t) { logRecord.AddBuffer(std::to_tstring(t)); return logRecord; } inline LogRecord &operator<<(LogRecord &logRecord, LogRecord &(*func)(LogRecord &)) { return func(logRecord); } inline LogRecord &endl(LogRecord &logRecord) { logRecord.AddBuffer(TEXT("\r\n")); logRecord.flush(); return logRecord; } #define LOG logRecord ================================================ FILE: sample/not_pass_yet/[GB18030]TBarTool_GB.cpp ================================================ #pragma once #include "TBarTool.h" #include "..\Control\TTreeViewContent.h" #include "..\Element\TShape.h" #include "..\Element\TBar.h" #include "..\Element\TConstraintCoincide.h" TBarTool::TBarTool() { myElementType = ELEMENT_BAR; sType = TEXT(""); bCanBuildCoincide = true; } TBarTool::~TBarTool() { } TElement * TBarTool::AddIntoShape(TRealLine &RealLine) { RealLine.vecDpt.push_back(RealLine.GetRelativePointByIndex(0)); RealLine.vecDpt.push_back(RealLine.GetRelativePointByIndex(1)); RealLine.eType = myElementType; return pShape->AddElement((TBar *)&RealLine); } void TBarTool::AddIntoTreeViewContent(TElement *Element, int id) { if (Element->eType == ELEMENT_REALLINE) { Element->eType = myElementType; TBar Bar; Bar= *(TRealLine*)Element; pTreeViewContent->AddItem(&Bar, pShape->iNextId); } else TLineTool::AddIntoTreeViewContent(Element, id); } //void TBarTool::AddCoincide(TConstraintCoincide *pCoincide, int id, TConfiguration *pConfig) //{ // AddIntoTreeViewContent(pCoincide, id); // pShape->AddElement(pCoincide); //} ================================================ FILE: sample/not_pass_yet/[GB18030]TDraw.h ================================================ #pragma once #include #include #pragma comment(lib, "gdiplus.lib") #include #include #include "..\Common\DPOINT.h" class TConfiguration; class TElement; class TBar; class TLine; class TRealLine; class TSlideway; class TSlider; class TFramePoint; class TConstraintCoincide; class TConstraintColinear; class TPolylineBar; class TDraw { private: ULONG_PTR gdiplusStartupToken; struct HSB { float H, S, B; }; public: TDraw(); ~TDraw(); void TDraw::DrawLogo(HINSTANCE hInst, UINT nID, LPCTSTR sType, HDC hdc, const RECT &ClientRect); BOOL TDraw::ImageFromIDResource(HINSTANCE hInst, UINT nID, LPCTSTR sType, Gdiplus::Image *&pImg); static void TDraw::MoveByDelta(POINT apt[], int apt_num, long dx, long dy); static void TDraw::MoveByDelta(std::vector &vecpt, long dx, long dy); static void TDraw::Move(POINT apt[], int apt_num, double angle, double dist); static void TDraw::MoveRect(RECT &rc, int left, int top); static void TDraw::Rotate(POINT apt[], int apt_num, int Ox, int Oy, double theta); static void TDraw::MirrorX(POINT apt[], int apt_num, int Oy); static void TDraw::GetBoundingBox(POINT apt[], int apt_num, RECT *rect, bool YPlusIsUP); static void TDraw::GetBoundingBox(std::vector &vecdpt, RECT *rect); static void TDraw::GetBoundingBox(std::vector &vecpt, RECT *rect); static double TDraw::Distance(DPOINT pt1, DPOINT pt2); static double TDraw::Distance(POINT pt1, POINT pt2); static double TDraw::DistanceScreen(const DPOINT &dpt1, const DPOINT &dpt2, const TConfiguration *pConfig); static DPOINT TDraw::GetAbsolute(const DPOINT &dpt, const DPOINT &Org, double angle); static void TDraw::GetAbsoluteReal(std::vector &vecdptResult, const std::vector &vecdpt, const DPOINT &Org, double angle); static void TDraw::GetAbsoluteScreen(std::vector &vecptResult, const std::vector &vecdpt, const DPOINT &Org, double angle, const TConfiguration *pConfig); static DPOINT TDraw::GetRelative(const DPOINT &dpt, const DPOINT &Org, double angle); static bool TDraw::GetIntersection(const POINT &ptL1Begin, const POINT &ptL1End, const POINT &ptL2Begin, const POINT &ptL2End, POINT &ptIntersection); static bool TDraw::GetIntersection(const DPOINT &dptL1Begin, const DPOINT &dptL1End, const DPOINT &dptL2Begin, const DPOINT &dptL2End, DPOINT &dptIntersection); static RECT TDraw::GetMarginRect(RECT rect, int margin); static void TDraw::SetMarginRect(RECT *rect, int margin); static RECT TDraw::GetMarginCtrlRect(const RECT &rect, int margin); static RECT TDraw::GetMarginRect(RECT rect, LONG margin_left, LONG margin_top, LONG margin_right, LONG margin_bottom); static POINT TDraw::GetCenter(const POINT &pt1,const POINT &pt2); static DPOINT TDraw::GetCenter(const DPOINT &pt1,const DPOINT &pt2); static bool TDraw::ShowConstraintCoincideDotLine(TElement *element, const TConfiguration *pConfig); static bool TDraw::ShowConstraintColinearDotLine(const TConstraintColinear *pColinear, POINT &ptCenter1, POINT &ptCenter2, const TConfiguration *pConfig); static COLORREF TDraw::GetBrighterColor(COLORREF cr); static void TDraw::DrawFramePoint(HDC hdc, TFramePoint *pFramePoint,const TConfiguration *Config); static void TDraw::DrawBar(HDC hdc, TBar *Bar,const TConfiguration *Config); static void TDraw::DrawBarSimple(HDC hdc, TBar *Bar, const TConfiguration *Config); static void TDraw::DrawBarTranslucent(HDC hdc, TBar *pBar, const TConfiguration *pConfig); static void TDraw::DrawBarTranslucent(HDC hdc, POINT &ptBegin, POINT &ptEnd, double angle, unsigned char alpha, LOGPEN logpen, const TConfiguration *pConfig); static void TDraw::DrawPolylineBar(HDC hdc, TPolylineBar *PolylineBar, const TConfiguration *pConfig); static void TDraw::DrawPolylineBarSimple(HDC hdc, TPolylineBar *pPolylineBar, const TConfiguration *pConfig); static void TDraw::DrawPolylineBarTranslucent(HDC hdc, TPolylineBar *pPolylineBar, const TConfiguration *pConfig); static void TDraw::DrawRealLine(HDC hdc, TRealLine &RealLine, const TConfiguration *Config); static void TDraw::DrawRealLine(HDC hdc, DPOINT ptBegin, DPOINT ptEnd, LOGPEN logpen,const TConfiguration *Config); static void TDraw::DrawSlideway(HDC hdc, TSlideway *Slidewayconst, const TConfiguration *Config); static void TDraw::DrawSlidewaySingle(HDC hdc, const LOGPEN &logpen, const DPOINT &dptBegin, const DPOINT &dptEnd, double dAngle, int ShadowQuadrant, int ShadowLength, const TConfiguration *pConfig); static void TDraw::DrawSlider(HDC hdc, TSlider *pSlider, const TConfiguration *pConfig); static void TDraw::DrawConstraintCoincide(HDC hdc, DPOINT dpt0, DPOINT dpt1,const LOGPEN &logpen, const TConfiguration *pConfig); static void TDraw::DrawConstraintCoincide(HDC hdc, TConstraintCoincide *pCoincide, const TConfiguration *pConfig); static void TDraw::DrawConstraintColinear_inner(HDC hdc, const POINT &pt1, const POINT &pt2,LOGPEN logpen, const TConfiguration *pConfig); static void TDraw::DrawConstraintColinear(HDC hdc, TConstraintColinear *pColinear, const TConfiguration *pConfig); static void TDraw::DrawArc(HDC hdc, const POINT &pt, int r, const POINT &pt1, const POINT &pt2, bool bAlwaysDrawAngleBetween); static void TDraw::DrawPie(HDC hdc, const POINT &pt, int r, const POINT &pt1, const POINT &pt2,bool bAlwaysDrawAngleBetween); static void TDraw::DrawPie(HDC hdc, const POINT &pt, int r, const POINT &pt1, const POINT &pt2, const LOGPEN &logpen, const COLORREF &crColor); static void TDraw::DrawRect(HDC hdc, const RECT &rect,const LOGPEN &logpen); static void TDraw::DrawRect(HDC hdc, const RECT &rect,const LOGPEN &logpen, COLORREF crBk); static void TDraw::DrawPickSquare(HDC hdc, POINT pt); static void TDraw::DrawLine(HDC hdc, POINT ptFirstPos, POINT ptSecondPos); static void TDraw::DrawLine(HDC hdc, POINT ptFirstPos, POINT ptSecondPos, const LOGPEN &logpen); static void TDraw::DrawLine(HDC hdc, TLine Line); static void TDraw::DrawPolyline(HDC hdc, const POINT *apt, int count, LOGPEN &logpen); static void TDraw::DrawCircle(HDC hdc, POINT pt, int r); static void TDraw::DrawCircle(HDC hdc, POINT pt, int r, LOGPEN logpen); static void TDraw::DrawCross(HDC hdc, POINT pt, int size, LOGPEN Style); static void TDraw::DrawArrow(HDC hdc, POINT ptBegin, POINT ptEnd, int length, int width); static void TDraw::DrawAxes(HDC hdc, int Ox, int Oy, COLORREF crColor); static void TDraw::CalcBarLineEndpoint(POINT &ptBegin, POINT &ptEnd, int distBegin, int distEnd); static void TDraw::CalcPolylineBarRgn(HRGN &hRgn, const std::vector &vecDpt, DPOINT dpt, double angle, const TConfiguration *pConfig); static void TDraw::CalcPolylineBarRgn(HRGN &hRgn, TPolylineBar *pPolylineBar, const TConfiguration *pConfig); static void TDraw::CalcBarRectCoor(POINT ptResult[4], const POINT &ptBegin, const POINT &ptEnd, double angle, int width); static void TDraw::CalcSliderRectCoor(POINT aptResult[4], const POINT &pt, double angle, const TConfiguration *pConfig); static void TDraw::FillRect(HDC hdc, RECT *rect, COLORREF crColor); static void TDraw::DrawGrid(HDC hdc, const RECT &rect, POINT ptOrg, COLORREF crGridBig, COLORREF crGridSmall, const TConfiguration *pConfig); static void TDraw::DrawTips(HDC hdc, POINT &ptMouse,const RECT &rcLimited, const TCHAR text[], TConfiguration *pConfig); static void TDraw::DrawAdjustedText(HDC hdc, POINT &ptMouse, const RECT &rcLimited, const TCHAR text[], LONG dist, bool DrawBorder, TConfiguration *pConfig); static POINT TDraw::GetSystemFontSize(HDC hdc, const TCHAR text[]); static void TDraw::DrawSystemFontText(HDC hdc, const TCHAR text[], RECT &rect, COLORREF color, UINT format); static void TDraw::DrawSystemFontTextVertical(HDC hdc, const TCHAR text[], RECT &rect, COLORREF color, UINT format); static void TDraw::DrawTextAdvance(HDC hdc,const TCHAR text[], RECT *rect, long FontSize, int FontWeight, unsigned long color, const TCHAR FontName[], UINT format,int cEscapement=0,int cOrientation=0); static void TDraw::DrawSection(HDC hdc, int x1, int y1, int x2, int y2, int d, double angleDEG); static void TDraw::DrawSection(HDC hdc, POINT apt[], int apt_num, int d, double angleDEG); static double TDraw::GetAngleFromPointReal(DPOINT ptO, DPOINT pt); static double TDraw::GetAngleBetweenPointReal(const DPOINT &pt1, const DPOINT &ptO, const DPOINT &pt2); static double TDraw::GetAngleBetweenPointScreen(const POINT &pt1, const POINT &ptO, const POINT &pt2); static double TDraw::GetAngleFromPointScreen(POINT pt0, POINT pt); static void TDraw::ClientPosToScreen(HWND hWnd, POINT *pt); static int TDraw::DPOINT2POINTXLEN(double x1, double x2, double x_min, double x_max, const RECT &rect); static int TDraw::DPOINT2POINTYLEN(double y1, double y2, double y_min, double y_max, const RECT &rect); static int TDraw::DPOINT2POINTX(double x, double x_min, double x_max, const RECT &rect); static int TDraw::DPOINT2POINTY(double y, double y_min, double y_max, const RECT &rect); static POINT TDraw::DPOINT2POINT(DPOINT &dpt, double x_min, double x_max, double y_min, double y_max,const RECT &rect); static DPOINT TDraw::POINT2DPOINT(POINT &pt, double x_min, double x_max, double y_min, double y_max,const RECT &rect); static void TDraw::MakeRect(RECT &rcResult, double x_min, double x_max, double y_min, double y_max, const TConfiguration *pConfig); static void TDraw::GetCenter(POINT &ptResult, const RECT &rect); //ʰȡϵ static bool TDraw::PointInPolylineBar(POINT ptPos, TPolylineBar *pPolylineBar,const TConfiguration *pConfig); static bool TDraw::PointInFramePoint(POINT ptFramePoint, POINT pt, const TConfiguration *pConfig); static bool TDraw::PointInRgn(POINT *ptRgn, int RgnCount, POINT pt); static bool TDraw::PointInRealLine(POINT ptPos, TRealLine *pRealLine,const TConfiguration *pConfig); static bool TDraw::PointInSlider(POINT ptPos, TSlider *pSlider, const TConfiguration *pConfig); static bool TDraw::PointInRealLine(const POINT &ptPos,const POINT &ptBegin,const POINT &ptEnd, const TConfiguration *pConfig); static bool TDraw::PointInRealLine(const POINT &ptPos,const DPOINT &dptBegin,const DPOINT &dptEnd, const TConfiguration *pConfig); static int TDraw::PointInRealLineOrExtension(const DPOINT &dptPos, DPOINT &dptIntersection, const DPOINT dptBegin, const DPOINT dptEnd,const TConfiguration *pConfig); static bool TDraw::PickConstraintColinear(POINT ptPos, TConstraintColinear *pColinear,const TConfiguration *pConfig); static bool TDraw::PickConstraintCoincide(POINT ptPos, TElement *element,const TConfiguration *pConfig); static TDraw::HSB RGB2HSB(int rgbR, int rgbG, int rgbB); static COLORREF TDraw::HSB2RGB(float h, float s, float v); // static bool TDraw::CaptureWindowToFile(HWND hWnd, TCHAR szFileName[]); static void TDraw::GetGifPaletteByHwnd(HWND hWnd, unsigned char *&palette, int &color_num, int &depth); static unsigned char TDraw::GetIndexFromPalette(const UINT32 &data, const unsigned char *palette, const int &color_num); static void TDraw::Create8TreePal(HWND hWnd, unsigned char *&palette, int &color_num, int &depth); static unsigned char TDraw::GetIndexFromPalette(const UINT32 &data, const std::vector &palette, const int &color_num); static unsigned char TDraw::GetIndexFromPalette_Slow(const UINT32 &data, const std::vector &palette, const int &color_num); }; ================================================ FILE: sample/not_pass_yet/[GB18030]TMenu.cpp ================================================ #include "TMenu.h" void PopupMenu(HWND hParent, int menu_id) { //Ҽ˵ HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(menu_id)); hMenu = GetSubMenu(hMenu, 0); POINT pt; GetCursorPos(&pt); TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hParent, NULL); } ================================================ FILE: sample/not_pass_yet/[GB18030]一个字.txt ================================================ ================================================ FILE: sample/not_pass_yet/[GB18030]澤野弘之.lrc ================================================ [ti:THE ANSWER] [ar:Ұ֮ ( Ҥ椭)] [al:86DƥåD ꥸʥ・ɥȥå] [by:] [offset:0] [00:00.00]THE ANSWER - Ұ֮ ( Ҥ椭)/Laco [00:25.18]Lyrics byBenjamin/mpi [00:31.11]Composed byHiroyuki Sawano [00:36.85]We've spent our lives in shadows [00:41.45]Good people [00:43.26]Off the radar [00:45.90]I see you now [00:48.06]As the pressure builds [00:50.06]The doubts I had looking back [00:53.79]I didn't understand your reason [00:56.06]You always asked me every season [00:58.28]When all the madness is all over [01:00.10]What is your answer [01:03.41]Where do we go [01:04.46]Don't need to know [01:05.73]Just keep flow [01:06.73]Can we go back [01:07.94]I'll cover you [01:08.93]You cover me [01:10.10]Pick it up [01:10.85]Keep your head [01:11.80]Pick it up [01:12.38]You talk to me [01:13.35]I talk to you [01:14.59]It's gon' be our Xanadu [01:16.88]Where do we go [01:18.04]Is it with you [01:19.47]Your answer [01:21.50]Yes they lied to us [01:23.61]But I don't wanna nap in the dirt [01:25.99]Yes they lied to us [01:27.91]We still got a lot of work [01:30.39]First we must beat the legion [01:32.66]Then show the world we're human [01:34.85]First we must beat the legion [01:36.81]Show the world we like it rough [01:41.98]So many dreams were shattered [01:46.39]You saved us when it mattered [01:50.88]We still can't see how this story ends [01:55.08]When shall you tell me your name [01:58.83]I didn't understand your reason [02:01.15]You always asked me every season [02:03.33]When all the madness is all over [02:05.27]What is your answer [02:08.52]Where do we go [02:09.49]Don't need to know [02:10.73]Just keep flow [02:11.72]Can we go back [02:12.96]I'll cover you [02:13.89]You cover me [02:15.15]Pick it up [02:15.93]Keep your head [02:16.86]Pick it up [02:17.47]You talk to me [02:18.53]I talk to you [02:19.54]It's gon' be our Xanadu [02:21.93]Where do we go [02:23.08]Is it with you [02:24.50]Your answer [02:26.48]Yes they lied to us [02:28.73]But I don't wanna nap in the dirt [02:31.05]Yes they lied to us [02:32.88]We still got a lot of work [02:35.45]First we must beat the legion [02:37.66]Then show the world we're human [02:39.89]First we must beat the legion [02:41.85]Show the world we like it rough [02:46.91]Enough [02:53.77]We're tough enough [02:55.69]Enough [03:02.65]Your answer [03:04.59]Where do we go [03:05.62]Don't need to know [03:06.71]Just keep flow [03:07.81]Can we go back [03:09.04]I'll cover you [03:10.06]You cover me [03:11.26]Pick it up [03:12.06]Keep your head [03:12.91]Pick it up [03:13.60]You talk to me [03:14.59]I talk to you [03:15.72]It's gon' be our Xanadu [03:18.03]Where do we go [03:19.14]Is it with you [03:20.60]Your answer [03:22.63]Yes they lied to us [03:24.75]But I don't wanna nap in the dirt [03:27.11]Yes they lied to us [03:28.99]We still got a lot of work [03:31.56]First we must beat the legion [03:33.73]Then show the world we're human [03:36.02]First we must beat the legion [03:37.93]Show the world we like it rough ================================================ FILE: sample/not_pass_yet/[GB18030]编译说明.txt ================================================ sdjfksdjfskjdfsd sdfjsdkfjsdkjf dskfsjdfklsjfd ================================================ FILE: sample/not_pass_yet/[GB18030]连杆.cpp ================================================ ================================================ FILE: sample/not_pass_yet/[UTF-8]CMakeLists.txt ================================================ cmake_minimum_required(VERSION 3.11) # C++17 set(CMAKE_CXX_STANDARD 17) project(SmartCharsetConverter) # 添加unicode宏 add_definitions(-DUNICODE -D_UNICODE) add_compile_options("$<$:/source-charset:utf-8>") if(MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") endif() # ============================================= add_subdirectory(third_party) add_subdirectory(src) ================================================ FILE: sample/not_pass_yet/[UTF-8]TBarTool.cpp ================================================ #pragma once #include "TBarTool.h" #include "..\Control\TTreeViewContent.h" #include "..\Element\TShape.h" #include "..\Element\TBar.h" #include "..\Element\TConstraintCoincide.h" TBarTool::TBarTool() { myElementType = ELEMENT_BAR; sType = TEXT("连杆"); bCanBuildCoincide = true; } TBarTool::~TBarTool() { } TElement * TBarTool::AddIntoShape(TRealLine &RealLine) { RealLine.vecDpt.push_back(RealLine.GetRelativePointByIndex(0)); RealLine.vecDpt.push_back(RealLine.GetRelativePointByIndex(1)); RealLine.eType = myElementType; return pShape->AddElement((TBar *)&RealLine); } void TBarTool::AddIntoTreeViewContent(TElement *Element, int id) { if (Element->eType == ELEMENT_REALLINE) { Element->eType = myElementType; TBar Bar; Bar= *(TRealLine*)Element; pTreeViewContent->AddItem(&Bar, pShape->iNextId); } else TLineTool::AddIntoTreeViewContent(Element, id); } //void TBarTool::AddCoincide(TConstraintCoincide *pCoincide, int id, TConfiguration *pConfig) //{ // AddIntoTreeViewContent(pCoincide, id); // pShape->AddElement(pCoincide); //} ================================================ FILE: sample/not_pass_yet/[UTF-8]虚拟机环境.txt ================================================ 换源 gcc: build-essential cmake 3.16+ vscode: c++ go cmake ssh-remote shell ================================================ FILE: sample/tcvn/demo1-tcvn.txt ================================================ msg_id pre_msg_id next_msg_id msg_info 1 0 0 Nhm Gio Ch: Cho cc h! Ti h Giang Bit Hc, ngng m i danh ca cc h t lu, nghe ni gio ch git cht c ma ng Phng Bt Bi, trn chnh li Nht Nguyt Thn Gio, a t Gio Ch thay tri hnh o dit tr i ma u, ti h tin rng Nhm gio ch v cng ci th, nht nh s a Nht Nguyt Thn Gio danh chn giang h. Ti h c bit trong Thng Thin Huyn Cnh c mt Vn Kim Trng, ngc ng chu bu rt nhiu, bit c Nhm gio ch tng vo trong , v vy thnh mi gio ch cng ti h xng vo Vn Kim Trng, nu chng ta ng tm hip lc nht nh s m c Phong n, n lc ngc ng chu bu gio ch c ly, ti h nht nh tun theo sp xp ca gio ch. Nu c gio ch tng tr l nim vinh hnh ca ti h. mong sm c din kin gio ch! Giang Bit Hc 2 0 0 cc v ng o giang h: ti h Giang Bit Hc, gn y c mt vic v cng au u, mt mnh ti h th khng th lm c, v vy thnh mi v lm cao th gip sc, nu cc v nguyn cng ti h hon thnh vic ln, Giang Bit Hc cm kch v cng. cc v c th n Phng Tng Ph tm ti h cng bn lun k sch. a t ng o giang h! Giang Bit Hc ================================================ FILE: sample/tcvn/demo1-utf8.txt ================================================ msg_id pre_msg_id next_msg_id msg_info 1 0 0 Nhậm Giáo Chủ: Chào các hạ! Tại hạ Giang Biệt Hạc, ngượng mộ đại danh của các hạ từ lâu, nghe nói giáo chủ đã giết chết ác ma Đông Phương Bất Bại, trấn chỉnh lại Nhật Nguyệt Thần Giáo, đa tạ Giáo Chủ thay trời hành đạo diệt trừ đại ma đầu, tại hạ tin rằng Nhậm giáo chủ võ công cái thế, nhất định sẽ đưa Nhật Nguyệt Thần Giáo danh chấn giang hồ. Tại hạ được biết trong Thông Thiên Huyễn Cảnh có một Vạn Kiếm Trũng, ngọc ngà châu báu rất nhiều, biết được Nhậm giáo chủ đã từng vào trong đó, vì vậy thỉnh mời giáo chủ cùng tại hạ xông vào Vạn Kiếm Trũng, nếu chúng ta đồng tâm hiệp lực nhất định sẽ mở được Phong ấn, đến lúc đó ngọc ngà châu báu giáo chủ cứ lấy, tại hạ nhất định tuân theo sắp xếp của giáo chủ. Nếu được giáo chủ tương trợ đó là niềm vinh hạnh của tại hạ. mong sớm được diện kiến giáo chủ! Giang Biệt Hạc 2 0 0 các vị đồng đạo giang hồ: tại hạ Giang Biệt Hạc, gần đây có một việc vô cùng đau đầu, một mình tại hạ thì không thể làm được, vì vậy thỉnh mời võ lâm cao thủ giúp sức, nếu các vị nguyện cùng tại hạ hoàn thành việc lớn, Giang Biệt Hạc cảm kích vô cùng. các vị có thể đến Phượng Tường Phủ tìm tại hạ cùng bàn luận kế sách. Đa tạ đồng đạo giang hồ! Giang Biệt Hạc ================================================ FILE: sample/uchardet_test_samples/ar/iso-8859-6.txt ================================================ -1256 . . 8859-6. ================================================ FILE: sample/uchardet_test_samples/ar/utf-8.txt ================================================ ويندوز-1256 هي صفحة كود تستخدم في كتابة اللغة العربية عموماً وبعض اللغات الشبيهة التي تستخدم نفس الأبجدية مثل الأردو والفارسية والكوردية. وذلك تحت نظام مايكروسوفت ويندوز. صفحة الكود هذه لا تتوافق مع الأيزو 8859-6. ================================================ FILE: sample/uchardet_test_samples/ar/windows-1256.txt ================================================ -1256 . . 8859-6. ================================================ FILE: sample/uchardet_test_samples/be/iso-8859-5.txt ================================================ (Marmota), , . 15 , . -- . , . , , . , , . ================================================ FILE: sample/uchardet_test_samples/be/utf-8.txt ================================================ Суркі (Marmota), сысуны, прадстаўнікі атраду грызуноў. На Зямлі існуе 15 відаў суркоў, якія маюць агульнага продка. Прарадзіма суркоў — Амерыка. У той час як большасць жывёл рухалася з Еўразіі ў Амерыку, суркі з Амерыкі перабіраліся ў Азію. Розныя віды абасобіліся ў розных геаграфічных зонах і адрозніваюцца асаблівасцямі паводзін, але захавалі знешнюю падобнасць, неабходнасць упадаць у спячку і жыццё ў калоніях. Усе суркі траваядныя, жывуць у норах, маюць цёплае футра. ================================================ FILE: sample/uchardet_test_samples/be/windows-1251.txt ================================================ (Marmota), , . 15 , .  . Ţ糳 , . , , . , , . ================================================ FILE: sample/uchardet_test_samples/bg/iso-8859-5.txt ================================================ (Marmota) - (Sciuridae), 14 , (Spermophilus citellus). , . ================================================ FILE: sample/uchardet_test_samples/bg/utf-8.txt ================================================ Мармотите (Marmota) са бозайници - род гризачи от семейство катерицови (Sciuridae), включващ 14 вида, включващи групата на лалугерите (Spermophilus citellus). За разлика от родствената катерица, мармотът и лалугерът водят наземен начин на живот. ================================================ FILE: sample/uchardet_test_samples/bg/windows-1251.txt ================================================ Windows-1251 8- () , , , . Windows-1251 KOI8-R ( KOI8-U) - ISO 8859-5, . , . ================================================ FILE: sample/uchardet_test_samples/ca/iso-8859-1.txt ================================================ Les marmotes (Marmota) sn un gnere de mamfers de la famlia dels escirids.[1] Viuen a l'alta muntanya a l'hemisferi nord. Sn rosegadors de mida mitjana, una mica ms grans que els gats domstics, de potes curtes i cos ample que els proporcionen un aspecte fora rabassut. ================================================ FILE: sample/uchardet_test_samples/ca/utf-8.txt ================================================ Les marmotes (Marmota) són un gènere de mamífers de la família dels esciúrids.[1] Viuen a l'alta muntanya a l'hemisferi nord. Són rosegadors de mida mitjana, una mica més grans que els gats domèstics, de potes curtes i cos ample que els proporcionen un aspecte força rabassut. ================================================ FILE: sample/uchardet_test_samples/ca/windows-1252.txt ================================================ Les especials relacions econmiques es fonamenten en la llibertat de trnsit de mercaderies, treballadors i capitals, aix com en l'establiment d'una moneda nica, l'euro () per tots els estats membres (la denominada Eurozona). ================================================ FILE: sample/uchardet_test_samples/cs/ibm852.txt ================================================ Led堟ek n (Alcedo atthis) je prmrn 16,5 cm velk ptk z eledi led堟kovitch (Alcedinidae). Je velmi vrazn zbarven s oranovou spodinou a modrm hbetem, kdly a temenem. Vraznm znakem je tak jeho npadn dlouh zapiatl zobk. Pro sv krsn zbarven je nazvn Ltajc drahokam. ================================================ FILE: sample/uchardet_test_samples/cs/iso-8859-2.txt ================================================ Ledek n (Alcedo atthis) je prmrn 16,5 cm velk ptk z eledi ledkovitch (Alcedinidae). Je velmi vrazn zbarven s oranovou spodinou a modrm hbetem, kdly a temenem. Vraznm znakem je tak jeho npadn dlouh zapiatl zobk. Pro sv krsn zbarven je nazvn Ltajc drahokam. ================================================ FILE: sample/uchardet_test_samples/cs/mac-centraleurope.txt ================================================ Ledˇek ޒn (Alcedo atthis) je prmrn 16,5 cm velk ptk z eledi ledˇkovitch (Alcedinidae). Je velmi vrazn zbarven s oranovou spodinou a modrm hbetem, kޒdly a temenem. Vraznm znakem je tak jeho npadn dlouh zapiatl zobk. Pro sv krsn zbarven je nazvn Ltajc drahokam. ================================================ FILE: sample/uchardet_test_samples/cs/utf-8.txt ================================================ Ledňáček říční (Alcedo atthis) je průměrně 16,5 cm velký pták z čeledi ledňáčkovitých (Alcedinidae). Je velmi výrazně zbarvený s oranžovou spodinou a modrým hřbetem, křídly a temenem. Výrazným znakem je také jeho nápadně dlouhý zašpičatělý zobák. Pro své krásné zbarvení je nazýván Létající drahokam. ================================================ FILE: sample/uchardet_test_samples/cs/windows-1250.txt ================================================ Ledek n (Alcedo atthis) je prmrn 16,5 cm velk ptk z eledi ledkovitch (Alcedinidae). Je velmi vrazn zbarven s oranovou spodinou a modrm hbetem, kdly a temenem. Vraznm znakem je tak jeho npadn dlouh zapiatl zobk. Pro sv krsn zbarven je nazvn Ltajc drahokam. ================================================ FILE: sample/uchardet_test_samples/da/ibm865.txt ================================================ Jimi Hendrix (1942-1970) var en amerikansk rockguitarist, sanger og sangskriver. Han begyndte at spille guitar, da han var femten r, og efter at have spillet med blandt andet Little Richard dannede han Jimi Hendrix Experience i slutningen af 1966. Denne gruppe fik snart hits med sange som "Hey Joe" og "Purple Haze", og med det tredje album, Electric Ladyland fra 1968, fik gruppen sit store gennembrud. Med flere markante optrdener p tidens store festivaler, heriblandt Woodstock, opnede han legendarisk status i rockmusikken, allerede mens han var i live. Hendrix brugte sin elektriske guitar som elektronisk lydkilde og eksperimenterede med feedback og distortion med udgangspunkt i traditionel rock'n'roll og blues. Hans misbrug af alkohol og narkotika frte imidlertid til, at han delagde sig selv, og han dde som blot 27-rig efter indtagelse af sovepiller. ================================================ FILE: sample/uchardet_test_samples/da/iso-8859-1.txt ================================================ Dansk er et nord-germansk sprog af den stnordiske (kontinentale) gruppe, der tales af ca. seks millioner mennesker. Det er strkt pvirket af plattysk. Dansk tales ogs i Sydslesvig (i Flensborg ca. 20 %) samt p Frerne og Grnland [1]. Dansk er tt forbundet med norsk. Fra et sprogvidenskabeligt synspunkt kan den fremherskende form af norsk, bokml (og i endnu hjere grad riksml), betragtes som dansk, i hvert fald hvad skriftsproget angr. Bde dansk, norsk og svensk er skandinaviske sprog og minder meget om hinanden. ================================================ FILE: sample/uchardet_test_samples/da/iso-8859-15.txt ================================================ Eurosymbolet eller eurotegnet () anvendes som valutasymbol for mntenheden euro. Symbolsk kombinerer det et E eller et grsk epsilon med de to parallelle streger, man ofte ser i valutasymboler. Det vides ikke med sikkerhed, hvem eurosymbolet blev designet af. Nogle medier hvder, det blev skabt af tidligere designer ved EF Arthur Eisenmenger, mens andre pstr, det blev skabt af en lille gruppe ledet af Alain Billiet. Muligvis er ingen af disse forklaringer korrekte, da Den Paneuropiske Union udsendte en '1 euro'-medalje i 1972, hvorp man kan se et symbol, der i hj grad ligner det nuvrende eurosymbol. ================================================ FILE: sample/uchardet_test_samples/da/utf-8.txt ================================================ Eurosymbolet eller eurotegnet (€) anvendes som valutasymbol for møntenheden euro. Symbolsk kombinerer det et E eller et græsk epsilon med de to parallelle streger, man ofte ser i valutasymboler. Det vides ikke med sikkerhed, hvem eurosymbolet blev designet af. Nogle medier hævder, det blev skabt af tidligere designer ved EF Arthur Eisenmenger, mens andre påstår, det blev skabt af en lille gruppe ledet af Alain Billiet. Muligvis er ingen af disse forklaringer korrekte, da Den Paneuropæiske Union udsendte en '1 euro'-medalje i 1972, hvorpå man kan se et symbol, der i høj grad ligner det nuværende eurosymbol. ================================================ FILE: sample/uchardet_test_samples/da/windows-1252.txt ================================================ Eurosymbolet eller eurotegnet () anvendes som valutasymbol for mntenheden euro. Symbolsk kombinerer det et E eller et grsk epsilon med de to parallelle streger, man ofte ser i valutasymboler. Det vides ikke med sikkerhed, hvem eurosymbolet blev designet af. Nogle medier hvder, det blev skabt af tidligere designer ved EF Arthur Eisenmenger, mens andre pstr, det blev skabt af en lille gruppe ledet af Alain Billiet. Muligvis er ingen af disse forklaringer korrekte, da Den Paneuropiske Union udsendte en '1 euro'-medalje i 1972, hvorp man kan se et symbol, der i hj grad ligner det nuvrende eurosymbol. ================================================ FILE: sample/uchardet_test_samples/de/iso-8859-1.txt ================================================ ISO 8859-1, genauer ISO/IEC 8859-1, auch bekannt als Latin-1, ist ein von der ISO zuletzt 1998 aktualisierter Standard fr die Informationstechnik zur Zeichenkodierung mit acht Bit und der erste Teil der Normenfamilie ISO/IEC 8859. Die mit sieben Bit kodierbaren Zeichen entsprechen US-ASCII mit fhrendem Nullbit. Zustzlich zu den 95 darstellbaren ASCII-Zeichen (2016-7E16) kodiert ISO 8859-1 96 weitere (A016-FF16), also insgesamt 191 von theoretisch mglichen 256 (= 28). Den Positionen 0016-1F16 und 7F16-9F16 sind in ISO/IEC 8859 und damit ISO/IEC 8859-1 keine Zeichen zugewiesen. Die von der IANA definierte Bezeichnung ISO-8859-1 (mit Bindestrich) steht fr die Kombination der Zeichen dieser Norm mit nicht darstellbaren Steuerzeichen gem ISO/IEC 6429. ================================================ FILE: sample/uchardet_test_samples/de/utf-8.txt ================================================ Berlin (Zum Anhören bitte klicken!Abspielen [bɛɐ̯ˈliːn]) ist Hauptstadt und als Land eine parlamentarische Republik und ein teilsouveräner Gliedstaat der Bundesrepublik Deutschland.[14] Die Stadt ist mit rund 3,7 Millionen Einwohnern die bevölkerungsreichste und mit 892 Quadratkilometern die flächengrößte Gemeinde Deutschlands und die einwohnerstärkste Stadt der Europäischen Union.[4] In der Agglomeration Berlin leben knapp 4,7 Millionen Einwohner, in der Metropolregion Berlin/Brandenburg gut sechs Millionen. Der Stadtstaat besteht aus zwölf Berliner Bezirken. Neben den Flüssen Spree und Havel befinden sich im Stadtgebiet kleinere Fließgewässer sowie zahlreiche Seen und Wälder. Im Jahr 1237 erstmals urkundlich erwähnt, war die Stadt in der Geschichte Berlins Residenz- und Hauptstadt der Mark Brandenburg, des Königreichs Preußen und Deutschlands. Nach dem Ende des Zweiten Weltkriegs unterlag die Stadt 1945 dem Viermächte-Status: Ost-Berlin hatte ab 1949 die Funktion als Hauptstadt der Deutschen Demokratischen Republik, während West-Berlin sich eng an die alte Bundesrepublik Deutschland anschloss. Mit dem Fall der Berliner Mauer 1989 und der deutschen Wiedervereinigung im Jahr 1990 wuchsen die beiden Stadthälften wieder zusammen und Berlin erhielt seine Rolle als gesamtdeutsche Hauptstadt zurück. Seit 1999 ist die Stadt Sitz der Bundesregierung, des Bundespräsidenten, des Bundestages, des Bundesrates sowie der Bundesministerien und zahlreicher Botschaften. ================================================ FILE: sample/uchardet_test_samples/de/windows-1252.txt ================================================ ISO 8859-1, genauer ISO/IEC 8859-1, auch bekannt als Latin-1, ist ein von der ISO zuletzt 1998 aktualisierter Standard fr die Informationstechnik zur Zeichenkodierung mit acht Bit und der erste Teil der Normenfamilie ISO/IEC 8859. Die mit sieben Bit kodierbaren Zeichen entsprechen US-ASCII mit fhrendem Nullbit. Zustzlich zu den 95 darstellbaren ASCII-Zeichen (20167E16) kodiert ISO 8859-1 96 weitere (A016FF16), also insgesamt 191 von theoretisch mglichen 256 (= 28). Den Positionen 00161F16 und 7F169F16 sind in ISO/IEC 8859 und damit ISO/IEC 8859-1 keine Zeichen zugewiesen. Die von der IANA definierte Bezeichnung ISO-8859-1 (mit Bindestrich) steht fr die Kombination der Zeichen dieser Norm mit nicht darstellbaren Steuerzeichen gem ISO/IEC 6429. ================================================ FILE: sample/uchardet_test_samples/el/cp737.txt ================================================ 櫘 夘 ⤦ ࡫ 磜 ⩩ 回 ⤦ Marmota, 餫 樜 . ᭦ 回 夘 婫 ᫦ . ================================================ FILE: sample/uchardet_test_samples/el/iso-8859-7.txt ================================================ ISO 8859-7, , 8- , ISO 8859. . 1987 ELOT 928, 1986. 2003, , . ================================================ FILE: sample/uchardet_test_samples/el/utf-8.txt ================================================ Το UTF-8 (8-bit Unicode Transformation Format) είναι ένα μη-απωλεστικό σχήμα κωδικοποίησης χαρακτήρων μεταβλητού μήκους για το πρότυπο Unicode που δημιουργήθηκε από τους Ken Thompson και Rob Pike. Χρησιμοποιεί ομάδες από byte για να αναπαραστήσει τα κωδικά σημεία του Unicode. Είναι ιδιαίτερα χρήσιμο για μετάδοση δεδομένων σε 8bit συστήματα ηλεκτρονικού ταχυδρομείου. Συγκεκριμένα χρησιμοποιεί ένα μέχρι τέσσερα byte ανά χαρακτήρα ανάλογα με το σύμβολο και το κωδικό του σημείο. Για παράδειγμα χρειάζεται μόνο ένα byte του UTF-8 για την κωδικοποίηση των 128 ASCII χαρακτήρες στο διάστημα του Unicode U+0000 μέχρι U+007F. ================================================ FILE: sample/uchardet_test_samples/el/windows-1253.txt ================================================ Windows-1253 Windows-1253. ( Windows-1253) "A2". ( ), , . ================================================ FILE: sample/uchardet_test_samples/en/ascii.txt ================================================ This is an ASCII TEST. We still want uchardet to detect it as ASCII, even with the presence of an escape character:  Or with the HZ encoding escape sequence: ~{ ================================================ FILE: sample/uchardet_test_samples/en/utf-8.txt ================================================ Europe covers about 10,180,000 km² (3,930,000 sq mi), or 2% of the Earth's surface (6.8% of land area), making it the second smallest continent (using the seven-continent model). Politically, Europe is divided into about fifty sovereign states, of which Russia is the largest and most populous, spanning 39% of the continent and comprising 15% of its population. Europe had a total population of about 746 million (about 10% of the world population) in 2018.[2][3] The European climate is largely affected by warm Atlantic currents that temper winters and summers on much of the continent, even at latitudes along which the climate in Asia and North America is severe. Further from the sea, seasonal differences are more noticeable than close to the coast. ================================================ FILE: sample/uchardet_test_samples/eo/iso-8859-3.txt ================================================ Esperanto (origine Lingvo Internacia) estas la plej disvastigita internacia planlingvo.[3] La nomo venas de la kanomo "Dr-o Esperanto", sub kiu la juda kuracisto Ludoviko Lazaro Zamenhofo en la jaro 1887 publikigis la bazon de la lingvo. La unua versio, la rusa, ricevis la cenzuran permeson disvastii en la 26-a de julio; i tiun daton oni konsideras la naskitago de Esperanto[4][5]. Li intencis krei facile lerneblan netralan lingvon, tagan por uzo en la internacia komunikado, tamen ne anstataigi aliajn, naciajn lingvojn. ================================================ FILE: sample/uchardet_test_samples/eo/utf-8.txt ================================================ Esperanto, origine la Lingvo Internacia,[4] estas la plej disvastiĝinta internacia planlingvo.[5] En 1887 Esperanton parolis nur manpleno da homoj; Esperanto havis unu el la plej malgrandaj lingvo-komunumoj de la mondo. Ĝi funkciis dekomence kiel lingvo de alternativa komunikado kaj de arta kreipovo[6]. En 2012, la lingvo fariĝis la 64-a tradukebla per Google Translate[7]; En 2016, la lingvo fariĝis tradukebla per Yandex Translate[8]; laŭ 2016, Esperanto aperis en listoj de lingvoj plej lernataj[9] kaj konataj en Hungarujo[10]. La nomo de la lingvo venas de la kaŝnomo “D-ro Esperanto„ sub kiu la juda kuracisto Ludoviko Lazaro Zamenhofo en la jaro 1887 publikigis la bazon de la lingvo. La unua versio, la rusa, ricevis la cenzuran permeson disvastiĝi en la 26-a de julio; ĉi tiun daton oni konsideras la naskiĝtago de Esperanto[11][12]. Li celis kaj sukcesis krei facile lerneblan neŭtralan lingvon, taŭgan por uzo en la internacia komunikado; la celo tamen ne estas anstataŭigi aliajn, naciajn lingvojn. ================================================ FILE: sample/uchardet_test_samples/es/iso-8859-1.txt ================================================ El precio medio de la vivienda nueva es de 2212 EUR/m2, segn datos de la Sociedad de Tasacin a 31 de diciembre de 2012.156 El precio de la vivienda, sin embargo, vara ostensiblemente en funcin de las comunidades autnomas y las capitales de provincia, encontrndose la de mayor valor en Catalua (3146 EUR/m), y en contraposicin las de Extremadura y Murcia (1271 EUR/m) ================================================ FILE: sample/uchardet_test_samples/es/iso-8859-15.txt ================================================ El precio medio de la vivienda nueva es de 2212 /m2, segn datos de la Sociedad de Tasacin a 31 de diciembre de 2012.156 El precio de la vivienda, sin embargo, vara ostensiblemente en funcin de las comunidades autnomas y las capitales de provincia, encontrndose la de mayor valor en Catalua (3146 /m), y en contraposicin las de Extremadura y Murcia (1271 /m) ================================================ FILE: sample/uchardet_test_samples/es/utf-8.txt ================================================ El precio medio de la vivienda nueva es de 2212 €/m2, según datos de la Sociedad de Tasación a 31 de diciembre de 2012.156 El precio de la vivienda, sin embargo, varía ostensiblemente en función de las comunidades autónomas y las capitales de provincia, encontrándose la de mayor valor en Cataluña (3146 €/m²), y en contraposición las de Extremadura y Murcia (1271 €/m²) ================================================ FILE: sample/uchardet_test_samples/es/windows-1252.txt ================================================ El precio medio de la vivienda nueva es de 2212 /m2, segn datos de la Sociedad de Tasacin a 31 de diciembre de 2012.156 El precio de la vivienda, sin embargo, vara ostensiblemente en funcin de las comunidades autnomas y las capitales de provincia, encontrndose la de mayor valor en Catalua (3146 /m), y en contraposicin las de Extremadura y Murcia (1271 /m) ================================================ FILE: sample/uchardet_test_samples/et/iso-8859-13.txt ================================================ Anton Pavlovit Tehhov oli vene nite- ja novellikirjanik ning praktiseeriv arst. Tehhov on eelkige tuntud oma novellide poolest. Tema jutustuste tavaliseks tegevuspaigaks olid vene vikeasulad ja need ksitlesid hingeksildust, raisatud nne jms. Tuntud on ka tema pshholoogilised nidendid, kus valitseb kurb ja lootusetu meeleolu. ================================================ FILE: sample/uchardet_test_samples/et/iso-8859-15.txt ================================================ Anton Pavlovit Tehhov oli vene nite- ja novellikirjanik ning praktiseeriv arst. Tehhov on eelkige tuntud oma novellide poolest. Tema jutustuste tavaliseks tegevuspaigaks olid vene vikeasulad ja need ksitlesid hingeksildust, raisatud nne jms. Tuntud on ka tema pshholoogilised nidendid, kus valitseb kurb ja lootusetu meeleolu. ================================================ FILE: sample/uchardet_test_samples/et/iso-8859-4.txt ================================================ Anton Pavlovit Tehhov oli vene nite- ja novellikirjanik ning praktiseeriv arst. Tehhov on eelkige tuntud oma novellide poolest. Tema jutustuste tavaliseks tegevuspaigaks olid vene vikeasulad ja need ksitlesid hingeksildust, raisatud nne jms. Tuntud on ka tema pshholoogilised nidendid, kus valitseb kurb ja lootusetu meeleolu. ================================================ FILE: sample/uchardet_test_samples/et/utf-8.txt ================================================ Anton Pavlovitš Tšehhov oli vene näite- ja novellikirjanik ning praktiseeriv arst. Tšehhov on eelkõige tuntud oma novellide poolest. Tema jutustuste tavaliseks tegevuspaigaks olid vene väikeasulad ja need käsitlesid hingeüksildust, raisatud õnne jms. Tuntud on ka tema psühholoogilised näidendid, kus valitseb kurb ja lootusetu meeleolu. ================================================ FILE: sample/uchardet_test_samples/et/windows-1252.txt ================================================ Anton Pavlovit Tehhov oli vene nite- ja novellikirjanik ning praktiseeriv arst. Tehhov on eelkige tuntud oma novellide poolest. Tema jutustuste tavaliseks tegevuspaigaks olid vene vikeasulad ja need ksitlesid hingeksildust, raisatud nne jms. Tuntud on ka tema pshholoogilised nidendid, kus valitseb kurb ja lootusetu meeleolu. ================================================ FILE: sample/uchardet_test_samples/et/windows-1257.txt ================================================ Anton Pavlovit Tehhov oli vene nite- ja novellikirjanik ning praktiseeriv arst. Tehhov on eelkige tuntud oma novellide poolest. Tema jutustuste tavaliseks tegevuspaigaks olid vene vikeasulad ja need ksitlesid hingeksildust, raisatud nne jms. Tuntud on ka tema pshholoogilised nidendid, kus valitseb kurb ja lootusetu meeleolu. ================================================ FILE: sample/uchardet_test_samples/fi/iso-8859-1.txt ================================================ Termi science fiction on amerikkalaisen tieteislehtien toimittajan Hugo Gernsbackin keksim. Suomessa termin tieteiskirjallisuus loi tohtori Eino Kauppinen 1950-luvun alkupuolella. Tieteiskirjallisuudelle on laadittu erilaisia mritelmi. Tieteiskirjallisuuden rajat eivt ole yksiselitteisen selket. Tieteiskirjallisuus lhenee monia kirjallisuudenlajeja, erityisesti kauhu- ja fantasiakirjallisuutta. Nill kolmella lajilla onkin yhteiset juuret 1800-lukua edeltvss ei-realistisessa kirjallisuudessa. ================================================ FILE: sample/uchardet_test_samples/fi/utf-8.txt ================================================ Termi science fiction on amerikkalaisen tieteislehtien toimittajan Hugo Gernsbackin keksimä. Suomessa termin tieteiskirjallisuus loi tohtori Eino Kauppinen 1950-luvun alkupuolella. Tieteiskirjallisuudelle on laadittu erilaisia määritelmiä. Tieteiskirjallisuuden rajat eivät ole yksiselitteisen selkeät. Tieteiskirjallisuus lähenee monia kirjallisuudenlajeja, erityisesti kauhu- ja fantasiakirjallisuutta. Näillä kolmella lajilla onkin yhteiset juuret 1800-lukua edeltävässä ei-realistisessa kirjallisuudessa. ================================================ FILE: sample/uchardet_test_samples/fr/iso-8859-1.txt ================================================ La norme ISO 8859-1, dont le nom complet est ISO/CEI 8859-1, et qui est souvent appele Latin-1 ou Europe occidentale, forme la premire partie de la norme internationale ISO/CEI 8859, qui est une norme de l'Organisation internationale de normalisation pour le codage des caractres en informatique. Elle dfinit ce qu'elle appelle l'alphabet latin numro 1, qui consiste en 191 caractres de l'alphabet latin, chacun d'entre eux tant cod par un octet (soit 8 bits). ISO 8859-1 reprend le codage des caractres imprimables d'US-ASCII. Dans les pays occidentaux, cette norme tait utilise par de nombreux systmes d'exploitation, dont UNIX, Windows ou AmigaOS. Elle a donn lieu quelques extensions et adaptations, dont Windows-1252 et ISO 8859-15. La distinction entre ASCII, ISO 8859-1, ISO 8859-15, Windows-1252 et MacRoman est une source de confusion parmi les dveloppeurs de programmes informatiques. Le Multinational Character Set cr par Digital Equipment Corporation pour le terminal informatique VT220 est considr comme la fois l'anctre de l'ISO 8859-1 et de l'Unicode2. Aujourd'hui, son utilisation tend dcrotre au profit de l'Unicode. ================================================ FILE: sample/uchardet_test_samples/fr/iso-8859-15.txt ================================================ L'uf de volaille est un produit agricole servant d'ingrdient entrant dans la composition de nombreux plats, dans de nombreuses cultures gastronomiques du monde. Le plus utilis est l'uf de poule, mais les ufs d'autres oiseaux sont aussi consomms : caille, cane, oie, autruche, etc. Les ufs de poissons, comme le caviar, ou de certains reptiles, comme ceux de l'iguane vert, sont galement utiliss dans l'alimentation humaine. Cependant, leur utilisation est trs diffrente de celle des ufs de volaille. Les ufs utiliss en cuisine ne sont gnralement pas fconds du fait de leur provenance d'levages industriels o les coqs sont absents. Fconds ou non, ils sont utiliss l'tat frais si moins de vingt-huit jours se sont couls aprs la ponte, selon les normes administratives franaises. Dans les usages culinaires asiatiques, les ufs sont parfois consomms couvs, comme le balut, ou mis fermenter pendant plusieurs semaines, comme l'uf de cent ans. ================================================ FILE: sample/uchardet_test_samples/fr/utf-8.txt ================================================ UTF-8 (abréviation de l’anglais Universal Character Set Transformation Format - 8 bits) est un codage de caractères informatiques conçu pour coder l’ensemble des caractères du « répertoire universel de caractères codés », initialement développé par l’ISO dans la norme internationale ISO/CEI 10646, aujourd’hui totalement compatible avec le standard Unicode, en restant compatible avec la norme ASCII limitée à l’anglais de base (et quelques autres langues beaucoup moins fréquentes), mais très largement répandue depuis des décennies. L’UTF-8 est utilisé par 82,2 % des sites web en décembre 20141. De par sa nature, UTF-8 est d’un usage de plus en plus courant sur Internet, et dans les systèmes devant échanger de l'information. Il s’agit également du codage le plus utilisé dans les systèmes GNU, Linux et compatibles pour gérer le plus simplement possible des textes et leurs traductions dans tous les systèmes d’écritures et tous les alphabets du monde. ================================================ FILE: sample/uchardet_test_samples/fr/windows-1252.txt ================================================ Luf de volaille est un produit agricole servant d'ingrdient entrant dans la composition de nombreux plats, dans de nombreuses cultures gastronomiques du monde. ================================================ FILE: sample/uchardet_test_samples/ga/iso-8859-1.txt ================================================ Ag seo tarma seoltireachta a bhaineann le longa adhmaid agus le bid. N bhodh de cheangal idir ire agus tortha eile ach na longa, agus t ire fin ln de lochanna agus d'aibhneacha. Fgann seo go bhfuil an teanga breac le tarmaocht seoltireachta agus loingseoireachta agus cuid di tugtha isteach n Lochlainnis agus n mBarla tr lonnaitheoir n iasacht. ================================================ FILE: sample/uchardet_test_samples/ga/utf-8.txt ================================================ Ag seo téarmaí seoltóireachta a bhaineann le longa adhmaid agus le báid. Ní bhíodh de cheangal idir Éire agus tíortha eile ach na longa, agus tá Éire féin lán de lochanna agus d’aibhneacha. Fágann seo go bhfuil an teanga breac le téarmaíocht seoltóireachta agus loingseoireachta agus cuid di tugtha isteach ón Lochlainnis agus ón mBéarla trí lonnaitheoirí ón iasacht. ================================================ FILE: sample/uchardet_test_samples/ga/windows-1252.txt ================================================ Ag seo tarma seoltireachta a bhaineann le longa adhmaid agus le bid. N bhodh de cheangal idir ire agus tortha eile ach na longa, agus t ire fin ln de lochanna agus daibhneacha. Fgann seo go bhfuil an teanga breac le tarmaocht seoltireachta agus loingseoireachta agus cuid di tugtha isteach n Lochlainnis agus n mBarla tr lonnaitheoir n iasacht. ================================================ FILE: sample/uchardet_test_samples/he/ibm862.logical.txt ================================================ (: Two Treatises of Government) - ' , -1689.[1] (). "". , . , . ================================================ FILE: sample/uchardet_test_samples/he/ibm862.visual.txt ================================================ . , . , ."" .)( ]1[.9861- , \' - )tnemnrevoG fo sesitaerT owT :( ================================================ FILE: sample/uchardet_test_samples/he/iso-8859-8.txt ================================================ ISO 8859 , , : 0xA0 0xBF , , . ================================================ FILE: sample/uchardet_test_samples/he/utf-8.txt ================================================ (ראשי תיבות של 8‎-bit Unicode Transformation Format או 8‎-bit UCS Transformation Format) הוא קידוד תווים באורך משתנה ליוניקוד, שנוצר על ידי רוב פייק וקן תומפסון. ניתן לקודד בו כל תו המצוי בתקן יוניקוד על ידי שימוש באחד עד ארבעה בתים, תלוי בתו. הקידוד ב-UTF-8 מעניק את כל יתרונות השימוש בקידוד ליוניקוד ומוסיף עליהם, בין היתר, גם חיסכון בזיכרון, עמידות בפני איבוד או השחתת בתים ותאימות לאחור ל-ASCII. ה-IETF מעדיף בבירור את UTF-8 ומחייב כל פרוטוקול אינטרנט לתמוך בו, וכן קונסורציום הדואר האלקטרוני, ה-IMC, ממליץ שכל תוכנת דואר אלקטרוני תוכל להציג וליצור דואר באמצעות UTF-8. ================================================ FILE: sample/uchardet_test_samples/he/windows-1255.txt ================================================ , -, , . ================================================ FILE: sample/uchardet_test_samples/hi/utf-8.txt ================================================ ग्लेशियर नेशनल पार्क (अंग्रेज़ी: Glacier National Park; उच्चा.: ग्लेशियर नेशनल पार्क) अमेरिकी राष्ट्रीय उद्यान है, जो कि कनाडा-संयुक्त राज्य अमेरिका की सीमा पर स्थित है। उद्यान संयुक्त राज्य के उत्तर-पश्चिमी मोंटाना राज्य में स्थित है और कनाडा की ओर अल्बर्टा और ब्रिटिश कोलम्बिया प्रांतों से सटा हुआ है। उद्यान दस लाख एकड़ (4,000 किमी2) से अधिक क्षेत्र में फैला हुआ है और इसमें दो पर्वत श्रृंखला (रॉकी पर्वत की उप-श्रेणियाँ), 130 से अधिक नामित झीलें, 1,000 से अधिक विभिन्न पौधों की प्रजातियां और सैकड़ों वन्यजीवों की प्रजातियां शामिल हैं। इस विशाल प्राचीन पारिस्थितिकी तंत्र को जो कि 16,000 वर्ग मील (41,000 किमी2) में शामिल संरक्षित भूमि का भाग है, "क्राउन ऑफ़ द कॉन्टिनेंट इकोसिस्टम" के रूप में संदर्भित किया गया है।[1] ग्लेशियर नेशनल पार्क में लगभग सभी मूल स्थानीय पादप और जीव-जन्तु प्रजातियां हैं। बड़े स्तनधारी जैसे कि भूरा भालू, मूस, और पहाड़ी बकरियों के साथ-साथ दुर्लभ या लुप्तप्राय प्रजातियां जैसे कि वूल्वरिन और कनाडाई लिनेक्स, उद्यान में निवास करते हैं। यहां से पक्षियों की सैकड़ों प्रजातियां, एक दर्जन से अधिक मछलियों की प्रजातियां और कुछ सरीसृप और उभयचर प्रजातियों को प्रलेखित किया गया है। उद्यान में प्रेरी से टुंड्रा तक कई पारिस्थितिकी तंत्र हैं। उद्यान के दक्षिण-पश्चिम हिस्से में पश्चिमी रेडेकार्डर और हेमलॉक के जंगल पाये जाते हैं। उद्यान के जंगलों में आग लगना आम है। 1964 को छोड़कर उद्यान में हर साल आग लगती है। 1936 में 64 बार आग लगी थी जो कि रिकॉर्ड में सबसे अधिक है।[2][3] 2003 में लगी छह आग ने लगभग 136,000 एकड़ (550 किमी2), उद्यान के 13% से अधिक हिस्से को जला डाला था।[4] ================================================ FILE: sample/uchardet_test_samples/hr/ibm852.txt ================================================ Brekinja (lat. Sorbus torminalis) je bjelogorina vrsta drvea iz porodice Rosaceae. Prirodno je rasprostranjena u zapadnoj, srednjoj i junoj Europi, sjevernoj Africi, Krimu, Maloj Aziji, Kavkazu i Transkavkaziji. ================================================ FILE: sample/uchardet_test_samples/hr/iso-8859-13.txt ================================================ Brekinja (lat. Sorbus torminalis) je bjelogorina vrsta drvea iz porodice Rosaceae. Prirodno je rasprostranjena u zapadnoj, srednjoj i junoj Europi, sjevernoj Africi, Krimu, Maloj Aziji, Kavkazu i Transkavkaziji. ================================================ FILE: sample/uchardet_test_samples/hr/iso-8859-16.txt ================================================ Brekinja (lat. Sorbus torminalis) je bjelogorina vrsta drvea iz porodice Rosaceae. Prirodno je rasprostranjena u zapadnoj, srednjoj i junoj Europi, sjevernoj Africi, Krimu, Maloj Aziji, Kavkazu i Transkavkaziji. ================================================ FILE: sample/uchardet_test_samples/hr/iso-8859-2.txt ================================================ Brekinja (lat. Sorbus torminalis) je bjelogorina vrsta drvea iz porodice Rosaceae. Prirodno je rasprostranjena u zapadnoj, srednjoj i junoj Europi, sjevernoj Africi, Krimu, Maloj Aziji, Kavkazu i Transkavkaziji. ================================================ FILE: sample/uchardet_test_samples/hr/mac-centraleurope.txt ================================================ Brekinja (lat. Sorbus torminalis) je bjelogorina vrsta drvea iz porodice Rosaceae. Prirodno je rasprostranjena u zapadnoj, srednjoj i junoj Europi, sjevernoj Africi, Krimu, Maloj Aziji, Kavkazu i Transkavkaziji. ================================================ FILE: sample/uchardet_test_samples/hr/utf-8.txt ================================================ Brekinja (lat. Sorbus torminalis) je bjelogorična vrsta drveća iz porodice Rosaceae. Prirodno je rasprostranjena u zapadnoj, srednjoj i južnoj Europi, sjevernoj Africi, Krimu, Maloj Aziji, Kavkazu i Transkavkaziji. ================================================ FILE: sample/uchardet_test_samples/hr/windows-1250.txt ================================================ Brekinja (lat. Sorbus torminalis) je bjelogorina vrsta drvea iz porodice Rosaceae. Prirodno je rasprostranjena u zapadnoj, srednjoj i junoj Europi, sjevernoj Africi, Krimu, Maloj Aziji, Kavkazu i Transkavkaziji. ================================================ FILE: sample/uchardet_test_samples/hu/iso-8859-2.txt ================================================ Az ISO 8859-2 (hivatalosan ISO/IEC 8859-2, rviden s nem hivatalosan Latin-2) az ISO/IEC 8859-es karakterkdolsi szabvny msodik rsze. Az ISO ltal kettes szm latin bcnek nevezett 191 karakter mindegyiknek egybjtos (nyolcbites) kdjt adja meg. A 191 karakter kztt minden magyar kezetes bet megtallhat (a sok ms kszletbl hinyz s is). Az ISO_8859-2:1987 (mime rvidtsbl ismertebb nevn ISO-8859-2 (az "ISO" utn ktjellel)) az IANA-nak erre a szabvnyra pl karakterkszletnek neve, melyben a C0 (0x00-0x1F) s a C1 (0x80-0x9F) rsz az ISO/IEC 6429-ben meghatrozott vezrlkdokat tartalmazza. Az ISO/IEC 6429-ben s 2022-ben megadott escape szekvencikat nem hasznlja. Tovbbi ismert nevei: ISO_8859-2, latin2, l2 s csISOLatin2. ================================================ FILE: sample/uchardet_test_samples/hu/utf-8.txt ================================================ Giacomo Puccini (Lucca, 1858. december 22. – Brüsszel, 1924. november 29.) a 20. század egyik legnépszerűbb olasz operaszerzője. Műveiben főként az emberi érzésekre összpontosított: kis örömök, mindennapi kis események, nagy szenvedélyek és érzelmek jelennek meg, többnyire egzotikus környezetben. Hősei hétköznapi emberek. A Bohémélet tüdőbajos Mimije, az elhagyott Pillangókisasszony, az öngyilkos Tosca mind a szerelem áldozatai, akik végül az életükkel fizetnek. Puccini operái többnyire tragikus befejezésű darabok. A Nyugat lánya és a Gianni Schicchi című vígopera cselekménye azonban boldog véget ér; tragikus fordulata után az utolsó mű, a Turandot is. ================================================ FILE: sample/uchardet_test_samples/hu/windows-1250.txt ================================================ Jellemz r az els sztagra es hangsly (ebben a finnugor nyelvek s a szlovk nyelv hasonltanak hozz), a magnhangz-harmnia (barnulsotokrl zldlsetekrl), valamint a magnhangz-hosszsg s a hangsly egymstl fggetlen volta (amely szinte egyedliknt lehetv teszi az antik Idmrtkes versels alkalmazst). Hangrendszerre ezenkvl a lgy mssalhangzk (ny, ty, gy), az aspirlatlan zrhangok (h nlkl ejtett p, t, k, szemben pldul a germn nyelvekkel) s a palatlis magnhangzk eltti kemny mssalhangzk jelenlte jellemz (azaz lehetsges ne, ti stb. hangkapcsolat, nye, tyi helyett; szemben pldul az orosszal). Nincsenek benne valdi diftongusok (mint pldul a finnben vagy nmetben) s reduklt, vagyis elnyelt magnhangzk (mint pldul az angolban, nmetben). A specilis magyar a hang (mely a svdben s a perzsban is megvan) nehzsget okozhat a nyelvnket tanulknak. ================================================ FILE: sample/uchardet_test_samples/it/iso-8859-1.txt ================================================ L'architettura longobarda costituita dall'insieme delle opere architettoniche realizzate in Italia durante il regno dei Longobardi (568-774), con residuale permanenza nell'Italia meridionale fino al X-XI secolo (Langobardia Minor), e commissionate dai re e dai duchi longobardi. L'attivit architettonica sviluppata in Langobardia Maior andata in gran parte perduta, per lo pi a causa di successive ricostruzioni degli edifici sacri e profani eretti tra VII e VIII secolo. A parte il Tempietto longobardo di Cividale del Friuli, rimasto in gran parte intatto, gli edifici civili e religiosi di Pavia, Monza o altre localit sono stati ampiamente rimaneggiati nei secoli seguenti. Ancora integre rimangono cos soltanto poche architetture, o perch inglobate negli ampliamenti successivi - come la chiesa di San Salvatore a Brescia) -, o perch periferiche e di modeste dimensioni - come la chiesa di Santa Maria foris portas a Castelseprio. Testimonianze maggiormente fedeli alla forma originale si ritrovano, invece, nella Langobardia Minor: a Benevento si conservano la chiesa di Santa Sofia, un ampio tratto delle Mura e la Rocca dei Rettori, unici esempi superstiti di architettura militare longobarda, mentre altre testimonianze si sono conservate in centri minori del ducato beneventano e a Spoleto. ================================================ FILE: sample/uchardet_test_samples/it/utf-8.txt ================================================ L'architettura longobarda è costituita dall'insieme delle opere architettoniche realizzate in Italia durante il regno dei Longobardi (568-774), con residuale permanenza nell'Italia meridionale fino al X-XI secolo (Langobardia Minor), e commissionate dai re e dai duchi longobardi. L'attività architettonica sviluppata in Langobardia Maior è andata in gran parte perduta, per lo più a causa di successive ricostruzioni degli edifici sacri e profani eretti tra VII e VIII secolo. A parte il Tempietto longobardo di Cividale del Friuli, rimasto in gran parte intatto, gli edifici civili e religiosi di Pavia, Monza o altre località sono stati ampiamente rimaneggiati nei secoli seguenti. Ancora integre rimangono così soltanto poche architetture, o perché inglobate negli ampliamenti successivi - come la chiesa di San Salvatore a Brescia) -, o perché periferiche e di modeste dimensioni - come la chiesa di Santa Maria foris portas a Castelseprio. Testimonianze maggiormente fedeli alla forma originale si ritrovano, invece, nella Langobardia Minor: a Benevento si conservano la chiesa di Santa Sofia, un ampio tratto delle Mura e la Rocca dei Rettori, unici esempi superstiti di architettura militare longobarda, mentre altre testimonianze si sono conservate in centri minori del ducato beneventano e a Spoleto. ================================================ FILE: sample/uchardet_test_samples/ja/euc-jp.txt ================================================ Extended Unix Code(EUC)ϡUNIXǤ褯Ȥʸɤ沽Ǥ롣 ܸEUC JIS X 0208١ (EUC-JP) JIS X 0213١ (EUC-JIS-2004) ڹEUC (EUC-KR) λEUC (EUC-CN) λEUC (EUC-TW) ʤɤ롣 ================================================ FILE: sample/uchardet_test_samples/ja/iso-2022-jp.txt ================================================ ISO/IEC 2022$B!J5l>N(B ISO 2022$B!K$O!"(B $BJ8;z=89g$r(B7$B%S%C%HId9f$^$?$O(B8$B%S%C%HId9f$GI=8=$9$k$?$a$N5;=Q!"$*$h$S(B $BJ#?t$NJ8;z=89g$rC10l$NJ8;zId9f2=J}<0$K4^$a$k5;=Q(B $B$r5,Dj$9$k(BISO$B5,3J$G$"$k!#(BJIS$B$NBP1~5,3J$O(BJIS X 0202 $B!V>pJs5;=Q(B-$BJ8;zId9f$N9=B$5Z$S3HD%K!!W(B[1]$B!#(BEcma International$B$NBP1~5,3J$O(BECMA-35$B!#(B ISO/IEC 2022 $B$NId9f2=J}<0$O!"0lHL$K!"(B1$BJ8;z$K(B1$B%P%$%H$+(B2$B%P%$%H0J>e$r;H$&2DJQD9$NJ8;zId9f2=J}<0$G$"$k!#$$$/$D$+$NId9f2=I=8=$,(BISO/IEC 2022$B$N5!9=$r;H$C$F$$$k!#$?$H$($P!"(BISO-2022-JP$B$OF|K\8l$G9-$/;H$o$l$F$$$kId9f2=I=8=$G$"$j!"$$$o$f$k!V(BJIS$B%3!<%I!W$H$$$&$N$b$3$l$r;X$9$3$H$,0lHLE*$G$"$k!#(B ================================================ FILE: sample/uchardet_test_samples/ja/shift_jis.txt ================================================ {{{{{{{{{{{{{{{{{{{ ================================================ FILE: sample/uchardet_test_samples/ja/utf-8.txt ================================================ UTF-8(ユーティーエフはち、ユーティーエフエイト)はISO/IEC 10646 (UCS) とUnicodeで使える8ビット符号単位の文字符号化形式及び文字符号化スキーム。 正式名称は、ISO/IEC 10646では “UCS Transformation Format 8”、Unicodeでは “Unicode Transformation Format-8” という。両者はISO/IEC 10646とUnicodeのコード重複範囲で互換性がある。RFCにも仕様がある[1]。 2バイト目以降に「/」などのASCII文字が現れないように工夫されていることから、UTF-FSS (File System Safe) ともいわれる。旧名称はUTF-2。 データ交換方式、ファイル形式として、一般的にUTF-8は使われる傾向にある。 当初は、ベル研究所においてPlan 9で用いるエンコードとして、ロブ・パイクによる設計指針のもと、ケン・トンプソンによって考案された ================================================ FILE: sample/uchardet_test_samples/ka/georgian-academy.txt ================================================ (. Marmota) . 15 . . . , , . ================================================ FILE: sample/uchardet_test_samples/ka/georgian-ps.txt ================================================ (. Marmota) . 15 . . . , , . ================================================ FILE: sample/uchardet_test_samples/ka/utf-8.txt ================================================ ვირზაზუნა (ლათ. Marmota) — ძუძუმწოვრების გვარი მღრღნელების რიგისა. მსოფლიოში ვირზაზუნათა 15 სახეობაა ცნობილი. მათ სამშობლოდ ამერიკა ითვლება. ვირზაზუნები ძალიან განსხვავდებიან სხვა ძუძუმწოვრებისაგან. იმ დროს როდესაც ცხოველები აზიიდან და ევროპიდან ამერიკისაკენ მიემართებოდნენ, ვირზაზუნები პირიქით, ამერიკიდან გავრცელდნენ მთელ მსოფლიოში. ================================================ FILE: sample/uchardet_test_samples/ko/iso-2022-kr.txt ================================================ $)CISO/IEC 20224B 9.@Z A}GU@; 7:qF. :NH# 6G4B 8:qF. :NH#7N G%GvGO1b @'GQ 1b24B 0!:/ 9.@Z :NH#H- 9f=D@L8g GQ19>n@G 0f?l EUC-KR@L @L :NH#H- 9f=D@; ;g?kGQ4Y. ================================================ FILE: sample/uchardet_test_samples/ko/johab.txt ================================================ eie ѩ } ii ee qa[1] ei x‘Ae } 14 ѩ 10 24i aa qea. "aui ia" Ai a A׷ ee aa ia aa 1443e wAaa 1446e e͡ava. {iaa {e aaa qaa { , , i A eA aa A q颅a b xea. qAe } 17A ѩ 11 28aa A 4i Ae 24e ea. e 壥 幢 aáAe w a, Aa ɥ Ae aa᷁ a Ȃava. 壥Ae i(Xhi)a ea. ================================================ FILE: sample/uchardet_test_samples/ko/uhc.smi ================================================ EUC-KR.smi

EUC-KR

EUC-KR KS X 1001 KS X 1003 ϴ 8Ʈ ڵ, EUC ̸ ǥ ѱ ϼ ڵ̱ ϼ̶ Ҹ.

EUC-KR ڵ ȴ.

128 Ʈ KS X 1003 Ѵ.

128 ũų Ʈ KS X 1001 Ѵ. ڴ 128 ڵ尪 Ͽ 2Ʈ ǥȴ.

KS X 1001 40-27 "" ڴ EUC-KR C0 A7 Ʈ ǥȴ.

KS X 1001 ѱ ä ڸ Ͽ ԰ տ Ե ѱ ǥϴ Ȯ , κ EUC-KR ʰ CP949 ٸ Ͽ KS X 1001 ٱ ѱ ǥѴ. ================================================ FILE: sample/uchardet_test_samples/ko/utf-8.txt ================================================ UTF-8은 유니코드를 위한 가변 길이 문자 인코딩 방식 중 하나로, 켄 톰프슨과 롭 파이크가 만들었다. 본래는 FSS-UTF(File System Safe UCS/Unicode Transformation Format)라는 이름으로 제안되었다. UTF-8 인코딩은 유니코드 한 문자를 나타내기 위해 1바이트에서 4바이트까지를 사용한다. 예를 들어서, U+0000부터 U+007F 범위에 있는 ASCII 문자들은 UTF-8에서 1바이트만으로 표시된다. 4바이트로 표현되는 문자는 모두 기본 다국어 평면(BMP) 바깥의 유니코드 문자이며, 거의 사용되지 않는다. UTF-16과 UTF-8 중 어느 인코딩이 더 적은 바이트를 사용하는지는 문자열에서 사용된 코드 포인트에 따라 달라지며, 실제로 DEFLATE와 같은 일반적인 압축 알고리즘을 사용할 경우 이 차이는 무시할 수 있을 정도이다. 이러한 압축 알고리즘을 사용하기 힘들고 크기가 중요할 경우 유니코드 표준 압축 방식을 대신 사용할 수 있다. ================================================ FILE: sample/uchardet_test_samples/lt/iso-8859-10.txt ================================================ Vincentas van Gogas (ol. Vincent van Gogh, 1853 m. kovo 30 d. Grot Zunderte, Nyderlandai - 1890 m. liepos 29 d. Overe prie Uazos, Pranczija) - oland tapytojas ir grafikas, postimpresionistas. ================================================ FILE: sample/uchardet_test_samples/lt/iso-8859-13.txt ================================================ Vincentas van Gogas (ol. Vincent van Gogh, 1853 m. kovo 30 d. Grot Zunderte, Nyderlandai - 1890 m. liepos 29 d. Overe prie Uazos, Pranczija) - oland tapytojas ir grafikas, postimpresionistas. ================================================ FILE: sample/uchardet_test_samples/lt/iso-8859-4.txt ================================================ Vincentas van Gogas (ol. Vincent van Gogh, 1853 m. kovo 30 d. Grot Zunderte, Nyderlandai - 1890 m. liepos 29 d. Overe prie Uazos, Pranczija) - oland tapytojas ir grafikas, postimpresionistas. ================================================ FILE: sample/uchardet_test_samples/lt/utf-8.txt ================================================ Vincentas van Gogas (ol. Vincent van Gogh, 1853 m. kovo 30 d. Grot Zunderte, Nyderlandai – 1890 m. liepos 29 d. Overe prie Uazos, Prancūzija) – olandų tapytojas ir grafikas, postimpresionistas. ================================================ FILE: sample/uchardet_test_samples/lv/iso-8859-10.txt ================================================ Vinsents Villems van Gogs (nderlandieu: Vincent Willem van Gogh, dzimis 1853. gada 30. mart, miris 1890. gada 29. jlij) bija nderlandieu gleznotjs, postimpresionisma prstvis. Kopum van Gogs radja vairk nek 2000 darbu, to skait 900 gleznu un 1100 zmjumu un skiu. Savus slavenkos darbus vi radja pdjo divu dzves gadu laik. Tiek uzskatts, ka van Gogs btiski ir ietekmjis 20. gadsimta mkslu, tostarp ekspresionismu un fovismu. ================================================ FILE: sample/uchardet_test_samples/lv/iso-8859-13.txt ================================================ Vinsents Villems van Gogs (nderlandieu: Vincent Willem van Gogh, dzimis 1853. gada 30. mart, miris 1890. gada 29. jlij) bija nderlandieu gleznotjs, postimpresionisma prstvis. Kopum van Gogs radja vairk nek 2000 darbu, to skait 900 gleznu un 1100 zmjumu un skiu. Savus slavenkos darbus vi radja pdjo divu dzves gadu laik. Tiek uzskatts, ka van Gogs btiski ir ietekmjis 20. gadsimta mkslu, tostarp ekspresionismu un fovismu. ================================================ FILE: sample/uchardet_test_samples/lv/iso-8859-4.txt ================================================ Vinsents Villems van Gogs (nderlandieu: Vincent Willem van Gogh, dzimis 1853. gada 30. mart, miris 1890. gada 29. jlij) bija nderlandieu gleznotjs, postimpresionisma prstvis. Kopum van Gogs radja vairk nek 2000 darbu, to skait 900 gleznu un 1100 zmjumu un skiu. Savus slavenkos darbus vi radja pdjo divu dzves gadu laik. Tiek uzskatts, ka van Gogs btiski ir ietekmjis 20. gadsimta mkslu, tostarp ekspresionismu un fovismu. ================================================ FILE: sample/uchardet_test_samples/lv/utf-8.txt ================================================ Vinsents Villems van Gogs (nīderlandiešu: Vincent Willem van Gogh, dzimis 1853. gada 30. martā, miris 1890. gada 29. jūlijā) bija nīderlandiešu gleznotājs, postimpresionisma pārstāvis. Kopumā van Gogs radīja vairāk nekā 2000 darbu, to skaitā 900 gleznu un 1100 zīmējumu un skiču. Savus slavenākos darbus viņš radīja pēdējo divu dzīves gadu laikā. Tiek uzskatīts, ka van Gogs būtiski ir ietekmējis 20. gadsimta mākslu, tostarp ekspresionismu un fovismu. ================================================ FILE: sample/uchardet_test_samples/mk/ibm855.txt ================================================ Ԡ з Ʒ ֎ Ԡ 렒 Ԡ Ҩ堢з ԷƠ ШԠ ب Ơ ֦ᨦԷ Է Ҩ Ԡ Ҡ. Ԡ ؠ ֬Ш ֎ ԨԷ Է Ҡ ֎ . ՠ Ơ ҨƠ Ҡ ԷԠ ШԠ ب 禠 Ш Ԩ Ҩ堠 Ʒ Ԡ. 먖 Ԡ ֨Ơ Է Рᠠ Ԡ Է (. Ơ) з Է Ҡ ( Ҡ Ʒ). 淨 禠 먖ؠ Ҩ Ԡ Ҡ. ѠԷ Է ᠠ Էᠠ Ơ ԠԠ ب ֦ Ơ Ԡ 렒. Ԡ Ԡ Ԡ Ҩ Ԡ Ш 려. ================================================ FILE: sample/uchardet_test_samples/mk/iso-8859-5.txt ================================================ . . . (. ) ( ). . . . ================================================ FILE: sample/uchardet_test_samples/mk/utf-8.txt ================================================ Хибернација или зимски сон е состојба на успорување на метаболизмот и ниска телесна температура кај одредени животни за време на зимата. Во хибернатори спаѓаат поголем број крзнени животни и мал број цицачи. На цицачите како мечката само малку им е снижена телесната температура се будат лесно и не се сметаат за вистински хибернатори. Повеќето хибернатори доека се активни складираат храна во засолништата (пр. верверичка) или резервни масти во телото (во масното ткиво). Тие можат да се разбудат повеќепати за време на зимата. Ладнокрвните животни мораат да хибернираат таму каде што надворешната температура се спушта под точка на смрзнување. Еднакво на хибернација за време на лето е естивација. ================================================ FILE: sample/uchardet_test_samples/mk/windows-1251.txt ================================================ . . . (. ) ( ). . . . ================================================ FILE: sample/uchardet_test_samples/mt/iso-8859-3.txt ================================================ Il-Malti huwa l-ilsien nazzjonali tar-Repubblika ta' Malta. Huwa l-ilsien uffijali flimkien mal-Ingli; kif ukoll wieed mill-ilsna uffijali tal-Unjoni Ewropea. Dan l-ilsien gandu sisien u gerq semitiku, ta' djalett Garbi li ej mit-Tramuntana tal-Afrika, galekk qatt ma kellu rabta mill-qrib mal-Garbi Klassiku. Ida tul i-minijiet, minabba proess tal-Latinizzazzjoni ta' Malta, bdew delin bosta elementi lingwistii mill-Isqalli, djalett ta' art li wkoll gaddiet minn mien ta' akma Garbija. Wara l-Isqalli beda dieel ukoll it-Taljan, fuq kollox fi-mien tad-dala tal-Kavallieri tal-Ordni ta' San wann sa meta l-Ingli a post it-Taljan bala l-ilsien uffijali fil-Kostituzzjoni Kolonjali tal-1934. Il-Malti huwa l-ilsien wadieni ta' gajn semitika li jinkiteb b'ittri Latini. L-alfabett Malti magmul minn 30 ittra (24 konsonanti u 6 vokali) li jidhru f'din l-ordni: ================================================ FILE: sample/uchardet_test_samples/mt/utf-8.txt ================================================ Franza (Franċiż:France), uffiċjalment ir-Repubblika Franċiża (Franċiż: République française), hi pajjiż fl-Ewropa tal-Punent. Il-belt belt kapitali tagħha hi Pariġi. Hi membru tal-Unjoni Ewropea. Franza hi maqsuma f'22 régions li huma suddiviżi f' départements. ================================================ FILE: sample/uchardet_test_samples/no/ibm865.txt ================================================ Pangramer brukes som ren underholdning; som skriveeksempel for prve p hndskrift; som hjelpemiddel til vise en font; eller som huskeregel for raskt teste tegnsettet i teknisk utstyr som behandler eller viser bokstaver. Sr golfer med klle vant sexquiz p wc i hjemby. Hvdingens kjre squaw fr litt pizza i Mexico by. Vr kjre my i cape vde banjo, whist og quiz i taxifila. IQ-ls WC-boms uten hrsel skjrer god pizza p xylofon. Vr kjre zulu-my vde banjo, whist og quickstep fra taxi. Etter quiz og whist m Jo bre fakkellys p vr srgende cox. Taxisjfren quizet bedre om calypso, watt og klr p hjemveien. Vr sre Zulu fra badeya spilte jo whist og quickstep i min taxi. Du t ca fire wienerplser og tok taxi hjem fra byen med re fra quizen. Jeg begynte fortre en sandwich mens jeg kjrte taxi p vei til quiz. Quisling var ein klppar til spela jazz p xylofon, men lrte seg aldri spela cembalo fr han drog til Washington. Hvdingens kjre squaw fr litt pizza i Mexico by. ================================================ FILE: sample/uchardet_test_samples/no/iso-8859-1.txt ================================================ Pangramer brukes som ren underholdning; som skriveeksempel for prve p hndskrift; som hjelpemiddel til vise en font; eller som huskeregel for raskt teste tegnsettet i teknisk utstyr som behandler eller viser bokstaver. Sr golfer med klle vant sexquiz p wc i hjemby. Hvdingens kjre squaw fr litt pizza i Mexico by. Vr kjre my i cape vde banjo, whist og quiz i taxifila. IQ-ls WC-boms uten hrsel skjrer god pizza p xylofon. Vr kjre zulu-my vde banjo, whist og quickstep fra taxi. Etter quiz og whist m Jo bre fakkellys p vr srgende cox. Taxisjfren quizet bedre om calypso, watt og klr p hjemveien. Vr sre Zulu fra badeya spilte jo whist og quickstep i min taxi. Du t ca fire wienerplser og tok taxi hjem fra byen med re fra quizen. Jeg begynte fortre en sandwich mens jeg kjrte taxi p vei til quiz. Quisling var ein klppar til spela jazz p xylofon, men lrte seg aldri spela cembalo fr han drog til Washington. Hvdingens kjre squaw fr litt pizza i Mexico by. Et sted, cirka inn i John Greens siste roman, Skilpadder hele veien ned, begynte jeg og romanens forteller, Aza Holmes, grte helt samtidig ================================================ FILE: sample/uchardet_test_samples/no/iso-8859-15.txt ================================================ Pangramer brukes som ren underholdning; som skriveeksempel for prve p hndskrift; som hjelpemiddel til vise en font; eller som huskeregel for raskt teste tegnsettet i teknisk utstyr som behandler eller viser bokstaver. Sr golfer med klle vant sexquiz p wc i hjemby. Hvdingens kjre squaw fr litt pizza i Mexico by. Vr kjre my i cape vde banjo, whist og quiz i taxifila. IQ-ls WC-boms uten hrsel skjrer god pizza p xylofon. Vr kjre zulu-my vde banjo, whist og quickstep fra taxi. Etter quiz og whist m Jo bre fakkellys p vr srgende cox. Taxisjfren quizet bedre om calypso, watt og klr p hjemveien. Vr sre Zulu fra badeya spilte jo whist og quickstep i min taxi. Du t ca fire wienerplser og tok taxi hjem fra byen med re fra quizen. Jeg begynte fortre en sandwich mens jeg kjrte taxi p vei til quiz. Quisling var ein klppar til spela jazz p xylofon, men lrte seg aldri spela cembalo fr han drog til Washington. Hvdingens kjre squaw fr litt pizza i Mexico by. Euro (symbol: ) er den Den europeiske unions myntenhet. Den er innfrt i 19 av unionens 27 medlemsland (kjent som eurosonen) og i fire mikrostater og noen andre land og omrder. ================================================ FILE: sample/uchardet_test_samples/no/utf-8.txt ================================================ Pangramer brukes som ren underholdning; som skriveeksempel for prøve på håndskrift; som hjelpemiddel til å vise en font; eller som huskeregel for å raskt teste tegnsettet i teknisk utstyr som behandler eller viser bokstaver. Sær golfer med kølle vant sexquiz på wc i hjemby. Høvdingens kjære squaw får litt pizza i Mexico by. Vår kjære møy i cape øvde banjo, whist og quiz i taxifila. IQ-løs WC-boms uten hørsel skjærer god pizza på xylofon. Vår kjære zulu-møy øvde banjo, whist og quickstep fra taxi. Etter quiz og whist må Jo bære fakkellys på vår sørgående cox. Taxisjåføren quizet bedre om calypso, watt og klær på hjemveien. Vår sære Zulu fra badeøya spilte jo whist og quickstep i min taxi. Du åt ca fire wienerpølser og tok taxi hjem fra byen med ære fra quizen. Jeg begynte å fortære en sandwich mens jeg kjørte taxi på vei til quiz. Quisling var ein kløppar til å spela jazz på xylofon, men lærte seg aldri å spela cembalo før han drog til Washington. Høvdingens kjære squaw får litt pizza i Mexico by. Et sted, cirka ¾ inn i John Greens siste roman, Skilpadder hele veien ned, begynte jeg og romanens forteller, Aza Holmes, å gråte helt samtidig ================================================ FILE: sample/uchardet_test_samples/no/windows-1252.txt ================================================ Pangramer brukes som ren underholdning; som skriveeksempel for prve p hndskrift; som hjelpemiddel til vise en font; eller som huskeregel for raskt teste tegnsettet i teknisk utstyr som behandler eller viser bokstaver. Sr golfer med klle vant sexquiz p wc i hjemby. Hvdingens kjre squaw fr litt pizza i Mexico by. Vr kjre my i cape vde banjo, whist og quiz i taxifila. IQ-ls WC-boms uten hrsel skjrer god pizza p xylofon. Vr kjre zulu-my vde banjo, whist og quickstep fra taxi. Etter quiz og whist m Jo bre fakkellys p vr srgende cox. Taxisjfren quizet bedre om calypso, watt og klr p hjemveien. Vr sre Zulu fra badeya spilte jo whist og quickstep i min taxi. Du t ca fire wienerplser og tok taxi hjem fra byen med re fra quizen. Jeg begynte fortre en sandwich mens jeg kjrte taxi p vei til quiz. Quisling var ein klppar til spela jazz p xylofon, men lrte seg aldri spela cembalo fr han drog til Washington. Hvdingens kjre squaw fr litt pizza i Mexico by. Euro (symbol: valutakode: EUR) er den Den europeiske unions myntenhet. Den er innfrt i 19 av unionens 27 medlemsland (kjent som eurosonen) og i fire mikrostater og noen andre land og omrder. ================================================ FILE: sample/uchardet_test_samples/pl/ibm852.txt ================================================ Zofia (Sonka) Holszaska herbu Hippocentaurus (ur. ok. 1405, zm. 21 wrzenia 1461 w Krakowie) ksiniczka litewska, krlowa Polski, od 1422 roku czwarta i ostatnia ona Wadysawa II Jagiey. ================================================ FILE: sample/uchardet_test_samples/pl/iso-8859-13.txt ================================================ Zofia (Sonka) Holszaska herbu Hippocentaurus (ur. ok. 1405, zm. 21 wrzenia 1461 w Krakowie) ksiniczka litewska, krlowa Polski, od 1422 roku czwarta i ostatnia ona Wadysawa II Jagiey. ================================================ FILE: sample/uchardet_test_samples/pl/iso-8859-16.txt ================================================ Zofia (Sonka) Holszaska herbu Hippocentaurus (ur. ok. 1405, zm. 21 wrzenia 1461 w Krakowie) ksiniczka litewska, krlowa Polski, od 1422 roku czwarta i ostatnia ona Wadysawa II Jagiey. ================================================ FILE: sample/uchardet_test_samples/pl/iso-8859-2.txt ================================================ Zofia (Sonka) Holszaska herbu Hippocentaurus (ur. ok. 1405, zm. 21 wrzenia 1461 w Krakowie) ksiniczka litewska, krlowa Polski, od 1422 roku czwarta i ostatnia ona Wadysawa II Jagiey. ================================================ FILE: sample/uchardet_test_samples/pl/mac-centraleurope.txt ================================================ Zofia (Sonka) Holszaska herbu Hippocentaurus (ur. ok. 1405, zm. 21 wrzenia 1461 w Krakowie) ksiniczka litewska, krlowa Polski, od 1422 roku czwarta i ostatnia ona Wadysawa II Jagiey. ================================================ FILE: sample/uchardet_test_samples/pl/utf-8.txt ================================================ Zofia (Sonka) Holszańska herbu Hippocentaurus (ur. ok. 1405, zm. 21 września 1461 w Krakowie) księżniczka litewska, królowa Polski, od 1422 roku czwarta i ostatnia żona Władysława II Jagiełły. ================================================ FILE: sample/uchardet_test_samples/pl/windows-1250.txt ================================================ Zofia (Sonka) Holszaska herbu Hippocentaurus (ur. ok. 1405, zm. 21 wrzenia 1461 w Krakowie) ksiniczka litewska, krlowa Polski, od 1422 roku czwarta i ostatnia ona Wadysawa II Jagiey. ================================================ FILE: sample/uchardet_test_samples/pt/iso-8859-1.txt ================================================ Albertossauro (Albertosaurus sp., que significa "lagarto de Alberta" no Canad), foi um gnero de dinossauro carnvoro e bpede presente no fim do perodo Cretceo. Media cerca de 8 a 9 metros de comprimento, 3 metros de altura e pesava menos de 2 toneladas. O Albertossauro viveu na Amrica do Norte e foi descoberto no ano de 1884 por Joseph Burr Tyrrell em Alberta, no Canad, local ao qual deve seu nome. ================================================ FILE: sample/uchardet_test_samples/pt/utf-8.txt ================================================ Albertossauro (Albertosaurus sp., que significa "lagarto de Alberta" no Canadá), foi um género de dinossauro carnívoro e bípede presente no fim do período Cretáceo. Media cerca de 8 a 9 metros de comprimento, 3 metros de altura e pesava menos de 2 toneladas. O Albertossauro viveu na América do Norte e foi descoberto no ano de 1884 por Joseph Burr Tyrrell em Alberta, no Canadá, local ao qual deve seu nome. ================================================ FILE: sample/uchardet_test_samples/ro/ibm852.txt ================================================ Danemarca (n danez Sunet Danmark), oficial Regatul Danemarcei (n danez Sunet Kongeriget Danmark), este un stat suveran din Europa de Nord, avnd si dou tri constituente de peste mri, care fac parte integrant din regat: Insulele Feroe n Atlanticul de Nord si Groenlanda n America de Nord. Danemarca propriu-zis[a] este cea mai de sud dintre trile nordice, aflat la sud-vest de Suedia si la sud de Norvegia, nvecinndu-se la sud cu Germania. Tara const dintr-o peninsul mare, Iutlanda, si mai multe insule, dintre care cele mai mari sunt Zealand, Funen, Lolland, Falster si Bornholm, precum si sute de insulite denumite n general ,,Arhipelagul Danez". ================================================ FILE: sample/uchardet_test_samples/ro/iso-8859-16.txt ================================================ Danemarca (n danez Sunet Danmark), oficial Regatul Danemarcei (n danez Sunet Kongeriget Danmark), este un stat suveran din Europa de Nord, avnd i dou ri constituente de peste mri, care fac parte integrant din regat: Insulele Feroe n Atlanticul de Nord i Groenlanda n America de Nord. Danemarca propriu-zis[a] este cea mai de sud dintre rile nordice, aflat la sud-vest de Suedia i la sud de Norvegia, nvecinndu-se la sud cu Germania. ara const dintr-o peninsul mare, Iutlanda, i mai multe insule, dintre care cele mai mari sunt Zealand, Funen, Lolland, Falster i Bornholm, precum i sute de insulie denumite n general Arhipelagul Danez. ================================================ FILE: sample/uchardet_test_samples/ro/utf-8.txt ================================================ Danemarca (în daneză Sunet Danmark), oficial Regatul Danemarcei (în daneză Sunet Kongeriget Danmark), este un stat suveran din Europa de Nord, având și două țări constituente de peste mări, care fac parte integrantă din regat: Insulele Feroe în Atlanticul de Nord și Groenlanda în America de Nord. Danemarca propriu-zisă[a] este cea mai de sud dintre țările nordice, aflată la sud-vest de Suedia și la sud de Norvegia, învecinându-se la sud cu Germania. Țara constă dintr-o peninsulă mare, Iutlanda, și mai multe insule, dintre care cele mai mari sunt Zealand, Funen, Lolland, Falster și Bornholm, precum și sute de insulițe denumite în general „Arhipelagul Danez”. ================================================ FILE: sample/uchardet_test_samples/ro/windows-1250.txt ================================================ Danemarca (n danez Sunet Danmark), oficial Regatul Danemarcei (n danez Sunet Kongeriget Danmark), este un stat suveran din Europa de Nord, avnd si dou tri constituente de peste mri, care fac parte integrant din regat: Insulele Feroe n Atlanticul de Nord si Groenlanda n America de Nord. Danemarca propriu-zis[a] este cea mai de sud dintre trile nordice, aflat la sud-vest de Suedia si la sud de Norvegia, nvecinndu-se la sud cu Germania. Tara const dintr-o peninsul mare, Iutlanda, si mai multe insule, dintre care cele mai mari sunt Zealand, Funen, Lolland, Falster si Bornholm, precum si sute de insulite denumite n general Arhipelagul Danez. ================================================ FILE: sample/uchardet_test_samples/ru/ibm855.txt ================================================ CP855 -- ƷзƠ ֦ Է MS-DOS ֦֢ بᠤ . М Ԡ ISO 8859-5. ը֬ Р ᢷ, ӠƨԷ Ь᷷, 㷷 Ԩ Р. ݨ Ԡ ֽ֦ 堢з ؠ ASCII. Р ֦ ҷ ֢Ԡ Ԡ ֦ Է֦. ================================================ FILE: sample/uchardet_test_samples/ru/ibm866.txt ================================================ <<ୠ⨢ ஢>> (<<ୠ⨢ ஢ >>) -- ᭮ CP437 ࠭, ᯥ᪨ ய᪨ ᨬ ன ਫ, ⠢ ᥢ᪨ ᨬ ஭묨. ⥫쭮, ணࠬ, ᯮ ࠡ ⥪⮢ , ⠪ ᯥ稢 ᯮ짮 ᨬ ਫ. ᪨ ⢮ ਠ⮢ ୠ⨢ ஢, ࠧ ⮫쪮 0xF0 -- 0xFF (240--255). ᯮ짮 ᥢ 䨪-ᠬ, ᠢ訥 ᨬ 묨 ணࠬ⠬, ࠭ १ । 業. ================================================ FILE: sample/uchardet_test_samples/ru/iso-8859-5.txt ================================================ ISO 8859-5 8- ISO-8859 . ISO 8859-5 " " ( , ). ================================================ FILE: sample/uchardet_test_samples/ru/koi8-r.txt ================================================ -8 ( , 8 ), KOI8 - , ASCII. . Unix- , 2010 , , . ================================================ FILE: sample/uchardet_test_samples/ru/mac-cyrillic.txt ================================================ MacCyrillic nj. ; , , ( ), , . () ASCII. . ================================================ FILE: sample/uchardet_test_samples/ru/utf-8.txt ================================================ Сурки образуют отчётливо выраженную группу из 14 или 15 видов (статус лесостепного сурка как отдельного вида является предметом обсуждения), в рамках семейства беличьих. Это относительно крупные, весом в несколько килограммов, животные, обитающие в открытых ландшафтах, в сооружаемых самостоятельно норах. Прародина сурков — Северная Америка, откуда они распространились через Берингию в Азию, и дальше — в Европу. В Евразии большинство исследователей выделяет 8 видов сурков: три или четыре вида, объединяемых в группу bobak (степной сурок, лесостепной сурок, серый сурок и монгольский сурок), населяющие широкую полосу степей и гор от Украины на западе до северо-западного Китая на востоке, единственный чисто европейский вид — альпийский сурок, три вида гор Центральной Азии — сурок Мензбира, длиннохвостый, или красный сурок и гималайский сурок и обособленный северо-восточный вид — черношапочный сурок. Разные виды сурков обособились в различных географических зонах и отличаются друг от друга особенностями поведения, но сохранили внешнее сходство и необходимость впадать в зимнюю спячку. Все сурки травоядны, селятся в норах, имеют тёплый мех и почти все живут колониями. Различаются равнинные сурки (байбаки) и сурки горные, живущие в суровых условиях альпийских гор, куда летнее тепло приходит поздно, а зима является рано. Сурки встречают свистом восход солнца[3]. Сурки иногда храпят[3]. ================================================ FILE: sample/uchardet_test_samples/ru/windows-1251.txt ================================================ Windows-1251 , 8- Microsoft Windows. . , Windows 19901991 . , Microsoft. ( , ). Windows-1251 8- ( CP866, KOI8-R ISO 8859-5) , ( ); : , , , . ================================================ FILE: sample/uchardet_test_samples/sk/ibm852.txt ================================================ Jupiter je piata planta v porad od Slnka, najvia a najhmotnejia planta naej slnenej sstavy. Je pomenovan po rmskom bohovi Jupiterovi. Symbolom planty je tylizovan znzornenie Jupiterovho boskho blesku. ================================================ FILE: sample/uchardet_test_samples/sk/iso-8859-2.txt ================================================ Jupiter je piata planta v porad od Slnka, najvia a najhmotnejia planta naej slnenej sstavy. Je pomenovan po rmskom bohovi Jupiterovi. Symbolom planty je tylizovan znzornenie Jupiterovho boskho blesku. ================================================ FILE: sample/uchardet_test_samples/sk/mac-centraleurope.txt ================================================ Jupiter je piata planta v porad od Slnka, najvia a najhmotnejia planta naej slnenej sstavy. Je pomenovan po rmskom bohovi Jupiterovi. Symbolom planty je tylizovan znzornenie Jupiterovho boskho blesku. ================================================ FILE: sample/uchardet_test_samples/sk/utf-8.txt ================================================ Jupiter je piata planéta v poradí od Slnka, najväčšia a najhmotnejšia planéta našej slnečnej sústavy. Je pomenovaný po rímskom bohovi Jupiterovi. Symbolom planéty je štylizované znázornenie Jupiterovho božského blesku. ================================================ FILE: sample/uchardet_test_samples/sk/windows-1250.txt ================================================ Jupiter je piata planta v porad od Slnka, najvia a najhmotnejia planta naej slnenej sstavy. Je pomenovan po rmskom bohovi Jupiterovi. Symbolom planty je tylizovan znzornenie Jupiterovho boskho blesku. ================================================ FILE: sample/uchardet_test_samples/sl/ibm852.txt ================================================ Naseljvi plant je planet ali naravni satelit (redkeje tudi asteroid[1]), ki je zmoen razviti in ohranjati ivljenje. Ker je obstoj nezemeljskega ivljenja trenutno negotov, je raziskovanje naseljivih planetov v glavnem ekstrapolacija razmer na Zemlji in znailnosti Sonca in celotnega Osonja, ki govorijo v prid razvitju ivljenja. e posebej so pomembni faktorji, ki so ohranili zapletene, mnogoceline organizme in ne le preprosta, enocelina iva bitja, mikroorganizme. Raziskovanje in teorija v tej smeri je del planetologije in razvijajoe astrobiologije. ================================================ FILE: sample/uchardet_test_samples/sl/iso-8859-16.txt ================================================ Naseljvi plant je planet ali naravni satelit (redkeje tudi asteroid[1]), ki je zmoen razviti in ohranjati ivljenje. Ker je obstoj nezemeljskega ivljenja trenutno negotov, je raziskovanje naseljivih planetov v glavnem ekstrapolacija razmer na Zemlji in znailnosti Sonca in celotnega Osonja, ki govorijo v prid razvitju ivljenja. e posebej so pomembni faktorji, ki so ohranili zapletene, mnogoceline organizme in ne le preprosta, enocelina iva bitja, mikroorganizme. Raziskovanje in teorija v tej smeri je del planetologije in razvijajoe astrobiologije. ================================================ FILE: sample/uchardet_test_samples/sl/iso-8859-2.txt ================================================ Naseljvi plant je planet ali naravni satelit (redkeje tudi asteroid[1]), ki je zmoen razviti in ohranjati ivljenje. Ker je obstoj nezemeljskega ivljenja trenutno negotov, je raziskovanje naseljivih planetov v glavnem ekstrapolacija razmer na Zemlji in znailnosti Sonca in celotnega Osonja, ki govorijo v prid razvitju ivljenja. e posebej so pomembni faktorji, ki so ohranili zapletene, mnogoceline organizme in ne le preprosta, enocelina iva bitja, mikroorganizme. Raziskovanje in teorija v tej smeri je del planetologije in razvijajoe astrobiologije. ================================================ FILE: sample/uchardet_test_samples/sl/mac-centraleurope.txt ================================================ Naseljvi plant je planet ali naravni satelit (redkeje tudi asteroid[1]), ki je zmoen razviti in ohranjati ivljenje. Ker je obstoj nezemeljskega ivljenja trenutno negotov, je raziskovanje naseljivih planetov v glavnem ekstrapolacija razmer na Zemlji in znailnosti Sonca in celotnega Osonja, ki govorijo v prid razvitju ivljenja. e posebej so pomembni faktorji, ki so ohranili zapletene, mnogoceline organizme in ne le preprosta, enocelina iva bitja, mikroorganizme. Raziskovanje in teorija v tej smeri je del planetologije in razvijajoe astrobiologije. ================================================ FILE: sample/uchardet_test_samples/sl/utf-8.txt ================================================ Naseljívi planét je planet ali naravni satelit (redkeje tudi asteroid[1]), ki je zmožen razviti in ohranjati življenje. Ker je obstoj nezemeljskega življenja trenutno negotov, je raziskovanje naseljivih planetov v glavnem ekstrapolacija razmer na Zemlji in značilnosti Sonca in celotnega Osončja, ki govorijo v prid razvitju življenja. Še posebej so pomembni faktorji, ki so ohranili zapletene, mnogocelične organizme in ne le preprosta, enocelična živa bitja, mikroorganizme. Raziskovanje in teorija v tej smeri je del planetologije in razvijajoče astrobiologije. ================================================ FILE: sample/uchardet_test_samples/sl/windows-1250.txt ================================================ Naseljvi plant je planet ali naravni satelit (redkeje tudi asteroid[1]), ki je zmoen razviti in ohranjati ivljenje. Ker je obstoj nezemeljskega ivljenja trenutno negotov, je raziskovanje naseljivih planetov v glavnem ekstrapolacija razmer na Zemlji in znailnosti Sonca in celotnega Osonja, ki govorijo v prid razvitju ivljenja. e posebej so pomembni faktorji, ki so ohranili zapletene, mnogoceline organizme in ne le preprosta, enocelina iva bitja, mikroorganizme. Raziskovanje in teorija v tej smeri je del planetologije in razvijajoe astrobiologije. ================================================ FILE: sample/uchardet_test_samples/sr/iso-8859-5.txt ================================================ , . , . , . , , . , . . , .[2] ================================================ FILE: sample/uchardet_test_samples/sr/utf-8.txt ================================================ Мрмот је дугачак отприлике педесет сантиметара, заједно с репом који сам износи двадесет сантиметара. Тежак је четири до пет килограма, ретко више. Има прекрасно крзно сивкасте боје, које на светлости добија златносмеђе преливе. Као мишеви, зечеви и остали глодари, мрмот има секутиће који непрестано расту па мора често нешто да глође да би их трошио. На предњим ногама има четири прста наоружана повијеним канџама помоћу којих животиња узима траву и гранчице, приноси храну устима и копа земљу. На задњим ногама има пет прстију с прилично кратким канџама. Мрмот има веома оштар вид, а уши му хватају сваки и најслабији звук.[2] ================================================ FILE: sample/uchardet_test_samples/sr/windows-1251.txt ================================================ , . , . , . , , . , . . , .[2] ================================================ FILE: sample/uchardet_test_samples/sv/iso-8859-1.txt ================================================ Mlle r en ttort p Kullahalvn i Brunnby socken i Hgans kommun, Skne ln. Samhllet var frn brjan ett fiskelge, men kom att spela en stor roll i den framvxande turismen i Sverige i slutet av 1800-talet. Till detta bidrog - och bidrar - Mlles naturskna lge invid resunds norra utlopp, med Kullaberg som bakgrund. Gemensamhetsbad fr mn och kvinnor introducerades i Ransvik i brjan av 1900-talet. Storhetstiden som turistort intrffade strax fre frsta vrldskriget, men ven under mellankrigstiden var turiststrmmarna stora. Fortfarande r Mlle en populr turistort med en tredubbling av invnarantalet under sommarmnaderna. ================================================ FILE: sample/uchardet_test_samples/sv/utf-8.txt ================================================ Mölle är en tätort på Kullahalvön i Brunnby socken i Höganäs kommun, Skåne län. Samhället var från början ett fiskeläge, men kom att spela en stor roll i den framväxande turismen i Sverige i slutet av 1800-talet. Till detta bidrog – och bidrar – Mölles natursköna läge invid Öresunds norra utlopp, med Kullaberg som bakgrund. Gemensamhetsbad för män och kvinnor introducerades i Ransvik i början av 1900-talet. Storhetstiden som turistort inträffade strax före första världskriget, men även under mellankrigstiden var turistströmmarna stora. Fortfarande är Mölle en populär turistort med en tredubbling av invånarantalet under sommarmånaderna. ================================================ FILE: sample/uchardet_test_samples/sv/windows-1252.txt ================================================ Mlle r en ttort p Kullahalvn i Brunnby socken i Hgans kommun, Skne ln. Samhllet var frn brjan ett fiskelge, men kom att spela en stor roll i den framvxande turismen i Sverige i slutet av 1800-talet. Till detta bidrog och bidrar Mlles naturskna lge invid resunds norra utlopp, med Kullaberg som bakgrund. Gemensamhetsbad fr mn och kvinnor introducerades i Ransvik i brjan av 1900-talet. Storhetstiden som turistort intrffade strax fre frsta vrldskriget, men ven under mellankrigstiden var turiststrmmarna stora. Fortfarande r Mlle en populr turistort med en tredubbling av invnarantalet under sommarmnaderna. ================================================ FILE: sample/uchardet_test_samples/th/iso-8859-11.txt ================================================ TIS-620 ҵðҹԵѳصˡ 620-2533, ͡.620-2533, ͷѡѹ TIS-620 繪شѡҵðҹصˡͧ ժ Ѻѡ·Ѻ TIS-620 ´ ISO-8859-11 ҡ ᵡҧѹ§ ISO-8859-11 ˹ A0 "äẺѴ" (no-break space) ǹ TIS-620 ʧǹ˹ A0 ˹ ================================================ FILE: sample/uchardet_test_samples/th/tis-620.txt ================================================ TIS-620 ҵðҹԵѳصˡ 620-2533, ͡.620-2533, ͷѡѹ TIS-620 繪شѡҵðҹصˡͧ ժ Ѻѡ·Ѻ TIS-620 ´ ISO-8859-11 ҡ ᵡҧѹ§ ISO-8859-11 ˹ A0 "äẺѴ" (no-break space) ǹ TIS-620 ʧǹ˹ A0 ˹ ================================================ FILE: sample/uchardet_test_samples/th/utf-8.txt ================================================ ยูนิโคด (อังกฤษ: Unicode) คือมาตรฐานอุตสาหกรรมที่ช่วยให้คอมพิวเตอร์แสดงผลและจัดการข้อความธรรมดาที่ใช้ในระบบการเขียนของภาษาส่วนใหญ่ในโลกได้อย่างสอดคล้องกัน ยูนิโคดประกอบด้วยรายการอักขระที่แสดงผลได้มากกว่า 100,000 ตัว พัฒนาต่อยอดมาจากมาตรฐานชุดอักขระสากล (Universal Character Set: UCS) และมีการตีพิมพ์ลงในหนังสือ The Unicode Standard เป็นแผนผังรหัสเพื่อใช้เป็นรายการอ้างอิง นอกจากนั้นยังมีการอธิบายวิธีการที่ใช้เข้ารหัสและการนำเสนอมาตรฐานของการเข้ารหัสอักขระอีกจำนวนหนึ่ง การเรียงลำดับอักษร กฎเกณฑ์ของการรวมและการแยกอักขระ รวมไปถึงลำดับการแสดงผลของอักขระสองทิศทาง (เช่นอักษรอาหรับหรืออักษรฮีบรูที่เขียนจากขวาไปซ้าย) ================================================ FILE: sample/uchardet_test_samples/tr/iso-8859-3.txt ================================================ Trke, Trk dili ya da Trkiye Trkesi, batda Balkanlar'dan balayp douda Hazar Denizi sahasna kadar konuulan Altay dillerinden biridir. Ya, en eski hesaplara gre 8500 olan Trke, bugn yaayan Dnya dilleri arasnda en eski yazl belgelere sahip olan dildir. Bu belgeler, ivi yazl Smerce tabletlerdeki alnt kelimelerdir.[12] Trk yaz dilleri iinde Ouz sahas yaz dillerinden Osmanl Trkesinin devamn oluturur. Bata Trkiye olmak zere eski Osmanl mparatorluu corafyasnda konuulan Trke, dnyada en fazla konuulan 5. dildir. Trke sondan eklemeli bir dildir.[13] Bundan tr kullanlan herhangi bir eylem zerinden istenildii kadar szck tretilebilir.[14] Trkiye Trkesi bu ynnden dolay dier Trk dilleriyle ortak ya da ayrk bulunan onlarca eke sahiptir.[15] Trke ok geni kullanmyla birlikte zengin bir dil olmasnn yan sra, genel itibaryla "zne-nesne-yklem" biimindeki cmle kuruluuna sahiptir. ================================================ FILE: sample/uchardet_test_samples/tr/iso-8859-9.txt ================================================ Trke, Trk dili ya da Trkiye Trkesi, batda Balkanlar'dan balayp douda Hazar Denizi sahasna kadar konuulan Altay dillerinden biridir. Ya, en eski hesaplara gre 8500 olan Trke, bugn yaayan Dnya dilleri arasnda en eski yazl belgelere sahip olan dildir. Bu belgeler, ivi yazl Smerce tabletlerdeki alnt kelimelerdir.[12] Trk yaz dilleri iinde Ouz sahas yaz dillerinden Osmanl Trkesinin devamn oluturur. Bata Trkiye olmak zere eski Osmanl mparatorluu corafyasnda konuulan Trke, dnyada en fazla konuulan 5. dildir. Trke sondan eklemeli bir dildir.[13] Bundan tr kullanlan herhangi bir eylem zerinden istenildii kadar szck tretilebilir.[14] Trkiye Trkesi bu ynnden dolay dier Trk dilleriyle ortak ya da ayrk bulunan onlarca eke sahiptir.[15] Trke ok geni kullanmyla birlikte zengin bir dil olmasnn yan sra, genel itibaryla "zne-nesne-yklem" biimindeki cmle kuruluuna sahiptir. ================================================ FILE: sample/uchardet_test_samples/tr/utf-8.txt ================================================ Türkiye, resmî adıyla Türkiye Cumhuriyeti, topraklarının büyük bölümü Anadolu'da, küçük bir bölümü ise Balkan Yarımadası'nın güneydoğu uzantısı olan Trakya'da yer alan ülke. Kuzeybatıda Bulgaristan, batıda Yunanistan, kuzeydoğuda Gürcistan, doğuda Ermenistan, İran ve Azerbaycan'ın ekslav toprağı Nahçıvan, güneydoğuda ise Irak ve Suriye komşusudur. Güneyini Kıbrıs adası ve Akdeniz. Batısını Ege Denizi ve kuzeyini Karadeniz çevreler. Marmara Denizi ise İstanbul Boğazı ve Çanakkale Boğazı ile birlikte Anadolu'yu Trakya'dan yani Asya'yı Avrupa'dan ayırır. Türkiye, Avrupa ve Asya'nın kavşak noktasında yer alması sayesinde önemli bir jeostratejik güce sahiptir. ================================================ FILE: sample/uchardet_test_samples/uk/utf-8.txt ================================================ Бабак[1][2], байбак[1], бобак[3] (Marmota Blumenbach, 1779) — рід гризунів родини вивіркових (Sciuridae) поширених в Євразії та Північній Америці. Бабаки в основному їдять зелень і багато видів трав, ягід, лишайники, мохи, коріння і квіти. Як правило, живуть у норах і перебувають у сплячці впродовж зими. Більшість бабаків дуже соціальні. У залежності від виду, довжина голови й тіла становить від 30 до 60 сантиметрів, довжина хвоста — від 10 до 25 см, вага становить від 3 до 7 кілограмів[4]. ================================================ FILE: sample/uchardet_test_samples/uk/windows-1251.txt ================================================ [1][2], [1], [3] (Marmota Blumenbach, 1779) (Sciuridae) 糿 ϳ . , , , , . , . . , 30 60 , 10 25 , 3 7 [4]. ================================================ FILE: sample/uchardet_test_samples/vi/utf-8.txt ================================================ Chữ Quốc ngữ là hệ chữ viết thống nhất chính thức hiện nay của tiếng Việt, sử dụng ký tự La Tinh, dựa trên các bảng chữ cái của nhóm ngôn ngữ Rôman,[1] đặc biệt là bảng chữ cái Bồ Đào Nha,[2] với các dấu phụ chủ yếu từ bảng chữ cái Hy Lạp. ================================================ FILE: sample/uchardet_test_samples/vi/viscii.txt ================================================ Ch Quc ng l h ch vit thng nht chnh thc hin nay ca ting Vit, s dng k t La Tinh, da trn cc bng ch ci ca nhm ngn ng Rman,[1] c bit l bng ch ci B o Nha,[2] vi cc du ph ch yu t bng ch ci Hy Lp. ================================================ FILE: sample/uchardet_test_samples/vi/windows-1258.txt ================================================ Ch Quc ng l h ch vit thng nht chnh thc hin nay cua ting Vit, s dung ky t La Tinh, da trn cc bang ch ci cua nhm ngn ng Rman,[1] c bit l bang ch ci B o Nha,[2] vi cc du phu chu yu t bang ch ci Hy Lap. ================================================ FILE: sample/uchardet_test_samples/zh/big5.txt ================================================ c餤c餤c餤c餤c餤c餤c餤c餤c餤c餤c餤c餤c餤c餤c餤c餤c餤 ================================================ FILE: sample/uchardet_test_samples/zh/euc-tw.txt ================================================ EUC-TWҳƺġCNS 11643??ƺEUC-TWŷ ================================================ FILE: sample/uchardet_test_samples/zh/gb18030.txt ================================================ ļļļļļļļļļļ ================================================ FILE: sample/uchardet_test_samples/zh/utf-8.txt ================================================ 汉字漢字統一編碼萬國碼 ================================================ FILE: scripts/extract_change_log.py ================================================ import argparse import os import re import sys # 设置 Python 的默认编码为 utf-8 os.environ['PYTHONIOENCODING'] = 'utf-8' if hasattr(sys.stdout, 'reconfigure'): sys.stdout.reconfigure(encoding='utf-8') # this works else: import io sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') SELF_DIR = os.path.split(os.path.realpath(__file__))[0].replace("\\", "/") SELF_BASENAME = os.path.split(os.path.realpath(__file__))[1] REPO_DIR = os.path.abspath(f"{SELF_DIR}/..").replace("\\", "/") CHANGE_LOG_FILENAME = f"{REPO_DIR}/build/CHANGELOG.txt" README_FILENAME_CN = f"{REPO_DIR}/README.md" README_FILENAME_EN = f"{REPO_DIR}/README-en.md" VERSION_START_STR_CN = "# 版本记录" VERSION_START_STR_EN = "# Version" def ParseArguments() -> argparse.Namespace: parser = argparse.ArgumentParser() parser.add_argument("--tag", required=True) args = parser.parse_args() print(f"[{SELF_BASENAME}] args: {args}") return args def SearchTag(filename: str, tag: str, versionStartStr: str) -> str: with open(filename, "r", encoding="utf-8") as f: lines = f.readlines() pos = 0 found = False for i in range(len(lines)): line = lines[i] if line.find(versionStartStr) != -1: pos = i found = True break if not found: raise RuntimeError(f"version start string \"{versionStartStr}\" not found at {filename}") found = False for i in range(pos, len(lines)): line = lines[i] if line.startswith(tag): pos = i found = True break if not found: raise RuntimeError(f"tag \"{tag}\" not found at {filename}") ret = [line.strip()] pos += 1 for i in range(pos, len(lines)): line = lines[i] if line == "\n" or line == "\r\n": break if re.match(r"v\d+\.\d+.*", line): break ret.append(line.strip()) return "\n".join(ret) def main(args: argparse.Namespace): cnContent = SearchTag(README_FILENAME_CN, args.tag, VERSION_START_STR_CN) enContent = SearchTag(README_FILENAME_EN, args.tag, VERSION_START_STR_EN) changeLog = "" changeLog += cnContent changeLog += "\n" changeLog += enContent print(f"[{SELF_BASENAME}] CHANGELOG.txt:") print("=" * 30) print(changeLog) print("=" * 30) with open(CHANGE_LOG_FILENAME, "w", encoding="utf-8") as f: f.write(changeLog) if __name__ == "__main__": args = ParseArguments() main(args) ================================================ FILE: src/CMakeLists.txt ================================================ add_subdirectory(Common) add_subdirectory(Control) add_subdirectory(Core) add_subdirectory(Translator) add_subdirectory(SmartCharsetConverter) add_subdirectory(SmartCharsetConverter-imgui) ================================================ FILE: src/Common/CMakeLists.txt ================================================ # ============================== file(GLOB_RECURSE SRC_CODE *.h *.cpp ) add_library(Common STATIC ${SRC_CODE}) ================================================ FILE: src/Common/CommandLineParser.cpp ================================================ #include "CommandLineParser.h" #include "tstring.h" std::vector GetCommandLineArgs() { std::vector args; LPWSTR *szArglist; int nArgs; int i; szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); if (NULL == szArglist) { throw std::runtime_error("CommandLineToArgvW failed"); } for (i = 0; i < nArgs; i++) { args.push_back(to_utf8(szArglist[i])); } // Free memory allocated for CommandLineToArgvW arguments. LocalFree(szArglist); return args; } ================================================ FILE: src/Common/CommandLineParser.h ================================================ #pragma once #include #include #include #include std::vector GetCommandLineArgs(); ================================================ FILE: src/Common/ConsoleSettings.cpp ================================================ #include "ConsoleSettings.h" #include void SetConsoleColor(ConsoleColor color) noexcept { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); assert(hConsole); BOOL ok = SetConsoleTextAttribute(hConsole, static_cast(color)); assert(ok); HANDLE hConsoleErr = GetStdHandle(STD_ERROR_HANDLE); assert(hConsoleErr); ok = SetConsoleTextAttribute(hConsoleErr, static_cast(color)); assert(ok); } ================================================ FILE: src/Common/ConsoleSettings.h ================================================ #pragma once #include enum class ConsoleColor { GREEN = 10, BLUE = 11, RED = 12, PINK = 13, YELLOW = 14, WHITE = 15 }; void SetConsoleColor(ConsoleColor color = ConsoleColor::WHITE) noexcept; ================================================ FILE: src/Common/ErrorFunction.cpp ================================================ #include "ErrorFunction.h" using namespace std; // 根据错误码返回对应的错误信息 std::tstring GetLastErrorString(DWORD errorCode) { TCHAR *lpMsgBuf = nullptr; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (TCHAR *)&lpMsgBuf, 0, NULL); tstring ret(lpMsgBuf); LocalFree(lpMsgBuf); return ret; } ================================================ FILE: src/Common/ErrorFunction.h ================================================ #pragma once #include "tstring.h" // 根据错误码返回对应的错误信息 std::tstring GetLastErrorString(DWORD errorCode); ================================================ FILE: src/Common/FileFunction.cpp ================================================ #define _CRT_SECURE_NO_WARNINGS #include "FileFunction.h" #include #include #include #include #include #include //选择文件夹对话框 #include //CommandLineToArgvW #pragma comment(lib, "Shell32.lib") #undef max #undef min using namespace std; // 文件对话框 存储文件列表字符串的缓冲长度。MAX_PATH是肯定不够的,选几个就超出了。 // 据说nMaxFile虽然是DWORD类型,但只用了前2个字节,所以这里设成int16_t最大值 const int TFileDialog_BUF_SIZE = 32767; std::unique_ptr ToTCHARArray(const std::tstring &s) { auto size = s.size(); unique_ptr ret(new TCHAR[size + 1]); memcpy(ret.get(), s.data(), size * sizeof(TCHAR)); ret[size] = TEXT('\0'); return ret; } TFileDialog::TFileDialog(HWND hwndOwner) { // Initialize OPENFILENAME ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwndOwner; result = unique_ptr(new TCHAR[TFileDialog_BUF_SIZE]); result[0] = TEXT('\0'); ofn.lpstrFile = result.get(); ofn.nMaxFile = TFileDialog_BUF_SIZE; ofn.nFilterIndex = 1; ofn.lpstrInitialDir = NULL; } TFileDialog::TFileDialog(HWND hwndOwner, std::vector> vecFilter, bool multiSelect) : TFileDialog(hwndOwner) { SetFilter(vecFilter); ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if (multiSelect) { ofn.Flags |= OFN_ALLOWMULTISELECT; } } void TFileDialog::SetFilter(std::vector> vecFilter) { // lpstrFilter格式:TEXT("机构设计文件(*.lml)\0*.lml\0\0") std::tstring ret; for (auto &pr : vecFilter) { auto &name = pr.first; auto ® = pr.second; ret += name + TEXT('\0') + reg + TEXT('\0'); } ret += TEXT('\0'); filter = ToTCHARArray(ret); ofn.lpstrFilter = filter.get(); // 两个\0表示结束 } void TFileDialog::SetTitle(const std::tstring &title) { this->title = ToTCHARArray(title); ofn.lpstrTitle = this->title.get(); } bool TFileDialog::Open() { TCHAR originDir[1024]; GetCurrentDirectory(1024, originDir); bool ok = ::GetOpenFileName(&ofn); if (!ok) { auto err = CommDlgExtendedError(); if (err == 0x3003) // FNERR_BUFFERTOOSMALL { throw runtime_error("文件选太多。少选一点试试。"); } } SetCurrentDirectory(originDir); return ok; } std::vector TFileDialog::GetResult() const { // 如果没结果,返回空 if (ofn.lpstrFile[0] == TEXT('\0')) { return {}; } // 如果是单选 if ((ofn.Flags & OFN_ALLOWMULTISELECT) == 0) { return {ofn.lpstrFile}; } // 如果是多选 std::vector ans; tstring dir, temp; auto p = ofn.lpstrFile; int state = 0; for (DWORD i = 0; i < ofn.nMaxFile; ++i) { auto c = p[i]; switch (state) { case 0: // 状态0:第一次遇到\0之前 if (c == TEXT('\0')) { ans.push_back(temp); temp.clear(); state = 1; } else { temp += c; } break; case 1: // 状态1:中途的字符 if (c == TEXT('\0')) { goto end; } else { temp += c; state = 2; dir = ans[0]; ans.pop_back(); } break; case 2: // 状态2:中途已遇到\0 if (c == TEXT('\0')) // 再次遇到\0,结束 { ans.push_back(dir + TEXT('\\') + temp); temp.clear(); state = 3; } else { temp += c; } break; case 3: if (c == TEXT('\0')) { goto end; } else { temp += c; state = 2; } break; } } end: return ans; } void TFileDialog::SetResult(const std::tstring &s) { result = ToTCHARArray(s); ofn.lpstrFile = result.get(); } bool TFileDialog::Save() { ofn.Flags = OFN_PATHMUSTEXIST; // 设为空可以自动加上选择的后缀名,否则无论选什么后缀, // 只要没有输入.txt这种,都是无后缀 ofn.lpstrDefExt = TEXT(""); return ::GetSaveFileName(&ofn); } TFolderBrowser::TFolderBrowser(HWND hwndOwner, std::tstring title) : hWndOwner(hwndOwner), title(title) {} bool TFolderBrowser::Open(std::tstring &fileName) { assert(hWndOwner); auto BrowserCallbackProc = [](HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) -> int { if (uMsg == BFFM_INITIALIZED) { SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData); } return 0; }; TCHAR szBuffer[MAX_PATH] = {0}; BROWSEINFO bi = {0}; bi.hwndOwner = hWndOwner; bi.pszDisplayName = szBuffer; // 接收文件夹的缓冲区 bi.lpszTitle = title.c_str(); // 标题 bi.ulFlags = BIF_NEWDIALOGSTYLE; // 使用回调传入初始路径 bi.lParam = (LPARAM)fileName.c_str(); bi.lpfn = (BFFCALLBACK)BrowserCallbackProc; LPITEMIDLIST idl = SHBrowseForFolder(&bi); bool ret = SHGetPathFromIDList(idl, szBuffer); if (ret) fileName = szBuffer; return ret; } // 传入index=1则得到传入文件名 // 失败返回空串 #ifdef UNICODE std::wstring GetCommandLineByIndex(int index) { int nArgs; LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); if (szArglist && nArgs >= index + 1) { return szArglist[index]; } return L""; } #else std::string GetCommandLineByIndex(int index) { int nArgs; LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs); if (szArglist && nArgs >= index + 1) { return szArglist[index]; } return L""; } #endif bool GetFileExists(const std::string filename) { WIN32_FIND_DATA FindFileData; HANDLE hFind; hFind = FindFirstFileW(utf8_to_wstring(filename).c_str(), &FindFileData); if (hFind == INVALID_HANDLE_VALUE) { return false; } else { if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { // is folder FindClose(hFind); return false; } else { FindClose(hFind); return true; } } } vector SplitPath(const std::tstring &s) { vector ret; auto slash = s.find_last_of(TEXT("/\\")); // 找最后一个正斜杠或者反斜杠位置 if (slash != tstring::npos) // 存在 { ret.push_back(s.substr(0, slash)); // 得到纯路径 auto vec = SplitFileName(s.substr(slash + 1)); // 分割文件名 ret.insert(ret.end(), vec.begin(), vec.end()); } else { ret.push_back(TEXT("")); auto vec = SplitFileName(s); ret.insert(ret.end(), vec.begin(), vec.end()); } return ret; } vector SplitFileName(const std::tstring &s) { auto dot = s.find_last_of(TEXT('.')); // 从后寻找. if (dot != tstring::npos) return {s.substr(0, dot), s.substr(dot)}; else return {s, TEXT("")}; } std::string GetNameAndExt(std::string s) noexcept { string ret; auto slash = s.find_last_of("/\\"); // 从后寻找正反斜杠 if (slash != string::npos) { ret = s.substr(slash + 1); } else { ret = s; } return ret; } // e.g. ext="txt" tstring ChangeExtend(tstring fileName, tstring ext) { auto slash_pos = fileName.find_last_of('\\'); auto dot_pos = fileName.find_last_of('.'); if (dot_pos == tstring::npos || (slash_pos != tstring::npos && dot_pos < slash_pos)) // e.g. "Name" "dir.dir\file.ext" { return fileName + TEXT('.') + ext; } return fileName.substr(0, dot_pos) + TEXT('.') + ext; } std::string GetExtend(std::string fileName) { auto slash_pos = fileName.find_last_of('\\'); auto dot_pos = fileName.find_last_of('.'); if (dot_pos == string::npos || (slash_pos != string::npos && dot_pos < slash_pos)) // e.g. "Name" "dir.dir\file" { return ""; } return fileName.substr(dot_pos + 1); } // 取得文件大小,不改变读写位置 uint64_t GetFileSize(FILE *fp) { long long origin_pos = _ftelli64(fp); _fseeki64(fp, 0LL, SEEK_END); long long ret = _ftelli64(fp); _fseeki64(fp, origin_pos, SEEK_SET); return ret; } uint64_t GetFileSize(std::string fileName) { std::wstring wfilename = utf8_to_wstring(fileName); FILE *fp = _wfopen(wfilename.c_str(), L"rb"); if (fp == nullptr) { throw file_io_error(string("\"") + fileName + "\" can't open.", fileName); } uint64_t sz = GetFileSize(fp); fclose(fp); return sz; } std::string FileSizeToHumanString(uint64_t fileSize) { double d; char buf[64]; if (fileSize >= GB) { d = fileSize / (double)GB; sprintf(buf, "%.2f GB", d); } else { if (fileSize >= MB) { d = fileSize / (double)MB; sprintf(buf, "%.2f MB", d); } else if (fileSize >= KB) { d = fileSize / (double)KB; sprintf(buf, "%.2f KB", d); } else { d = static_cast(fileSize); sprintf(buf, "%.0f B", d); } } return buf; } std::tuple, uint64_t> ReadFileToBuffer(std::string fileName, uint64_t limitSize) { uint64_t bufSize = GetFileSize(fileName); if (limitSize != 0) { bufSize = std::min(bufSize, limitSize); } unique_ptr buf = make_unique(bufSize); // 如果是空文件,就不用读了 if (bufSize == 0) { return make_tuple(std::move(buf), bufSize); } std::wstring wfilename = utf8_to_wstring(fileName); FILE *fp = _wfopen(wfilename.c_str(), TEXT("rb")); if (fp == nullptr) throw file_io_error(string("\"") + fileName + "\" can't open.", fileName); auto ret = fread(buf.get(), bufSize, 1, fp); if (ret < 1) { fclose(fp); throw file_io_error(string("\"") + fileName + "\" can't read.", fileName); } fclose(fp); return make_tuple(std::move(buf), bufSize); } void WriteFileFromBuffer(std::string fileName, const char buf[], uint64_t bufSize) { std::wstring wfilename = utf8_to_wstring(fileName); FILE *fp = _wfopen(wfilename.c_str(), TEXT("wb")); if (fp == nullptr) throw file_io_error(string("\"") + fileName + "\" can't open.", fileName); auto ret = fwrite(buf, bufSize, 1, fp); if (ret < 1) { fclose(fp); throw file_io_error(string("\"") + fileName + "\" can't write.", fileName); } fclose(fp); } void WriteDetailFile(HWND hWnd, std::tstring filename, std::function fnWrite) { TFileDialog fileDialog(hWnd, {{TEXT("txt"), TEXT("*.txt")}}); fileDialog.SetResult(filename); if (fileDialog.Save()) { tofstream ofs(filename); if (ofs.fail()) { tstring errInfo = TEXT("写入") + filename + TEXT("失败。可能是文件正在被占用或者没有权限。"); ::MessageBox(hWnd, errInfo.c_str(), TEXT("出错"), MB_OK | MB_ICONERROR); return; } fnWrite(ofs); ofs.close(); tstring info = filename + TEXT("已写入。"); ::MessageBox(hWnd, info.c_str(), TEXT("提示"), MB_OK | MB_ICONINFORMATION); } } // 失败抛出file_io_error类型自定义异常 void findFiles(std::vector &ret, std::string lpPath, std::vector dotextNames, bool enterSubFolder) { string szFile; WIN32_FIND_DATA FindFileData; string szFind = lpPath + "\\*"; HANDLE hFind = ::FindFirstFileW(utf8_to_wstring(szFind).c_str(), &FindFileData); if (INVALID_HANDLE_VALUE == hFind) { throw file_io_error("Invalid folder:" + szFind, szFind); return; } do { if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { // 是目录 if (FindFileData.cFileName[0] != TEXT('.')) // 不是以.开头的目录 { if (enterSubFolder) { // 进入子目录 szFile = lpPath + "\\" + to_utf8(FindFileData.cFileName); findFiles(ret, szFile, dotextNames, enterSubFolder); } } } else { // 是文件 std::string filePath = lpPath + "\\" + to_utf8(FindFileData.cFileName); if (dotextNames.empty()) { ret.push_back(filePath); } else { string filename(tolower(to_utf8(FindFileData.cFileName))); for (auto &dotext : dotextNames) { if (filename.substr(filename.length() - dotext.length(), dotext.length()) == dotext) // 文件名后n位和扩展名相同 { ret.push_back(filePath); } } } // if ( szFile.empty() ) // { ////szFile为空,为当前目录 // std::string filePath = szFile+FindFileData.cFileName; // file_lists.push_back(filePath); // } // else // { ////非当前目录,输出全路径 // std::string filePath = lpPath+"\\"+FindFileData.cFileName; // file_lists.push_back(filePath); // } } } while (::FindNextFile(hFind, &FindFileData)); ::FindClose(hFind); } // 失败抛出file_io_error类型自定义异常 std::vector TraversalAllFileNames(std::string lpPath, std::vector dotextNames, bool enterSubFolder) { std::vector file_lists; findFiles(file_lists, lpPath, dotextNames, enterSubFolder); return file_lists; } ================================================ FILE: src/Common/FileFunction.h ================================================ #pragma once #include "tstring.h" #include #include #include #include #include // OPENFILENAME class TFileDialog { private: OPENFILENAME ofn; std::unique_ptr title; std::unique_ptr result; std::unique_ptr filter; public: TFileDialog() = delete; TFileDialog(const TFileDialog &) = delete; TFileDialog(HWND hwndOwner); // 示例:m_hWnd, {{"txt文本文件","*.txt"}} TFileDialog(HWND hwndOwner, std::vector> vecFilter, bool multiSelect = false); void SetFilter(std::vector> vecFilter); void SetTitle(const std::tstring &title); void SetResult(const std::tstring &s); std::vector GetResult() const; bool Open(); bool Save(); }; class TFolderBrowser { public: TFolderBrowser(HWND hwndOwner, std::tstring title = TEXT("请选择一个文件夹")); // fileName用于赋予初始路径,若用户点了取消,将不会对值产生影响 bool Open(std::tstring &fileName); private: std::tstring title; HWND hWndOwner; }; // 自定义的文件IO异常。继承自runtime_error class file_io_error : public std::runtime_error { public: std::string _filename; file_io_error(std::string s, std::string filename) : std::runtime_error(s), _filename(filename) {} const std::string &filename() { return _filename; } }; const uint64_t KB = 1024; const uint64_t MB = KB * KB; const uint64_t GB = MB * MB; // 传入index=1则得到传入文件名 // 失败返回空串 std::wstring GetCommandLineByIndex(int index); // 判断文件是否存在 bool GetFileExists(const std::string filename); // 分割完整路径为 {路径,文件名不带后缀,.后缀} std::vector SplitPath(const std::tstring &s); // 从[文件名+后缀]的字符串中分割出 { 文件名不带后缀,.后缀 } std::vector SplitFileName(const std::tstring &s); // 从完整路径得到 文件名+后缀,若本身不含正反斜杠,则返回自身 std::string GetNameAndExt(std::string s) noexcept; // e.g. ext="txt" std::tstring ChangeExtend(std::tstring fileName, std::tstring ext); // e.g. ext="txt" std::string GetExtend(std::string fileName); // 取得文件大小,不改变读写位置 uint64_t GetFileSize(FILE *fp); // 取得文件大小 // 失败抛出file_io_error类型自定义异常 uint64_t GetFileSize(std::string fileName); std::string FileSizeToHumanString(uint64_t fileSize); /* * @brief 给定文件名,读取到一个buffer * @limitSize 限制大小。为0代表读完。不为0的话,最大读取limitSize大小。 * @exception file_io_error 失败抛出异常 */ std::tuple, uint64_t> ReadFileToBuffer(std::string fileName, uint64_t limitSize = 0); // 失败抛出file_io_error类型自定义异常 void WriteFileFromBuffer(std::string fileName, const char buf[], uint64_t bufSize); // 弹出文件对话框,然后按照给定文件名写入一个文本文件 // 传入的filename会在文件对话框中显示为默认文件名 // fnWrite中定义要写入的内容,不需要进行打开关闭操作 // 写入成功或者失败均会弹出对话框提示 void WriteDetailFile(HWND hWnd, std::tstring filename, std::function fnWrite); // 失败抛出file_io_error类型自定义异常 std::vector TraversalAllFileNames(std::string lpPath, std::vector dotextNames = {}, bool enterSubFolder = true); ================================================ FILE: src/Common/ResourceLoader.cpp ================================================ #include "ResourceLoader.h" #include #include std::vector LoadCustomFileFromResource(int id, const std::wstring &resourceType) { HRSRC hResource = FindResourceW(NULL, MAKEINTRESOURCE(id), resourceType.c_str()); // 处理资源未找到的情况 assert(hResource); HGLOBAL hResData = LoadResource(NULL, hResource); // 处理资源加载失败的情况 assert(hResData); DWORD dwResSize = SizeofResource(NULL, hResource); // 处理资源大小为0的情况 assert(dwResSize); LPBYTE lpResData = (LPBYTE)LockResource(hResData); // 处理资源锁定失败的情况 assert(lpResData); std::vector ret(dwResSize); memcpy(ret.data(), lpResData, dwResSize); return ret; } ================================================ FILE: src/Common/ResourceLoader.h ================================================ #pragma once #include #include std::vector LoadCustomFileFromResource(int id, const std::wstring &resourceType); ================================================ FILE: src/Common/SingleApplication.h ================================================ #pragma once #include #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include /* 防多开类 用法: SingleApplication single; if (single.IsRunning(TEXT("AppTitle"))) { throw runtime_error("只能同时运行一个实例!"); } */ class SingleApplication { public: ~SingleApplication() { ReleaseMutex(mutex); } bool IsRunning(const std::tstring &mutex_name) { mutex = OpenMutex(MUTEX_ALL_ACCESS, 0, mutex_name.c_str()); if (nullptr == mutex) { mutex = CreateMutex(0, 0, mutex_name.c_str()); return false; } else { return true; } } private: HANDLE mutex; }; ================================================ FILE: src/Common/ThreadPool/SafeQueue.h ================================================ #pragma once #include #include #include template class SafeQueue { public: SafeQueue() {} bool empty() const { std::scoped_lock sl(m); return q.empty(); } std::size_t size() const { std::scoped_lock sl(m); return q.size(); } template void enqueue(U &&t) { std::scoped_lock sl(m); q.push(std::forward(t)); } std::optional dequeue() { std::scoped_lock sl(m); if (q.empty()) { return {}; } T t = std::move(q.front()); q.pop(); return t; } private: std::queue q; mutable std::mutex m; }; ================================================ FILE: src/Common/ThreadPool/ThreadPool.h ================================================ #pragma once #include "SafeQueue.h" #include #include #include #include #include #include #undef min #undef max class ThreadPool { public: ThreadPool() : doStop(false) { int workerNums = std::max(1, static_cast(std::thread::hardware_concurrency()) - 1); for (int i = 0; i < workerNums; i++) { vecth.push_back(std::thread(&ThreadPool::workLoop, this)); } } ~ThreadPool() { { std::scoped_lock sl(m); doStop = true; } cv.notify_all(); for (auto &th : vecth) { th.join(); } } template auto submit(F &&fn, Args &&...args) -> std::future { std::function func = std::bind(std::forward(fn), std::forward(args)...); auto taskPtr = std::make_shared>(func); std::function wrapper = [taskPtr]() { (*taskPtr)(); }; q.enqueue(std::move(wrapper)); cv.notify_one(); return taskPtr->get_future(); } private: std::vector vecth; bool doStop; SafeQueue> q; std::mutex m; std::condition_variable cv; void workLoop() { while (1) { std::unique_lock ul(m); while (!doStop && q.empty()) { cv.wait(ul); } if (doStop) return; auto t = q.dequeue(); ul.unlock(); if (!t.has_value()) continue; auto fn = t.value(); fn(); } } }; ================================================ FILE: src/Common/TimeStamp.cpp ================================================ #define _CRT_SECURE_NO_WARNINGS #include "TimeStamp.h" #include using namespace std; #define TICKS_PER_SECOND 10000000 #define EPOCH_DIFFERENCE 11644473600LL // Windows时间从1601-01-01T00:00:00Z开始。离UNIX/Linux时间(1970-01-01T00:00:00Z)还有11644473600秒。Windows时间为100纳秒。 // 因此,从UNIX时间获得秒的函数如下所示 time_t convertWindowsTimeToUnixTime(long long input) { long long temp; temp = input / TICKS_PER_SECOND; // convert from 100ns intervals to seconds; temp = temp - EPOCH_DIFFERENCE; // subtract number of seconds between epochs return (time_t)temp; } TimeStamp::TimeStamp() : tp(selected_clock::now()) {} TimeStamp::TimeStamp(std::chrono::time_point tp) : tp(tp) {} TimeStamp::TimeStamp(time_t t) { tp = selected_clock::from_time_t(t); // assert(selected_clock::to_time_t(tp) == t); } TimeStamp::TimeStamp(FILETIME fileTime) { time_t t = convertWindowsTimeToUnixTime(*((long long *)&fileTime)); tp = selected_clock::from_time_t(t); } bool TimeStamp::operator<(const TimeStamp &other) const { return tp.time_since_epoch().count() < other.tp.time_since_epoch().count(); } bool TimeStamp::operator<=(const TimeStamp &other) const { return tp.time_since_epoch().count() <= other.tp.time_since_epoch().count(); } bool TimeStamp::operator>(const TimeStamp &other) const { return tp.time_since_epoch().count() > other.tp.time_since_epoch().count(); } bool TimeStamp::operator>=(const TimeStamp &other) const { return tp.time_since_epoch().count() >= other.tp.time_since_epoch().count(); } TimeStamp TimeStamp::operator+(const std::chrono::milliseconds &dura) const { return tp + dura; } TimeStamp::selected_clock::time_point TimeStamp::Raw() const { return tp; } std::tstring TimeStamp::ToTString() const { const int bufSize = 64; char buf[bufSize]; auto t = selected_clock::to_time_t(tp); tm tempTM; errno_t err = LOCALTIME_R(&tempTM, &t); strftime(buf, bufSize, "%Y-%m-%d %H:%M:%S", &tempTM); return to_tstring(buf); } TimeStamp TimeStamp::now() { return TimeStamp(); } ================================================ FILE: src/Common/TimeStamp.h ================================================ #pragma once #include "tstring.h" #include #ifdef WIN32 #define LOCALTIME_R(pTM, pTimeT) localtime_s(pTM, pTimeT) #else #define LOCALTIME_R(tm, ti) localtime_r(ti, tm) #endif // #define localtime static_assert("localtime is not thread-safe. considering LOCALTIME_R") template class TimeDuration { public: TimeDuration() {} private: std::chrono::duration d; }; class TimeStamp { public: using selected_clock = std::chrono::system_clock; TimeStamp(); TimeStamp(std::chrono::time_point tp); TimeStamp(time_t t); TimeStamp(FILETIME fileTime); bool operator<(const TimeStamp &other) const; bool operator<=(const TimeStamp &other) const; bool operator>(const TimeStamp &other) const; bool operator>=(const TimeStamp &other) const; TimeStamp operator+(const std::chrono::milliseconds &dura) const; selected_clock::time_point Raw() const; std::tstring ToTString() const; static TimeStamp now(); private: selected_clock::time_point tp; }; ================================================ FILE: src/Common/noncopyable.h ================================================ #pragma once namespace Zhongmao { class noncopyable { public: noncopyable(const noncopyable &) = delete; void operator=(const noncopyable &) = delete; protected: noncopyable() = default; ~noncopyable() = default; }; } // namespace Zhongmao ================================================ FILE: src/Common/tstring.cpp ================================================ #include "tstring.h" #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include #include #include #include #include using namespace std; std::wstring string_to_wstring(const std::string &str) { LPCSTR pszSrc = str.c_str(); int nLen = MultiByteToWideChar(CP_ACP, 0, pszSrc, -1, NULL, 0); if (nLen == 0) return std::wstring(L""); wchar_t *pwszDst = new wchar_t[nLen]; if (!pwszDst) return std::wstring(L""); MultiByteToWideChar(CP_ACP, 0, pszSrc, -1, pwszDst, nLen); std::wstring wstr(pwszDst); delete[] pwszDst; pwszDst = NULL; return wstr; } void MyWideCharToMultiByte(const wchar_t *wsrc, int wsrcSize, std::unique_ptr &dest, int &destSize, UINT codePage) { // 取得大小 destSize = WideCharToMultiByte(codePage, 0, wsrc, wsrcSize, NULL, 0, NULL, NULL); if (destSize == 0) // 大小为0或者失败,返回空串 { dest.reset(nullptr); return; } // 分配空间 dest.reset(new char[destSize]); // 进行转换 WideCharToMultiByte(codePage, 0, wsrc, wsrcSize, dest.get(), destSize, NULL, NULL); } void MyMultiByteToWideChar(const char *src, int srcSize, std::unique_ptr &dest, int &destSize, UINT codePage) { // 取得大小 destSize = MultiByteToWideChar(codePage, 0, src, srcSize, NULL, 0); if (destSize == 0) // 大小为0或者失败,返回空串 { dest.reset(nullptr); return; } // 分配空间 dest.reset(new wchar_t[destSize]); // 进行转换 MultiByteToWideChar(codePage, 0, src, srcSize, dest.get(), destSize); } std::string wstring_to_string(const std::wstring &wstr) { // 取得大小 int nLen = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, NULL, 0, NULL, NULL); if (nLen == 0) // 大小为0或者失败,返回空串 return std::string(""); // 分配空间 unique_ptr buf = unique_ptr(new char[nLen]); // 进行转换 nLen = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, buf.get(), nLen, NULL, NULL); if (nLen == 0) // 大小为0或者失败,返回空串 return std::string(""); return std::string(buf.get()); } std::string to_string(const std::wstring &ws) { return wstring_to_string(ws); } std::wstring to_wstring(const std::string &s) { return string_to_wstring(s); } std::wstring to_wstring(const std::wstring &s) { return s; } std::string to_utf8(const std::wstring &wstr) { // 取得大小 int nLen = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), -1, NULL, 0, NULL, NULL); if (nLen == 0) // 大小为0或者失败,返回空串 return std::string(""); // 分配空间 unique_ptr buf = unique_ptr(new char[nLen]); // 进行转换 nLen = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), -1, buf.get(), nLen, NULL, NULL); if (nLen == 0) // 大小为0或者失败,返回空串 return std::string(""); return std::string(buf.get()); } std::string to_utf8(const std::u16string &wstr) { #if WIN32 const std::wstring &w = reinterpret_cast(wstr); return to_utf8(w); #endif } std::string ansi_to_utf8(const std::string &str) { int nwLen = MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, NULL, 0); unique_ptr pwBuf(new wchar_t[nwLen]); MultiByteToWideChar(CP_ACP, 0, str.c_str(), static_cast(str.length()), pwBuf.get(), nwLen); int nLen = WideCharToMultiByte(CP_UTF8, 0, pwBuf.get(), -1, NULL, NULL, NULL, NULL); unique_ptr pBuf(new char[nLen]); WideCharToMultiByte(CP_UTF8, 0, pwBuf.get(), nwLen, pBuf.get(), nLen, NULL, NULL); return string(pBuf.get()); } std::vector to_utf8(const std::vector &wstrs) { std::vector ret; for (const auto &wstr : wstrs) { ret.push_back(to_utf8(wstr)); } return ret; } std::string utf8_to_string(const std::string &str) { int nwLen = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0); wchar_t *pwBuf = new wchar_t[nwLen + 1]; memset(pwBuf, 0, nwLen * 2 + 2); MultiByteToWideChar(CP_UTF8, 0, str.c_str(), static_cast(str.length()), pwBuf, nwLen); int nLen = WideCharToMultiByte(CP_ACP, 0, pwBuf, -1, NULL, NULL, NULL, NULL); char *pBuf = new char[nLen + 1]; memset(pBuf, 0, nLen + 1); WideCharToMultiByte(CP_ACP, 0, pwBuf, nwLen, pBuf, nLen, NULL, NULL); std::string ret = pBuf; delete[] pBuf; delete[] pwBuf; return ret; } std::wstring utf8_to_wstring(const std::string &str) { int nwLen = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0); std::wstring ret(nwLen - 1, L'\0'); // -1是为了排除掉上一步预计算时添加的尾后0的长度 MultiByteToWideChar(CP_UTF8, 0, str.c_str(), static_cast(str.size()), ret.data(), nwLen); return ret; } std::string to_hex(char c) noexcept { std::string ret; auto to_hex_in_16 = [](char n) noexcept -> char { if (!(n >= 0 && n <= 15)) { assert(0); } if (n >= 0 && n <= 9) { return n + '0'; } else { return (n - 10) + 'A'; } }; ret += to_hex_in_16(static_cast(c) >> 4); // high 4 bits ret += to_hex_in_16(c & 0b00001111); // low 4 bits return ret; } // 未测试 void FixEndLine(std::tstring &s) { tstring temp; tstring::size_type cur = 0; while (1) { auto lf = s.find_first_of(TEXT('\n'), cur); if (lf == tstring::npos) { temp += s.substr(cur); break; } else if (lf > cur && s[lf - 1] == TEXT('\r')) { temp += s.substr(cur, (lf + 1) - cur); cur = lf + 1; } else { temp += s.substr(cur, lf - cur); cur = lf + 1; } } s = temp; } std::string to_hex(const char *buf, int bufSize) { constexpr int len = 4; std::string hex; char temp[len]; for (int i = 0; i < bufSize; ++i) { _snprintf_s(temp, len, "%02X ", (unsigned char)(buf[i])); hex += temp; } return hex; } std::string to_hex(std::string s) { constexpr int len = 4; std::string hex; char temp[len]; for (char c : s) { _snprintf_s(temp, len, "%02X ", (unsigned char)c); hex += temp; } return hex; } std::wstring to_hex(std::wstring s) { std::wstring hex; wchar_t temp[5]; for (auto c : s) { _snwprintf_s(temp, 5, 5, L"%04X", c); hex += temp; } return hex; } // https://stackoverflow.com/questions/6089231/getting-std-ifstream-to-handle-lf-cr-and-crlf std::tistream &safeGetline(std::tistream &is, std::tstring &t) { t.clear(); // The characters in the stream are read one-by-one using a std::streambuf. // That is faster than reading them one-by-one using the std::istream. // Code that uses streambuf this way must be guarded by a sentry object. // The sentry object performs various tasks, // such as thread synchronization and updating the stream state. std::tistream::sentry se(is, true); std::tstreambuf *sb = is.rdbuf(); for (;;) { TCHAR c = sb->sbumpc(); switch (c) { case TEXT('\n'): return is; case TEXT('\r'): if (sb->sgetc() == '\n') sb->sbumpc(); return is; case std::tstreambuf::traits_type::eof(): // Also handle the case when the last line has no line ending if (t.empty()) is.setstate(std::tios::eofbit); return is; default: t += c; } } } std::vector Split(std::string_view s, const std::string &dep) noexcept { std::vector ans; string::size_type beg = 0; while (1) { // beg: ""->npos " a"->1 "a"->0 beg = s.find_first_not_of(dep); if (beg == string::npos) { // s == "" break; } s = s.substr(beg); // end: "a "->1 "a"->npos auto end = s.find_first_of(dep); if (end == string::npos) { ans.push_back(s); break; } ans.push_back(s.substr(0, end)); s = s.substr(end); } return ans; } ================================================ FILE: src/Common/tstring.h ================================================ #pragma once #include #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include //TEXT macro #include #include #include #include #ifdef _UNICODE #define tstring wstring #define tstring_view wstring_view #define tios wios #define tistream wistream #define tostream wostream #define tifstream wifstream #define tofstream wofstream #define tstringstream wstringstream #define tistringstream wistringstream #define tostringstream wostringstream #define tstreambuf wstreambuf #define tcout wcout #define to_tstring to_wstring #define to_tstring_from_utf8 utf8_to_wstring #else #define tstring string #define tstring_view string_view #define tios ios #define tistream istream #define tostream ostream #define tifstream ifstream #define tofstream ofstream #define tstringstream stringstream #define tistringstream istringstream #define tostringstream ostringstream #define tstreambuf streambuf #define tcout cout #define to_tstring to_string #define to_tstring_from_utf8 utf8_to_string #endif void MyWideCharToMultiByte(const wchar_t *wsrc, int wsrcSize, std::unique_ptr &dest, int &destSize, UINT codePage = CP_ACP); void MyMultiByteToWideChar(const char *src, int srcSize, std::unique_ptr &dest, int &destSize, UINT codePage = CP_ACP); std::wstring string_to_wstring(const std::string &str); std::string wstring_to_string(const std::wstring &wstr); std::string to_string(const std::wstring &ws); std::wstring to_wstring(const std::string &s); std::wstring to_wstring(const std::wstring &s); template std::enable_if_t || std::is_same_v, T> tolower(const T &s) noexcept { using C = T::value_type; T ret{s}; std::for_each(ret.begin(), ret.end(), [](C &c) { c = tolower(c); }); return ret; } std::string to_utf8(const std::wstring &wstr); std::string to_utf8(const std::u16string &wstr); std::string ansi_to_utf8(const std::string &str); std::vector to_utf8(const std::vector &wstrs); std::string utf8_to_string(const std::string &str); std::wstring utf8_to_wstring(const std::string &str); std::string to_hex(char c) noexcept; std::string to_hex(const char *buf, int bufSize); std::string to_hex(std::string s); std::wstring to_hex(std::wstring s); std::tistream &safeGetline(std::tistream &is, std::tstring &t); /** * 切分字符串。 * dep填入分隔符,可以支持多种分隔符。例如"\n\t"。 */ std::vector Split(std::string_view s, const std::string &dep) noexcept; ================================================ FILE: src/Control/CMakeLists.txt ================================================ # ============================== file(GLOB_RECURSE SRC_CODE *.h *.cpp ) add_library(Control STATIC ${SRC_CODE}) # 添加include目录 target_include_directories(Control PUBLIC .. ${PROJECT_SOURCE_DIR}/third_party/WTL/include ) ================================================ FILE: src/Control/ControlStyle.h ================================================ #pragma once #if defined _M_IX86 #pragma comment( \ linker, \ "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") #elif defined _M_X64 #pragma comment( \ linker, \ "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") #else #pragma comment( \ linker, \ "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include #include #pragma comment(lib, "comctl32.lib") // 高dpi支持(此法只能在Win7 SP1及以上系统调用,否则报错找不到dll) //#include //#pragma comment(lib,"Shcore.lib") #ifndef DPI_ENUMS_DECLARED typedef enum PROCESS_DPI_AWARENESS { PROCESS_DPI_UNAWARE = 0, PROCESS_SYSTEM_DPI_AWARE = 1, PROCESS_PER_MONITOR_DPI_AWARE = 2 } PROCESS_DPI_AWARENESS; typedef enum MONITOR_DPI_TYPE { MDT_EFFECTIVE_DPI = 0, MDT_ANGULAR_DPI = 1, MDT_RAW_DPI = 2, MDT_DEFAULT = MDT_EFFECTIVE_DPI } MONITOR_DPI_TYPE; #define DPI_ENUMS_DECLARED #endif // 启用高DPI适配。若在Win7 SP1以下系统,找不到函数时,则不做处理 inline void SupportHighDPI() { HMODULE hHighDpi = LoadLibrary(TEXT("SHCore.dll")); if (hHighDpi) { typedef HRESULT(__stdcall * FuncSetHighDpi)(PROCESS_DPI_AWARENESS); FuncSetHighDpi fnSetHighDpi = (FuncSetHighDpi)GetProcAddress(hHighDpi, "SetProcessDpiAwareness"); if (fnSetHighDpi) { fnSetHighDpi(PROCESS_PER_MONITOR_DPI_AWARE); } FreeLibrary(hHighDpi); } } ================================================ FILE: src/Control/TListView.cpp ================================================ #include "TListView.h" #include #include using namespace std; std::vector TListView::GetSelectedItems() const { std::vector ans; int iPos = -1; while (1) { // Get the next selected item iPos = GetNextItem(iPos, LVNI_SELECTED); if (iPos == -1) break; ans.push_back(iPos); } return ans; } std::tstring TListView::GetItemText(int nItem, int nSubItem) const { assert(::IsWindow(this->m_hWnd)); tstring ans; LVITEM lvi = {}; lvi.iSubItem = nSubItem; for (int nLen = 256;; nLen *= 2) { ans.resize(nLen); lvi.cchTextMax = nLen; lvi.pszText = ans.data(); int nRes = (int)::SendMessage(this->m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); if (nRes < nLen - 1) { ans.resize(nRes); break; } } return ans; } void TListView::SetColumnText(int col, const std::tstring &s) noexcept { std::tstring buf(s); buf.push_back(TEXT('\0')); LVCOLUMN lvColumn; lvColumn.mask = LVCF_TEXT; lvColumn.iSubItem = col; lvColumn.pszText = buf.data(); SetColumn(col, &lvColumn); } ================================================ FILE: src/Control/TListView.h ================================================ #pragma once #include #include // 基本的ATL类 #include // ATL窗口类 #include // WTL 主框架窗口类 #include #include // WTL 增强的消息宏 #include class TListView : public CWindowImpl { public: BEGIN_MSG_MAP_EX(TListView) MESSAGE_HANDLER(WM_DROPFILES, OnDropFiles) END_MSG_MAP() void SetColumnText(int col, const std::tstring &s) noexcept; std::vector GetSelectedItems() const; std::tstring GetItemText(int nItem, int nSubItem) const; LRESULT OnDropFiles(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { SendMessage(GetParent(), uMsg, wParam, lParam); return 0; } }; ================================================ FILE: src/Control/TMenu.cpp ================================================ #include "TMenu.h" #include TMenu::TMenu() noexcept { hMenu = CreateMenu(); } void TMenu::SetItemEnable(int itemId, bool enabled) noexcept { int lastStatus = EnableMenuItem(hMenu, itemId, enabled ? MF_ENABLED : MF_DISABLED); assert(lastStatus >= 0); } TMenu &TMenu::SetItemToBeContainer(int itemId) noexcept { assert(children.find(itemId) == children.end()); TMenu child; MENUITEMINFO menuItemInfo = {0}; menuItemInfo.cbSize = sizeof(MENUITEMINFO); menuItemInfo.fMask = MIIM_SUBMENU; menuItemInfo.hSubMenu = child.hMenu; BOOL ok = SetMenuItemInfo(hMenu, itemId, FALSE, &menuItemInfo); assert(ok); children.insert({itemId, child}); return children[itemId]; } void TMenu::AppendItem(int id, const std::wstring &s) noexcept { BOOL ok = AppendMenu(hMenu, MF_STRING, id, s.c_str()); assert(ok); } void TMenu::InsertItem(int posId, int newItemid, const std::wstring &s) noexcept { HMENU hMenuPopup = CreateMenu(); MENUITEMINFO menuItemInfo = {0}; menuItemInfo.cbSize = sizeof(MENUITEMINFO); menuItemInfo.wID = newItemid; menuItemInfo.fMask = MIIM_ID | MIIM_STRING | MIIM_SUBMENU; menuItemInfo.cch = static_cast(s.length() + 1); menuItemInfo.dwTypeData = const_cast(s.c_str()); menuItemInfo.hSubMenu = hMenu; BOOL ok = InsertMenuItem(hMenu, posId, FALSE, &menuItemInfo); assert(ok); } std::wstring TMenu::GetItemTextByPosition(int pos) noexcept { return GetItemTextByPositionOrId(true, pos); } std::wstring TMenu::GetItemTextById(int id) noexcept { return GetItemTextByPositionOrId(false, id); } void TMenu::SetItemTextByPosition(int pos, const std::wstring &s) noexcept { SetItemTextByPositionOrId(true, pos, s); } void TMenu::SetItemTextById(int id, const std::wstring &s) noexcept { SetItemTextByPositionOrId(false, id, s); } void TMenu::SetItemTextByPositionOrId(bool byPosition, int posOrId, const std::wstring &s) noexcept { std::wstring ws(s); ws.push_back(L'\0'); MENUITEMINFO menuItemInfo = {0}; menuItemInfo.cbSize = sizeof(MENUITEMINFO); menuItemInfo.fMask = MIIM_STRING; menuItemInfo.cch = static_cast(ws.size()); menuItemInfo.dwTypeData = const_cast(ws.data()); BOOL ok = SetMenuItemInfo(hMenu, posOrId, byPosition, &menuItemInfo); assert(ok); } TMenu &TMenu::GetChild(int itemId) { return children.at(itemId); } std::wstring TMenu::GetItemTextByPositionOrId(bool byPosition, int posOrId) noexcept { MENUITEMINFO menuItemInfo = {0}; // 第一次,先拿到cch,即文本长度 menuItemInfo.cbSize = sizeof(MENUITEMINFO); menuItemInfo.fMask = MIIM_STRING; BOOL ok = GetMenuItemInfo(hMenu, posOrId, byPosition, &menuItemInfo); assert(ok); // 增加长度,以容纳尾后0 menuItemInfo.cch++; std::wstring ws(menuItemInfo.cch, L'\0'); // 把字符串指针指向ws,让系统往ws里写内容 menuItemInfo.dwTypeData = const_cast(ws.data()); ok = GetMenuItemInfo(hMenu, posOrId, byPosition, &menuItemInfo); assert(ok); return ws; } TPopupMenu::TPopupMenu(int menuId) noexcept { hRoot = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(menuId)); assert(hRoot); hMenu = GetSubMenu(hRoot, 0); assert(hMenu); } void TPopupMenu::Popup(HWND hParent) noexcept { POINT pt; GetCursorPos(&pt); BOOL ok = TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hParent, NULL); assert(ok); } ================================================ FILE: src/Control/TMenu.h ================================================ #pragma once #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include #include #include class TMenu { public: TMenu() noexcept; virtual ~TMenu() = default; void SetItemEnable(int itemId, bool enabled = true) noexcept; TMenu &SetItemToBeContainer(int itemId) noexcept; void AppendItem(int id, const std::wstring &s) noexcept; void InsertItem(int posId, int newItemid, const std::wstring &s) noexcept; std::wstring GetItemTextByPosition(int pos) noexcept; std::wstring GetItemTextById(int id) noexcept; void SetItemTextByPosition(int pos, const std::wstring &s) noexcept; void SetItemTextById(int id, const std::wstring &s) noexcept; TMenu &GetChild(int itemId); protected: HMENU hMenu; std::map children; std::wstring GetItemTextByPositionOrId(bool byPosition, int posOrId) noexcept; void SetItemTextByPositionOrId(bool byPosition, int posOrId, const std::wstring &s) noexcept; }; class TPopupMenu : public TMenu { public: TPopupMenu(int menuId) noexcept; void Popup(HWND hParent) noexcept; private: HMENU hRoot; }; ================================================ FILE: src/Core/CMakeLists.txt ================================================ # ============================================= find_package(nlohmann_json CONFIG REQUIRED) # 添加icu库 find_package(ICU REQUIRED COMPONENTS uc dt in io data ) find_package(fmt CONFIG REQUIRED) # === Core ==================================== file(GLOB CORE_CODE *.h *.cpp ) add_library(Core STATIC ${CORE_CODE}) target_include_directories(Core PRIVATE ${PROJECT_SOURCE_DIR}/third_party/uchardet/uchardet/src ) target_link_libraries(Core PUBLIC Common nlohmann_json::nlohmann_json libuchardet_static ICU::uc ICU::in ICU::data ced fmt::fmt ) # 添加include目录 target_include_directories(Core PUBLIC .. ) ================================================ FILE: src/Core/CharsetCode.cpp ================================================ #include "CharsetCode.h" // standard #include struct MyCharset { std::string viewName; // the name shown on interface std::string icuName; // the name used by icu std::unordered_set icuNames; // if icu detected these charset names, map all of them to be the main charset ConvertEngine convertEngine; }; // 字符集code到名称的映射表 const std::unordered_map charsetCodeMap = { // CharsetCode枚举值, viewName显示名称, icuName, 可能的别名 {CharsetCode::UNKNOWN, MyCharset{u8"Unknown", "-", {}, ConvertEngine::ICU}}, {CharsetCode::EMPTY, MyCharset{u8"-", "-", {}, ConvertEngine::ICU}}, {CharsetCode::NOT_SUPPORTED, MyCharset{u8"Not Supported", "-", {}, ConvertEngine::ICU}}, {CharsetCode::UTF8, MyCharset{u8"UTF-8", "UTF-8", {"ASCII", "ANSI", "UTF8"}, ConvertEngine::ICU}}, {CharsetCode::UTF8BOM, MyCharset{u8"UTF-8 BOM", "UTF-8", {}, ConvertEngine::ICU}}, {CharsetCode::GB18030, MyCharset{u8"GB18030", "GB18030", {"GB"}, ConvertEngine::ICU}}, {CharsetCode::UTF16LE, MyCharset{u8"UTF-16LE", "UTF-16LE", {}, ConvertEngine::ICU}}, {CharsetCode::UTF16LEBOM, MyCharset{u8"UTF-16LE BOM", "UTF-16LE", {"utf-16"}, ConvertEngine::ICU}}, {CharsetCode::UTF16BE, MyCharset{u8"UTF-16BE", "UTF-16BE", {}, ConvertEngine::ICU}}, {CharsetCode::UTF16BEBOM, MyCharset{u8"UTF-16BE BOM", "UTF-16BE", {}, ConvertEngine::ICU}}, {CharsetCode::UTF32LE, MyCharset{u8"UTF-32LE", "UTF-32LE", {}, ConvertEngine::ICU}}, {CharsetCode::UTF32LEBOM, MyCharset{u8"UTF-32LE BOM", "UTF-32LE", {"utf-32"}, ConvertEngine::ICU}}, {CharsetCode::UTF32BE, MyCharset{u8"UTF-32BE", "UTF-32BE", {}, ConvertEngine::ICU}}, {CharsetCode::UTF32BEBOM, MyCharset{u8"UTF-32BE BOM", "UTF-32BE", {}, ConvertEngine::ICU}}, {CharsetCode::BIG5, MyCharset{u8"BIG5", "Big5", {"Big5"}, ConvertEngine::ICU}}, {CharsetCode::SHIFT_JIS, MyCharset{u8"SHIFT-JIS", "SHIFT-JIS", {"SHIFT_JIS"}, ConvertEngine::ICU}}, {CharsetCode::EUC_JP, MyCharset{u8"EUC-JP", "EUC-JP", {"EUC-JP"}, ConvertEngine::ICU}}, {CharsetCode::EUC_TW, MyCharset{u8"EUC-TW", "EUC-TW", {"EUC-TW"}, ConvertEngine::ICU}}, {CharsetCode::WINDOWS_1250, MyCharset{u8"WINDOWS-1250", "WINDOWS-1250", {}, ConvertEngine::ICU}}, {CharsetCode::WINDOWS_1251, MyCharset{u8"WINDOWS-1251", "WINDOWS-1251", {}, ConvertEngine::ICU}}, {CharsetCode::WINDOWS_1252, MyCharset{u8"WINDOWS-1252", "WINDOWS-1252", {}, ConvertEngine::ICU}}, {CharsetCode::WINDOWS_1253, MyCharset{u8"WINDOWS-1253", "WINDOWS-1253", {}, ConvertEngine::ICU}}, {CharsetCode::WINDOWS_1254, MyCharset{u8"WINDOWS-1254", "WINDOWS-1254", {}, ConvertEngine::ICU}}, {CharsetCode::WINDOWS_1255, MyCharset{u8"WINDOWS-1255", "WINDOWS-1255", {}, ConvertEngine::ICU}}, {CharsetCode::WINDOWS_1256, MyCharset{u8"WINDOWS-1256", "WINDOWS-1256", {}, ConvertEngine::ICU}}, {CharsetCode::WINDOWS_1257, MyCharset{u8"WINDOWS-1257", "WINDOWS-1257", {}, ConvertEngine::ICU}}, {CharsetCode::WINDOWS_1258, MyCharset{u8"WINDOWS-1258", "WINDOWS-1258", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_1, MyCharset{u8"ISO-8859-1", "ISO-8859-1", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_2, MyCharset{u8"ISO-8859-2", "ISO-8859-2", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_3, MyCharset{u8"ISO-8859-3", "ISO-8859-3", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_4, MyCharset{u8"ISO-8859-4", "ISO-8859-4", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_5, MyCharset{u8"ISO-8859-5", "ISO-8859-5", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_6, MyCharset{u8"ISO-8859-6", "ISO-8859-6", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_7, MyCharset{u8"ISO-8859-7", "ISO-8859-7", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_8, MyCharset{u8"ISO-8859-8", "ISO-8859-8", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_9, MyCharset{u8"ISO-8859-9", "ISO-8859-9", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_10, MyCharset{u8"ISO-8859-10", "ISO-8859-10", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_11, MyCharset{u8"ISO-8859-11", "ISO-8859-11", {}, ConvertEngine::ICU}}, //{CharsetCode::ISO_8859_12, MyCharset{u8"ISO-8859-12", "ISO-8859-12", {}, ConvertEngine::ICU}}, // no this // charset due to history reason {CharsetCode::ISO_8859_13, MyCharset{u8"ISO-8859-13", "ISO-8859-13", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_14, MyCharset{u8"ISO-8859-14", "ISO-8859-14", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_15, MyCharset{u8"ISO-8859-15", "ISO-8859-15", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_8859_16, MyCharset{u8"ISO-8859-16", "ISO-8859-16", {"latin-10"}, ConvertEngine::NO_ENGINE}}, {CharsetCode::ISO_2022_JP, MyCharset{u8"ISO-2022-jp", "ISO-2022-jp", {}, ConvertEngine::ICU}}, {CharsetCode::ISO_2022_KR, MyCharset{u8"ISO-2022-kr", "ISO-2022-kr", {}, ConvertEngine::ICU}}, {CharsetCode::IBM852, MyCharset{u8"ibm852", "ibm852", {}, ConvertEngine::ICU}}, {CharsetCode::IBM855, MyCharset{u8"ibm855", "ibm855", {}, ConvertEngine::ICU}}, {CharsetCode::IBM865, MyCharset{u8"ibm865", "ibm865", {}, ConvertEngine::ICU}}, {CharsetCode::IBM862_LOGICAL, MyCharset{u8"ibm862.logical", "ibm862.logical", {}, ConvertEngine::NO_ENGINE}}, {CharsetCode::IBM862_VISUAL, MyCharset{u8"ibm862.visual", "ibm862.visual", {}, ConvertEngine::NO_ENGINE}}, {CharsetCode::IBM866, MyCharset{u8"ibm866", "ibm866", {}, ConvertEngine::ICU}}, {CharsetCode::CP737, MyCharset{u8"CP737", "CP737", {}, ConvertEngine::ICU}}, {CharsetCode::MAC_CENTRALEUROPE, MyCharset{u8"Central Europe(Mac)", "mac-centraleurope", {}, ConvertEngine::ICU}}, {CharsetCode::MAC_CYRILLIC, MyCharset{u8"Mac Cyrillic", "mac-cyrillic", {}, ConvertEngine::ICU}}, {CharsetCode::VNI, MyCharset{u8"VNI", "", {}, ConvertEngine::SELF_VIETNAMESE_CONVERTER}}, {CharsetCode::VPS, MyCharset{u8"VPS", "", {}, ConvertEngine::SELF_VIETNAMESE_CONVERTER}}, {CharsetCode::VISCII, MyCharset{u8"VISCII", "", {}, ConvertEngine::SELF_VIETNAMESE_CONVERTER}}, {CharsetCode::TCVN3, MyCharset{u8"TCVN3", "", {}, ConvertEngine::SELF_VIETNAMESE_CONVERTER}}, {CharsetCode::GEORGIAN_ACADEMY, MyCharset{u8"georgian-academy", "georgian-academy", {}, ConvertEngine::NO_ENGINE}}, {CharsetCode::GEORGIAN_PS, MyCharset{u8"georgian-ps", "georgian-ps", {}, ConvertEngine::NO_ENGINE}}, {CharsetCode::JOHAB, MyCharset{u8"JOHAB", "JOHAB", {}, ConvertEngine::NO_ENGINE}}, {CharsetCode::UHC, MyCharset{u8"UHC", "UHC", {}, ConvertEngine::NO_ENGINE}}, {CharsetCode::KOI8_R, MyCharset{u8"koi8-r", "koi8-r", {}, ConvertEngine::NO_ENGINE}}, {CharsetCode::TIS_620, MyCharset{u8"tis-620", "tis-620", {}, ConvertEngine::NO_ENGINE}}, }; std::string ToViewCharsetName(CharsetCode code) noexcept { return charsetCodeMap.at(code).viewName; } CharsetCode ToCharsetCode(const std::string &name) { // 查找name是否有吻合的viewName auto it = std::find_if(charsetCodeMap.begin(), charsetCodeMap.end(), [&](const std::pair &pr) { return tolower(pr.second.viewName) == tolower(name); }); if (it != charsetCodeMap.end()) { return it->first; } // 查找name是否有吻合的icuName it = std::find_if(charsetCodeMap.begin(), charsetCodeMap.end(), [&](const std::pair &pr) { return tolower(pr.second.icuName) == tolower(name); }); if (it != charsetCodeMap.end()) { return it->first; } // 查找name是否有吻合的icuNames for (auto &pr : charsetCodeMap) { for (auto &icuName : pr.second.icuNames) { if (tolower(icuName) == tolower(name)) { return pr.first; } } } throw std::runtime_error("unsupported: " + name); } std::string ToICUCharsetName(CharsetCode code) noexcept { return charsetCodeMap.at(code).icuName; } bool HasBom(CharsetCode code) { switch (code) { case CharsetCode::UTF8BOM: case CharsetCode::UTF16LEBOM: case CharsetCode::UTF16BEBOM: return true; } return false; } const char *GetBomData(CharsetCode code) { switch (code) { case CharsetCode::UTF8BOM: return UTF8BOM_DATA; case CharsetCode::UTF16LEBOM: return UTF16LEBOM_DATA; case CharsetCode::UTF16BEBOM: return UTF16BEBOM_DATA; } return nullptr; } int BomSize(CharsetCode code) { switch (code) { case CharsetCode::UTF8BOM: return sizeof(UTF8BOM_DATA); case CharsetCode::UTF16LEBOM: return sizeof(UTF16LEBOM_DATA); case CharsetCode::UTF16BEBOM: return sizeof(UTF16BEBOM_DATA); } return 0; } CharsetCode CheckBom(char *buf, int bufSize) { if (bufSize >= sizeof(UTF8BOM_DATA) && memcmp(buf, UTF8BOM_DATA, sizeof(UTF8BOM_DATA)) == 0) { return CharsetCode::UTF8BOM; } if (bufSize >= sizeof(UTF16LEBOM_DATA) && memcmp(buf, UTF16LEBOM_DATA, sizeof(UTF16LEBOM_DATA)) == 0) { return CharsetCode::UTF8BOM; } if (bufSize >= sizeof(UTF16BEBOM_DATA) && memcmp(buf, UTF16BEBOM_DATA, sizeof(UTF16BEBOM_DATA)) == 0) { return CharsetCode::UTF8BOM; } if (bufSize >= sizeof(UTF32LEBOM_DATA) && memcmp(buf, UTF32LEBOM_DATA, sizeof(UTF32LEBOM_DATA)) == 0) { return CharsetCode::UTF8BOM; } if (bufSize >= sizeof(UTF32BEBOM_DATA) && memcmp(buf, UTF32BEBOM_DATA, sizeof(UTF32BEBOM_DATA)) == 0) { return CharsetCode::UTF8BOM; } return CharsetCode::UNKNOWN; } ConvertEngine GetConvertEngine(CharsetCode code) noexcept { return charsetCodeMap.at(code).convertEngine; } ================================================ FILE: src/Core/CharsetCode.h ================================================ #pragma once #include // standard lib #include #include enum class CharsetCode { UNKNOWN, EMPTY, NOT_SUPPORTED, // UTF8, // this line's order should not be changed. see DialogMain.cpp line 142: for (int icode = // static_cast(CharsetCode::UTF8), i = 0; UTF8BOM, UTF16BE, UTF16BEBOM, UTF16LE, UTF16LEBOM, UTF32BE, UTF32BEBOM, UTF32LE, UTF32LEBOM, GB18030, BIG5, SHIFT_JIS, EUC_JP, EUC_TW, WINDOWS_1250, WINDOWS_1251, WINDOWS_1252, WINDOWS_1253, WINDOWS_1254, WINDOWS_1255, WINDOWS_1256, WINDOWS_1257, WINDOWS_1258, // Vietnamese ISO_8859_1, ISO_8859_2, ISO_8859_3, ISO_8859_4, ISO_8859_5, ISO_8859_6, ISO_8859_7, ISO_8859_8, ISO_8859_9, ISO_8859_10, ISO_8859_11, // ISO_8859_12, // no this charset due to history reason ISO_8859_13, ISO_8859_14, ISO_8859_15, ISO_8859_16, ISO_2022_JP, ISO_2022_KR, IBM852, IBM855, IBM865, IBM862_LOGICAL, IBM862_VISUAL, IBM866, CP737, MAC_CENTRALEUROPE, MAC_CYRILLIC, VNI, // Vietnamese VPS, // Vietnamese VISCII, // Vietnamese TCVN3, // Vietnamese GEORGIAN_ACADEMY, GEORGIAN_PS, JOHAB, UHC, KOI8_R, TIS_620, CHARSET_CODE_END // 添加字符集需要同步修改:charsetCodeMap }; enum class ConvertEngine { ICU, SELF_VIETNAMESE_CONVERTER, NO_ENGINE, END, }; std::string ToViewCharsetName(CharsetCode code) noexcept; /** * 编码集名字转CharsetCode * @exception runtime_error 未识别的字符串 */ // CharsetCode ToCharsetCode(const std::string &name); std::string ToICUCharsetName(CharsetCode code) noexcept; // bom串 const char UTF8BOM_DATA[] = {'\xEF', '\xBB', '\xBF'}; const char UTF16LEBOM_DATA[] = {'\xFF', '\xFE'}; const char UTF16BEBOM_DATA[] = {'\xFE', '\xFF'}; const char UTF32LEBOM_DATA[] = {'\xFF', '\xFE', '\x0', '\x0'}; const char UTF32BEBOM_DATA[] = {'\xFE', '\xFF', '\x0', '\x0'}; bool HasBom(CharsetCode code); const char *GetBomData(CharsetCode code); int BomSize(CharsetCode code); /** * @brief 返回buf的开头是否符合某种BOM,如果都不符合返回UNKNOWN */ CharsetCode CheckBom(char *buf, int bufSize); ConvertEngine GetConvertEngine(CharsetCode code) noexcept; ================================================ FILE: src/Core/Config.cpp ================================================ #include "Config.h" std::unordered_set Configuration::normalCharset = {CharsetCode::UTF8, CharsetCode::UTF8BOM, CharsetCode::GB18030}; ================================================ FILE: src/Core/Config.h ================================================ #pragma once // self #include "CharsetCode.h" #include "LineBreaks.h" #include // third party #include // standard lib #include /** * @brief 配置信息 */ struct Configuration { enum class FilterMode : int { NO_FILTER, SMART, ONLY_SOME_EXTANT }; enum class OutputTarget { ORIGIN, TO_DIR }; static std::unordered_set normalCharset; FilterMode filterMode; OutputTarget outputTarget; std::string includeRule = u8"h hpp c cpp cxx txt"; std::string excludeRule; std::string outputDir; CharsetCode outputCharset; bool enableConvertLineBreaks; LineBreaks lineBreak; std::string language; // if member variables is added, it must be synchronized at NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE below. Configuration() : filterMode(FilterMode::SMART), outputTarget(OutputTarget::ORIGIN), outputCharset(CharsetCode::UTF8), lineBreak(LineBreaks::CRLF), enableConvertLineBreaks(false) {} static bool IsNormalCharset(CharsetCode charset) { return normalCharset.find(charset) != normalCharset.end(); } }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Configuration, filterMode, outputTarget, includeRule, excludeRule, outputDir, outputCharset, enableConvertLineBreaks, lineBreak, language) ================================================ FILE: src/Core/Core.cpp ================================================ #include "Core.h" #include "Detect.h" #include "UCNVHelper.h" #include "Exceptions.h" #include #include #include #include #include #include #include using namespace std; constexpr uint64_t tryReadSize = 100Ui64 * KB; constexpr uint64_t MAX_STRING_PIECE_LENGTH = 64; std::u16string Decode(std::string_view src, CharsetCode code) { if (code == CharsetCode::EMPTY) { return {}; } switch (GetConvertEngine(code)) { case ConvertEngine::SELF_VIETNAMESE_CONVERTER: { viet::Init(); return viet::ConvertToUtf16LE(src, CharsetCodeToVietEncoding(code)); } case ConvertEngine::ICU: { // 从code转换到icu的字符集名称 auto icuCharsetName = ToICUCharsetName(code); UErrorCode err = U_ZERO_ERROR; // 打开转换器 unique_ptr> conv(ucnv_open(icuCharsetName.c_str(), &err), [](UConverter *p) { ucnv_close(p); }); DealWithUCNVError(err); std::size_t cap = src.size() + 1; std::u16string target(cap, u'\u0000'); ucnv_setToUCallBack(conv.get(), UCNV_TO_U_CALLBACK_STOP, NULL, NULL, NULL, &err); DealWithUCNVError(err); if (cap > std::numeric_limits::max()) { throw MyRuntimeError(MessageId::STRING_LENGTH_OUT_OF_LIMIT); } if (src.size() > std::numeric_limits::max()) { throw MyRuntimeError(MessageId::STRING_LENGTH_OUT_OF_LIMIT); } // 解码 int retLen = ucnv_toUChars(conv.get(), target.data(), static_cast(cap), src.data(), static_cast(src.size()), &err); target.resize(retLen); int corruptedDataPieceSize = static_cast(std::min(32ull, src.size() - retLen)); // if there is corrupted data at src.data(), err will be U_ILLEGAL_CHAR_FOUND(12). // TODO: at this case, maybe prompt user to decide how to deal with. // current we just throw a clear error message. if (err == U_ILLEGAL_CHAR_FOUND) { throw IllegalCharFoundError(code, retLen, std::string(src.substr(retLen, corruptedDataPieceSize))); } if (err == U_INVALID_CHAR_FOUND) { throw InvalidCharFoundError(code, retLen, std::string(src.substr(retLen, corruptedDataPieceSize))); } DealWithUCNVError(err); return target; } case ConvertEngine::NO_ENGINE: throw CharsetNotSupportedError(code); default: assert(0); } return u"internal error"; } std::u16string DecodeToLimitBytes(std::string_view src, uint64_t maxInputBytes, CharsetCode code) { std::u16string output; std::size_t use_bytes = std::min(maxInputBytes, src.size()); while (use_bytes > 0) { try { output = Decode(std::string_view(src.data(), use_bytes), code); break; } catch (const TruncatedCharFoundError &err) { (err); if (use_bytes != src.size()) { use_bytes--; continue; } throw; } } return output; } // below copied from https://github.com/unicode-org/icu/blob/main/icu4c/source/samples/ucnv/flagcb.c /* The structure of a FromU Flag context. (conceivably there could be a ToU Flag Context) */ struct FromUFLAGContext { UConverterFromUCallback subCallback; const void *subContext; std::vector unassigned; // 是否出现了不能转换的字符 FromUFLAGContext() : subCallback(nullptr), subContext(nullptr) {} }; /** * the actual callback */ U_CAPI void U_EXPORT2 flagCB_fromU(const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar *codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode *err) { /* First step - based on the reason code, take action */ FromUFLAGContext *ctx = reinterpret_cast(const_cast(context)); if (reason == UCNV_UNASSIGNED) { /* whatever set should be trapped here */ if (ctx->unassigned.size() < 32) ctx->unassigned.push_back(codePoint); } if (reason == UCNV_CLONE) { /* The following is the recommended way to implement UCNV_CLONE in a callback. */ UConverterFromUCallback saveCallback; const void *saveContext; UErrorCode subErr = U_ZERO_ERROR; FromUFLAGContext *cloned = nullptr; *cloned = *ctx; /* We need to get the sub CB to handle cloning, * so we have to set up the following, temporarily: * * - Set the callback+context to the sub of this (flag) cb * - preserve the current cb+context, it could be anything * * Before: * CNV -> FLAG -> subcb -> ... * * After: * CNV -> subcb -> ... * * The chain from 'something' on is saved, and will be restored * at the end of this block. * */ ucnv_setFromUCallBack(fromUArgs->converter, cloned->subCallback, cloned->subContext, &saveCallback, &saveContext, &subErr); if (cloned->subCallback != NULL) { /* Now, call the sub callback if present */ cloned->subCallback(cloned->subContext, fromUArgs, codeUnits, length, codePoint, reason, err); } ucnv_setFromUCallBack(fromUArgs->converter, saveCallback, /* Us */ cloned, /* new context */ &cloned->subCallback, /* IMPORTANT! Accept any change in CB or context */ &cloned->subContext, &subErr); if (U_FAILURE(subErr)) { *err = subErr; } } /* process other reasons here if need be */ /* Always call the subCallback if present */ if (ctx->subCallback != NULL && reason != UCNV_CLONE) { ctx->subCallback(ctx->subContext, fromUArgs, codeUnits, length, codePoint, reason, err); } /* cleanup - free the memory AFTER calling the sub CB */ if (reason == UCNV_CLOSE) { delete context; } } std::string Encode(std::u16string_view src, CharsetCode targetCode) { switch (GetConvertEngine(targetCode)) { case ConvertEngine::SELF_VIETNAMESE_CONVERTER: { viet::Init(); return viet::ConvertFromUtf16LE(src, CharsetCodeToVietEncoding(targetCode)); } case ConvertEngine::ICU: { // 从code转换到icu的字符集名称 auto icuCharsetName = ToICUCharsetName(targetCode); UErrorCode err = U_ZERO_ERROR; // 打开转换器 unique_ptr> conv(ucnv_open(icuCharsetName.c_str(), &err), [](UConverter *p) { ucnv_close(p); }); DealWithUCNVError(err); if (src.size() >= std::numeric_limits::max() / sizeof(UChar) - 1) { throw MyRuntimeError(MessageId::STRING_LENGTH_OUT_OF_LIMIT); } int32_t destCap = static_cast((src.size() + 1lu) * sizeof(UChar)); std::string target(destCap, '\0'); FromUFLAGContext *context = new FromUFLAGContext; // 由回调函数管理生命期 /* Set our special callback */ ucnv_setFromUCallBack(conv.get(), flagCB_fromU, context, &(context->subCallback), &(context->subContext), &err); DealWithUCNVError(err); // 编码 int retLen; while (1) { err = U_ZERO_ERROR; retLen = ucnv_fromUChars(conv.get(), target.data(), destCap, src.data(), static_cast(src.size()), &err); if (err == U_BUFFER_OVERFLOW_ERROR || err == U_STRING_NOT_TERMINATED_WARNING) { destCap = retLen + 6; // 增加一个尾后0的大小:utf-8 单个字符最大占用字节数 target.resize(destCap); continue; } DealWithUCNVError(err); if (err == U_ZERO_ERROR) { target.resize(retLen); break; } } // 如果存在不能转换的字符,那么抛出异常 if (!context->unassigned.empty()) { context->unassigned.push_back(0); UChar32 *s = context->unassigned.data(); // UTF32LE -> UTF16LE std::u16string temp = Decode(std::string_view(reinterpret_cast(s), (context->unassigned.size() - 1) * 4), CharsetCode::UTF32LE); // UTF16LE -> UTF8 std::string ret = Encode(temp, CharsetCode::UTF8); throw UnassignedCharError(ret); } return target; } case ConvertEngine::NO_ENGINE: throw CharsetNotSupportedError(targetCode); default: assert(0); } return u8"internal error"; } std::string Convert(std::string_view src, ConvertParam inputParam) { // 根据原编码得到Unicode字符串 std::u16string buf = Decode(src, inputParam.originCode); // 如果需要转换换行符 if (inputParam.doConvertLineBreaks) { ChangeLineBreaks(buf, inputParam.targetLineBreak); } // 转到目标编码 return Encode(buf, inputParam.targetCode); } viet::Encoding CharsetCodeToVietEncoding(CharsetCode code) noexcept { return viet::to_encoding(ToViewCharsetName(code)); } Core::Core(std::string configFileName, CoreInitOption opt) : configFileName(configFileName), opt(opt) { // 读ini ReadConfigFromFile(); // 初始化uchardet det = unique_ptr>(uchardet_new(), [](uchardet *det) { uchardet_delete(det); }); #ifndef NDEBUG // ================================= // ==== will detect memory leak ==== // UErrorCode err; // UEnumeration *allNames = ucnv_openAllNames(&err); // while (1) { // auto name = uenum_next(allNames, nullptr, &err); // if (name == nullptr) { // break; // } //} // ================================ #endif } const Configuration &Core::GetConfig() const noexcept { return config; } Configuration &Core::GetConfigRef() noexcept { return config; } const std::unique_ptr> &Core::GetUCharDet() const { return det; } void Core::SetFilterMode(Configuration::FilterMode mode) { config.filterMode = mode; WriteConfigToFile(); } void Core::SetFilterRule(const std::string &rule) { config.includeRule = rule; WriteConfigToFile(); } void Core::SetOutputTarget(Configuration::OutputTarget outputTarget) { config.outputTarget = outputTarget; WriteConfigToFile(); } void Core::SetOutputDir(const std::string &outputDir) { config.outputDir = outputDir; WriteConfigToFile(); } void Core::SetOutputCharset(CharsetCode outputCharset) { config.outputCharset = outputCharset; WriteConfigToFile(); } void Core::SetLineBreaks(LineBreaks lineBreak) { config.lineBreak = lineBreak; WriteConfigToFile(); } void Core::SetLanguage(const std::string &language) noexcept { config.language = language; WriteConfigToFile(); } void Core::SetEnableConvertLineBreak(bool enableLineBreaks) { config.enableConvertLineBreaks = enableLineBreaks; WriteConfigToFile(); } void RemoveASCII(std::vector &data) noexcept { auto itor = std::stable_partition(data.begin(), data.end(), [](char c) { return (c & 0b10000000); }); data.erase(itor, data.end()); } Core::AddItemResult Core::AddItem(const std::string &filename, const std::unordered_set &filterDotExts) { // 如果是只包括指定后缀的模式,且文件后缀不符合,则忽略掉,且不提示 if (GetConfig().filterMode == Configuration::FilterMode::ONLY_SOME_EXTANT) { auto ext = GetExtend(filename); auto dotExt = "." + tolower(ext); if (filterDotExts.find(dotExt) == filterDotExts.end()) { return {}; } } // 如果重复了 if (listFileNames.find(filename) != listFileNames.end()) { throw MyRuntimeError(MessageId::ADD_REDUNDANTLY); } // 读入文件,只读入部分。因为读入大文件会占用太长时间。 auto [buf, bufSize] = ReadFileToBuffer(filename, tryReadSize); // 识别字符集 auto charsetCode = DetectEncoding(det.get(), buf.get(), bufSize); std::u16string content; switch (charsetCode) { case CharsetCode::EMPTY: break; // 如果没有识别出编码集 case (CharsetCode::UNKNOWN): { switch (GetConfig().filterMode) { // 如果是智能模式或者后缀模式,不添加这个文件,但要抛出异常,让UI弹出提示 case Configuration::FilterMode::SMART: case Configuration::FilterMode::ONLY_SOME_EXTANT: throw io_error_ignore(); // 如果是不过滤模式 case Configuration::FilterMode::NO_FILTER: { // 强行添加 auto fileSize = GetFileSize(filename); // 成功添加 listFileNames.insert(filename); return AddItemResult{false, fileSize, charsetCode, LineBreaks::UNKNOWN, {}}; } default: assert(0); } break; } default: // 根据uchardet得出的字符集解码 content = DecodeToLimitBytes(std::string_view(buf.get(), bufSize), MAX_STRING_PIECE_LENGTH, charsetCode); } auto fileSize = GetFileSize(filename); auto charsetName = ToViewCharsetName(charsetCode); // 重新读入整个文件,因为之前只读入了部分,换行符可能判断不彻底 if (bufSize < fileSize) { std::tie(buf, bufSize) = ReadFileToBuffer(filename); } std::u16string wholeUtfStr; try { wholeUtfStr = Decode(std::string_view(buf.get(), bufSize), charsetCode); } catch (const IllegalCharFoundError &err) { (err); // if current is NO-FILTER mode, treat it as UNKOWN charset if (GetConfig().filterMode != Configuration::FilterMode::NO_FILTER) { throw; } listFileNames.insert(filename); return AddItemResult{false, fileSize, CharsetCode::UNKNOWN, LineBreaks::UNKNOWN, {}}; } // 检查换行符 auto lineBreak = GetLineBreaks(wholeUtfStr.data(), wholeUtfStr.size()); // 到达这里不会再抛异常了 // 成功添加 listFileNames.insert(filename); return AddItemResult{false, fileSize, charsetCode, lineBreak, content}; } void Core::SpecifyItemCharset(int index, const std::string &filename, CharsetCode charsetCode) { assert(listFileNames.find(filename) != listFileNames.end()); // 读入文件,只读入部分。因为读入大文件会占用太长时间。 auto [buf, bufSize] = ReadFileToBuffer(filename, tryReadSize); auto fileSize = GetFileSize(filename); auto fileSizeStr = FileSizeToHumanString(fileSize); auto charsetName = ToViewCharsetName(charsetCode); // 重新读入整个文件,因为之前只读入了部分,换行符可能判断不彻底 if (bufSize < fileSize) { std::tie(buf, bufSize) = ReadFileToBuffer(filename); } auto wholeUtfStr = Decode(std::string_view(buf.get(), bufSize), charsetCode); auto lineBreak = GetLineBreaks(wholeUtfStr.data(), wholeUtfStr.size()); auto lineBreakStr = LineBreaksToViewName(lineBreak); // 到达这里不会再抛异常了 // 通知UI新增条目 auto stringPiece = DecodeToLimitBytes(std::string_view(buf.get(), bufSize), MAX_STRING_PIECE_LENGTH, charsetCode); opt.fnUIUpdateItem(index, filename, fileSizeStr, charsetName, lineBreakStr, stringPiece); } void Core::RemoveItem(const std::string &filename) { listFileNames.erase(filename); } void Core::Clear() { listFileNames.clear(); } Core::ConvertFileResult Core::Convert(const std::string &inputFilename, CharsetCode originCode, LineBreaks originLineBreak, TranslatorBase *translator) noexcept { CharsetCode targetCode = config.outputCharset; ConvertFileResult ret; try { ret.outputFileName = inputFilename; ret.targetLineBreaks = originLineBreak; ret.outputFileSize = GetFileSize(inputFilename); // 计算目标文件名 if (GetConfig().outputTarget != Configuration::OutputTarget::ORIGIN) { // 纯文件名 auto pureFileName = GetNameAndExt(ret.outputFileName); ret.outputFileName = GetConfig().outputDir + "\\" + pureFileName; } // 原编码集 if (originCode == CharsetCode::UNKNOWN) { throw MyRuntimeError(MessageId::NO_DETECTED_ENCODING); } // 返回原字符集和目标字符集的条件为不需要转换的情形 auto CharsetNeedNotConvert = [&]() -> bool { // 原编码和目标编码一样 if (originCode == targetCode) return true; // 原来是空文件,且目标编码不需要写入BOM if (originCode == CharsetCode::EMPTY && !HasBom(targetCode)) return true; return false; }; // 判断不需要转换的条件,或者是需要复制的情形,直接不转换或者复制 // 返回true则不需要实际转换了 auto CheckNothingOrCopy = [&]() -> bool { if (CharsetNeedNotConvert() && // 不转换换行符,或者新换行符和原来的换行符一样 (GetConfig().enableConvertLineBreaks == false || GetConfig().lineBreak == originLineBreak)) { // 那么只需要考虑是否原位转换,原位转换的话什么也不做,否则复制过去 // 如果不是原位置转换,复制过去 if (GetConfig().outputTarget == Configuration::OutputTarget::TO_DIR) { bool ok = CopyFileW(utf8_to_wstring(inputFilename).c_str(), utf8_to_wstring(ret.outputFileName).c_str(), false); if (!ok) { throw FileIOError(MessageId::FAILED_TO_WRITE_FILE, ret.outputFileName); } } // 原位转换,什么也不做 return true; } return false; }; do { if (CheckNothingOrCopy()) break; // 前后编码不一样 auto filesize = GetFileSize(inputFilename); // 暂时不做分块转换 TODO { // 读二进制 auto [raw, rawSize] = ReadFileToBuffer(inputFilename); if (rawSize >= std::numeric_limits::max()) { throw MyRuntimeError(MessageId::FILE_SIZE_OUT_OF_LIMIT); } // 根据BOM偏移 const char *rawStart = raw.get(); // 如果需要抹掉BOM,则把起始位置设置到BOM之后,确保UChar[]不带BOM if (HasBom(originCode) && !HasBom(targetCode)) { auto bomSize = BomSize(originCode); rawStart += bomSize; rawSize -= bomSize; } ConvertParam param; param.originCode = originCode; param.targetCode = targetCode; param.doConvertLineBreaks = GetConfig().enableConvertLineBreaks && GetConfig().lineBreak != originLineBreak; param.targetLineBreak = GetConfig().lineBreak; // 转到目标编码 std::string outputBuf = ::Convert(std::string_view(rawStart, rawSize), param); if (param.doConvertLineBreaks) { ret.targetLineBreaks = param.targetLineBreak; } ret.outputFileSize = 0; // 写入文件 FILE *fp = nullptr; errno_t err = _wfopen_s(&fp, utf8_to_wstring(ret.outputFileName).c_str(), L"wb"); if (err == EACCES) { throw FileIOError(MessageId::NO_PERMISSION, ret.outputFileName); } if (fp == nullptr) { throw FileIOError(MessageId::FAILED_TO_OPEN_FILE, ret.outputFileName); } unique_ptr> upFile(fp, [](FILE *fp) { fclose(fp); }); // 如果需要额外加上BOM,先写入BOM if (!HasBom(originCode) && HasBom(targetCode)) { auto bomData = GetBomData(targetCode); // 写入BOM size_t wrote = fwrite(bomData, BomSize(targetCode), 1, fp); ret.outputFileSize += BomSize(targetCode); if (wrote != 1) { throw FileIOError(MessageId::FAILED_TO_WRITE_FILE, ret.outputFileName); } } // 写入正文 size_t wrote = fwrite(outputBuf.data(), outputBuf.size(), 1, fp); ret.outputFileSize += outputBuf.size(); if (outputBuf.size() != 0 && wrote != 1) { throw FileIOError(MessageId::FAILED_TO_WRITE_FILE, ret.outputFileName); } } } while (0); } catch (const MyRuntimeError &err) { // 这个文件失败了 if (translator) { ret.errInfo = err.ToLocalString(translator); } else { ret.errInfo = err.what(); } } // 这个文件成功了 return ret; } void Core::ReadConfigFromFile() { if (!GetFileExists(configFileName)) { return; } auto [buf, bufSize] = ReadFileToBuffer(configFileName); nlohmann::json j = nlohmann::json::parse(std::string_view(buf.get(), bufSize)); from_json(j, config); } void Core::WriteConfigToFile() { nlohmann::json j; to_json(j, config); std::string jsonStr = j.dump(4); WriteFileFromBuffer(configFileName, jsonStr.data(), jsonStr.size()); } // UINT Configuration::ToWinCodePage(OutputCharset charset) //{ // switch (charset) // { // case OutputCharset::UTF8: // return CP_UTF8; // case OutputCharset::GB18030: // return CP_GB18030; // } //} ================================================ FILE: src/Core/Core.h ================================================ #pragma once // self #include "CharsetCode.h" #include "LineBreaks.h" #include "Config.h" #include "Vietnamese.h" #include "Exceptions.h" #include // third-party lib #include #include // standard lib #include #include #include #include #include #include #include #undef min #undef max /** * @brief 根据code的字符集解码字符串为unicode * @return u16string(UTF-16LE) * @exception UCNVError ucnv出错。code */ std::u16string Decode(std::string_view src, CharsetCode code); /** * 根据code的字符集解码字符串为unicode。 * 为了只输出部分解码结果,输入一个最大输入bytes数量的限制。 * @param maxInputBytes 最大输入bytes数量。src的长度如果大于maxInputBytes,只有maxInputBytes数量的数据会送去解码。 * @return u16string(UTF-16LE) * @exception UCNVError ucnv出错。code */ std::u16string DecodeToLimitBytes(std::string_view src, uint64_t maxInputBytes, CharsetCode code); /** * @brief 把unicode串编码为指定字符集 * @param src u16string(UTF-16LE) * @return std::string CAUTION: this string is only as a container of char[] with the charset of targetCode. * NOT mean its charset is ASCII or ANSI or others. * @exception viet::ConvertError * @exception UnassignedCharError 出现了不能转换的字符 * @exception std::runtime_error ucnv出错 */ std::string Encode(std::u16string_view src, CharsetCode targetCode); struct ConvertParam { CharsetCode originCode; CharsetCode targetCode; bool doConvertLineBreaks; LineBreaks targetLineBreak; // target line break. if doConvertLineBreaks is false, this variable will be ignored. }; /** * Convert encoding. * @exception viet::ConvertError * @exception UnassignedCharError 出现了不能转换的字符 * @exception std::runtime_error ucnv出错 */ std::string Convert(std::string_view src, ConvertParam inputParam); viet::Encoding CharsetCodeToVietEncoding(CharsetCode code) noexcept; struct CoreInitOption { std::function fnUIUpdateItem = [](int index, std::string filename, std::string fileSizeStr, std::string charsetStr, std::string lineBreakStr, std::u16string textPiece) {}; }; class Core { public: Core(std::string configFileName, CoreInitOption opt); const Configuration &GetConfig() const noexcept; Configuration &GetConfigRef() noexcept; const std::unique_ptr> &GetUCharDet() const; void SetFilterMode(Configuration::FilterMode mode); void SetFilterRule(const std::string &rule); void SetOutputTarget(Configuration::OutputTarget outputTarget); void SetOutputDir(const std::string &outputDir); void SetOutputCharset(CharsetCode outputCharset); void SetEnableConvertLineBreak(bool enableLineBreaks); void SetLineBreaks(LineBreaks lineBreak); void SetLanguage(const std::string &language) noexcept; void WriteConfigToFile(); struct AddItemResult { bool isIgnore = true; // 是否应该忽略掉 uint64_t filesize; CharsetCode srcCharset; LineBreaks srcLineBreak; std::u16string strPiece; }; /** * 加入一个文件到列表。 * @exception runtime_error 重复添加 * @exception file_io_error 读文件失败 * @exception runtime_error ucnv出错。code * @exception io_error_ignore 按照配置忽略掉这个文件 */ [[nodiscard]] AddItemResult AddItem(const std::string &filename, const std::unordered_set &filterDotExts); /** * 指定文件的字符集。 * @exception file_io_error 读文件失败 * @exception runtime_error ucnv出错。code */ void SpecifyItemCharset(int index, const std::string &filename, CharsetCode code); void RemoveItem(const std::string &filename); void Clear(); struct ConvertFileResult { std::string outputFileName; std::optional errInfo; LineBreaks targetLineBreaks; std::size_t outputFileSize; }; /** * @brief 转换一个文件。 * @return <输出文件的文件名, 出错信息> */ ConvertFileResult Convert(const std::string &inputFilename, CharsetCode originCode, LineBreaks originLineBreak, TranslatorBase *translator = nullptr) noexcept; private: std::string configFileName; CoreInitOption opt; Configuration config; std::unique_ptr> det; std::unordered_set listFileNames; // 当前列表中的文件 void ReadConfigFromFile(); }; ================================================ FILE: src/Core/Detect.cpp ================================================ #include "Core.h" #include "UCNVHelper.h" #include #include #include #include #include #include using namespace std; std::tuple DetectByUCharDet(uchardet *det, const char *buf, std::size_t bufSize) { // 用uchardet判定字符集 uchardet_reset(det); int ret = uchardet_handle_data(det, buf, bufSize); switch (ret) { case HANDLE_DATA_RESULT_NEED_MORE_DATA: case HANDLE_DATA_RESULT_DETECTED: break; case HANDLE_DATA_RESULT_ERROR: throw runtime_error("uchardet fail"); } uchardet_data_end(det); // 得到uchardet的识别结果 string charset = uchardet_get_charset(det); float confidence = uchardet_get_confidence(det); return {charset, static_cast(confidence * 100)}; } std::tuple DetectByUCSDet(const char *buf, int32_t bufSize) { UErrorCode status = U_ZERO_ERROR; auto csd = std::unique_ptr(ucsdet_open(&status), [](UCharsetDetector *p) { ucsdet_close(p); }); DealWithUCNVError(status); ucsdet_setText(csd.get(), buf, bufSize, &status); DealWithUCNVError(status); const UCharsetMatch *ucm = ucsdet_detect(csd.get(), &status); if (status == U_INVALID_CHAR_FOUND) { // if this error code occurred while detecting, one possible situation is that input is a binary file. // we just return unknown as result. return {"unknown", 0}; } DealWithUCNVError(status); int32_t confidence = ucsdet_getConfidence(ucm, &status); DealWithUCNVError(status); const char *name = ucsdet_getName(ucm, &status); DealWithUCNVError(status); return {name, confidence}; } std::unordered_set DetectByMine(std::string_view src) { std::unordered_set ret; for (int i = static_cast(CharsetCode::UTF8); i <= static_cast(CharsetCode::ISO_8859_1); ++i) { CharsetCode tryCode = static_cast(i); try { auto temp = Decode(src, tryCode); Encode(temp, tryCode); ret.insert(tryCode); } catch (...) {} } return ret; } std::tuple DetectByCED(const char *buf, int len) { int bytes_consumed; bool is_reliable; Encoding encoding = CompactEncDet::DetectEncoding(buf, len, nullptr, // URL hint nullptr, // HTTP hint nullptr, // Meta hint UNKNOWN_ENCODING, UNKNOWN_LANGUAGE, CompactEncDet::WEB_CORPUS, false, // Include 7-bit encodings? &bytes_consumed, &is_reliable); // 如果认为是二进制文件,那么取信它 if (encoding == Encoding::BINARYENC) { return {CharsetCode::UNKNOWN, true}; } // 这里如果CED识别出的名字在CharsetCode中没有定义,将抛出异常 CharsetCode code; try { code = ToCharsetCode(EncodingName(encoding)); } catch (const std::runtime_error &err) { (err); if (is_reliable) { throw; } return {CharsetCode::UNKNOWN, true}; } return {code, is_reliable}; } CharsetCode ToCharsetCodeFinal(CharsetCode inputCode, const char *buf, std::size_t bufSize) { switch (inputCode) { case CharsetCode::UTF8: // 区分有无BOM if (bufSize >= sizeof(UTF8BOM_DATA) && memcmp(buf, UTF8BOM_DATA, sizeof(UTF8BOM_DATA)) == 0) { return CharsetCode::UTF8BOM; } return inputCode; case CharsetCode::UTF16BE: // 区分有无BOM if (bufSize >= sizeof(UTF16BEBOM_DATA) && memcmp(buf, UTF16BEBOM_DATA, sizeof(UTF16BEBOM_DATA)) == 0) { return CharsetCode::UTF16BEBOM; } return inputCode; case CharsetCode::UTF16LE: // 区分有无BOM if (bufSize >= sizeof(UTF16LEBOM_DATA) && memcmp(buf, UTF16LEBOM_DATA, sizeof(UTF16LEBOM_DATA)) == 0) { return CharsetCode::UTF16LEBOM; } return inputCode; case CharsetCode::UTF32BE: // 区分有无BOM if (bufSize >= sizeof(UTF32BEBOM_DATA) && memcmp(buf, UTF32BEBOM_DATA, sizeof(UTF32BEBOM_DATA)) == 0) { return CharsetCode::UTF32BEBOM; } return inputCode; case CharsetCode::UTF32LE: // 区分有无BOM if (bufSize >= sizeof(UTF32LEBOM_DATA) && memcmp(buf, UTF32LEBOM_DATA, sizeof(UTF32LEBOM_DATA)) == 0) { return CharsetCode::UTF32LEBOM; } return inputCode; } return inputCode; } CharsetCode DetectEncodingPlain(uchardet *det, const char *buf, std::size_t bufSize, int times) { if (bufSize == 0) { return CharsetCode::EMPTY; } if (bufSize > std::numeric_limits::max()) { throw MyRuntimeError(MessageId::STRING_LENGTH_OUT_OF_LIMIT); } auto [ucsdetResult, ucsdetConfidence] = DetectByUCSDet(buf, static_cast(bufSize)); if (ucsdetConfidence >= 95 && ucsdetResult.find("UTF") != string::npos) { // ucsdet如果判定为UTF-8/UTF-16BE|LE等,那么相信它 return ToCharsetCodeFinal(ToCharsetCode(ucsdetResult), buf, bufSize); } auto [uchardetResult, uchardetConfidence] = DetectByUCharDet(det, buf, bufSize); if (uchardetConfidence >= 95) { // uchardet如果有95及以上的信心,那么直接相信它 return ToCharsetCodeFinal(ToCharsetCode(uchardetResult), buf, bufSize); } // ucsdet和uchardet都没把握 return CharsetCode::UNKNOWN; /* // update: CED的探测结果不稳定,而且可能出现识别出错但reliable==true的情况, // 暂时先不用CED了。 auto [cedResult, reliable] = DetectByCED(buf, bufSize); if (reliable) { return cedResult; } if (times > 0) { // 第2次尝试失败,认命了 return CharsetCode::UNKNOWN; } // 裁掉ASCII,再战! std::vector data(bufSize); std::memcpy(data.data(), buf, bufSize); RemoveASCII(data); return DetectEncodingPlain(data.data(), data.size(), 1); */ } CharsetCode DetectEncoding(uchardet *det, const char *buf, std::size_t bufSize) { return DetectEncodingPlain(det, buf, bufSize, 0); } ================================================ FILE: src/Core/Detect.h ================================================ #pragma once // self #include "CharsetCode.h" // third-party lib #include // standard lib #include std::tuple DetectByUCharDet(uchardet *det, const char *buf, std::size_t bufSize); /** * @param bufSize 受ucsdet限制只能接受int32_t */ std::tuple DetectByUCSDet(const char *buf, int32_t bufSize); /** * @exception runtime_error 如果CED中定义的名称在CharsetCode中没有定义,将抛出异常 */ std::tuple DetectByCED(const char *buf, int len); CharsetCode ToCharsetCodeFinal(std::string charsetStr, const char *buf, std::size_t bufSize); /** * 探测编码集。 * return 探测出的编码集,根据探测出的编码集解码出的Unicode文本片段(最大64bytes),文本片段长度 * @exception file_io_error 读文件失败 * @exception runtime_error ucnv出错。code */ CharsetCode DetectEncodingPlain(uchardet *det, const char *buf, std::size_t bufSize, int times); /** * 探测编码集。 * return 探测出的编码集,根据探测出的编码集解码出的Unicode文本片段(最大64bytes),文本片段长度 * @exception file_io_error 读文件失败 * @exception runtime_error ucnv出错。code */ CharsetCode DetectEncoding(uchardet *det, const char *buf, std::size_t bufSize); ================================================ FILE: src/Core/Exceptions.cpp ================================================ #include "Exceptions.h" ================================================ FILE: src/Core/Exceptions.h ================================================ #pragma once #include "Vietnamese.h" #include "CharsetCode.h" #include "Messages.h" #include #include #include #include class MyRuntimeError : public std::runtime_error { public: MyRuntimeError(MessageId mid) : std::runtime_error(MessageIdToBasicString(mid)), mid(mid), errMsg(MessageIdToBasicString(mid)) { #ifndef NDEBUG assert(errMsg.find("{") == std::string::npos); #endif } MyRuntimeError(MessageId mid, const std::string errMsg) : std::runtime_error(errMsg), mid(mid), errMsg(errMsg) {} virtual const std::string ToLocalString(TranslatorBase *translator) const noexcept { return translator->MessageIdToString(mid); } protected: MessageId mid; const std::string errMsg; }; /** * 不可分配字符错误 * 用于转换时出现不能转换到指定编码的情形。 * err.what()方法会返回不能转换的字符组成的字符串(utf-8编码)。 */ class UnassignedCharError : public MyRuntimeError { public: UnassignedCharError(const std::string &unassignedChars) noexcept : MyRuntimeError(MessageId::WILL_LOST_CHARACTERS, fmt::format(MessageIdToBasicString(MessageId::WILL_LOST_CHARACTERS), unassignedChars)), unassignedChars(unassignedChars) {} virtual const std::string ToLocalString(TranslatorBase *translator) const noexcept { return fmt::format(translator->MessageIdToString(mid), unassignedChars); } const std::string GetUnassignedChar() const noexcept { return unassignedChars; } private: std::string unassignedChars; }; class io_error_ignore : public std::runtime_error { public: io_error_ignore() : runtime_error("ignored") {} }; class UCNVError : public MyRuntimeError { public: UCNVError(int errCode) noexcept : MyRuntimeError(MessageId::UCNV_ERROR, fmt::format(MessageIdToBasicString(MessageId::UCNV_ERROR), errCode)), errCode(errCode) {} virtual const std::string ToLocalString(TranslatorBase *translator) const noexcept { return fmt::format(translator->MessageIdToString(mid), errCode); } private: int errCode; }; class TruncatedCharFoundError : public UCNVError { public: TruncatedCharFoundError() : UCNVError(U_TRUNCATED_CHAR_FOUND) {} virtual const std::string ToLocalString(TranslatorBase *translator) const noexcept { return fmt::format(translator->MessageIdToString(MessageId::TRUNCATED_CHAR_FOUND)); } }; class IllegalCharFoundError : public UCNVError { public: IllegalCharFoundError(CharsetCode decodeAs, std::size_t position, std::string corruptedDataPiece) noexcept : UCNVError(U_ILLEGAL_CHAR_FOUND), decodeAs(decodeAs), position(position), corruptedDataPiece(corruptedDataPiece) {} virtual const std::string ToLocalString(TranslatorBase *translator) const noexcept { return fmt::format(translator->MessageIdToString(MessageId::CORRUPTED_DATA), ToViewCharsetName(decodeAs), position, 32, to_hex(corruptedDataPiece)); } private: CharsetCode decodeAs; std::size_t position; std::string corruptedDataPiece; // the data at corrupted position, at least 32 bytes }; using InvalidCharFoundError = IllegalCharFoundError; class CharsetNotSupportedError : public MyRuntimeError { public: CharsetNotSupportedError(CharsetCode targetCode) : MyRuntimeError( MessageId::CANNOT_CONVERT_CHARSET, fmt::format(MessageIdToBasicString(MessageId::CANNOT_CONVERT_CHARSET), ToViewCharsetName(targetCode))), targetCode(targetCode) {} virtual const std::string ToLocalString(TranslatorBase *translator) const noexcept { return fmt::format(translator->MessageIdToString(mid), ToViewCharsetName(targetCode)); } private: CharsetCode targetCode; }; class ConvertError : public MyRuntimeError { public: ConvertError(std::string content, std::size_t position, viet::Encoding srcEncoding, viet::Encoding destEncoding) noexcept : MyRuntimeError(MessageId::VIETNAMESE_CONVERT_ERROR, fmt::format(MessageIdToBasicString(MessageId::VIETNAMESE_CONVERT_ERROR), to_string(srcEncoding), to_string(srcEncoding), position, content)), content(content), position(position), srcEncoding(srcEncoding), destEncoding(destEncoding) {} virtual const std::string ToLocalString(TranslatorBase *translator) const noexcept { return fmt::format(translator->MessageIdToString(mid), to_string(srcEncoding), to_string(srcEncoding), position, content); } private: viet::Encoding srcEncoding; viet::Encoding destEncoding; std::size_t position; std::string content; }; class FileIOError : public MyRuntimeError { public: FileIOError(MessageId mid, const std::string &filename) noexcept : MyRuntimeError(mid, fmt::format(MessageIdToBasicString(mid), filename)), filename(filename) { assert(mid == MessageId::FAILED_TO_WRITE_FILE || mid == MessageId::FILE_SIZE_OUT_OF_LIMIT || mid == MessageId::FAILED_TO_OPEN_FILE || mid == MessageId::NO_PERMISSION); } virtual const std::string ToLocalString(TranslatorBase *translator) const noexcept { return fmt::format(translator->MessageIdToString(mid), filename); } private: std::string filename; }; ================================================ FILE: src/Core/LineBreaks.cpp ================================================ #include "LineBreaks.h" #include "Exceptions.h" #include // LineBreaks类型到字符串的映射表 const doublemap lineBreaksMap = { {LineBreaks::CRLF, u8"CRLF"}, {LineBreaks::LF, u8"LF"}, {LineBreaks::CR, u8"CR"}, {LineBreaks::EMPTY, u8""}, {LineBreaks::MIX, u8"N/A(Mixed)"}, {LineBreaks::UNKNOWN, u8"Unknown"}}; std::string LineBreaksToViewName(LineBreaks linebreaks) noexcept { return lineBreaksMap.at(linebreaks); } LineBreaks ViewNameToLineBreaks(std::string viewName) noexcept { return lineBreaksMap.at(viewName); } LineBreaks GetLineBreaks(const UChar *buf, std::size_t len) { LineBreaks ans = LineBreaks::EMPTY; for (std::size_t i = 0; i < len;) { const UChar &c = buf[i]; if (c == UChar(u'\r')) { // \r\n if (i < len && buf[i + 1] == UChar(u'\n')) { if (ans == LineBreaks::EMPTY) { ans = LineBreaks::CRLF; } else { if (ans != LineBreaks::CRLF) { ans = LineBreaks::MIX; return ans; } } i += 2; continue; } // \r if (ans == LineBreaks::EMPTY) { ans = LineBreaks::CR; } else { if (ans != LineBreaks::CR) { ans = LineBreaks::MIX; return ans; } } i++; continue; } // \n if (c == UChar(u'\n')) { if (ans == LineBreaks::EMPTY) { ans = LineBreaks::LF; } else { if (ans != LineBreaks::LF) { ans = LineBreaks::MIX; return ans; } } i++; continue; } i++; } return ans; } void ChangeLineBreaks(std::u16string &str, LineBreaks targetLineBreak) { std::vector out; std::size_t len = str.size(); out.reserve(len); std::vector lineBreak; switch (targetLineBreak) { case LineBreaks::CRLF: lineBreak = {u'\r', u'\n'}; break; case LineBreaks::LF: lineBreak = {u'\n'}; break; case LineBreaks::CR: lineBreak = {u'\r'}; break; } for (int i = 0; i < len;) { UChar c = str[i]; if (c == UChar(u'\r')) { // \r\n if (i < len && str[i + 1] == UChar(u'\n')) { out.insert(out.end(), lineBreak.begin(), lineBreak.end()); i += 2; continue; } // \r out.insert(out.end(), lineBreak.begin(), lineBreak.end()); i++; continue; } if (c == UChar(u'\n')) { out.insert(out.end(), lineBreak.begin(), lineBreak.end()); i++; continue; } out.push_back(c); i++; } if (out.size() >= std::numeric_limits::max()) { throw MyRuntimeError(MessageId::STRING_LENGTH_OUT_OF_LIMIT); } str.resize(out.size()); memcpy(str.data(), out.data(), out.size() * sizeof(UChar)); return; } ================================================ FILE: src/Core/LineBreaks.h ================================================ #pragma once // self #include "doublemap.h" #include // third-party lib #include #undef min #undef max enum class LineBreaks { CRLF, LF, CR, EMPTY, MIX, UNKNOWN }; std::string LineBreaksToViewName(LineBreaks linebreaks) noexcept; LineBreaks ViewNameToLineBreaks(std::string viewName) noexcept; // 识别换行符 LineBreaks GetLineBreaks(const UChar *buf, std::size_t len); // 变更换行符 void ChangeLineBreaks(std::u16string &str, LineBreaks targetLineBreak); ================================================ FILE: src/Core/Messages.cpp ================================================ #include "Messages.h" ================================================ FILE: src/Core/Messages.h ================================================ #pragma once #include "TranslatorBase.h" #include enum class MessageId { BEGIN = 0, WILL_LOST_CHARACTERS, // "Some characters will be lost when converting to the target encoding: {}" INVALID_CHARACTERS, // "Content contains invalid characters" UCNV_ERROR, // "UCNV error. error code: {}" VIETNAMESE_CONVERT_ERROR, // "[{}->{}] convert error at position: {} with content: {}" TRUNCATED_CHAR_FOUND, // "Truncated char found" ADD_REDUNDANTLY, // "Duplicate addition" NO_DETECTED_ENCODING, // "No encoding detected" FAILED_TO_WRITE_FILE, // "Write failed: {}" FILE_SIZE_OUT_OF_LIMIT, // "File size exceeds limit: {}" STRING_LENGTH_OUT_OF_LIMIT, // "String length exceeds limit" FAILED_TO_OPEN_FILE, // "Failed to open file: {}" CORRUPTED_DATA, // "Corrupted data found while decode as {}. position: {} content(in hex, shown {} bytes at // most): {}" CANNOT_CONVERT_CHARSET, // "Conversion to the {} charset is not supported" NO_PERMISSION, // "No permission. Tip: The file might be read-only: {}" END, }; static_assert(static_cast(MessageId::END) < 100); inline std::string MessageIdToBasicString(MessageId mid) noexcept { switch (mid) { case MessageId::WILL_LOST_CHARACTERS: return "Some characters will be lost when converting to the target encoding: {}"; case MessageId::INVALID_CHARACTERS: return "Content contains invalid characters"; case MessageId::UCNV_ERROR: return "UCNV error. error code: {}"; case MessageId::VIETNAMESE_CONVERT_ERROR: return "[{}->{}] convert error at position: {} with content: {}"; case MessageId::TRUNCATED_CHAR_FOUND: return "Truncated char found"; case MessageId::ADD_REDUNDANTLY: return "Duplicate addition"; case MessageId::NO_DETECTED_ENCODING: return "No encoding detected"; case MessageId::FAILED_TO_WRITE_FILE: return "Write failed: {}"; case MessageId::FILE_SIZE_OUT_OF_LIMIT: return "File size exceeds limit: {}"; case MessageId::STRING_LENGTH_OUT_OF_LIMIT: return "String length exceeds limit"; case MessageId::FAILED_TO_OPEN_FILE: return "Failed to open file: {}"; case MessageId::CORRUPTED_DATA: return "Corrupted data found while decode as {}. position: {} content(in hex, shown {} bytes at most): " "{}"; case MessageId::CANNOT_CONVERT_CHARSET: return "Conversion to the {} charset is not supported"; case MessageId::NO_PERMISSION: return "No permission. Tip: The file might be read-only: {}"; default: assert(0); } return "internal error"; } ================================================ FILE: src/Core/TranslatorBase.h ================================================ #pragma once #include enum class MessageId; class TranslatorBase { public: virtual std::string MessageIdToString(MessageId mid) const noexcept = 0; }; ================================================ FILE: src/Core/UCNVHelper.cpp ================================================ #include "UCNVHelper.h" #include "Exceptions.h" void DealWithUCNVError(UErrorCode err) { switch (err) { case U_ZERO_ERROR: break; case U_AMBIGUOUS_ALIAS_WARNING: // windows-1252 时会出这个,暂时忽略 break; // FIXME // case U_INVALID_CHAR_FOUND: // throw UnassignedCharError(errStr); // case U_ILLEGAL_CHAR_FOUND: // throw UnassignedCharError(errStr); default: throw UCNVError(err); break; } } ================================================ FILE: src/Core/UCNVHelper.h ================================================ #pragma once // self // third-party lib #include // standard lib #include /* * @exception UCNVError ucnv出错。code */ void DealWithUCNVError(UErrorCode err); ================================================ FILE: src/Core/Vietnamese.cpp ================================================ #include "Vietnamese.h" #include "Exceptions.h" #include "Common/tstring.h" #include #include namespace viet { namespace internal { const std::array utf8Table = { "\xc3\x80", "\xc3\x81", "\xc3\x82", "\xc3\x83", "\xc3\x88", "\xc3\x89", "\xc3\x8a", "\xc3\x8c", "\xc3\x8d", "\xc3\x92", "\xc3\x93", "\xc3\x94", "\xc3\x95", "\xc3\x99", "\xc3\x9a", "\xc3\x9d", "\xc3\xa0", "\xc3\xa1", "\xc3\xa2", "\xc3\xa3", "\xc3\xa8", "\xc3\xa9", "\xc3\xaa", "\xc3\xac", "\xc3\xad", "\xc3\xb2", "\xc3\xb3", "\xc3\xb4", "\xc3\xb5", "\xc3\xb9", "\xc3\xba", "\xc3\xbd", "\xc4\x82", "\xc4\x83", "\xc4\x90", "\xc4\x91", "\xc4\xa8", "\xc4\xa9", "\xc5\xa8", "\xc5\xa9", "\xc6\xa0", "\xc6\xa1", "\xc6\xaf", "\xc6\xb0", "\xe1\xba\xa0", "\xe1\xba\xa1", "\xe1\xba\xa2", "\xe1\xba\xa3", "\xe1\xba\xa4", "\xe1\xba\xa5", "\xe1\xba\xa6", "\xe1\xba\xa7", "\xe1\xba\xa8", "\xe1\xba\xa9", "\xe1\xba\xaa", "\xe1\xba\xab", "\xe1\xba\xac", "\xe1\xba\xad", "\xe1\xba\xae", "\xe1\xba\xaf", "\xe1\xba\xb0", "\xe1\xba\xb1", "\xe1\xba\xb2", "\xe1\xba\xb3", "\xe1\xba\xb4", "\xe1\xba\xb5", "\xe1\xba\xb6", "\xe1\xba\xb7", "\xe1\xba\xb8", "\xe1\xba\xb9", "\xe1\xba\xba", "\xe1\xba\xbb", "\xe1\xba\xbc", "\xe1\xba\xbd", "\xe1\xba\xbe", "\xe1\xba\xbf", "\xe1\xbb\x80", "\xe1\xbb\x81", "\xe1\xbb\x82", "\xe1\xbb\x83", "\xe1\xbb\x84", "\xe1\xbb\x85", "\xe1\xbb\x86", "\xe1\xbb\x87", "\xe1\xbb\x88", "\xe1\xbb\x89", "\xe1\xbb\x8a", "\xe1\xbb\x8b", "\xe1\xbb\x8c", "\xe1\xbb\x8d", "\xe1\xbb\x8e", "\xe1\xbb\x8f", "\xe1\xbb\x90", "\xe1\xbb\x91", "\xe1\xbb\x92", "\xe1\xbb\x93", "\xe1\xbb\x94", "\xe1\xbb\x95", "\xe1\xbb\x96", "\xe1\xbb\x97", "\xe1\xbb\x98", "\xe1\xbb\x99", "\xe1\xbb\x9a", "\xe1\xbb\x9b", "\xe1\xbb\x9c", "\xe1\xbb\x9d", "\xe1\xbb\x9e", "\xe1\xbb\x9f", "\xe1\xbb\xa0", "\xe1\xbb\xa1", "\xe1\xbb\xa2", "\xe1\xbb\xa3", "\xe1\xbb\xa4", "\xe1\xbb\xa5", "\xe1\xbb\xa6", "\xe1\xbb\xa7", "\xe1\xbb\xa8", "\xe1\xbb\xa9", "\xe1\xbb\xaa", "\xe1\xbb\xab", "\xe1\xbb\xac", "\xe1\xbb\xad", "\xe1\xbb\xae", "\xe1\xbb\xaf", "\xe1\xbb\xb0", "\xe1\xbb\xb1", "\xe1\xbb\xb2", "\xe1\xbb\xb3", "\xe1\xbb\xb4", "\xe1\xbb\xb5", "\xe1\xbb\xb6", "\xe1\xbb\xb7", "\xe1\xbb\xb8", "\xe1\xbb\xb9", }; const std::array utf16LETable = { u"\u00C0", u"\u00C1", u"\u00C2", u"\u00C3", u"\u00C8", u"\u00C9", u"\u00CA", u"\u00CC", u"\u00CD", u"\u00D2", u"\u00D3", u"\u00D4", u"\u00D5", u"\u00D9", u"\u00DA", u"\u00DD", u"\u00E0", u"\u00E1", u"\u00E2", u"\u00E3", u"\u00E8", u"\u00E9", u"\u00EA", u"\u00EC", u"\u00ED", u"\u00F2", u"\u00F3", u"\u00F4", u"\u00F5", u"\u00F9", u"\u00FA", u"\u00FD", u"\u0102", u"\u0103", u"\u0110", u"\u0111", u"\u0128", u"\u0129", u"\u0168", u"\u0169", u"\u01A0", u"\u01A1", u"\u01AF", u"\u01B0", u"\u1EA0", u"\u1EA1", u"\u1EA2", u"\u1EA3", u"\u1EA4", u"\u1EA5", u"\u1EA6", u"\u1EA7", u"\u1EA8", u"\u1EA9", u"\u1EAA", u"\u1EAB", u"\u1EAC", u"\u1EAD", u"\u1EAE", u"\u1EAF", u"\u1EB0", u"\u1EB1", u"\u1EB2", u"\u1EB3", u"\u1EB4", u"\u1EB5", u"\u1EB6", u"\u1EB7", u"\u1EB8", u"\u1EB9", u"\u1EBA", u"\u1EBB", u"\u1EBC", u"\u1EBD", u"\u1EBE", u"\u1EBF", u"\u1EC0", u"\u1EC1", u"\u1EC2", u"\u1EC3", u"\u1EC4", u"\u1EC5", u"\u1EC6", u"\u1EC7", u"\u1EC8", u"\u1EC9", u"\u1ECA", u"\u1ECB", u"\u1ECC", u"\u1ECD", u"\u1ECE", u"\u1ECF", u"\u1ED0", u"\u1ED1", u"\u1ED2", u"\u1ED3", u"\u1ED4", u"\u1ED5", u"\u1ED6", u"\u1ED7", u"\u1ED8", u"\u1ED9", u"\u1EDA", u"\u1EDB", u"\u1EDC", u"\u1EDD", u"\u1EDE", u"\u1EDF", u"\u1EE0", u"\u1EE1", u"\u1EE2", u"\u1EE3", u"\u1EE4", u"\u1EE5", u"\u1EE6", u"\u1EE7", u"\u1EE8", u"\u1EE9", u"\u1EEA", u"\u1EEB", u"\u1EEC", u"\u1EED", u"\u1EEE", u"\u1EEF", u"\u1EF0", u"\u1EF1", u"\u1EF2", u"\u1EF3", u"\u1EF4", u"\u1EF5", u"\u1EF6", u"\u1EF7", u"\u1EF8", u"\u1EF9", }; // overlapped with ASCII const std::array vniTable = { "\x41\xD8", "\x41\xD9", "\x41\xC2", "\x41\xD5", "\x45\xD8", "\x45\xD9", "\x45\xC2", "\xCC", "\xCD", "\x4F\xD8", "\x4F\xD9", "\x4F\xC2", "\x4F\xD5", "\x55\xD8", "\x55\xD9", "\x59\xD9", "\x61\xF8", "\x61\xF9", "\x61\xE2", "\x61\xF5", "\x65\xF8", "\x65\xF9", "\x65\xE2", "\xEC", "\xED", "\x6F\xF8", "\x6F\xF9", "\x6F\xE2", "\x6F\xF5", "\x75\xF8", "\x75\xF9", "\x79\xF9", "\x41\xCA", "\x61\xEA", "\xD1", "\xF1", "\xD3", "\xF3", "\x55\xD5", "\x75\xF5", "\xD4", "\xF4", "\xD6", "\xF6", "\x41\xCF", "\x61\xEF", "\x41\xDB", "\x61\xFB", "\x41\xC1", "\x61\xE1", "\x41\xC0", "\x61\xE0", "\x41\xC5", "\x61\xE5", "\x41\xC3", "\x61\xE3", "\x41\xC4", "\x61\xE4", "\x41\xC9", "\x61\xE9", "\x41\xC8", "\x61\xE8", "\x41\xDA", "\x61\xFA", "\x41\xDC", "\x61\xFC", "\x41\xCB", "\x61\xEB", "\x45\xCF", "\x65\xEF", "\x45\xDB", "\x65\xFB", "\x45\xD5", "\x65\xF5", "\x45\xC1", "\x65\xE1", "\x45\xC0", "\x65\xE0", "\x45\xC5", "\x65\xE5", "\x45\xC3", "\x65\xE3", "\x45\xC4", "\x65\xE4", "\xC6", "\xE6", "\xD2", "\xF2", "\x4F\xCF", "\x6F\xEF", "\x4F\xDB", "\x6F\xFB", "\x4F\xC1", "\x6F\xE1", "\x4F\xC0", "\x6F\xE0", "\x4F\xC5", "\x6F\xE5", "\x4F\xC3", "\x6F\xE3", "\x4F\xC4", "\x6F\xE4", "\xD4\xD9", "\xF4\xF9", "\xD4\xD8", "\xF4\xF8", "\xD4\xDB", "\xF4\xFB", "\xD4\xD5", "\xF4\xF5", "\xD4\xCF", "\xF4\xEF", "\x55\xCF", "\x75\xEF", "\x55\xDB", "\x75\xFB", "\xD6\xD9", "\xF6\xF9", "\xD6\xD8", "\xF6\xF8", "\xD6\xDB", "\xF6\xFB", "\xD6\xD5", "\xF6\xF5", "\xD6\xCF", "\xF6\xEF", "\x59\xD8", "\x79\xF8", "\xCE", "\xEE", "\x59\xDB", "\x79\xFB", "\x59\xD5", "\x79\xF5", }; // overlapped with ASCII const std::array vpsTable = { '\x80', '\xC1', '\xC2', '\x82', '\xD7', '\xC9', '\xCA', '\xB5', '\xB4', '\xBC', '\xB9', '\xD4', '\xBE', '\xA8', '\xDA', '\xDD', '\xE0', '\xE1', '\xE2', '\xE3', '\xE8', '\xE9', '\xEA', '\xEC', '\xED', '\xF2', '\xF3', '\xF4', '\xF5', '\xF9', '\xFA', '\x9A', '\x88', '\xE6', '\xF1', '\xC7', '\xB8', '\xEF', '\xAC', '\xDB', '\xF7', '\xD6', '\xD0', '\xDC', '\x2', '\xE5', '\x81', '\xE4', '\x83', '\xC3', '\x84', '\xC0', '\x85', '\xC4', '\x1C', '\xC5', '\x3', '\xC6', '\x8D', '\xA1', '\x8E', '\xA2', '\x8F', '\xA3', '\xF0', '\xA4', '\x4', '\xA5', '\x5', '\xCB', '\xDE', '\xC8', '\xFE', '\xEB', '\x90', '\x89', '\x93', '\x8A', '\x94', '\x8B', '\x95', '\xCD', '\x6', '\x8C', '\xB7', '\xCC', '\x10', '\xCE', '\x11', '\x86', '\xBD', '\xD5', '\x96', '\xD3', '\x97', '\xD2', '\x98', '\xB0', '\x99', '\x87', '\x12', '\xB6', '\x9D', '\xA7', '\x9E', '\xA9', '\x9F', '\xAA', '\xA6', '\xAB', '\x13', '\xAE', '\x14', '\xF8', '\xD1', '\xFB', '\xAD', '\xD9', '\xAF', '\xD8', '\xB1', '\xBA', '\x1D', '\xBB', '\x15', '\xBF', '\xB2', '\xFF', '\x19', '\x9C', '\xFD', '\x9B', '\xB3', '\xCF', }; // overlapped with ASCII const std::array visciiTable = { '\xC0', '\xC1', '\xC2', '\xC3', '\xC8', '\xC9', '\xCA', '\xCC', '\xCD', '\xD2', '\xD3', '\xD4', '\xA0', '\xD9', '\xDA', '\xDD', '\xE0', '\xE1', '\xE2', '\xE3', '\xE8', '\xE9', '\xEA', '\xEC', '\xED', '\xF2', '\xF3', '\xF4', '\xF5', '\xF9', '\xFA', '\xFD', '\xC5', '\xE5', '\xD0', '\xF0', '\xCE', '\xEE', '\x9D', '\xFB', '\xB4', '\xBD', '\xBF', '\xDF', '\x80', '\xD5', '\xC4', '\xE4', '\x84', '\xA4', '\x85', '\xA5', '\x86', '\xA6', '\x6', '\xE7', '\x87', '\xA7', '\x81', '\xA1', '\x82', '\xA2', '\x2', '\xC6', '\x5', '\xC7', '\x83', '\xA3', '\x89', '\xA9', '\xCB', '\xEB', '\x88', '\xA8', '\x8A', '\xAA', '\x8B', '\xAB', '\x8C', '\xAC', '\x8D', '\xAD', '\x8E', '\xAE', '\x9B', '\xEF', '\x98', '\xB8', '\x9A', '\xF7', '\x99', '\xF6', '\x8F', '\xAF', '\x90', '\xB0', '\x91', '\xB1', '\x92', '\xB2', '\x93', '\xB5', '\x95', '\xBE', '\x96', '\xB6', '\x97', '\xB7', '\xB3', '\xDE', '\x94', '\xFE', '\x9E', '\xF8', '\x9C', '\xFC', '\xBA', '\xD1', '\xBB', '\xD7', '\xBC', '\xD8', '\xFF', '\xE6', '\xB9', '\xF1', '\x9F', '\xCF', '\x1E', '\xDC', '\x14', '\xD6', '\x19', '\xDB', }; // NOTICE: TCVN3 is not double-byte, but due to the nature of its encoding, capital letters (vowels) are mapped to a // separate, capital font that is similar to the normal, lowercase one. As such, the hex code and character // representation of TCVN3 capital letters in the table is not correct—it is shown here for the purpose of illustration. // Users must take this peculiarity into account when converting files in TCVN3 format to Unicode; some post-conversion // editing is necessary. const std::array tcvn3Table = { "\x41\xB5", "\x41\xB8", "\xA2", "\x41\xB7", "\x45\xCC", "\x45\xD0", "\xA3", "\x49\xD7", "\x49\xDD", "\x4F\xDF", "\x4F\xE3", "\xA4", "\x4F\xE2", "\x55\xEF", "\x55\xF3", "\x59\xFD", "\xB5", "\xB8", "\xA9", "\xB7", "\xCC", "\xD0", "\xAA", "\xD7", "\xDD", "\xDF", "\xE3", "\xAB", "\xE2", "\xEF", "\xF3", "\xFD", "\xA1", "\xA8", "\xA7", "\xAE", "\x49\xDC", "\xDC", "\x55\xF2", "\xF2", "\xA5", "\xAC", "\xA6", "\xAD", "\x41\xB9", "\xB9", "\x41\xB6", "\xB6", "\xA2\xCA", "\xCA", "\xA2\xC7", "\xC7", "\xA2\xC8", "\xC8", "\xA2\xC9", "\xC9", "\xA2\xCB", "\xCB", "\xA1\xBE", "\xBE", "\xA1\xBB", "\xBB", "\xA1\xBC", "\xBC", "\xA1\xBD", "\xBD", "\xA1\xC6", "\xC6", "\x45\xD1", "\xD1", "\x45\xCE", "\xCE", "\x45\xCF", "\xCF", "\xA3\xD5", "\xD5", "\xA3\xD2", "\xD2", "\xA3\xD3", "\xD3", "\xA3\xD4", "\xD4", "\xA3\xD6", "\xD6", "\x49\xD8", "\xD8", "\x49\xDE", "\xDE", "\x4F\xE4", "\xE4", "\x4F\xE1", "\xE1", "\xA4\xE8", "\xE8", "\xA4\xE5", "\xE5", "\xA4\xE6", "\xE6", "\xA4\xE7", "\xE7", "\xA4\xE9", "\xE9", "\xA5\xED", "\xED", "\xA5\xEA", "\xEA", "\xA5\xEB", "\xEB", "\xA5\xEC", "\xEC", "\xA5\xEE", "\xEE", "\x55\xF4", "\xF4", "\x55\xF1", "\xF1", "\xA6\xF8", "\xF8", "\xA6\xF5", "\xF5", "\xA6\xF6", "\xF6", "\xA6\xF7", "\xF7", "\xA6\xF9", "\xF9", "\x59\xFA", "\xFA", "\x59\xFE", "\xFE", "\x59\xFB", "\xFB", "\x59\xFC", "\xFC", }; const std::array descriptionTable = { "LATIN CAPITAL LETTER A WITH GRAVE", "LATIN CAPITAL LETTER A WITH ACUTE", "LATIN CAPITAL LETTER A WITH CIRCUMFLEX", "LATIN CAPITAL LETTER A WITH TILDE", "LATIN CAPITAL LETTER E WITH GRAVE", "LATIN CAPITAL LETTER E WITH ACUTE", "LATIN CAPITAL LETTER E WITH CIRCUMFLEX", "LATIN CAPITAL LETTER I WITH GRAVE", "LATIN CAPITAL LETTER I WITH ACUTE", "LATIN CAPITAL LETTER O WITH GRAVE", "LATIN CAPITAL LETTER O WITH ACUTE", "LATIN CAPITAL LETTER O WITH CIRCUMFLEX", "LATIN CAPITAL LETTER O WITH TILDE", "LATIN CAPITAL LETTER U WITH GRAVE", "LATIN CAPITAL LETTER U WITH ACUTE", "LATIN CAPITAL LETTER Y WITH ACUTE", "LATIN SMALL LETTER A WITH GRAVE", "LATIN SMALL LETTER A WITH ACUTE", "LATIN SMALL LETTER A WITH CIRCUMFLEX", "LATIN SMALL LETTER A WITH TILDE", "LATIN SMALL LETTER E WITH GRAVE", "LATIN SMALL LETTER E WITH ACUTE", "LATIN SMALL LETTER E WITH CIRCUMFLEX", "LATIN SMALL LETTER I WITH GRAVE", "LATIN SMALL LETTER I WITH ACUTE", "LATIN SMALL LETTER O WITH GRAVE", "LATIN SMALL LETTER O WITH ACUTE", "LATIN SMALL LETTER O WITH CIRCUMFLEX", "LATIN SMALL LETTER O WITH TILDE", "LATIN SMALL LETTER U WITH GRAVE", "LATIN SMALL LETTER U WITH ACUTE", "LATIN SMALL LETTER Y WITH ACUTE", "LATIN CAPITAL LETTER A WITH BREVE", "LATIN SMALL LETTER A WITH BREVE", "LATIN CAPITAL LETTER D WITH STROKE", "LATIN SMALL LETTER D WITH STROKE", "LATIN CAPITAL LETTER I WITH TILDE", "LATIN SMALL LETTER I WITH TILDE", "LATIN CAPITAL LETTER U WITH TILDE", "LATIN SMALL LETTER U WITH TILDE", "LATIN CAPITAL LETTER O WITH HORN", "LATIN SMALL LETTER O WITH HORN", "LATIN CAPITAL LETTER U WITH HORN", "LATIN SMALL LETTER U WITH HORN", "LATIN CAPITAL LETTER A WITH DOT BELOW", "LATIN SMALL LETTER A WITH DOT BELOW", "LATIN CAPITAL LETTER A WITH HOOK ABOVE", "LATIN SMALL LETTER A WITH HOOK ABOVE", "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE", "LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE", "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE", "LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE", "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE", "LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE", "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE", "LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE", "LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW", "LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW", "LATIN CAPITAL LETTER A WITH BREVE AND ACUTE", "LATIN SMALL LETTER A WITH BREVE AND ACUTE", "LATIN CAPITAL LETTER A WITH BREVE AND GRAVE", "LATIN SMALL LETTER A WITH BREVE AND GRAVE", "LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE", "LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE", "LATIN CAPITAL LETTER A WITH BREVE AND TILDE", "LATIN SMALL LETTER A WITH BREVE AND TILDE", "LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW", "LATIN SMALL LETTER A WITH BREVE AND DOT BELOW", "LATIN CAPITAL LETTER E WITH DOT BELOW", "LATIN SMALL LETTER E WITH DOT BELOW", "LATIN CAPITAL LETTER E WITH HOOK ABOVE", "LATIN SMALL LETTER E WITH HOOK ABOVE", "LATIN CAPITAL LETTER E WITH TILDE", "LATIN SMALL LETTER E WITH TILDE", "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE", "LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE", "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE", "LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE", "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE", "LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE", "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE", "LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE", "LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW", "LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW", "LATIN CAPITAL LETTER I WITH HOOK ABOVE", "LATIN SMALL LETTER I WITH HOOK ABOVE", "LATIN CAPITAL LETTER I WITH DOT BELOW", "LATIN SMALL LETTER I WITH DOT BELOW", "LATIN CAPITAL LETTER O WITH DOT BELOW", "LATIN SMALL LETTER O WITH DOT BELOW", "LATIN CAPITAL LETTER O WITH HOOK ABOVE", "LATIN SMALL LETTER O WITH HOOK ABOVE", "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE", "LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE", "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE", "LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE", "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE", "LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE", "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE", "LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE", "LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW", "LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW", "LATIN CAPITAL LETTER O WITH HORN AND ACUTE", "LATIN SMALL LETTER O WITH HORN AND ACUTE", "LATIN CAPITAL LETTER O WITH HORN AND GRAVE", "LATIN SMALL LETTER O WITH HORN AND GRAVE", "LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE", "LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE", "LATIN CAPITAL LETTER O WITH HORN AND TILDE", "LATIN SMALL LETTER O WITH HORN AND TILDE", "LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW", "LATIN SMALL LETTER O WITH HORN AND DOT BELOW", "LATIN CAPITAL LETTER U WITH DOT BELOW", "LATIN SMALL LETTER U WITH DOT BELOW", "LATIN CAPITAL LETTER U WITH HOOK ABOVE", "LATIN SMALL LETTER U WITH HOOK ABOVE", "LATIN CAPITAL LETTER U WITH HORN AND ACUTE", "LATIN SMALL LETTER U WITH HORN AND ACUTE", "LATIN CAPITAL LETTER U WITH HORN AND GRAVE", "LATIN SMALL LETTER U WITH HORN AND GRAVE", "LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE", "LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE", "LATIN CAPITAL LETTER U WITH HORN AND TILDE", "LATIN SMALL LETTER U WITH HORN AND TILDE", "LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW", "LATIN SMALL LETTER U WITH HORN AND DOT BELOW", "LATIN CAPITAL LETTER Y WITH GRAVE", "LATIN SMALL LETTER Y WITH GRAVE", "LATIN CAPITAL LETTER Y WITH DOT BELOW", "LATIN SMALL LETTER Y WITH DOT BELOW", "LATIN CAPITAL LETTER Y WITH HOOK ABOVE", "LATIN SMALL LETTER Y WITH HOOK ABOVE", "LATIN CAPITAL LETTER Y WITH TILDE", "LATIN SMALL LETTER Y WITH TILDE", }; } // namespace internal std::unordered_map vniToUtf8; std::unordered_map vpsToUtf8; std::unordered_map viscii3ToUtf8; std::unordered_map tcvn3ToUtf8; std::unordered_map vniToUtf16LE; std::unordered_map vpsToUtf16LE; std::unordered_map visciiToUtf16LE; std::unordered_map tcvn3ToUtf16LE; struct Rune { const std::string_view utf8; const std::u16string_view utf16LE; const std::string_view vni; char vps; char viscii; const std::string_view tcvn3; const std::string_view description; void AddToString(std::string &out, Encoding targetEncoding) const noexcept { switch (targetEncoding) { case Encoding::VNI: out += vni; break; case Encoding::VPS: out += vps; break; case Encoding::VISCII: out += viscii; break; case Encoding::TCVN3: out += tcvn3; break; default: assert(0 && "unsupported encoding"); } } }; std::unordered_map utf8ToOthers; std::unordered_map utf16LEToOthers; bool &Initialized() noexcept { static bool initialized = false; return initialized; } void Init() noexcept { if (Initialized()) return; for (int i = 0; i < internal::TABLE_LENGTH; ++i) { vniToUtf8[internal::vniTable[i]] = internal::utf8Table[i]; vpsToUtf8[internal::vpsTable[i]] = internal::utf8Table[i]; viscii3ToUtf8[internal::visciiTable[i]] = internal::utf8Table[i]; tcvn3ToUtf8[internal::tcvn3Table[i]] = internal::utf8Table[i]; vniToUtf16LE[internal::vniTable[i]] = internal::utf16LETable[i]; vpsToUtf16LE[internal::vpsTable[i]] = internal::utf16LETable[i]; visciiToUtf16LE[internal::visciiTable[i]] = internal::utf16LETable[i]; tcvn3ToUtf16LE[internal::tcvn3Table[i]] = internal::utf16LETable[i]; std::string_view sv = internal::utf8Table[i]; utf8ToOthers.emplace(internal::utf8Table[i], Rune{internal::utf8Table[i], internal::utf16LETable[i], internal::vniTable[i], internal::vpsTable[i], internal::visciiTable[i], internal::tcvn3Table[i], internal::descriptionTable[i]}); utf16LEToOthers.emplace(internal::utf16LETable[i], Rune{internal::utf8Table[i], internal::utf16LETable[i], internal::vniTable[i], internal::vpsTable[i], internal::visciiTable[i], internal::tcvn3Table[i], internal::descriptionTable[i]}); } assert(vniToUtf8.size() == internal::TABLE_LENGTH); assert(vpsToUtf8.size() == internal::TABLE_LENGTH); assert(viscii3ToUtf8.size() == internal::TABLE_LENGTH); assert(tcvn3ToUtf8.size() == internal::TABLE_LENGTH); assert(vniToUtf16LE.size() == internal::TABLE_LENGTH); assert(vpsToUtf16LE.size() == internal::TABLE_LENGTH); assert(visciiToUtf16LE.size() == internal::TABLE_LENGTH); assert(tcvn3ToUtf16LE.size() == internal::TABLE_LENGTH); assert(utf8ToOthers.size() == internal::TABLE_LENGTH); assert(utf16LEToOthers.size() == internal::TABLE_LENGTH); Initialized() = true; } void CheckInit() noexcept { assert(Initialized() && "viet module is not initialized"); } bool CheckEncoding(const char *str, std::size_t len, Encoding encoding) noexcept { CheckInit(); if (encoding == Encoding::VPS || encoding == Encoding::VISCII) { const std::unordered_map *dict = nullptr; switch (encoding) { case Encoding::VPS: dict = &vpsToUtf8; break; case Encoding::VISCII: dict = &viscii3ToUtf8; break; } for (int i = 0; i < len; ++i) { auto c = str[i]; if (isascii(c)) { continue; } if (dict->find(c) == dict->end()) { return false; } } return true; } const std::unordered_map *dict = nullptr; switch (encoding) { case Encoding::VNI: dict = &vniToUtf8; break; case Encoding::TCVN3: dict = &tcvn3ToUtf8; break; default: assert(0 && "unsupported encoding"); break; } for (std::size_t i = 0; i < len; ++i) { char c = str[i]; if (isascii(c)) { continue; } std::string word(1, c); if (dict->find(word) != dict->end()) { continue; } i++; if (i == len) break; word += str[i]; if (dict->find(word) != dict->end()) { continue; } return false; } return true; } bool CheckEncoding(const std::string &str, Encoding encoding) noexcept { return CheckEncoding(str.c_str(), str.size(), encoding); } template auto ConvertTCVN3ToUtfX(std::string_view src) -> ReturnType { CheckInit(); ReturnType ret; const std::unordered_map *dict = nullptr; if constexpr (std::is_same_v) { dict = &tcvn3ToUtf8; } else if constexpr (std::is_same_v) { dict = &tcvn3ToUtf16LE; } else { static_assert(0); } // 虽然TCVN3存在部分2Byte映射的第1个char落在ASCII码表范围内的情况,但是根据 // https://vietunicode.sourceforge.net/charset/ 的描述,忽略2B的情况并且报错 for (std::size_t i = 0; i < src.size(); ++i) { char c = src[i]; if (isascii(c)) { ret += c; continue; } std::string word(1, c); auto iter = dict->find(word); if (iter != dict->end()) { ret += iter->second; continue; } // 不匹配,报错 throw ConvertError(word, i, Encoding::TCVN3, Encoding::UTF8); } return ret; } template auto ConvertVNIToUtfX(std::string_view src) -> ReturnType { CheckInit(); ReturnType ret; const std::unordered_map *dict = nullptr; if constexpr (std::is_same_v) { dict = &vniToUtf8; } else if constexpr (std::is_same_v) { dict = &vniToUtf16LE; } else { static_assert(0); } for (std::size_t i = 0; i < src.size();) { // 由于VNI存在第1个char落在ASCII码表范围内的问题,所以先判断2字节 if (i + 1 < src.size()) { std::string_view word = src.substr(i, 2); auto iter = dict->find(word); if (iter != dict->end()) { ret += iter->second; i += 2; continue; } // fallthrough } // 由于VNI存在单个char和ASCII码表重叠的问题,所以先判断 std::string_view word = src.substr(i, 1); auto iter = dict->find(word); if (iter != dict->end()) { ret += iter->second; i++; continue; } char c = src[i]; if (isascii(c)) { ret += c; i++; continue; } throw ConvertError(std::string(word), i, Encoding::VNI, Encoding::UTF8); } return ret; } template auto ConvertToUtfX(std::string_view src, Encoding srcEncoding) -> ReturnType { CheckInit(); assert(srcEncoding != Encoding::UTF8); ReturnType ret; if (srcEncoding == Encoding::VPS || srcEncoding == Encoding::VISCII) { const std::unordered_map *dict = nullptr; switch (srcEncoding) { case Encoding::VPS: if constexpr (std::is_same_v) { dict = &vpsToUtf8; } else if constexpr (std::is_same_v) { dict = &vpsToUtf16LE; } else { static_assert(0); } break; case Encoding::VISCII: if constexpr (std::is_same_v) { dict = &viscii3ToUtf8; } else if constexpr (std::is_same_v) { dict = &visciiToUtf16LE; } else { static_assert(0); } break; } for (int i = 0; i < src.size(); ++i) { auto c = src[i]; // VPS和VISCII覆盖了ASCII的部分码点,应该先查VPS/VISCII表 auto iter = dict->find(c); if (iter != dict->end()) { ret += iter->second; continue; } if (isascii(c)) { ret += c; continue; } throw ConvertError(std::string(1, c), i, srcEncoding, Encoding::UTF8); } return ret; } if (srcEncoding == Encoding::VNI) { return ConvertVNIToUtfX(src); } if (srcEncoding == Encoding::TCVN3) { return ConvertTCVN3ToUtfX(src); } assert(0 && "unsupported encoding"); return ret; } std::string ConvertToUtf8(std::string_view src, Encoding srcEncoding) { return ConvertToUtfX(src, srcEncoding); } std::u16string ConvertToUtf16LE(std::string_view src, Encoding srcEncoding) { return ConvertToUtfX(src, srcEncoding); } std::string ConvertFromUtf8(std::string_view utf8Str, Encoding destEncoding) { CheckInit(); std::string ret; auto srcSize = utf8Str.size(); for (std::size_t i = 0; i < srcSize;) { char c = utf8Str[i]; if (isascii(c)) { ret += c; i++; continue; } i++; if (i == srcSize) break; // 2B utf8 std::string word{utf8Str.substr(i - 1, 2)}; auto iter = utf8ToOthers.find(word); if (iter != utf8ToOthers.end()) { iter->second.AddToString(ret, destEncoding); i++; continue; } i++; if (i == srcSize) break; // 3B utf8 word += utf8Str[i]; iter = utf8ToOthers.find(word); if (iter != utf8ToOthers.end()) { iter->second.AddToString(ret, destEncoding); i++; continue; } throw ConvertError(word, i, Encoding::UTF8, destEncoding); } return ret; } std::string ConvertFromUtf16LE(std::u16string_view utf16Str, Encoding destEncoding) { CheckInit(); std::string ret; for (std::size_t i = 0; i < utf16Str.size(); ++i) { char16_t c = utf16Str[i]; if (isascii(c)) { ret += static_cast(c); // in ASCII range, this cast is safe whatever which endians(BE or LE) continue; } std::u16string_view word = utf16Str.substr(i, 1); auto iter = utf16LEToOthers.find(word); if (iter != utf16LEToOthers.end()) { iter->second.AddToString(ret, destEncoding); continue; } throw ConvertError(std::string(reinterpret_cast(word.data()), word.size() * sizeof(char16_t)), i, Encoding::UTF8, destEncoding); } return ret; } std::string Convert(std::string_view src, Encoding srcEncoding, Encoding destEncoding) { if (srcEncoding == destEncoding) { return std::string(src); } // utf8 -> other if (srcEncoding == Encoding::UTF8) { return ConvertFromUtf8(src, destEncoding); } // other -> utf8 if (destEncoding == Encoding::UTF8) { return ConvertToUtf8(src, srcEncoding); } // other -> other auto temp = ConvertToUtf8(src, srcEncoding); return ConvertFromUtf8(temp, destEncoding); } } // namespace viet ================================================ FILE: src/Core/Vietnamese.h ================================================ /* * Reference: * * https://vietunicode.sourceforge.net/charset/ */ #pragma once #include #include #include #include #include namespace viet { namespace internal { constexpr std::size_t TABLE_LENGTH = 134; extern const std::array utf8Table; extern const std::array utf16LETable; extern const std::array tcvn3Table; } // namespace internal enum class Encoding { UTF8, UTF16LE, VNI, VPS, VISCII, TCVN3 }; inline std::string_view to_string(Encoding encoding) noexcept { switch (encoding) { case Encoding::UTF8: return "UTF8"; case Encoding::UTF16LE: return "UTF-16LE"; case Encoding::VNI: return "VNI"; case Encoding::VPS: return "VPS"; case Encoding::VISCII: return "VISCII"; case Encoding::TCVN3: return "TCVN3"; default: assert(0 && "unsupported encoding"); } return ""; } inline Encoding to_encoding(std::string_view sv) noexcept { if (sv == "UTF8") { return Encoding::UTF8; } if (sv == "UTF-16LE") { return Encoding::UTF8; } if (sv == "VNI") { return Encoding::VNI; } if (sv == "VPS") { return Encoding::VPS; } if (sv == "VISCII") { return Encoding::VISCII; } if (sv == "TCVN3") { return Encoding::TCVN3; } assert(0); return Encoding::UTF8; } /** * All FUNCTIONS BELOW SHOULD CALL THIS FIRSTLY. */ void Init() noexcept; bool CheckEncoding(const char *str, std::size_t len, Encoding encoding) noexcept; bool CheckEncoding(const std::string &str, Encoding encoding) noexcept; /** * Convert TCVN3 etc. encodings to utf8 string. * @exception ConvertError thrown when parse fail. */ std::string ConvertToUtf8(std::string_view src, Encoding srcEncoding); /** * Convert to TCVN3 etc. encodings from utf8 string. * @exception ConvertError thrown when parse fail. */ std::string ConvertFromUtf8(std::string_view utf8Str, Encoding destEncoding); /** * Convert TCVN3 etc. encodings to UTF16LE string. * @exception ConvertError thrown when parse fail. */ std::u16string ConvertToUtf16LE(std::string_view src, Encoding srcEncoding); /** * Convert to TCVN3 etc. encodings from UTF16LE string. * @exception ConvertError thrown when parse fail. */ std::string ConvertFromUtf16LE(std::u16string_view utf16Str, Encoding destEncoding); /** * Convert any Vietnamese encoding(include utf8) to any Vietnamese encoding. * @exception ConvertError thrown when parse fail. */ std::string Convert(std::string_view src, Encoding srcEncoding, Encoding destEncoding); } // namespace viet ================================================ FILE: src/Core/cedHelper.h ================================================ #pragma once #include ================================================ FILE: src/Core/doublemap.h ================================================ #include #include // 双向map,支持双向查表操作 template class doublemap { public: doublemap(std::initializer_list> &&lst) { for (std::pair pr : lst) { insert(std::forward>(pr)); } } bool has(const T1 &t1) const { return t1ToT2.find(t1) != t1ToT2.end(); } bool has(const T2 &t2) const { return t2ToT1.find(t2) != t2ToT1.end(); } void insert(std::pair &&pr) { assert(has(pr.first) == false); assert(has(pr.second) == false); t1ToT2.insert(pr); t2ToT1.insert(std::pair{pr.second, pr.first}); } T2 &operator[](const T1 &t1) { return t1ToT2[t1]; } T1 &operator[](const T2 &t2) { return t2ToT1[t2]; } const T2 &at(const T1 &t1) const { return t1ToT2.at(t1); } const T1 &at(const T2 &t2) const { return t2ToT1.at(t2); } private: std::unordered_map t1ToT2; std::unordered_map t2ToT1; }; ================================================ FILE: src/SmartCharsetConverter/CLIHandler.cpp ================================================ #include "CLIHandler.h" #include "Core/Core.h" #include "Common/tstring.h" #include "Common/FileFunction.h" #include "Common/ConsoleSettings.h" #include #include #include #include #include using std::cerr; using std::cout; const std::string configFileName = "SmartCharsetConverter.json"; const char usage[] = u8R"( SmartCharsetConverter --help [] SmartCharsetConverter --input ... --target_charset [--target_linebreak ] [--output_origin | --output_dir

] --help [] 打印帮助信息。 options: * charset 打印出支持的字符集名称。 例如:--help charset --input ... 指定输入文件或者输入文件夹 例如:--input D:\a.txt D:\input --target_charset 指定目标字符集 例如:--target_charset UTF-8 --target_linebreak 指定目标换行符 * linebreak: LF 或者 Linux CRLF 或者 Windows CR 或者 Mac --output_origin 转换后直接覆盖输入文件 --output_dir 指定输出的文件夹 )"; int CLIMain(const std::vector &args) noexcept { std::setlocale(LC_CTYPE, ".UTF-8"); try { bool ok = AttachParentConsole(1024); if (!ok) { throw std::runtime_error("failed to AttachParentConsole"); } } catch (const std::runtime_error &err) { MessageBoxW(NULL, utf8_to_wstring(err.what()).c_str(), L"Error", MB_OK | MB_ICONERROR); return -1; } std::shared_ptr defer(nullptr, [](auto) { try { bool ok = ReleaseConsole(); if (!ok) { throw std::runtime_error("failed to ReleaseConsole"); } } catch (const std::runtime_error &err) { MessageBoxW(NULL, utf8_to_wstring(err.what()).c_str(), L"Error", MB_OK | MB_ICONERROR); } }); // ==================== 命令行已挂载 ===================== enum class TaskType { PURE_PRINT, CONVERT }; TaskType taskType = TaskType::CONVERT; bool setInput = false; bool setTargetCharset = false; bool setTargetLineBreak = false; bool setOutput = false; CoreInitOption coreInitOpt; Core core(configFileName, coreInitOpt); core.SetFilterMode(Configuration::FilterMode::NO_FILTER); std::stringstream ssErr; std::stringstream ssOutput; std::vector inputPathes; int state = 0; for (std::size_t i = 1; i < args.size(); ++i) { std::string arg = args[i]; switch (state) { case 0: if (arg == u8"--help") { taskType = TaskType::PURE_PRINT; if (i == args.size() - 1) { ssOutput << usage; break; } state = 10; break; } if (arg == u8"--input") { if (setInput) { ssErr << u8"错误:重复设置参数:" << arg << "\n"; break; } state = 20; break; } if (arg == u8"--target_charset") { if (setTargetCharset) { ssErr << u8"错误:重复设置参数:" << arg << "\n"; break; } state = 30; break; } if (arg == u8"--target_linebreak") { if (setTargetLineBreak) { ssErr << u8"错误:重复设置参数:" << arg << "\n"; break; } state = 40; break; } if (arg == u8"--output_origin") { if (setOutput) { ssErr << u8"错误:重复设置参数:" << arg << "\n"; break; } setOutput = true; core.SetOutputTarget(Configuration::OutputTarget::ORIGIN); break; } if (arg == u8"--output_dir") { if (setOutput) { ssErr << u8"错误:重复设置参数:" << arg << "\n"; break; } state = 50; break; } ssErr << u8"无效参数:" << arg; i = args.size(); // 让最外层循环退出 break; case 10: // --help xxx if (arg == u8"charset") { ssOutput << u8"支持的字符集有:\n"; for (int i = static_cast(CharsetCode::UTF8); i < static_cast(CharsetCode::CHARSET_CODE_END); ++i) { CharsetCode code = static_cast(i); ssOutput << ToViewCharsetName(code) << u8"\n"; } break; } ssErr << u8"错误:无效参数:" << arg; i = args.size(); // 让最外层循环退出 break; case 20: // --input xxx { setInput = true; std::filesystem::path path = std::filesystem::u8path(arg); if (std::filesystem::is_regular_file(path) || std::filesystem::is_directory(path)) { inputPathes.push_back(arg); break; } if (arg.substr(0, 2) == u8"--") { state = 0; i--; break; } ssErr << u8"错误:无效路径:" << arg << u8"\n"; break; } case 30: setTargetCharset = true; try { core.SetOutputCharset(ToCharsetCode(arg)); } catch (const std::runtime_error &err) { (err); ssErr << u8"错误:未能识别的字符集名称:" << arg << u8"\n"; ssErr << u8"提示:使用--help charset可以查看支持的字符集名称。\n"; } state = 0; break; case 40: setTargetLineBreak = true; core.SetEnableConvertLineBreak(true); if (tolower(arg) == tolower(std::string(u8"LF")) || tolower(arg) == tolower(std::string(u8"Linux"))) { core.SetLineBreaks(LineBreaks::LF); break; } if (tolower(arg) == tolower(std::string(u8"CRLF")) || tolower(arg) == tolower(std::string(u8"Windows"))) { core.SetLineBreaks(LineBreaks::CRLF); break; } if (tolower(arg) == tolower(std::string(u8"CR")) || tolower(arg) == tolower(std::string(u8"Mac"))) { core.SetLineBreaks(LineBreaks::CR); break; } ssErr << u8"错误:未能识别的换行符名称:" << arg << u8"\n"; ssErr << u8"提示:使用--help可以查看换行符名称。\n"; state = 0; break; case 50: setOutput = true; core.SetOutputTarget(Configuration::OutputTarget::TO_DIR); core.SetOutputDir(arg); state = 0; break; } // end of switch } // 校验输入参数 if (taskType == TaskType::CONVERT) { if (inputPathes.empty()) { ssErr << u8"错误:没有设置输入文件(--input)。" << u8"\n"; } if (!setOutput) { ssErr << u8"错误:没有设置输出方式(--output_origin或者--output_dir)。" << u8"\n"; } else { if (core.GetConfig().outputTarget == Configuration::OutputTarget::ORIGIN) { ssOutput << u8"输出方式:原位输出\n"; } else { ssOutput << u8"输出方式:输出到文件夹:" << core.GetConfig().outputDir << u8"\n"; } } if (!setTargetCharset) { ssErr << u8"错误:没有设置目标字符集(--targetCharset)。" << u8"\n"; } else { ssOutput << u8"目标字符集:" << ToViewCharsetName(core.GetConfig().outputCharset) << u8"\n"; } if (setTargetLineBreak) { ssOutput << u8"目标换行符:" << LineBreaksToViewName(core.GetConfig().lineBreak) << u8"\n"; } } // 开始输出 cout << std::string(32, L'=') << u8"\n"; int retCode = 0; if (!ssErr.str().empty()) { SetConsoleColor(ConsoleColor::RED); std::cerr << u8"输入参数:" << u8"\n"; for (auto arg : args) { std::cerr << arg << u8" "; } std::cerr << u8"\n\n"; std::cerr << ssErr.str() << u8"\n"; retCode = -1; SetConsoleColor(); return -1; } SetConsoleColor(ConsoleColor::GREEN); std::cout << ssOutput.str(); SetConsoleColor(); cout << std::string(32, L'=') << u8"\n"; cout << u8"\n"; ssErr.swap(std::stringstream{}); ssOutput.swap(std::stringstream{}); // 开始转换 auto AddAndConvertOneFile = [&core, &ssOutput, setTargetLineBreak]( int index, int total, const std::string &inputFilename, int &success, int &failed) { Core::AddItemResult addedItem; SetConsoleColor(ConsoleColor::YELLOW); std::cout << u8"[" << std::to_string(index) << u8"/" << std::to_string(total) << u8"] " << inputFilename << u8"\n"; SetConsoleColor(); try { addedItem = core.AddItem(inputFilename, {}); // std::cout << u8" 文本片段: " << addedItem.strPiece << u8"\n"; } catch (const std::runtime_error &err) { SetConsoleColor(ConsoleColor::RED); cerr << u8"读入文件失败。原因: " << err.what() << u8"\n"; cerr << u8"\n"; SetConsoleColor(); failed++; return; } Core::ConvertFileResult ret = core.Convert(inputFilename, addedItem.srcCharset, addedItem.srcLineBreak); if (ret.errInfo.has_value()) { cout << u8" 大小: " << FileSizeToHumanString(addedItem.filesize) << u8"\n"; cout << u8" 字符集: " << ToViewCharsetName(addedItem.srcCharset) << u8"\n"; cout << u8" 换行符: " << LineBreaksToViewName(addedItem.srcLineBreak) << u8"\n"; SetConsoleColor(ConsoleColor::RED); cerr << u8"转换失败。原因: " << ret.errInfo.value() << u8"\n"; cerr << u8"\n"; SetConsoleColor(); failed++; return; } cout << u8" 大小: " << FileSizeToHumanString(addedItem.filesize) << u8"\n"; cout << u8" 字符集: " << ToViewCharsetName(addedItem.srcCharset) << u8" -> "; SetConsoleColor(ConsoleColor::GREEN); cout << ToViewCharsetName(core.GetConfig().outputCharset) << u8"\n"; SetConsoleColor(); cout << u8" 换行符: " << LineBreaksToViewName(addedItem.srcLineBreak); if (setTargetLineBreak) { cout << u8" -> "; SetConsoleColor(ConsoleColor::GREEN); cout << LineBreaksToViewName(core.GetConfig().lineBreak) << u8"\n"; SetConsoleColor(); } else { cout << u8"\n"; } cout << u8"转换成功。\n\n"; success++; return; }; std::vector inputFileNames; for (auto &inputPath : inputPathes) { if (std::filesystem::is_regular_file(std::filesystem::u8path(inputPath))) { inputFileNames.push_back(inputPath); continue; } for (auto &path : std::filesystem::recursive_directory_iterator(std::filesystem::u8path(inputPath))) { if (std::filesystem::is_regular_file(path)) { inputFileNames.push_back(path.path().u8string()); continue; } } } int success = 0, failed = 0; int total = static_cast(inputFileNames.size()); for (int i = 0; i < total; i++) { AddAndConvertOneFile(i + 1, total, inputFileNames[i], success, failed); } cout << std::string(32, L'=') << u8"\n"; cout << u8"总计:" << std::to_string(total) << u8"\n"; SetConsoleColor(ConsoleColor::GREEN); cout << u8"成功:" << std::to_string(success) << u8"\n"; if (failed > 0) { SetConsoleColor(ConsoleColor::RED); } cout << u8"失败:" << std::to_string(failed) << u8"\n"; SetConsoleColor(); return retCode; } ================================================ FILE: src/SmartCharsetConverter/CLIHandler.h ================================================ #pragma once #include #include int CLIMain(const std::vector &args) noexcept; ================================================ FILE: src/SmartCharsetConverter/CMakeLists.txt ================================================ # === SmartCharsetConverter ============= file(GLOB SRC_CODE *.h *.cpp ) # 目标exe add_executable(${PROJECT_NAME} ${SRC_CODE} ) target_link_libraries(${PROJECT_NAME} PRIVATE Core Control Translator guicon ) # 添加include目录 target_include_directories(Core PRIVATE . ) # 添加.rc target_sources(${PROJECT_NAME} PRIVATE SmartCharsetConverter.rc) # VS 设置 Subsystem 选项 set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:WINDOWS") set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS") ================================================ FILE: src/SmartCharsetConverter/DialogMain.cpp ================================================ #include "DialogMain.h" // self #include "Control/TMenu.h" #include #include #include #include #include #include #include #include #undef min #undef max const std::tstring appTitle = TEXT("SmartCharsetConverter v0.9.3 by Tom Willow"); const std::string configFileName = "SmartCharsetConverter.json"; const std::vector innerLanguageIds = { IDR_LANGUAGEJSON_ENGLISH, IDR_LANGUAGEJSON_SIMPLIFIED_CHINESE, IDR_LANGUAGEJSON_SPANISH, }; using namespace std; DialogMain::DialogMain(const std::vector &filenames) : inputFilenames(filenames) { CoreInitOption coreOpt; coreOpt.fnUIUpdateItem = [this](int index, std::string filename, std::string fileSizeStr, std::string charsetStr, std::string lineBreakStr, std::u16string textPiece) { PostUIFunc([=]() { listview.SetItemText(index, static_cast(ListViewColumn::FILENAME), utf8_to_wstring(filename).c_str()); listview.SetItemText(index, static_cast(ListViewColumn::FILESIZE), utf8_to_wstring(fileSizeStr).c_str()); listview.SetItemText(index, static_cast(ListViewColumn::ENCODING), utf8_to_wstring(charsetStr).c_str()); listview.SetItemText(index, static_cast(ListViewColumn::LINE_BREAK), utf8_to_wstring(lineBreakStr).c_str()); listview.SetItemText(index, static_cast(ListViewColumn::TEXT_PIECE), reinterpret_cast(textPiece.c_str())); }); }; try { core = make_unique(configFileName, coreOpt); // LanguageServiceOption option; option.languageName = core->GetConfig().language; option.resourceIds = innerLanguageIds; option.resourceType = L"LanguageJson"; languageService = std::make_unique(option); } catch (const nlohmann::json::exception &err) { (err); throw; } catch (const std::exception &err) { (err); throw; } } DialogMain::~DialogMain() {} void DialogMain::OnClose() { if (thRunning) { doCancel = true; fu.get(); } EndDialog(0); } void DialogMain::RefreshInterfaceByCurrentLanguage() noexcept { // set controls by language settings GetDlgItem(IDC_STATIC_FILE_LISTS).SetWindowTextW(languageService->GetWString(v0_2::StringId::FILE_LISTS).c_str()); GetDlgItem(IDC_STATIC_SET_FILTER_MODE) .SetWindowTextW(languageService->GetWString(v0_2::StringId::SET_FILTER_MODE).c_str()); GetDlgItem(IDC_RADIO_STRETEGY_NO_FILTER) .SetWindowTextW(languageService->GetWString(v0_2::StringId::NO_FILTER).c_str()); GetDlgItem(IDC_RADIO_STRETEGY_SMART) .SetWindowTextW(languageService->GetWString(v0_2::StringId::SMART_FILE_DETECTION).c_str()); GetDlgItem(IDC_RADIO_STRETEGY_MANUAL) .SetWindowTextW(languageService->GetWString(v0_2::StringId::USE_FILE_EXTENSION).c_str()); GetDlgItem(IDC_STATIC_ADD_FILES_OR_FOLDER) .SetWindowTextW(languageService->GetWString(v0_2::StringId::ADD_FILES_OR_FOLDER).c_str()); GetDlgItem(IDC_BUTTON_ADD_FILES).SetWindowTextW(languageService->GetWString(v0_2::StringId::ADD_FILES).c_str()); GetDlgItem(IDC_BUTTON_ADD_DIR).SetWindowTextW(languageService->GetWString(v0_2::StringId::ADD_FOLDER).c_str()); GetDlgItem(IDC_STATIC_SET_OUTPUT).SetWindowTextW(languageService->GetWString(v0_2::StringId::SET_OUTPUT).c_str()); GetDlgItem(IDC_RADIO_TO_ORIGIN) .SetWindowTextW(languageService->GetWString(v0_2::StringId::OUTPUT_TO_ORIGIN).c_str()); GetDlgItem(IDC_RADIO_TO_DIR).SetWindowTextW(languageService->GetWString(v0_2::StringId::OUTPUT_TO_FOLDER).c_str()); GetDlgItem(IDC_BUTTON_SET_OUTPUT_DIR) .SetWindowTextW(languageService->GetWString(v0_2::StringId::SELECT_FOLDER).c_str()); GetDlgItem(IDC_STATIC_SET_OUTPUT_CHARSET) .SetWindowTextW(languageService->GetWString(v0_2::StringId::SET_OUTPUT_CHARSET).c_str()); GetDlgItem(IDC_RADIO_OTHER).SetWindowTextW(languageService->GetWString(v0_2::StringId::OTHERS).c_str()); GetDlgItem(IDC_CHECK_CONVERT_RETURN) .SetWindowTextW(languageService->GetWString(v0_2::StringId::CHANGE_LINE_BREAKS).c_str()); GetDlgItem(IDC_BUTTON_START).SetWindowTextW(languageService->GetWString(v0_2::StringId::START_CONVERT).c_str()); GetDlgItem(IDC_BUTTON_CLEAR).SetWindowTextW(languageService->GetWString(v0_2::StringId::CLEAR_LISTS).c_str()); listview.SetColumnText(static_cast(ListViewColumn::INDEX), languageService->GetWString(v0_2::StringId::INDEX).c_str()); listview.SetColumnText(static_cast(ListViewColumn::FILENAME), languageService->GetWString(v0_2::StringId::FILENAME).c_str()); listview.SetColumnText(static_cast(ListViewColumn::FILESIZE), languageService->GetWString(v0_2::StringId::SIZE).c_str()); listview.SetColumnText(static_cast(ListViewColumn::ENCODING), languageService->GetWString(v0_2::StringId::ENCODING).c_str()); listview.SetColumnText(static_cast(ListViewColumn::LINE_BREAK), languageService->GetWString(v0_2::StringId::LINE_BREAKS).c_str()); listview.SetColumnText(static_cast(ListViewColumn::TEXT_PIECE), languageService->GetWString(v0_2::StringId::TEXT_PIECE).c_str()); rightMenu->SetItemTextById(ID_OPEN_WITH_NOTEPAD, languageService->GetWString(v0_2::StringId::OPEN_WITH_NOTEPAD)); rightMenu->SetItemTextById(ID_SPECIFY_ORIGIN_CHARSET, languageService->GetWString(v0_2::StringId::SPECIFY_ORIGIN_ENCODING)); rightMenu->SetItemTextById(ID_REMOVE_ITEM, languageService->GetWString(v0_2::StringId::REMOVE)); } BOOL DialogMain::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) { // 设置窗口的大小图标 // 大图标:按下alt+tab键切换窗口时对应的图标 // 小图标:就是窗口左上角对应的那个图标 HICON hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1)); ::SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); ::SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); SetWindowText(appTitle.c_str()); BOOL bHandle = true; // 包含/排除指定后缀 SetFilterMode(core->GetConfig().filterMode); GetDlgItem(IDC_EDIT_INCLUDE_TEXT).SetWindowTextW(utf8_to_wstring(core->GetConfig().includeRule).c_str()); // target SetOutputTarget(core->GetConfig().outputTarget); GetDlgItem(IDC_EDIT_OUTPUT_DIR).SetWindowTextW(utf8_to_wstring(core->GetConfig().outputDir).c_str()); static_cast(GetDlgItem(IDC_EDIT_OUTPUT_DIR)).SetReadOnly(true); // 要从列表框“其他”中排除的字符集(也就是 能直接通过单选按钮选中的字符集) const std::vector comboBoxOtherExcludes = {CharsetCode::UTF8, CharsetCode::UTF8BOM, CharsetCode::GB18030}; comboBoxOther.Attach(GetDlgItem(IDC_COMBO_OTHER_CHARSET).m_hWnd); for (int icode = static_cast(CharsetCode::UTF8), i = 0; icode < static_cast(CharsetCode::CHARSET_CODE_END); ++icode) { CharsetCode code = static_cast(icode); if (std::find(comboBoxOtherExcludes.begin(), comboBoxOtherExcludes.end(), code) != comboBoxOtherExcludes.end()) { continue; } comboBoxOther.AddString(utf8_to_wstring(ToViewCharsetName(code)).c_str()); comboBoxOther.SetItemData(i, static_cast(code)); i++; } comboBoxOther.SetCurSel(0); SetOutputCharset(core->GetConfig().outputCharset); // enable/disable line breaks CButton(GetDlgItem(IDC_CHECK_CONVERT_RETURN)).SetCheck(core->GetConfig().enableConvertLineBreaks); OnBnClickedCheckConvertReturn(0, 0, 0, bHandle); CButton(GetDlgItem(IDC_RADIO_CRLF + static_cast(core->GetConfig().lineBreak))).SetCheck(true); // listview listview.SubclassWindow(GetDlgItem(IDC_LISTVIEW)); // 必须用SubclassWindow传入句柄,才能让MSG_MAP生效 listview.ModifyStyle(0, LVS_REPORT); listview.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); listview.AddColumn(languageService->GetWString(v0_2::StringId::INDEX).c_str(), static_cast(ListViewColumn::INDEX)); listview.SetColumnWidth(0, 40); listview.AddColumn(languageService->GetWString(v0_2::StringId::FILENAME).c_str(), static_cast(ListViewColumn::FILENAME)); listview.SetColumnWidth(1, 280); listview.AddColumn(languageService->GetWString(v0_2::StringId::SIZE).c_str(), static_cast(ListViewColumn::FILESIZE)); listview.SetColumnWidth(2, 60); listview.AddColumn(languageService->GetWString(v0_2::StringId::ENCODING).c_str(), static_cast(ListViewColumn::ENCODING)); listview.SetColumnWidth(3, 60); listview.AddColumn(languageService->GetWString(v0_2::StringId::LINE_BREAKS).c_str(), static_cast(ListViewColumn::LINE_BREAK)); listview.SetColumnWidth(4, 80); listview.AddColumn(languageService->GetWString(v0_2::StringId::TEXT_PIECE).c_str(), static_cast(ListViewColumn::TEXT_PIECE)); listview.SetColumnWidth(5, 200); // 右键菜单 rightMenu = std::make_unique(IDR_MENU_RIGHT); TMenu &specifyOriginCharsetMenu = rightMenu->SetItemToBeContainer(ID_SPECIFY_ORIGIN_CHARSET); for (auto commandId = SPECIFY_ORIGIN_CHARSET_ID_START; commandId < SPECIFY_ORIGIN_CHARSET_ID_END; ++commandId) { CharsetCode code = CommandIdToCharsetCode(commandId); specifyOriginCharsetMenu.AppendItem(commandId, utf8_to_wstring(ToViewCharsetName(code))); } selectLanguageMenu = std::make_unique(IDR_MENU_SELECT_LANGUAGES); TMenu &languageSubMenu = selectLanguageMenu->SetItemToBeContainer(ID_LANGUAGE); for (auto commandId = SELECT_LANUAGE_ID_START; commandId < GetSelectLanguageIdEnd(); ++commandId) { std::string languageName = CommandIdToLanguageName(commandId); languageSubMenu.AppendItem(commandId, utf8_to_wstring(languageName)); } // 启用拖放 ::DragAcceptFiles(listview, true); setlocale(LC_CTYPE, ""); RefreshInterfaceByCurrentLanguage(); CenterWindow(); AddItemsAsync(inputFilenames); return 0; } void DialogMain::SetFilterMode(Configuration::FilterMode mode) { core->SetFilterMode(mode); CButton(GetDlgItem(IDC_RADIO_STRETEGY_NO_FILTER)).SetCheck(false); CButton(GetDlgItem(IDC_RADIO_STRETEGY_SMART)).SetCheck(false); CButton(GetDlgItem(IDC_RADIO_STRETEGY_MANUAL)).SetCheck(false); switch (mode) { case Configuration::FilterMode::NO_FILTER: CButton(GetDlgItem(IDC_RADIO_STRETEGY_NO_FILTER)).SetCheck(true); break; case Configuration::FilterMode::SMART: CButton(GetDlgItem(IDC_RADIO_STRETEGY_SMART)).SetCheck(true); break; case Configuration::FilterMode::ONLY_SOME_EXTANT: CButton(GetDlgItem(IDC_RADIO_STRETEGY_MANUAL)).SetCheck(true); break; default: assert(0); } GetDlgItem(IDC_EDIT_INCLUDE_TEXT).EnableWindow(mode == Configuration::FilterMode::ONLY_SOME_EXTANT); } void DialogMain::SetOutputTarget(Configuration::OutputTarget outputTarget) { core->SetOutputTarget(outputTarget); bool isToOrigin = (outputTarget == Configuration::OutputTarget::ORIGIN); CButton(GetDlgItem(IDC_RADIO_TO_ORIGIN)).SetCheck(isToOrigin); CButton(GetDlgItem(IDC_RADIO_TO_DIR)).SetCheck(!isToOrigin); GetDlgItem(IDC_EDIT_OUTPUT_DIR).EnableWindow(!isToOrigin); GetDlgItem(IDC_BUTTON_SET_OUTPUT_DIR).EnableWindow(!isToOrigin); } void DialogMain::SetOutputCharset(CharsetCode charset) { assert(charset != CharsetCode::UNKNOWN); assert(charset != CharsetCode::EMPTY); assert(charset != CharsetCode::NOT_SUPPORTED); assert(charset != CharsetCode::CHARSET_CODE_END); core->SetOutputCharset(charset); bool isNormalCharset = Configuration::IsNormalCharset(charset); CButton(GetDlgItem(IDC_RADIO_UTF8)).SetCheck(charset == CharsetCode::UTF8); CButton(GetDlgItem(IDC_RADIO_UTF8BOM)).SetCheck(charset == CharsetCode::UTF8BOM); CButton(GetDlgItem(IDC_RADIO_GB18030)).SetCheck(charset == CharsetCode::GB18030); CButton(GetDlgItem(IDC_RADIO_OTHER)).SetCheck(Configuration::IsNormalCharset(charset) == false); GetDlgItem(IDC_COMBO_OTHER_CHARSET).EnableWindow(!isNormalCharset); if (!isNormalCharset) { for (int i = 0; i < comboBoxOther.GetCount(); ++i) { if (comboBoxOther.GetItemData(i) == static_cast(charset)) { comboBoxOther.SetCurSel(i); } } } } std::vector DialogMain::AddItems(const std::vector &pathes) noexcept { // 后缀 unordered_set filterDotExts; switch (core->GetConfig().filterMode) { case Configuration::FilterMode::NO_FILTER: break; case Configuration::FilterMode::SMART: // 智能识别文本 break; case Configuration::FilterMode::ONLY_SOME_EXTANT: // 只包括指定后缀 try { CheckAndTraversalIncludeRule([&](const string &dotExt) { filterDotExts.insert(dotExt); }); } catch (const std::runtime_error &err) { MessageBoxW(utf8_to_wstring(err.what()).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); return {}; } break; default: assert(0); } vector> failed; // 失败的文件 vector ignored; // 忽略的文件 auto AddItemNoException = [&](const std::string &filename) { try { Core::AddItemResult ret = core->AddItem(filename, filterDotExts); if (ret.isIgnore) { return; } PostUIFunc([filename, ret, this]() { AppendListViewItem(filename, ret.filesize, ret.srcCharset, ret.srcLineBreak, ret.strPiece); }); } catch (io_error_ignore) { ignored.push_back(filename); } catch (const MyRuntimeError &err) { failed.push_back({filename, err.ToLocalString(languageService.get())}); } catch (const runtime_error &err) { failed.push_back({filename, err.what()}); } }; for (auto &path : pathes) { // 如果是目录 if (std::filesystem::is_directory(std::filesystem::u8path(path))) { // 遍历指定目录 auto filenames = TraversalAllFileNames(path); for (auto &filename : filenames) { if (doCancel) { goto AddItemsAbort; } AddItemNoException(filename); } continue; } // 如果是文件 if (doCancel) { goto AddItemsAbort; } AddItemNoException(path); } AddItemsAbort: if (!failed.empty()) { string info = languageService->GetUtf8String(v0_2::StringId::FAILED_ADD_BELOW) + u8"\r\n"; for (auto &pr : failed) { info += pr.first + u8" " + languageService->GetUtf8String(v0_2::StringId::REASON) + u8" " + pr.second + u8"\r\n "; } MyMessage *msg = new MyMessage([this, info]() { MessageBox(utf8_to_wstring(info).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); }); PostMessage(WM_MY_MESSAGE, 0, reinterpret_cast(msg)); } if (!ignored.empty()) { string s; std::string dest = fmt::format(languageService->GetUtf8String(v0_2::StringId::NON_TEXT_OR_NO_DETECTED), ignored.size()); s += dest + u8"\r\n"; int count = 0; for (auto &filename : ignored) { s += filename + u8"\r\n"; count++; if (count >= 5) { s += languageService->GetUtf8String(v0_2::StringId::AND_SO_ON); break; } } s += u8"\r\n\r\n"; s += languageService->GetUtf8String(v0_2::StringId::TIPS_USE_NO_FILTER); PostUIFunc([this, s]() { MessageBox(utf8_to_wstring(s).c_str(), languageService->GetWString(v0_2::StringId::PROMPT).c_str(), MB_OK | MB_ICONINFORMATION); }); return ignored; } return ignored; } void DialogMain::AddItemsAsync(const std::vector &filenames) noexcept { auto restore = SetBusyState(); doCancel = false; assert(thRunning == false); thRunning = true; fu = std::async(std::launch::async, [this, restore, filenames]() { // 使用RTTI的手法记下恢复事件 unique_ptr> deferRestore(reinterpret_cast(1), [this, restore](void *) { PostUIFunc([this, restore]() { RestoreReadyState(restore); thRunning = false; }); }); try { AddItems(filenames); } catch (const runtime_error &err) { PostUIFunc([this, err]() { MessageBoxW(utf8_to_wstring(err.what()).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); }); } }); } void DialogMain::StartConvert(const std::vector> &restore, const std::vector &items) try { // 使用RTTI的手法记下恢复事件 unique_ptr> deferRestore(reinterpret_cast(1), [this, restore](void *) { PostUIFunc([this, restore]() { RestoreReadyState(restore); #ifndef NDEBUG cout << "Exit: StartConvert thread" << endl; #endif thRunning = false; }); }); // 如果没有内容 if (listview.GetItemCount() == 0) { throw runtime_error(languageService->GetUtf8String(v0_2::StringId::NO_FILE_TO_CONVERT)); } // 检查输出目录 if (core->GetConfig().outputTarget != Configuration::OutputTarget::ORIGIN) { if (core->GetConfig().outputDir.empty()) { throw runtime_error(languageService->GetUtf8String(v0_2::StringId::INVALID_OUTPUT_DIR)); } } vector> failed; // 失败文件/失败原因 vector succeed; // 成功的文件 // 目标编码 auto targetCode = core->GetConfig().outputCharset; // 逐个转换 auto count = items.size(); for (int i = 0; i < count; ++i) { if (doCancel) { break; } auto &filename = items[i].filename; auto originCode = items[i].originCode; auto originLineBreak = items[i].originLineBreak; // 更新UI PostUIFunc([=]() { listview.SetItemText(i, static_cast(ListViewColumn::INDEX), (TEXT("->") + to_tstring(i + 1)).c_str()); // listview滚动 listview.SelectItem(i); }); auto convertResult = core->Convert(filename, originCode, originLineBreak, languageService.get()); if (convertResult.errInfo.has_value()) { failed.push_back({filename, convertResult.errInfo.value()}); } else { succeed.push_back(filename); } // 更新UI PostUIFunc([=]() { listview.SetItemText(i, static_cast(ListViewColumn::INDEX), to_tstring(i + 1).c_str()); if (convertResult.errInfo.has_value()) { return; } listview.SetItemText(i, static_cast(ListViewColumn::FILENAME), utf8_to_wstring(convertResult.outputFileName).c_str()); listview.SetItemText(i, static_cast(ListViewColumn::FILESIZE), utf8_to_wstring(FileSizeToHumanString(convertResult.outputFileSize)).c_str()); listview.SetItemText(i, static_cast(ListViewColumn::ENCODING), utf8_to_wstring(ToViewCharsetName(targetCode)).c_str()); listview.SetItemText(i, static_cast(ListViewColumn::LINE_BREAK), utf8_to_wstring(LineBreaksToViewName(convertResult.targetLineBreaks)).c_str()); }); } // 已经完成处理 // 如果有失败的 if (failed.empty() == false) { string s; std::string dest = fmt::format(languageService->GetUtf8String(v0_2::StringId::SUCCEED_SOME_FILES), succeed.size()); s += dest + u8"\r\n\r\n"; s += languageService->GetUtf8String(v0_2::StringId::FAILED_CONVERT_BELOW) + u8"\r\n"; for (auto &pr : failed) { s += pr.first + u8" " + languageService->GetUtf8String(v0_2::StringId::REASON) + pr.second + u8"\r\n"; } if (doCancel) { s += u8"\r\n\r\n" + languageService->GetUtf8String(v0_2::StringId::NO_DEAL_DUE_TO_CANCEL); } PostUIFunc([this, s]() { MessageBox(utf8_to_wstring(s).c_str(), languageService->GetWString(v0_2::StringId::CONVERT_RESULT).c_str(), MB_OK | MB_ICONERROR); }); } else { // 全部成功之后 stringstream ss; std::string dest = fmt::format(languageService->GetUtf8String(v0_2::StringId::SUCCEED_SOME_FILES), succeed.size()); ss << dest << u8"\r\n\r\n"; if (targetCode == CharsetCode::GB18030) { ss << u8"\r\n\r\n" << languageService->GetUtf8String(v0_2::StringId::NOTICE_SHOW_AS_UTF8); } if (doCancel) { ss << u8"\r\n\r\n" << languageService->GetUtf8String(v0_2::StringId::NO_DEAL_DUE_TO_CANCEL); } string s = ss.str(); PostUIFunc([this, s]() { MessageBox(utf8_to_wstring(s).c_str(), languageService->GetWString(v0_2::StringId::PROMPT).c_str(), MB_OK | MB_ICONINFORMATION); }); } return; } catch (const runtime_error &err) { PostUIFunc([this, err]() { MessageBox(utf8_to_wstring(err.what()).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); }); return; } LRESULT DialogMain::OnBnClickedRadioStretegyNoFilter(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetFilterMode(Configuration::FilterMode::NO_FILTER); return 0; } LRESULT DialogMain::OnBnClickedRadioStretegySmart(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetFilterMode(Configuration::FilterMode::SMART); return 0; } LRESULT DialogMain::OnBnClickedRadioStretegyManual(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetFilterMode(Configuration::FilterMode::ONLY_SOME_EXTANT); return 0; } LRESULT DialogMain::OnBnClickedRadioToOrigin(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetOutputTarget(Configuration::OutputTarget::ORIGIN); return 0; } LRESULT DialogMain::OnBnClickedRadioToDir(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetOutputTarget(Configuration::OutputTarget::TO_DIR); return 0; } LRESULT DialogMain::OnBnClickedRadioUtf8(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetOutputCharset(CharsetCode::UTF8); return 0; } LRESULT DialogMain::OnBnClickedRadioUtf8bom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetOutputCharset(CharsetCode::UTF8BOM); return 0; } LRESULT DialogMain::OnBnClickedRadioGb18030(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetOutputCharset(CharsetCode::GB18030); return 0; } LRESULT DialogMain::OnBnClickedRadioOther(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetOutputCharset(static_cast(comboBoxOther.GetItemData(comboBoxOther.GetCurSel()))); return 0; } void DialogMain::CheckAndTraversalIncludeRule(std::function fn) { // 后缀字符串 auto &extsStr = core->GetConfig().includeRule; // 切分 auto exts = Split(extsStr, u8" ,|"); string filterExampleStr = languageService->GetUtf8String(v0_2::StringId::SUPPORT_FORMAT_BELOW) + u8"\r\n *.h *.hpp *.c *.cpp *.txt\r\n h hpp c cpp txt\r\n h|hpp|c|cpp\r\n" + languageService->GetUtf8String(v0_2::StringId::SEPERATOR_DESCRIPTION); // 如果为空 if (exts.empty()) { throw runtime_error(languageService->GetUtf8String(v0_2::StringId::NO_SPECIFY_FILTER_EXTEND) + u8"\r\n\r\n" + filterExampleStr); } // 逐个检查 for (auto s : exts) { string extStr(s); string pattern = u8R"((\*\.|\.|)(\w+))"; // 匹配*.xxx/.xxx/xxx的正则 regex r(pattern); smatch results; if (regex_match(extStr, results, r) == false) { throw runtime_error(languageService->GetUtf8String(v0_2::StringId::INVALID_EXTEND_FILTER) + extStr + u8"\r\n\r\n" + filterExampleStr); } fn(tolower(u8"." + results.str(2))); } } LRESULT DialogMain::OnBnClickedButtonAddFiles(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) try { vector> dialogFilter; switch (core->GetConfig().filterMode) { case Configuration::FilterMode::NO_FILTER: case Configuration::FilterMode::SMART: // 智能识别文本 dialogFilter = {{languageService->GetWString(v0_2::StringId::ALL_FILES) + L"*.*", L"*.*"}}; break; case Configuration::FilterMode::ONLY_SOME_EXTANT: { // 只包括指定后缀 tstring filterExtsStr; // dialog的过滤器要求;分割 CheckAndTraversalIncludeRule([&](const string &dotExt) { filterExtsStr += utf8_to_wstring("*" + dotExt + ";"); }); // dialog过滤器 dialogFilter.push_back(make_pair(filterExtsStr, filterExtsStr)); break; } default: assert(0); } // 打开文件对话框 TFileDialog dialog(*this, dialogFilter, true); if (dialog.Open()) { auto filenames = to_utf8(dialog.GetResult()); AddItemsAsync(filenames); } return 0; } catch (runtime_error &err) { MessageBox(utf8_to_wstring(err.what()).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); return 0; } LRESULT DialogMain::OnBnClickedButtonAddDir(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) try { static wstring dir; // 可用于赋予TFolderBrowser初始路径 TFolderBrowser folderBrowser(*this); if (folderBrowser.Open(dir)) { AddItemsAsync(to_utf8(std::vector{dir})); } return 0; } catch (runtime_error &err) { MessageBox(utf8_to_wstring(err.what()).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); return 0; } LRESULT DialogMain::OnBnClickedButtonStart(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL &bHandle /*bHandled*/) { if (thRunning) { doCancel = true; fu.get(); return 0; } auto restore = SetBusyState(); vector items; for (int i = 0; i < listview.GetItemCount(); ++i) { auto filename = to_utf8(listview.GetItemText(i, static_cast(ListViewColumn::FILENAME))); auto originCode = ToCharsetCode(to_utf8(listview.GetItemText(i, static_cast(ListViewColumn::ENCODING)))); auto originLineBreak = ViewNameToLineBreaks(to_utf8(listview.GetItemText(i, static_cast(ListViewColumn::LINE_BREAK)))); items.push_back({filename, originCode, originLineBreak}); } cout << "OnBnClickedButtonStart set cancel false" << endl; doCancel = false; cout << "OnBnClickedButtonStart async StartConvert" << endl; thRunning = true; fu = std::async(std::launch::async, &DialogMain::StartConvert, this, restore, items); return 0; } LRESULT DialogMain::OnBnClickedButtonClear(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { listview.DeleteAllItems(); core->Clear(); return 0; } LRESULT DialogMain::OnBnClickedButtonSettings(WORD, WORD, HWND, BOOL &) { // 弹出右键菜单 selectLanguageMenu->Popup(m_hWnd); return 0; } LRESULT DialogMain::OnBnClickedButtonSetOutputDir(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { tstring dir = utf8_to_wstring(core->GetConfig().outputDir); TFolderBrowser folderBrowser(*this); if (folderBrowser.Open(dir)) { core->SetOutputDir(to_utf8(dir)); GetDlgItem(IDC_EDIT_OUTPUT_DIR).SetWindowTextW(dir.c_str()); } return 0; } LRESULT DialogMain::OnCbnSelchangeComboOtherCharset(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { SetOutputCharset(static_cast(comboBoxOther.GetItemData(comboBoxOther.GetCurSel()))); return 0; } LRESULT DialogMain::OnNMRclickListview(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL & /*bHandled*/) { auto selectedItems = listview.GetSelectedItems(); if (selectedItems.empty()) { return 0; } // 弹出右键菜单 rightMenu->Popup(m_hWnd); return 0; } LRESULT DialogMain::OnOpenWithNotepad(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { auto selectedItems = listview.GetSelectedItems(); for (auto i : selectedItems) { auto filename = listview.GetItemText(i, static_cast(ListViewColumn::FILENAME)); wstring cmd = L"notepad " + filename; WinExec(to_string(cmd).c_str(), SW_SHOWNORMAL); } return 0; } LRESULT DialogMain::OnRemoveItem(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { auto selectedItems = listview.GetSelectedItems(); // 选中的序号,倒序遍历 for (auto itor = selectedItems.rbegin(); itor != selectedItems.rend(); ++itor) { int i = *itor; auto filename = to_utf8(listview.GetItemText(i, static_cast(ListViewColumn::FILENAME))); listview.DeleteItem(i); core->RemoveItem(filename); } // 剩下的重新编号 for (int i = selectedItems.front(); i < listview.GetItemCount(); ++i) { listview.SetItemText(i, static_cast(ListViewColumn::INDEX), to_tstring(i + 1).c_str()); } return 0; } LRESULT DialogMain::OnSpecifyOriginCharset(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { CharsetCode code = CommandIdToCharsetCode(wID); auto selectedItems = listview.GetSelectedItems(); vector> failed; // 失败文件/失败原因 for (auto itor = selectedItems.begin(); itor != selectedItems.end(); ++itor) { int index = *itor; auto filename = to_utf8(listview.GetItemText(index, static_cast(ListViewColumn::FILENAME))); try { core->SpecifyItemCharset(index, filename, code); } catch (const MyRuntimeError &err) { failed.push_back({filename, err.ToLocalString(languageService.get())}); } catch (const std::runtime_error &err) { failed.push_back({filename, err.what()}); } } if (!failed.empty()) { string info = languageService->GetUtf8String(v0_2::StringId::FAILED_TO_SET_CHARSET_MANUALLY) + u8"\r\n"; for (auto &pr : failed) { info += pr.first + u8" " + languageService->GetUtf8String(v0_2::StringId::REASON) + pr.second + u8"\r\n"; } MyMessage *msg = new MyMessage([this, info]() { MessageBox(utf8_to_wstring(info).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); }); PostMessage(WM_MY_MESSAGE, 0, reinterpret_cast(msg)); } return 0; } LRESULT DialogMain::OnSelectLanguage(WORD, WORD wID, HWND, BOOL &) { std::string languageName = CommandIdToLanguageName(wID); try { languageService->SetCurrentLanguage(languageName); } catch (const std::runtime_error &err) { MessageBox(utf8_to_wstring(err.what()).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); return 0; } core->SetLanguage(languageName); RefreshInterfaceByCurrentLanguage(); return 0; } LRESULT DialogMain::OnEnChangeEditIncludeText(WORD /*wNotifyCode*/, WORD /*wID*/, HWND hWndCtl, BOOL & /*bHandled*/) try { // 取得字符串 tstring filterStr; BSTR bstr = nullptr; CEdit edit(hWndCtl); if (edit.GetWindowTextLengthW() != 0) { bool ok = edit.GetWindowTextW(bstr); if (!ok) throw runtime_error(languageService->GetUtf8String(v0_2::StringId::NO_MEMORY)); filterStr = bstr; SysFreeString(bstr); } // 保存到core core->SetFilterRule(to_utf8(filterStr)); return 0; } catch (runtime_error &err) { MessageBox(utf8_to_wstring(err.what()).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); return 0; } LRESULT DialogMain::OnNMClickSyslink1(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL & /*bHandled*/) { HINSTANCE r = ShellExecute(NULL, L"open", L"https://github.com/tomwillow/SmartCharsetConverter/releases", NULL, NULL, SW_SHOWNORMAL); return 0; } LRESULT DialogMain::OnBnClickedCheckConvertReturn(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { bool enableLineBreaks = CButton(GetDlgItem(IDC_CHECK_CONVERT_RETURN)).GetCheck(); core->SetEnableConvertLineBreak(enableLineBreaks); CButton(GetDlgItem(IDC_RADIO_CRLF)).EnableWindow(enableLineBreaks); CButton(GetDlgItem(IDC_RADIO_LF)).EnableWindow(enableLineBreaks); CButton(GetDlgItem(IDC_RADIO_CR)).EnableWindow(enableLineBreaks); return 0; } LRESULT DialogMain::OnBnClickedRadioCrlf(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { core->SetLineBreaks(LineBreaks::CRLF); return 0; } LRESULT DialogMain::OnBnClickedRadioLf(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { core->SetLineBreaks(LineBreaks::LF); return 0; } LRESULT DialogMain::OnBnClickedRadioCr(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/) { core->SetLineBreaks(LineBreaks::CR); return 0; } LRESULT DialogMain::OnDropFiles(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) try { HDROP hDrop = reinterpret_cast(wParam); vector filenames; UINT nFileNum = DragQueryFileW(hDrop, 0xFFFFFFFF, NULL, 0); // 拖拽文件个数 TCHAR strFileName[MAX_PATH]; for (UINT i = 0; i < nFileNum; i++) { DragQueryFileW(hDrop, i, strFileName, MAX_PATH); // 获得拖曳的文件名 filenames.push_back(to_utf8(strFileName)); } DragFinish(hDrop); // 释放hDrop AddItemsAsync(filenames); return 0; } catch (const std::runtime_error &err) { MessageBox(utf8_to_wstring(err.what()).c_str(), languageService->GetWString(v0_2::StringId::MSGBOX_ERROR).c_str(), MB_OK | MB_ICONERROR); return 0; } void DialogMain::PostUIFunc(std::function fn) { MyMessage *msg = new MyMessage(fn); PostMessage(WM_MY_MESSAGE, 0, reinterpret_cast(msg)); } LRESULT DialogMain::OnUser(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { // cout << "OnUser Begin " << std::hex << lParam << endl; unique_ptr msg(reinterpret_cast(lParam)); msg->fn(); // cout << "OnUser End " << std::hex << lParam << endl; return 0; } std::vector> DialogMain::SetBusyState() noexcept { // 遍历控件,如果是启用状态,那么设置为disable,并在restore中记下,留待日后恢复 vector> restore; for (auto id = IDC_RADIO_STRETEGY_SMART; id <= IDC_RADIO_CR; ++id) { if (::GetDlgItem(m_hWnd, id) != NULL) { auto wnd = GetDlgItem(id); if (wnd.IsWindowEnabled()) { restore.push_back({id, true}); wnd.EnableWindow(false); } } } // 开始按钮text变更为“取消”,并额外enable,用于让用户按“取消” GetDlgItem(IDC_BUTTON_START).SetWindowTextW(languageService->GetWString(v0_2::StringId::CANCEL).c_str()); GetDlgItem(IDC_BUTTON_START).EnableWindow(true); return restore; } void DialogMain::RestoreReadyState(const std::vector> &restore) noexcept { for (auto &pr : restore) { auto wnd = GetDlgItem(pr.first); wnd.EnableWindow(pr.second); } GetDlgItem(IDC_BUTTON_START).SetWindowTextW(languageService->GetWString(v0_2::StringId::START_CONVERT).c_str()); } void DialogMain::AppendListViewItem(std::string filename, uint64_t fileSize, CharsetCode charset, LineBreaks lineBreak, std::u16string textPiece) noexcept { auto count = listview.GetItemCount(); listview.AddItem(count, static_cast(ListViewColumn::INDEX), to_tstring(count + 1).c_str()); listview.AddItem(count, static_cast(ListViewColumn::FILENAME), utf8_to_wstring(filename).c_str()); listview.AddItem(count, static_cast(ListViewColumn::FILESIZE), utf8_to_wstring(FileSizeToHumanString(fileSize)).c_str()); listview.AddItem(count, static_cast(ListViewColumn::ENCODING), utf8_to_wstring(ToViewCharsetName(charset)).c_str()); listview.AddItem(count, static_cast(ListViewColumn::LINE_BREAK), utf8_to_wstring(LineBreaksToViewName(lineBreak)).c_str()); listview.AddItem(count, static_cast(ListViewColumn::TEXT_PIECE), reinterpret_cast(textPiece.c_str())); // listview滚动到最下面 listview.SelectItem(count); } ================================================ FILE: src/SmartCharsetConverter/DialogMain.h ================================================ #pragma once #include "Core/Core.h" #include "Common/ThreadPool/ThreadPool.h" #include "Control/TMenu.h" #include #include "resource.h" #include #include #include // 基本的ATL类 #include // ATL窗口类 #include // WTL 主框架窗口类 #include #include // WTL 增强的消息宏 #include #include #include #include #include #include #include #include const unsigned int WM_MY_MESSAGE = WM_USER + 1; struct MyMessage { std::function fn; MyMessage(std::function fn) : fn(fn) { // std::cout << "MyMessage ctor: " << this << std::endl; } }; class DialogMain : public CDialogImpl { public: enum { IDD = IDD_DIALOG_MAIN }; /* * 如果需要初始时就添加文件/文件夹,则传入filenames参数 */ DialogMain(const std::vector &filenames = {}); ~DialogMain(); private: const std::string caption; std::vector inputFilenames; std::unique_ptr core; std::unique_ptr languageService; CComboBox comboBoxOther; TListView listview; std::unique_ptr rightMenu; std::unique_ptr selectLanguageMenu; enum class ListViewColumn { INDEX = 0, FILENAME, FILESIZE, ENCODING, LINE_BREAK, TEXT_PIECE }; std::future fu; std::atomic thRunning; std::atomic doCancel; ThreadPool thPool; void RefreshInterfaceByCurrentLanguage() noexcept; BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam); void SetFilterMode(Configuration::FilterMode mode); void SetOutputTarget(Configuration::OutputTarget outputTarget); void SetOutputCharset(CharsetCode charset); /* * 加入多个文件/文件夹到列表。 * 如果有添加失败的文件,会在事件队列中Post一个弹窗事件 * 线程安全。 */ std::vector AddItems(const std::vector &filenames) noexcept; /* * 加入多个文件/文件夹到列表。 * 如果有添加失败的文件,会在事件队列中Post一个弹窗事件 */ void AddItemsAsync(const std::vector &filenames) noexcept; struct Item { std::string filename; CharsetCode originCode; LineBreaks originLineBreak; }; void StartConvert(const std::vector> &restore, const std::vector &items); void OnClose(); // ================================================ /* 为了动态地在listview的右键菜单"指定原编码"项目里面添加字符集菜单选项,需要为每个字符集指定一个id。 但手动指定太麻烦,根据观察,菜单项目的起始编号为40000,所以这里选定了一个30000为起始编号,目的是不和其他id重合。 然后这个30000加上字符集的index则得到菜单项的id。 */ const int SPECIFY_ORIGIN_CHARSET_ID_CONST = 30000; const int SPECIFY_ORIGIN_CHARSET_ID_START = SPECIFY_ORIGIN_CHARSET_ID_CONST + static_cast(CharsetCode::UTF8); const int SPECIFY_ORIGIN_CHARSET_ID_END = SPECIFY_ORIGIN_CHARSET_ID_CONST + static_cast(CharsetCode::CHARSET_CODE_END); int CharsetCodeToCommandId(CharsetCode code) noexcept { return SPECIFY_ORIGIN_CHARSET_ID_CONST + static_cast(code); } CharsetCode CommandIdToCharsetCode(int id) noexcept { return static_cast(id - SPECIFY_ORIGIN_CHARSET_ID_CONST); } /* 为了动态地在Settings按钮"右键菜单"Language"项目里面添加语言菜单选项,需要为每个语言包指定一个id。 但只能动态指定。根据观察,菜单项目的起始编号为40000,所以这里选定了一个20000为起始编号,目的是不和其他id重合。 然后这个20000加上语言包的index则得到菜单项的id。 */ const int SELECT_LANUAGE_ID_CONST = 20000; const int SELECT_LANUAGE_ID_START = SELECT_LANUAGE_ID_CONST + 0; int GetSelectLanguageIdEnd() noexcept { return static_cast(SELECT_LANUAGE_ID_START + languageService->GetLanguageArray().size()); } int LanguageNameToCommandId(const std::string &languageName) noexcept { return static_cast(SELECT_LANUAGE_ID_START + std::distance(languageService->GetLanguagesTable().begin(), languageService->GetLanguagesTable().find(languageName))); } std::string CommandIdToLanguageName(int id) noexcept { return languageService->GetLanguageArray()[id - SELECT_LANUAGE_ID_START]; } // ================================================ BEGIN_MSG_MAP(DialogMain) MSG_WM_INITDIALOG(OnInitDialog) MSG_WM_CLOSE(OnClose) COMMAND_HANDLER(IDC_RADIO_STRETEGY_SMART, BN_CLICKED, OnBnClickedRadioStretegySmart) COMMAND_HANDLER(IDC_RADIO_STRETEGY_MANUAL, BN_CLICKED, OnBnClickedRadioStretegyManual) COMMAND_HANDLER(IDC_RADIO_TO_ORIGIN, BN_CLICKED, OnBnClickedRadioToOrigin) COMMAND_HANDLER(IDC_RADIO_TO_DIR, BN_CLICKED, OnBnClickedRadioToDir) COMMAND_HANDLER(IDC_RADIO_UTF8, BN_CLICKED, OnBnClickedRadioUtf8) COMMAND_HANDLER(IDC_RADIO_UTF8BOM, BN_CLICKED, OnBnClickedRadioUtf8bom) COMMAND_HANDLER(IDC_RADIO_GB18030, BN_CLICKED, OnBnClickedRadioGb18030) COMMAND_HANDLER(IDC_RADIO_OTHER, BN_CLICKED, OnBnClickedRadioOther) COMMAND_HANDLER(IDC_BUTTON_ADD_FILES, BN_CLICKED, OnBnClickedButtonAddFiles) COMMAND_HANDLER(IDC_BUTTON_ADD_DIR, BN_CLICKED, OnBnClickedButtonAddDir) COMMAND_HANDLER(IDC_BUTTON_SET_OUTPUT_DIR, BN_CLICKED, OnBnClickedButtonSetOutputDir) COMMAND_HANDLER(IDC_COMBO_OTHER_CHARSET, CBN_SELCHANGE, OnCbnSelchangeComboOtherCharset) NOTIFY_HANDLER(IDC_LISTVIEW, NM_RCLICK, OnNMRclickListview) COMMAND_ID_HANDLER(ID_OPEN_WITH_NOTEPAD, OnOpenWithNotepad) COMMAND_ID_HANDLER(ID_REMOVE_ITEM, OnRemoveItem) // 指定原编码 COMMAND_RANGE_HANDLER(SPECIFY_ORIGIN_CHARSET_ID_START, SPECIFY_ORIGIN_CHARSET_ID_END, OnSpecifyOriginCharset) // Language COMMAND_RANGE_HANDLER(SELECT_LANUAGE_ID_START, GetSelectLanguageIdEnd(), OnSelectLanguage) COMMAND_HANDLER(IDC_EDIT_INCLUDE_TEXT, EN_CHANGE, OnEnChangeEditIncludeText) COMMAND_HANDLER(IDC_RADIO_STRETEGY_NO_FILTER, BN_CLICKED, OnBnClickedRadioStretegyNoFilter) NOTIFY_HANDLER(IDC_SYSLINK1, NM_CLICK, OnNMClickSyslink1) COMMAND_HANDLER(IDC_CHECK_CONVERT_RETURN, BN_CLICKED, OnBnClickedCheckConvertReturn) COMMAND_HANDLER(IDC_RADIO_CRLF, BN_CLICKED, OnBnClickedRadioCrlf) COMMAND_HANDLER(IDC_RADIO_LF, BN_CLICKED, OnBnClickedRadioLf) COMMAND_HANDLER(IDC_RADIO_CR, BN_CLICKED, OnBnClickedRadioCr) MESSAGE_HANDLER(WM_DROPFILES, OnDropFiles) COMMAND_HANDLER(IDC_BUTTON_START, BN_CLICKED, OnBnClickedButtonStart) COMMAND_HANDLER(IDC_BUTTON_CLEAR, BN_CLICKED, OnBnClickedButtonClear) COMMAND_HANDLER(IDC_BUTTON_SETTINGS, BN_CLICKED, OnBnClickedButtonSettings) MESSAGE_HANDLER(WM_MY_MESSAGE, OnUser) END_MSG_MAP() LRESULT OnBnClickedRadioStretegySmart(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioStretegyManual(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioToOrigin(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioToDir(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioUtf8(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioUtf8bom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioGb18030(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); /** * 检查 include过滤器。 * @exception runtime_error 过滤器字符串不合法 */ void CheckAndTraversalIncludeRule(std::function fn); LRESULT OnBnClickedRadioOther(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedButtonAddFiles(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedButtonAddDir(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedButtonSetOutputDir(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnCbnSelchangeComboOtherCharset(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); // 右键点击listview LRESULT OnNMRclickListview(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL & /*bHandled*/); LRESULT OnOpenWithNotepad(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnRemoveItem(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnSpecifyOriginCharset(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnSelectLanguage(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnEnChangeEditIncludeText(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioStretegyNoFilter(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnNMClickSyslink1(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL & /*bHandled*/); LRESULT OnBnClickedCheckConvertReturn(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioCrlf(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioLf(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedRadioCr(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnDropFiles(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnBnClickedButtonStart(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedButtonClear(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); LRESULT OnBnClickedButtonSettings(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL & /*bHandled*/); void PostUIFunc(std::function fn); LRESULT OnUser(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); /** * @brief 禁用控件,只保留一个取消按钮。 * @return vector<被禁用控件的id, 恢复时应该设置的enable值> */ std::vector> SetBusyState() noexcept; /** * @brief 恢复控件。 * @return vector<被禁用控件的id, 恢复时应该设置的enable值> */ void RestoreReadyState(const std::vector> &restore) noexcept; void AppendListViewItem(std::string filename, uint64_t fileSize, CharsetCode charset, LineBreaks lineBreak, std::u16string textPiece) noexcept; }; ================================================ FILE: src/SmartCharsetConverter/Resource/lang_embed/English.json ================================================ { "language":"English", "langId": 1033, "author":"Tom Willow", "version":"0.2", "date":"2024-12-22", "data":[ [1,"Some characters will be lost when converting to the target encoding: {}"], [2,"Content contains invalid characters"], [3,"UCNV Error. Error code: {}"], [4,"[{}->{}] Conversion error. Position: {}, Content: {}"], [5,"Truncated character found"], [6,"Duplicate addition"], [7,"Encoding not detected"], [8,"Failed to write file: {}"], [9,"File size exceeds limit: {}"], [10,"String length exceeds limit"], [11,"Failed to open file: {}"], [12,"Corrupted data found while decode as {}. position: {} content(in hex, shown {} bytes at most): {}"], [13,"Conversion to the {} charset is not supported"], [14,"No permission. Tip: The file might be read-only: {}"], [101,"Index"], [102,"File Name"], [103,"Size"], [104,"Encoding"], [105,"Line Breaks"], [106,"Text Fragment"], [107,"Error"], [108,"Failed to add the following files:"], [109,"Reason:"], [110,"{} files were detected to be non-text files, or no character set was detected:"], [111,"...etc."], [112, "Tip: Use the \"No Filter\" mode to add again, and you can right-click in the list box to specify the original encoding manually."], [113,"Tip"], [114,"There are no files to convert."], [115,"The output directory is invalid."], [116,"Conversion of {} files was successful."], [117,"The following files failed to be converted:"], [118,"The remaining files are not processed because the operation was canceled."], [119,"Conversion result"], [120, "Note: GB18030 and other some encodings is overlapped with UTF-8 encoding while content is in pure English(or only ASCII characters), so it may be displayed as UTF-8 encoding after conversion."], [121,"The following formats are supported:"], [122, "(The separator allows spaces, commas, and vertical bars, and the extension allows *. or without)"], [123,"No extension was specified to filter."], [124,"This extension filter is invalid:"], [125,"All files"], [126,"Failed to specify encoding for the following file:"], [127,"Out of memory."], [128,"Cancel"], [129,"Convert"], [130,"Content contains invalid characters"], [131,"Some characters will be lost when converting to the target encoding:"], [132,"Not supported yet: {}, please contact the author."], [133,"Duplicate addition"], [134,"No encoding detected"], [135,"Write failed:"], [136,"File size exceeds limit"], [137,"Failed to open file:"], [138,"File List"], [139,"1. Setup Files Filter:"], [140,"No Filter Files"], [141,"Smart File Detection"], [142,"Use File Extension:"], [143,"2. Add Files / Folders:"], [144,"Files"], [145,"Folder"], [146,"3. Select Output:"], [147,"Original File"], [148,"Use Folder:"], [149,"4. Select File Encoding:"], [150,"Other:"], [151,"Change Line Breaks"], [152,"Empty List"], [153,"Open with Notepad"], [154,"Specify original encoding"], [155,"Remove"], [156,"Select Folder"] ] } ================================================ FILE: src/SmartCharsetConverter/Resource/lang_embed/Simplified Chinese.json ================================================ { "language":"Simplified Chinese", "langId": 2052, "author":"Tom Willow", "version":"0.2", "date":"2024-12-22", "data":[ [1,"转换到目标编码会丢失字符:{}"], [2,"内容包含无效字符"], [3,"UCNV 错误。错误码:{}"], [4,"[{}->{}] 转换出错。位置:{},内容:{}"], [5,"发现截断的字符"], [6,"重复添加"], [7,"未探测出编码集"], [8,"写入文件失败:{}"], [9,"文件大小超出限制:{}"], [10,"字符串长度超出限制"], [11,"打开文件失败:{}"], [12,"以{}编码集解码时出现错误字符。位置:{} 内容(以16进制表示,最多显示{}字节): {}"], [13,"不支持转换到{}字符集"], [14,"没有权限。提示:可能文件是只读状态:{}"], [101,"序号"], [102,"文件名"], [103,"大小"], [104,"编码"], [105,"换行符"], [106,"文本片段"], [107,"出错"], [108,"以下文件添加失败:"], [109,"原因:"], [110,"{}个文件被判定为非文本文件、或者没有探测出字符集:"], [111,"......等"], [112,"提示:使用“不过滤”模式再次添加,可以在列表框中点击右键手动指定原编码集。"], [113,"提示"], [114,"没有待转换的文件。"], [115,"输出目录无效。"], [116,"转换成功 {} 个文件。"], [117,"以下文件转换失败:"], [118,"剩余文件由于取消操作所以未做处理。"], [119,"转换结果"], [120,"注意:GB18030等多个编码在纯英文(只有ASCII码)的情况下和UTF-8编码位重合,所以可能会出现转换后显示为UTF-8编码的情况。"], [121,"支持以下格式:"], [122,"(分隔符允许空格、逗号、竖线,后缀允许带*.或者不带)"], [123,"没有指定要过滤的后缀。"], [124,"指定的后缀过滤器无效:"], [125,"所有文件"], [126,"以下文件设置字符集失败:"], [127,"内存不足。"], [128,"取消"], [129,"开始转换"], [130,"内容包含无效字符"], [131,"转换到目标编码会丢失字符:"], [132,"暂不支持:{},请联系作者。"], [133,"重复添加"], [134,"未探测出编码集"], [135,"写入失败:"], [136,"文件大小超出限制"], [137,"打开文件失败:"], [138,"文件列表"], [139,"1. 设置文件过滤:"], [140,"不过滤"], [141,"智能识别文本文件"], [142,"只要指定后缀的文件:"], [143,"2. 添加要转换的文件或文件夹:"], [144,"添加文件"], [145,"添加文件夹"], [146,"3. 选择转出位置:"], [147,"转出到原文件"], [148,"转出到文件夹:"], [149,"4. 指定转出字符集:"], [150,"其他:"], [151,"转换换行符"], [152,"清空列表"], [153,"用记事本打开"], [154,"指定原编码"], [155,"移除"], [156,"选择文件夹"] ] } ================================================ FILE: src/SmartCharsetConverter/Resource/lang_embed/Spanish.json ================================================ { "language":"Spanish", "langId": 1252, "author":"Carlos Sánchez, Last Edited by Tom Willow", "version":"0.2", "date":"2024-12-22", "data":[ [1,"Algunos caracteres se perderán al convertir a la codificación de destino: {}"], [2,"El contenido incluye caracteres no válidos"], [3,"UCNV Error. Error code: {}"], [4,"[{}->{}] Error de conversión. Posición: {}, Contenido: {}"], [5,"Se encontró carácter truncado"], [6,"Adición duplicada"], [7,"No se detectó codificación"], [8,"Fallo al escribir el archivo: {}"], [9,"El tamaño del archivo excede el límite: {}"], [10,"La longitud de la cadena excede el límite"], [11,"Fallo al abrir el archivo: {}"], [12,"Se encontraron datos dañados mientras se intentaba decodificar como {}. posición: {} contenido (en hexadecimal, mostrando como máximo {} bytes): {}"], [13,"No se admite la conversión al conjunto de caracteres {}"], [14,"Sin permisos. Consejo: Es posible que el archivo sea de solo lectura: {}"], [101,"#"], [102,"Archivo"], [103,"Tamaño"], [104,"Codificación"], [105,"Salto de línea"], [106,"Fragmento de texto"], [107,"Error"], [108,"Error al añadir los siguientes archivos:"], [109,"Reason:"], [110,"Se detectaron {} archivos que no eran archivos de texto, o no se detectó ningún juego de caracteres:"], [111,"...etc."], [112, "Consejo: use el modo \"Sin filtro\" para agregar nuevamente, y puede hacer clic derecho en el cuadro de lista para especificar la codificación original manualmente."], [113,"Consejo"], [114,"No hay archivos que convertir."], [115,"El directorio de salida no es válido."], [116,"La conversión de {} archivos se ha realizado correctamente."], [117,"No se han podido convertir los siguientes archivos:"], [118,"Los archivos restantes no se procesan porque la operación se canceló."], [119,"Resultado de la conversión"], [120, "Note: GB18030 y otras codificaciones se superponen con la codificación UTF-8, mientras que el contenido está en inglés puro (o sólo caracteres ASCII), por lo que puede mostrarse como codificación UTF-8 después de la conversión."], [121,"Se soportan los siguientes formatos:"], [122, "(El separador permite espacios, comas y barras verticales, y la extensión permite *. o sin)"], [123,"No se ha especificado ninguna extensión para filtrar."], [124,"Este filtro de extensión no es válido:"], [125,"Todos los archivos"], [126,"Error al especificar la codificación del siguiente archivo:"], [127,"Sin memoria."], [128,"Cancelar"], [129,"Convertir"], [130,"El contenido incluye caracteres no válidos"], [131,"Algunos caracteres se perderán al convertir a la codificación de destino:"], [132,"Aún no se soporta: {}, póngase en contacto con el autor."], [133,"Añadir por duplicado"], [134,"No se ha detectado ninguna codificación"], [135,"Error de escritura:"], [136,"El tamaño del archivo supera el límite"], [137,"Error al abrir el archivo:"], [138,"Lista de archivos"], [139,"1. Configurar filtro de archivos:"], [140,"Sin filtrar archivos"], [141,"Detección inteligente"], [142,"Usar extensión:"], [143,"2. Añadir archivos / carpetas:"], [144,"Archivos"], [145,"Carpetas"], [146,"3. Seleccionar salida:"], [147,"Archivo original"], [148,"Usar carpeta:"], [149,"4. Seleccionar codificación:"], [150,"Otra:"], [151,"Cambiar saltos de línea"], [152,"Vaciar lista"], [153,"Abrir con el Bloc de notas"], [154,"Especificar la codificación original"], [155,"Quitar"], [156,"Seleccionar carpeta"] ] } ================================================ FILE: src/SmartCharsetConverter/SmartCharsetConverter.cpp ================================================ #include #include "CLIHandler.h" #include "DialogMain.h" #include "Common/CommandLineParser.h" #include #include #include #include using namespace std; #ifndef NDEBUG int main() { #else int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR szCmdLine, int nCmdShow) { #endif // 得到命令行参数 const vector args = GetCommandLineArgs(); // 是否使用命令模式 // 进入命令行模式的前提条件:有传入参数,且这些参数不全为文件或文件夹路径 bool useCli = false; // GUI模式下的初始输入文件。目的是文件拖到程序图标上时能够自动加载 vector inputFilenames; // 第1个参数是程序路径。多于1个参数说明传入更多参数了 if (args.size() > 1) { for (int i = 1; i < args.size(); ++i) { auto path = filesystem::u8path(args[i]); if (!filesystem::is_regular_file(path) && !filesystem::is_directory(path)) { useCli = true; break; } inputFilenames.push_back(args[i]); } if (useCli) { // 进入命令行模式 return CLIMain(args); } } // GUI模式 try { InitCommonControls(); SupportHighDPI(); { DialogMain dialogMain(inputFilenames); auto ret = dialogMain.DoModal(); if (ret == -1) { auto code = GetLastError(); throw runtime_error(string("DoModal fail. \ncode = ") + to_string(code) + string("\ninfo = ") + to_utf8(GetLastErrorString(code))); } } return 0; } catch (const std::exception &err) { MessageBox(0, utf8_to_wstring(err.what()).c_str(), L"Error", MB_OK | MB_ICONERROR); return -1; } } ================================================ FILE: src/SmartCharsetConverter/SmartCharsetConverter.json ================================================ { "enableConvertLineBreaks": false, "excludeRule": "", "filterMode": 1, "includeRule": "h hpp c cpp cxx txt", "language": "", "lineBreak": 0, "outputCharset": 3, "outputDir": "", "outputTarget": 0 } ================================================ FILE: src/SmartCharsetConverter/resource.h ================================================ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ 生成的包含文件。 // 供 SmartCharsetConverter.rc 使用 // #define IDD_DIALOG_MAIN 101 #define IDI_ICON1 102 #define IDR_MENU_RIGHT 106 #define IDR_MENU_SELECT_LANGUAGES 107 #define IDR_LANGUAGEJSON_ENGLISH 108 #define IDR_LANGUAGEJSON2 109 #define IDR_LANGUAGEJSON_SIMPLIFIED_CHINESE 109 #define IDR_LANGUAGEJSON1 111 #define IDR_LANGUAGEJSON_SPANISH 111 #define IDC_RADIO_STRETEGY_SMART 1001 #define IDC_RADIO_STRETEGY_MANUAL 1002 #define IDC_RADIO_STRETEGY_NO_FILTER 1003 #define IDC_EDIT_INCLUDE_TEXT 1004 #define IDC_BUTTON_ADD_DIR 1010 #define IDC_BUTTON_ADD_FILES 1011 #define IDC_RADIO_TO_ORIGIN 1020 #define IDC_RADIO_TO_DIR 1021 #define IDC_EDIT_OUTPUT_DIR 1022 #define IDC_BUTTON_SET_OUTPUT_DIR 1023 #define IDC_RADIO_UTF8 1030 #define IDC_RADIO_UTF8BOM 1031 #define IDC_RADIO_GB18030 1032 #define IDC_RADIO_OTHER 1033 #define IDC_COMBO_OTHER_CHARSET 1034 #define IDC_LISTVIEW 1040 #define IDC_BUTTON_START 1050 #define IDC_BUTTON_CLEAR 1051 #define IDC_CHECK_CONVERT_RETURN 1052 #define IDC_RADIO_CRLF 1053 #define IDC_RADIO_LF 1054 #define IDC_RADIO_CR 1055 #define IDC_SYSLINK1 1057 #define IDC_BUTTON1 1058 #define IDC_BUTTON_SETTINGS 1058 #define IDC_STATIC_FILE_LISTS 1059 #define IDC_STATIC_SET_FILTER_MODE 1060 #define IDC_STATIC_ADD_FILES_OR_FOLDER 1061 #define IDC_STATIC_SET_OUTPUT 1062 #define IDC_STATIC_SET_OUTPUT_CHARSET 1063 #define ID_OPEN_WITH_NOTEPAD 40003 #define ID_REMOVE_ITEM 40004 #define ID_40005 40005 #define ID_SPECIFY_ORIGIN_CHARSET 40006 #define ID_40007 40007 #define ID_LANGUAGE 40008 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 112 #define _APS_NEXT_COMMAND_VALUE 40009 #define _APS_NEXT_CONTROL_VALUE 1064 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif ================================================ FILE: src/SmartCharsetConverter-imgui/CMakeLists.txt ================================================ # === SmartCharsetConverter-imgui ============= set(target_name SmartCharsetConverter-imgui) file(GLOB SRC_CODE *.h *.cpp ) # 目标exe add_executable(${target_name} ${SRC_CODE} SmartCharsetConverter.rc ) find_package(imgui CONFIG REQUIRED) target_link_libraries(${target_name} PRIVATE Core Translator guicon imgui::imgui opengl32.lib ) # 添加include目录 target_include_directories(${target_name} PRIVATE . ) # VS 设置 Subsystem 选项 set_target_properties(${target_name} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") set_target_properties(${target_name} PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:WINDOWS") set_target_properties(${target_name} PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS") ================================================ FILE: src/SmartCharsetConverter-imgui/FontAnalyzer.cpp ================================================ ================================================ FILE: src/SmartCharsetConverter-imgui/FontAnalyzer.h ================================================ #pragma once #include #include #include #include #include template > class FontAnalyzer { public: using InsertFunc = std::function; FontAnalyzer(InsertFunc insertFunc) : library([]() -> std::unique_ptr { FT_Library rawLibrary; FT_Error error = FT_Init_FreeType(&rawLibrary); if (error) { throw std::runtime_error( fmt::format("Failed to initialize FreeType library. error code = {}", error)); } return std::unique_ptr(rawLibrary, [](FT_LibraryRec_ *lib) { FT_Done_FreeType(lib); }); }()), insertFunc(insertFunc) {} Container GetUnicodePointRange(const std::string &fontFilePath) const { // Load font file FT_Face face; FT_Error error = FT_New_Face(library.get(), fontFilePath.c_str(), 0, &face); if (error == FT_Err_Unknown_File_Format) { throw std::runtime_error( fmt::format("Font file could be opened and read, but it appears that its font format is unsupported.")); } else if (error) { throw std::runtime_error(fmt::format("Font file could be opened and read, but it appears that its font " "format is unsupported. error code = {}", error)); } // Select the Unicode character map. error = FT_Select_Charmap(face, ft_encoding_unicode); if (error) { throw std::runtime_error(fmt::format("failed at FT_Select_Charmap. error code = {}", error)); } // Iterate over the character map to find supported Unicode characters. FT_ULong charcode = FT_Get_First_Char(face, nullptr); FT_ULong prev_charcode = charcode; Container seen; while (charcode != 0) { insertFunc(seen, static_cast(charcode)); charcode = FT_Get_Next_Char(face, charcode, nullptr); } // Cleanup FT_Done_Face(face); return seen; } private: std::unique_ptr library; InsertFunc insertFunc; }; ================================================ FILE: src/SmartCharsetConverter-imgui/FontLoader.cpp ================================================ #include "FontLoader.h" #include "FontAnalyzer.h" #include #include #include #include #include struct FontInfo { std::string fontPath; int fontSize; std::vector dict; }; constexpr char windowsFontDir[] = "C:\\Windows\\Fonts\\"; void LoadFonts(ImFontAtlas *ioFonts, float scaleFactor) { std::vector fontInfos{ FontInfo{std::string(windowsFontDir) + "segoeui.ttf", static_cast(16.0f * scaleFactor), std::vector{}}, FontInfo{std::string(windowsFontDir) + "msyh.ttc", static_cast(16.0f * scaleFactor), std::vector{}}, FontInfo{std::string(windowsFontDir) + "simsun.ttc", static_cast(16.0f * scaleFactor), std::vector{}}, }; ImFontConfig fontConfig; bool loadedTheFirst = false; for (std::size_t i = 0; i < fontInfos.size(); ++i) { if (loadedTheFirst) { fontConfig.MergeMode = true; } auto &fontInfo = fontInfos[i]; if (!std::filesystem::is_regular_file(std::filesystem::u8path(fontInfo.fontPath))) { continue; } FontAnalyzer> fontAnalyzer([](std::vector &c, ImWchar val) { c.push_back(val); }); auto ret = fontAnalyzer.GetUnicodePointRange(fontInfos[i].fontPath); ret.push_back(0); fontInfos[i].dict = std::move(ret); ImFont *font = ioFonts->AddFontFromFileTTF(fontInfos[i].fontPath.c_str(), static_cast(fontInfos[i].fontSize), &fontConfig, fontInfos[i].dict.data()); if (!font) { throw std::runtime_error(fmt::format("failed to add font: {}", fontInfo.fontPath)); } loadedTheFirst = true; } ioFonts->Build(); for (auto font : ioFonts->Fonts) { if (!font->IsLoaded()) { throw std::runtime_error(fmt::format("failed to load font: {}", font->ConfigData->Name)); } } } ================================================ FILE: src/SmartCharsetConverter-imgui/FontLoader.h ================================================ #pragma once #include #include void LoadFonts(ImFontAtlas *ioFonts, float scaleFactor = 1.0f); class FontLoader { public: FontLoader() {} void StartAsyncLoad(float scaleFactor = 1.0f) { assert(!fu.valid()); fu = std::async(std::launch::async, [scaleFactor]() -> std::unique_ptr { std::unique_ptr ioFonts(IM_NEW(ImFontAtlas)); LoadFonts(ioFonts.get(), scaleFactor); return ioFonts; }); } std::unique_ptr TryGetFontAtlas() { if (!fu.valid()) { return nullptr; } if (fu.wait_for(std::chrono::milliseconds(0)) == std::future_status::ready) { return fu.get(); } return nullptr; } private: std::future> fu; }; ================================================ FILE: src/SmartCharsetConverter-imgui/ListView.cpp ================================================ #include "ListView.h" #include #include /** * @return */ template std::tuple Compare(const ListView::MyItem *a, const ListView::MyItem *b, bool ascending) { if (std::get(a->AsTuple()) == std::get(b->AsTuple())) { return {false, true}; } bool isLessThan = std::get(a->AsTuple()) < std::get(b->AsTuple()); return {ascending ? isLessThan : !isLessThan, false}; } bool CompareWithSortSpecs(ImGuiTableSortSpecs *sort_specs, const ListView::MyItem *a, const ListView::MyItem *b) { for (int n = 0; n < sort_specs->SpecsCount; n++) { // Here we identify columns using the ColumnUserID value that we ourselves passed to TableSetupColumn() // We could also choose to identify columns based on their index (sort_spec->ColumnIndex), which is // simpler! const ImGuiTableColumnSortSpecs *sort_spec = &sort_specs->Specs[n]; switch (sort_spec->ColumnUserID) { case 0: { auto [returnValue, shouldBreak] = Compare<0>(a, b, sort_spec->SortDirection == ImGuiSortDirection_Ascending); if (shouldBreak) { break; } return returnValue; } case 1: { auto [returnValue, shouldBreak] = Compare<1>(a, b, sort_spec->SortDirection == ImGuiSortDirection_Ascending); if (shouldBreak) { break; } return returnValue; } case 2: { auto [returnValue, shouldBreak] = Compare<2>(a, b, sort_spec->SortDirection == ImGuiSortDirection_Ascending); if (shouldBreak) { break; } return returnValue; } case 3: { auto [returnValue, shouldBreak] = Compare<3>(a, b, sort_spec->SortDirection == ImGuiSortDirection_Ascending); if (shouldBreak) { break; } return returnValue; } case 4: { auto [returnValue, shouldBreak] = Compare<4>(a, b, sort_spec->SortDirection == ImGuiSortDirection_Ascending); if (shouldBreak) { break; } return returnValue; } case 5: { auto [returnValue, shouldBreak] = Compare<5>(a, b, sort_spec->SortDirection == ImGuiSortDirection_Ascending); if (shouldBreak) { break; } return returnValue; } default: IM_ASSERT(0); break; } } return false; } ListView::ListView(LanguageService &languageService) noexcept : languageService(languageService) { static const char *template_items_names[] = {u8"香蕉", u8"苹果", u8"樱桃", u8"西瓜", u8"葡萄柚", u8"草莓", u8"芒果", u8"猕猴桃", u8"橙子", u8"菠萝", u8"蓝莓", u8"李子", u8"椰子", u8"梨", u8"杏"}; const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing(); // Create item list if (items.size() == 0) { items.resize(50, MyItem()); for (int n = 0; n < items.size(); n++) { const int template_n = n % IM_ARRAYSIZE(template_items_names); MyItem &item = items[n]; item.index = n; item.fileName = template_items_names[template_n]; item.fileSize = (n * n - n) % 20; // Assign default quantities } } } void ListView::Render() { std::vector itemsTemp; { std::unique_lock ul(itemsLock); itemsTemp.swap(itemsQueue); } items.insert(items.end(), itemsTemp.begin(), itemsTemp.end()); const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing(); // Options static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ScrollY; // ImGuiTableFlags_NoBordersInBody | // PushStyleCompact(); // ImGui::CheckboxFlags("ImGuiTableFlags_SortMulti", &flags, ImGuiTableFlags_SortMulti); // ImGui::SameLine(); // HelpMarker("When sorting is enabled: hold shift when clicking headers to sort on multiple column. " // "TableGetSortSpecs() may return specs where (SpecsCount > 1)."); // ImGui::CheckboxFlags("ImGuiTableFlags_SortTristate", &flags, ImGuiTableFlags_SortTristate); // ImGui::SameLine(); // HelpMarker("When sorting is enabled: allow no sorting, disable default sorting. TableGetSortSpecs() may " // "return specs where (SpecsCount == 0)."); // PopStyleCompact(); if (ImGui::BeginTable("table_sorting", static_cast(ListViewColumn::TEXT_PIECE) + 1, flags, ImVec2(0.0f, TEXT_BASE_HEIGHT * 15), 0.0f)) { // Declare columns // We use the "user_id" parameter of TableSetupColumn() to specify a user id that will be stored in the // sort specifications. This is so our sort function can identify a column given our own identifier. We // could also identify them based on their index! Demonstrate using a mixture of flags among available // sort-related flags: // - ImGuiTableColumnFlags_DefaultSort // - ImGuiTableColumnFlags_NoSort / ImGuiTableColumnFlags_NoSortAscending / // ImGuiTableColumnFlags_NoSortDescending // - ImGuiTableColumnFlags_PreferSortAscending / ImGuiTableColumnFlags_PreferSortDescending ImGui::TableSetupColumn(languageService.GetUtf8String(v0_2::StringId::INDEX).c_str(), ImGuiTableColumnFlags_DefaultSort | ImGuiTableColumnFlags_WidthFixed, 0.0f, static_cast(ListViewColumn::INDEX)); ImGui::TableSetupColumn(languageService.GetUtf8String(v0_2::StringId::FILENAME).c_str(), ImGuiTableColumnFlags_WidthFixed, 0.0f, static_cast(ListViewColumn::FILENAME)); ImGui::TableSetupColumn(languageService.GetUtf8String(v0_2::StringId::SIZE).c_str(), ImGuiTableColumnFlags_WidthFixed, 0.0f, static_cast(ListViewColumn::FILESIZE)); ImGui::TableSetupColumn(languageService.GetUtf8String(v0_2::StringId::ENCODING).c_str(), ImGuiTableColumnFlags_WidthFixed, 0.0f, static_cast(ListViewColumn::ENCODING)); ImGui::TableSetupColumn(languageService.GetUtf8String(v0_2::StringId::LINE_BREAKS).c_str(), ImGuiTableColumnFlags_WidthFixed, 0.0f, static_cast(ListViewColumn::LINE_BREAK)); ImGui::TableSetupColumn(languageService.GetUtf8String(v0_2::StringId::TEXT_PIECE).c_str(), ImGuiTableColumnFlags_WidthStretch, 0.0f, static_cast(ListViewColumn::TEXT_PIECE)); ImGui::TableSetupScrollFreeze(0, 1); // Make row always visible ImGui::TableHeadersRow(); // Sort our data if sort specs have been changed! if (ImGuiTableSortSpecs *sort_specs = ImGui::TableGetSortSpecs()) if (sort_specs->SpecsDirty) { std::sort(items.begin(), items.end(), [sort_specs](const MyItem &lhs, const MyItem &rhs) -> bool { return CompareWithSortSpecs(sort_specs, &lhs, &rhs); }); sort_specs->SpecsDirty = false; } // Demonstrate using clipper for large vertical lists ImGuiListClipper clipper; clipper.Begin(static_cast(items.size())); while (clipper.Step()) for (int row_n = clipper.DisplayStart; row_n < clipper.DisplayEnd; row_n++) { // Display a data item MyItem *item = &items[row_n]; ImGui::PushID(item->index); ImGui::TableNextRow(); ImGui::TableNextColumn(); // ImGui::Text("%04d", item->ID); { static ImVector selection; const bool item_is_selected = selection.contains(item->index); std::string label = fmt::format("{}", item->index); ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap; if (ImGui::Selectable(label.c_str(), item_is_selected, selectable_flags, ImVec2(0, 0))) { if (ImGui::GetIO().KeyCtrl) { if (item_is_selected) selection.find_erase_unsorted(item->index); else selection.push_back(item->index); } else { selection.clear(); selection.push_back(item->index); } } } ImGui::TableNextColumn(); ImGui::TextUnformatted(item->fileName.c_str()); ImGui::TableNextColumn(); ImGui::Text("%d", item->fileSize); ImGui::TableNextColumn(); ImGui::PopID(); } // if in this frame there are new items to add, to scroll table to bottom if (!itemsTemp.empty()) { ImGui::SetScrollHereY(1.0); } ImGui::EndTable(); } } void ListView::AddItem(MyItem myItem) { std::unique_lock ul(itemsLock); itemsQueue.push_back(std::move(myItem)); } ================================================ FILE: src/SmartCharsetConverter-imgui/ListView.h ================================================ #pragma once #include #include #include #include #include #include class ListView { public: ListView(LanguageService &languageService) noexcept; enum class ListViewColumn { INDEX = 0, FILENAME, FILESIZE, ENCODING, LINE_BREAK, TEXT_PIECE }; struct MyItem { int index; std::string fileName; std::size_t fileSize; CharsetCode encoding; LineBreaks lineBreak; std::string textPiece; const std::tuple AsTuple() const noexcept { return std::tie(index, fileName, fileSize, encoding, lineBreak, textPiece); } }; void Render(); void AddItem(MyItem myItem); private: LanguageService &languageService; std::mutex itemsLock; std::vector itemsQueue; std::vector items; }; ================================================ FILE: src/SmartCharsetConverter-imgui/MainWindow.cpp ================================================ #include "MainWindow.h" #include "resource.h" #include #include // third party #include #define GLFW_EXPOSE_NATIVE_WIN32 #include #include #include #include #include #include #include const std::string configFileName = "SmartCharsetConverter.json"; const std::vector innerLanguageIds = { IDR_LANGUAGEJSON_ENGLISH, IDR_LANGUAGEJSON_SIMPLIFIED_CHINESE, IDR_LANGUAGEJSON_SPANISH, }; EventAction PopupMessageBox(const std::string &text, const std::string &caption, std::function fnInPopupScope = nullptr) noexcept { ImGui::OpenPopup(caption.c_str()); // Always center this window when appearing ImVec2 center = ImGui::GetMainViewport()->GetCenter(); ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f)); if (ImGui::BeginPopupModal(caption.c_str(), NULL, ImGuiWindowFlags_AlwaysAutoResize)) { std::shared_ptr defer(nullptr, [](...) { ImGui::EndPopup(); }); ImGui::Text(text.c_str()); ImGui::Separator(); ImGui::SetItemDefaultFocus(); if (ImGui::Button("OK", ImVec2(120, 0))) { ImGui::CloseCurrentPopup(); return EventAction::FINISH; } if (fnInPopupScope) { return fnInPopupScope(); } } return EventAction::KEEP_ALIVE; } MainWindow::MainWindow(GLFWwindow *glfwWindow, const std::vector &filenames) : glfwWindow(glfwWindow), core(configFileName, CoreInitOption{}), languageService([this]() -> LanguageServiceOption { LanguageServiceOption option; option.languageName = core.GetConfig().language; option.resourceIds = innerLanguageIds; option.resourceType = L"LanguageJson"; return option; }()), listView(languageService) { uni_table::InitUtf8Table(); pool.detach_task([this, filenames = std::move(filenames)]() { AddItems(filenames); }); } void MainWindow::Render() { ImGui::StyleColorsLight(); { ImGuiStyle &style = ImGui::GetStyle(); style.FrameBorderSize = 1.0f; style.ScrollbarSize = 20.0f; style.ScrollbarRounding = 0.0f; } { bool open = true; static bool use_work_area = true; static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar; // We demonstrate using the full viewport area or the work area (without menu-bars, task-bars etc.) // Based on your use case you may want one or the other. const ImGuiViewport *viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(use_work_area ? viewport->WorkPos : viewport->Pos); ImGui::SetNextWindowSize(use_work_area ? viewport->WorkSize : viewport->Size); if (ImGui::Begin("Example: Simple layout", &open, flags)) { if (ImGui::BeginMenuBar()) { if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("Close", "Ctrl+W")) { //*p_open = false; } ImGui::EndMenu(); } ImGui::EndMenuBar(); } // Left static int selected = 0; { ImGui::BeginGroup(); ImGui::BeginChild("left pane", ImVec2(150, 0), ImGuiChildFlags_ResizeX); ImGui::SeparatorText(languageService.GetUtf8String(v0_2::StringId::FILE_LISTS).c_str()); { ImGui::BeginChild("left pane", ImVec2(0, 0), ImGuiChildFlags_Border); // for (int i = 0; i < 100; i++) { // // FIXME: Good candidate to use ImGuiSelectableFlags_SelectOnNav // char label[128]; // sprintf(label, "MyObject %d", i); // if (ImGui::Selectable(label, selected == i)) // selected = i; // } listView.Render(); ImGui::EndChild(); } ImGui::EndChild(); ImGui::EndGroup(); } // here can catch the drop event at left panel HandleDragDrop(); ImGui::SameLine(); // Right { ImGui::BeginGroup(); ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); // Leave room for 1 line below us // whether configuration is changed. // after all the flow, this flag indicates whether the configuration should be wrote to file. bool changed = false; // 1. selete filter mode ImGui::SetNextItemOpen(true, ImGuiCond_FirstUseEver); if (ImGui::TreeNode( fmt::format(languageService.GetUtf8String(v0_2::StringId::SET_FILTER_MODE)).c_str())) { changed |= ImGui::RadioButton(languageService.GetUtf8String(v0_2::StringId::NO_FILTER).c_str(), reinterpret_cast(&core.GetConfigRef().filterMode), static_cast(Configuration::FilterMode::NO_FILTER)); changed |= ImGui::RadioButton(languageService.GetUtf8String(v0_2::StringId::SMART_FILE_DETECTION).c_str(), reinterpret_cast(&core.GetConfigRef().filterMode), static_cast(Configuration::FilterMode::SMART)); changed |= ImGui::RadioButton(languageService.GetUtf8String(v0_2::StringId::USE_FILE_EXTENSION).c_str(), reinterpret_cast(&core.GetConfigRef().filterMode), static_cast(Configuration::FilterMode::ONLY_SOME_EXTANT)); ImGui::BeginDisabled(core.GetConfigRef().filterMode != Configuration::FilterMode::ONLY_SOME_EXTANT); ImGui::InputText("##", &core.GetConfigRef().includeRule); ImGui::EndDisabled(); ImGui::TreePop(); } // 2. add files or folder ImGui::SetNextItemOpen(true, ImGuiCond_FirstUseEver); if (ImGui::TreeNode( fmt::format(languageService.GetUtf8String(v0_2::StringId::ADD_FILES_OR_FOLDER)).c_str())) { if (ImGui::Button(languageService.GetUtf8String(v0_2::StringId::ADD_FILES).c_str())) { try { std::vector> dialogFilter; switch (core.GetConfig().filterMode) { case Configuration::FilterMode::NO_FILTER: case Configuration::FilterMode::SMART: // 智能识别文本 dialogFilter = { {languageService.GetWString(v0_2::StringId::ALL_FILES) + L"*.*", L"*.*"}}; break; case Configuration::FilterMode::ONLY_SOME_EXTANT: { // 只包括指定后缀 std::wstring filterExtsStr; // dialog的过滤器要求;分割 CheckAndTraversalIncludeRule([&](const std::string &dotExt) { filterExtsStr += utf8_to_wstring("*" + dotExt + ";"); }); // dialog过滤器 dialogFilter.push_back(make_pair(filterExtsStr, filterExtsStr)); break; } default: assert(0); } // 打开文件对话框 TFileDialog dialog(glfwGetWin32Window(glfwWindow), dialogFilter, true); if (dialog.Open()) { auto filenames = to_utf8(dialog.GetResult()); pool.detach_task([this, filenames = std::move(filenames)]() { AddItems(filenames); }); } } catch (const std::runtime_error &err) { PopupMessageBox(err.what(), languageService.GetUtf8String(v0_2::StringId::MSGBOX_ERROR)); } } ImGui::SameLine(); bool clicked = ImGui::Button(languageService.GetUtf8String(v0_2::StringId::ADD_FOLDER).c_str()); if (clicked) { TFolderBrowser folderBrowser(glfwGetWin32Window(glfwWindow)); if (folderBrowser.Open(folderBrowserDir)) { pool.detach_task([this]() { AddItems({to_utf8(folderBrowserDir)}); }); } } ImGui::TreePop(); } // 3. select output target ImGui::SetNextItemOpen(true, ImGuiCond_FirstUseEver); if (ImGui::TreeNode(fmt::format(languageService.GetUtf8String(v0_2::StringId::SET_OUTPUT)).c_str())) { changed |= ImGui::RadioButton(languageService.GetUtf8String(v0_2::StringId::OUTPUT_TO_ORIGIN).c_str(), reinterpret_cast(&core.GetConfigRef().outputTarget), static_cast(Configuration::OutputTarget::ORIGIN)); changed |= ImGui::RadioButton(languageService.GetUtf8String(v0_2::StringId::OUTPUT_TO_FOLDER).c_str(), reinterpret_cast(&core.GetConfigRef().outputTarget), static_cast(Configuration::OutputTarget::TO_DIR)); ImGui::BeginDisabled(core.GetConfigRef().outputTarget != Configuration::OutputTarget::TO_DIR); ImGui::InputText("##", &core.GetConfigRef().outputDir); ImGui::SameLine(); if (ImGui::Button(languageService.GetUtf8String(v0_2::StringId::SELECT_FOLDER).c_str())) { TFolderBrowser folderBrowser(glfwGetWin32Window(glfwWindow)); if (folderBrowser.Open(folderBrowserDir)) { core.SetOutputDir(to_utf8(folderBrowserDir)); } } ImGui::EndDisabled(); ImGui::TreePop(); } // 4. specify output charset ImGui::SetNextItemOpen(true, ImGuiCond_FirstUseEver); if (ImGui::TreeNode( fmt::format(languageService.GetUtf8String(v0_2::StringId::SET_OUTPUT_CHARSET)).c_str())) { // shown, outer charset (these charset are not in combo box) const std::vector comboBoxOtherExcludes = {CharsetCode::UTF8, CharsetCode::UTF8BOM, CharsetCode::GB18030}; // FIXME: move to initializing std::vector comboBoxOthers; for (int icode = static_cast(CharsetCode::UTF8); icode < static_cast(CharsetCode::CHARSET_CODE_END); ++icode) { CharsetCode code = static_cast(icode); if (std::find(comboBoxOtherExcludes.begin(), comboBoxOtherExcludes.end(), code) != comboBoxOtherExcludes.end()) { continue; } comboBoxOthers.push_back(code); } for (auto charset : comboBoxOtherExcludes) { changed |= ImGui::RadioButton(ToViewCharsetName(charset).c_str(), reinterpret_cast(&core.GetConfigRef().outputCharset), static_cast(charset)); } bool outputCharsetIsInOthersComboBox = std::find(comboBoxOtherExcludes.begin(), comboBoxOtherExcludes.end(), core.GetConfigRef().outputCharset) == comboBoxOtherExcludes.end(); int selectedOthers = outputCharsetIsInOthersComboBox; changed |= ImGui::RadioButton(languageService.GetUtf8String(v0_2::StringId::OTHERS).c_str(), &selectedOthers, true); CharsetCode comboSelectionCode; if (outputCharsetIsInOthersComboBox) { comboSelectionCode = core.GetConfigRef().outputCharset; } else { assert(comboBoxOthers.size() > 0); comboSelectionCode = comboBoxOthers[0]; } if (!outputCharsetIsInOthersComboBox && selectedOthers) { core.GetConfigRef().outputCharset = comboSelectionCode; changed = true; } ImGui::BeginDisabled(!outputCharsetIsInOthersComboBox); ImGui::SameLine(); if (ImGui::BeginCombo("##combo 1", ToViewCharsetName(comboSelectionCode).c_str())) { for (auto code : comboBoxOthers) { if (ImGui::Selectable(ToViewCharsetName(code).c_str(), core.GetConfigRef().outputCharset == code)) { core.GetConfigRef().outputCharset = code; changed = true; } // Set the initial focus when opening the combo (scrolling + keyboard navigation focus) if (core.GetConfigRef().outputCharset == code) { ImGui::SetItemDefaultFocus(); } } ImGui::EndCombo(); } ImGui::EndDisabled(); ImGui::TreePop(); } if (changed) { core.WriteConfigToFile(); } ImGui::EndChild(); ImGui::EndGroup(); } // here can catch the drop event at right panel HandleDragDrop(); } ImGui::End(); // in theory here is the whole window's end, but HandleDragDrop() not work if it's at here. // so have to put two HandleDragDrop at both left panel and right panel's end. } { static uni_table::ExampleAssetsBrowser brower; bool open = true; brower.Draw("aa", &open); } // 在这里放置你所有的 UI 控件 static bool show_demo_window = true; if (show_demo_window) ImGui::ShowDemoWindow(&show_demo_window); { std::unique_lock ul(guiEventsLock); localGuiEvents.insert(localGuiEvents.end(), guiEvents.begin(), guiEvents.end()); guiEvents.clear(); } for (auto it = localGuiEvents.begin(); it != localGuiEvents.end();) { auto &ev = *it; EventAction act = ev(); if (act == EventAction::FINISH) { it = localGuiEvents.erase(it); } else { it++; } } } void MainWindow::AddGuiEvent(std::function guiEvent) noexcept { std::unique_lock ul(guiEventsLock); guiEvents.push_back(guiEvent); } void MainWindow::HandleDragDrop() { if (ImGui::BeginDragDropTarget()) { auto payload = ImGui::AcceptDragDropPayload("files", ImGuiDragDropFlags_AcceptBeforeDelivery); if (payload->IsDelivery()) { std::string s(reinterpret_cast(payload->Data), payload->DataSize); auto j = nlohmann::json::parse(s); std::vector filenames = j["data"].get>(); fmt::print("accept: {}\n", filenames); pool.detach_task([this, filenames = std::move(filenames)]() { AddItems(filenames); }); } ImGui::EndDragDropTarget(); } } void MainWindow::CheckAndTraversalIncludeRule(std::function fn) { // 后缀字符串 auto &extsStr = core.GetConfig().includeRule; // 切分 auto exts = Split(extsStr, u8" ,|"); std::string filterExampleStr = languageService.GetUtf8String(v0_2::StringId::SUPPORT_FORMAT_BELOW) + u8"\r\n *.h *.hpp *.c *.cpp *.txt\r\n h hpp c cpp txt\r\n h|hpp|c|cpp\r\n" + languageService.GetUtf8String(v0_2::StringId::SEPERATOR_DESCRIPTION); // 如果为空 if (exts.empty()) { throw std::runtime_error(languageService.GetUtf8String(v0_2::StringId::NO_SPECIFY_FILTER_EXTEND) + u8"\r\n\r\n" + filterExampleStr); } // 逐个检查 for (auto s : exts) { std::string extStr(s); std::string pattern = u8R"((\*\.|\.|)(\w+))"; // 匹配*.xxx/.xxx/xxx的正则 std::regex r(pattern); std::smatch results; if (std::regex_match(extStr, results, r) == false) { throw std::runtime_error(languageService.GetUtf8String(v0_2::StringId::INVALID_EXTEND_FILTER) + extStr + u8"\r\n\r\n" + filterExampleStr); } fn(tolower(u8"." + results.str(2))); } } void MainWindow::AddItems(const std::vector &pathStrings) noexcept { std::shared_ptr> doCancel = std::make_shared>(false); // ========================================================= // 后缀 std::unordered_set filterDotExts; switch (core.GetConfig().filterMode) { case Configuration::FilterMode::NO_FILTER: break; case Configuration::FilterMode::SMART: // 智能识别文本 break; case Configuration::FilterMode::ONLY_SOME_EXTANT: // 只包括指定后缀 try { CheckAndTraversalIncludeRule([&](const std::string &dotExt) { filterDotExts.insert(dotExt); }); } catch (const std::runtime_error &err) { AddGuiEvent([this, err]() -> EventAction { return ::PopupMessageBox(err.what(), languageService.GetUtf8String(v0_2::StringId::MSGBOX_ERROR)); }); return; } break; default: assert(0); } std::shared_ptr> finished = std::make_shared>(false); std::shared_ptr defer = std::shared_ptr(nullptr, [finished](...) { finished->store(true); }); std::shared_ptr> status = std::make_shared>(); std::shared_ptr> progress = std::make_shared>(-1); std::shared_ptr> progressTotal = std::make_shared>(-1); // ========================================================= AddGuiEvent([this, doCancel, status, finished, progress, progressTotal]() -> EventAction { // FIXME ImGui::OpenPopup("adding"); // Always center this window when appearing ImVec2 center = ImGui::GetMainViewport()->GetCenter(); ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f)); if (ImGui::BeginPopupModal("adding", NULL, ImGuiWindowFlags_AlwaysAutoResize)) { std::shared_ptr defer(nullptr, [](...) { ImGui::EndPopup(); }); ImGui::Text(status->synchronize()->c_str()); if (progress->load() < 0) { ImGui::ProgressBar(-1.0f * (float)ImGui::GetTime(), ImVec2(0.0f, 0.0f), "Searching.."); // FIXME } else { float fraction = static_cast(progress->load()) / static_cast(progressTotal->load()); ImGui::ProgressBar(fraction, ImVec2(0.0f, 0.0f), fmt::format("{}/{}", progress->load(), progressTotal->load()).c_str()); // FIXME } ImGui::Separator(); if (ImGui::Button(languageService.GetUtf8String(v0_2::StringId::CANCEL).c_str())) { doCancel->store(true); } } return finished->load() ? EventAction::FINISH : EventAction::KEEP_ALIVE; }); // ========================================================= status->synchronize()->assign(u8"正在统计文件数量..."); // FIXME std::vector paths; for (auto &pathString : pathStrings) { if (doCancel->load()) { return; } auto path = std::filesystem::u8path(pathString); // 如果是目录 if (std::filesystem::is_directory(path)) { for (auto p : std::filesystem::recursive_directory_iterator(path)) { paths.push_back(p.path().u8string()); status->synchronize()->assign(fmt::format(u8"正在统计文件数量:{}...", paths.size())); // FIXME } continue; } // 如果是文件 paths.push_back(path.u8string()); status->synchronize()->assign(fmt::format(u8"正在统计文件数量:{}...", paths.size())); // FIXME } // ========================================================= std::vector> failed; // 失败的文件 std::vector ignored; // 忽略的文件 progressTotal->store(static_cast(paths.size())); for (auto it = paths.begin(); it != paths.end(); it++) { if (doCancel->load()) { break; } progress->store(static_cast(it - paths.begin())); auto &filename = *it; status->synchronize()->assign(u8"正在探测字符集..."); // FIXME try { Core::AddItemResult ret = core.AddItem(filename, filterDotExts); if (ret.isIgnore) { continue; } listView.AddItem( ListView::MyItem{-1, filename, ret.filesize, ret.srcCharset, ret.srcLineBreak, to_utf8(ret.strPiece)}); } catch (io_error_ignore) { ignored.push_back(filename); } catch (const MyRuntimeError &err) { failed.push_back({filename, err.ToLocalString(&languageService)}); } catch (const std::runtime_error &err) { failed.push_back({filename, err.what()}); } } // ========================================================= // show results std::shared_ptr closeButtonNotPressed = std::make_shared(true); AddGuiEvent([this, failed, ignored, closeButtonNotPressed]() -> EventAction { // 计算父窗口的 80% 宽高 ImVec2 parentSize = ImGui::GetMainViewport()->WorkSize; // Always center this window when appearing // ImVec2 popupSize(parentSize.x * 0.8f, parentSize.y * 0.8f); // ImGui::SetNextWindowSize(popupSize, ImGuiCond_Appearing); ImVec2 maxPopupSize(parentSize.x * 0.8f, parentSize.y * 0.8f); // 设置弹出窗口的大小约束(允许缩小,但最大不超过 80%) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), maxPopupSize); ImVec2 center = ImGui::GetMainViewport()->GetCenter(); ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f)); if (failed.empty() && ignored.empty()) { return EventAction::FINISH; } if (!*closeButtonNotPressed) { return EventAction::FINISH; } // FIXME ImGui::OpenPopup("results"); if (ImGui::BeginPopupModal("results", closeButtonNotPressed.get())) { std::shared_ptr defer(nullptr, [](...) { ImGui::EndPopup(); }); ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_RowBg | ImGuiTableFlags_ScrollY; // ImGuiTableFlags_NoBordersInBody | flags = ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV; if (!failed.empty()) { ImGui::Text(languageService.GetUtf8String(v0_2::StringId::FAILED_ADD_BELOW).c_str()); ImGui::Separator(); if (ImGui::BeginTable("##failed add below", 3, flags)) { ImGui::TableSetupColumn(u8"index", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn(u8"filename"); ImGui::TableSetupColumn(u8"reason"); ImGui::TableSetupScrollFreeze(0, 1); // Make row always visible ImGui::TableHeadersRow(); int index = 1; for (auto &pr : failed) { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text(fmt::format("{}", index++).c_str()); ImGui::TableNextColumn(); ImGui::Text(pr.first.c_str()); ImGui::TableNextColumn(); ImGui::Text(pr.second.c_str()); } ImGui::EndTable(); } } if (!ignored.empty()) { ImGui::Text( fmt::format(languageService.GetUtf8String(v0_2::StringId::NON_TEXT_OR_NO_DETECTED), ignored.size()) .c_str()); ImGui::Separator(); if (ImGui::BeginTable("##non text or no detected", 2, flags)) { ImGui::TableSetupColumn(u8"index", ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn(u8"filename"); ImGui::TableSetupScrollFreeze(0, 1); // Make row always visible ImGui::TableHeadersRow(); int index = 1; for (auto &filename : ignored) { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text(fmt::format("{}", index++).c_str()); ImGui::TableNextColumn(); ImGui::Text(filename.c_str()); } ImGui::EndTable(); } ImGui::Text(languageService.GetUtf8String(v0_2::StringId::TIPS_USE_NO_FILTER).c_str()); } ImGui::SetItemDefaultFocus(); if (ImGui::Button("OK", ImVec2(120, 0))) { ImGui::CloseCurrentPopup(); return EventAction::FINISH; } } return EventAction::KEEP_ALIVE; }); return; } ================================================ FILE: src/SmartCharsetConverter-imgui/MainWindow.h ================================================ #pragma once #include "UnicodeTable.h" #include "ListView.h" #include "Core/Core.h" #include "Translator/LanguageService.h" // third party #include #include #include #include enum class EventAction { KEEP_ALIVE, FINISH, }; class MainWindow { public: MainWindow(GLFWwindow *glfwWindow, const std::vector &filenames = {}); void Render(); private: // not own it, only ref it GLFWwindow *glfwWindow; Core core; LanguageService languageService; ListView listView; BS::thread_pool pool; mutable std::mutex guiEventsLock; std::vector> guiEvents; std::vector> localGuiEvents; std::wstring folderBrowserDir; std::atomic doCancel; void AddGuiEvent(std::function guiEvent) noexcept; void HandleDragDrop(); void CheckAndTraversalIncludeRule(std::function fn); void AddItems(const std::vector &pathes) noexcept; }; ================================================ FILE: src/SmartCharsetConverter-imgui/Resource/lang_embed/English.json ================================================ { "language":"English", "langId": 1033, "author":"Tom Willow", "version":"0.2", "date":"2024-12-22", "data":[ [1,"Some characters will be lost when converting to the target encoding: {}"], [2,"Content contains invalid characters"], [3,"UCNV Error. Error code: {}"], [4,"[{}->{}] Conversion error. Position: {}, Content: {}"], [5,"Truncated character found"], [6,"Duplicate addition"], [7,"Encoding not detected"], [8,"Failed to write file: {}"], [9,"File size exceeds limit: {}"], [10,"String length exceeds limit"], [11,"Failed to open file: {}"], [12,"Corrupted data found while decode as {}. position: {} content(in hex, shown {} bytes at most): {}"], [13,"Conversion to the {} charset is not supported"], [14,"No permission. Tip: The file might be read-only: {}"], [101,"Index"], [102,"File Name"], [103,"Size"], [104,"Encoding"], [105,"Line Breaks"], [106,"Text Fragment"], [107,"Error"], [108,"Failed to add the following files:"], [109,"Reason:"], [110,"{} files were detected to be non-text files, or no character set was detected:"], [111,"...etc."], [112, "Tip: Use the \"No Filter\" mode to add again, and you can right-click in the list box to specify the original encoding manually."], [113,"Tip"], [114,"There are no files to convert."], [115,"The output directory is invalid."], [116,"Conversion of {} files was successful."], [117,"The following files failed to be converted:"], [118,"The remaining files are not processed because the operation was canceled."], [119,"Conversion result"], [120, "Note: GB18030 and other some encodings is overlapped with UTF-8 encoding while content is in pure English(or only ASCII characters), so it may be displayed as UTF-8 encoding after conversion."], [121,"The following formats are supported:"], [122, "(The separator allows spaces, commas, and vertical bars, and the extension allows *. or without)"], [123,"No extension was specified to filter."], [124,"This extension filter is invalid:"], [125,"All files"], [126,"Failed to specify encoding for the following file:"], [127,"Out of memory."], [128,"Cancel"], [129,"Convert"], [130,"Content contains invalid characters"], [131,"Some characters will be lost when converting to the target encoding:"], [132,"Not supported yet: {}, please contact the author."], [133,"Duplicate addition"], [134,"No encoding detected"], [135,"Write failed:"], [136,"File size exceeds limit"], [137,"Failed to open file:"], [138,"File List"], [139,"1. Setup Files Filter:"], [140,"No Filter Files"], [141,"Smart File Detection"], [142,"Use File Extension:"], [143,"2. Add Files / Folders:"], [144,"Files"], [145,"Folder"], [146,"3. Select Output:"], [147,"Original File"], [148,"Use Folder:"], [149,"4. Select File Encoding:"], [150,"Other:"], [151,"Change Line Breaks"], [152,"Empty List"], [153,"Open with Notepad"], [154,"Specify original encoding"], [155,"Remove"], [156,"Select Folder"] ] } ================================================ FILE: src/SmartCharsetConverter-imgui/Resource/lang_embed/Simplified Chinese.json ================================================ { "language":"Simplified Chinese", "langId": 2052, "author":"Tom Willow", "version":"0.2", "date":"2024-12-22", "data":[ [1,"转换到目标编码会丢失字符:{}"], [2,"内容包含无效字符"], [3,"UCNV 错误。错误码:{}"], [4,"[{}->{}] 转换出错。位置:{},内容:{}"], [5,"发现截断的字符"], [6,"重复添加"], [7,"未探测出编码集"], [8,"写入文件失败:{}"], [9,"文件大小超出限制:{}"], [10,"字符串长度超出限制"], [11,"打开文件失败:{}"], [12,"以{}编码集解码时出现错误字符。位置:{} 内容(以16进制表示,最多显示{}字节): {}"], [13,"不支持转换到{}字符集"], [14,"没有权限。提示:可能文件是只读状态:{}"], [101,"序号"], [102,"文件名"], [103,"大小"], [104,"编码"], [105,"换行符"], [106,"文本片段"], [107,"出错"], [108,"以下文件添加失败:"], [109,"原因:"], [110,"{}个文件被判定为非文本文件、或者没有探测出字符集:"], [111,"......等"], [112,"提示:使用“不过滤”模式再次添加,可以在列表框中点击右键手动指定原编码集。"], [113,"提示"], [114,"没有待转换的文件。"], [115,"输出目录无效。"], [116,"转换成功 {} 个文件。"], [117,"以下文件转换失败:"], [118,"剩余文件由于取消操作所以未做处理。"], [119,"转换结果"], [120,"注意:GB18030等多个编码在纯英文(只有ASCII码)的情况下和UTF-8编码位重合,所以可能会出现转换后显示为UTF-8编码的情况。"], [121,"支持以下格式:"], [122,"(分隔符允许空格、逗号、竖线,后缀允许带*.或者不带)"], [123,"没有指定要过滤的后缀。"], [124,"指定的后缀过滤器无效:"], [125,"所有文件"], [126,"以下文件设置字符集失败:"], [127,"内存不足。"], [128,"取消"], [129,"开始转换"], [130,"内容包含无效字符"], [131,"转换到目标编码会丢失字符:"], [132,"暂不支持:{},请联系作者。"], [133,"重复添加"], [134,"未探测出编码集"], [135,"写入失败:"], [136,"文件大小超出限制"], [137,"打开文件失败:"], [138,"文件列表"], [139,"1. 设置文件过滤:"], [140,"不过滤"], [141,"智能识别文本文件"], [142,"只要指定后缀的文件:"], [143,"2. 添加要转换的文件或文件夹:"], [144,"添加文件"], [145,"添加文件夹"], [146,"3. 选择转出位置:"], [147,"转出到原文件"], [148,"转出到文件夹:"], [149,"4. 指定转出字符集:"], [150,"其他:"], [151,"转换换行符"], [152,"清空列表"], [153,"用记事本打开"], [154,"指定原编码"], [155,"移除"], [156,"选择文件夹"] ] } ================================================ FILE: src/SmartCharsetConverter-imgui/Resource/lang_embed/Spanish.json ================================================ { "language":"Spanish", "langId": 1252, "author":"Carlos Sánchez, Last Edited by Tom Willow", "version":"0.2", "date":"2024-12-22", "data":[ [1,"Algunos caracteres se perderán al convertir a la codificación de destino: {}"], [2,"El contenido incluye caracteres no válidos"], [3,"UCNV Error. Error code: {}"], [4,"[{}->{}] Error de conversión. Posición: {}, Contenido: {}"], [5,"Se encontró carácter truncado"], [6,"Adición duplicada"], [7,"No se detectó codificación"], [8,"Fallo al escribir el archivo: {}"], [9,"El tamaño del archivo excede el límite: {}"], [10,"La longitud de la cadena excede el límite"], [11,"Fallo al abrir el archivo: {}"], [12,"Se encontraron datos dañados mientras se intentaba decodificar como {}. posición: {} contenido (en hexadecimal, mostrando como máximo {} bytes): {}"], [13,"No se admite la conversión al conjunto de caracteres {}"], [14,"Sin permisos. Consejo: Es posible que el archivo sea de solo lectura: {}"], [101,"#"], [102,"Archivo"], [103,"Tamaño"], [104,"Codificación"], [105,"Salto de línea"], [106,"Fragmento de texto"], [107,"Error"], [108,"Error al añadir los siguientes archivos:"], [109,"Reason:"], [110,"Se detectaron {} archivos que no eran archivos de texto, o no se detectó ningún juego de caracteres:"], [111,"...etc."], [112, "Consejo: use el modo \"Sin filtro\" para agregar nuevamente, y puede hacer clic derecho en el cuadro de lista para especificar la codificación original manualmente."], [113,"Consejo"], [114,"No hay archivos que convertir."], [115,"El directorio de salida no es válido."], [116,"La conversión de {} archivos se ha realizado correctamente."], [117,"No se han podido convertir los siguientes archivos:"], [118,"Los archivos restantes no se procesan porque la operación se canceló."], [119,"Resultado de la conversión"], [120, "Note: GB18030 y otras codificaciones se superponen con la codificación UTF-8, mientras que el contenido está en inglés puro (o sólo caracteres ASCII), por lo que puede mostrarse como codificación UTF-8 después de la conversión."], [121,"Se soportan los siguientes formatos:"], [122, "(El separador permite espacios, comas y barras verticales, y la extensión permite *. o sin)"], [123,"No se ha especificado ninguna extensión para filtrar."], [124,"Este filtro de extensión no es válido:"], [125,"Todos los archivos"], [126,"Error al especificar la codificación del siguiente archivo:"], [127,"Sin memoria."], [128,"Cancelar"], [129,"Convertir"], [130,"El contenido incluye caracteres no válidos"], [131,"Algunos caracteres se perderán al convertir a la codificación de destino:"], [132,"Aún no se soporta: {}, póngase en contacto con el autor."], [133,"Añadir por duplicado"], [134,"No se ha detectado ninguna codificación"], [135,"Error de escritura:"], [136,"El tamaño del archivo supera el límite"], [137,"Error al abrir el archivo:"], [138,"Lista de archivos"], [139,"1. Configurar filtro de archivos:"], [140,"Sin filtrar archivos"], [141,"Detección inteligente"], [142,"Usar extensión:"], [143,"2. Añadir archivos / carpetas:"], [144,"Archivos"], [145,"Carpetas"], [146,"3. Seleccionar salida:"], [147,"Archivo original"], [148,"Usar carpeta:"], [149,"4. Seleccionar codificación:"], [150,"Otra:"], [151,"Cambiar saltos de línea"], [152,"Vaciar lista"], [153,"Abrir con el Bloc de notas"], [154,"Especificar la codificación original"], [155,"Quitar"], [156,"Seleccionar carpeta"] ] } ================================================ FILE: src/SmartCharsetConverter-imgui/UnicodeTable.cpp ================================================ #include "UnicodeTable.h" namespace uni_table { constexpr std::size_t UTF8_SPACE_SIZE = 0x10FFFF; std::array utf8table; Utf8Str PointToUtf8(int point) noexcept { Utf8Str utf8 = {{0, 0, 0, 0, 0, 0}}; unsigned int codepoint = static_cast(point); if (codepoint <= 0x7F) { // 1-byte sequence utf8[0] = static_cast(codepoint); utf8[1] = '\0'; } else if (codepoint <= 0x7FF) { // 2-byte sequence utf8[0] = static_cast(0xC0 | (codepoint >> 6)); utf8[1] = static_cast(0x80 | (codepoint & 0x3F)); utf8[2] = '\0'; } else if (codepoint <= 0xFFFF) { // 3-byte sequence utf8[0] = static_cast(0xE0 | (codepoint >> 12)); utf8[1] = static_cast(0x80 | ((codepoint >> 6) & 0x3F)); utf8[2] = static_cast(0x80 | (codepoint & 0x3F)); utf8[3] = '\0'; } else if (codepoint <= 0x10FFFF) { // 4-byte sequence utf8[0] = static_cast(0xF0 | (codepoint >> 18)); utf8[1] = static_cast(0x80 | ((codepoint >> 12) & 0x3F)); utf8[2] = static_cast(0x80 | ((codepoint >> 6) & 0x3F)); utf8[3] = static_cast(0x80 | (codepoint & 0x3F)); utf8[4] = '\0'; } else { // Invalid codepoint, return empty string utf8[0] = '\0'; } return utf8; } void InitUtf8Table() { for (int i = 1; i <= UTF8_SPACE_SIZE; ++i) { auto utf8 = PointToUtf8(i); utf8table[i] = utf8; } } // Functions ExampleAssetsBrowser::ExampleAssetsBrowser() { AddItems(UTF8_SPACE_SIZE); } } // namespace uni_table ================================================ FILE: src/SmartCharsetConverter-imgui/UnicodeTable.h ================================================ #pragma once #define _CRT_SECURE_NO_WARNINGS #include #define IMGUI_CDECL __cdecl // Helpers macros // We normally try to not use many helpers in imgui_demo.cpp in order to make code easier to copy and paste, // but making an exception here as those are largely simplifying code... // In other imgui sources we can use nicer internal functions from imgui_internal.h (ImMin/ImMax) but not in the demo. #define IM_MIN(A, B) (((A) < (B)) ? (A) : (B)) #define IM_MAX(A, B) (((A) >= (B)) ? (A) : (B)) #define IM_CLAMP(V, MN, MX) ((V) < (MN) ? (MN) : (V) > (MX) ? (MX) : (V)) #include #include namespace uni_table { using Utf8Str = std::array; Utf8Str PointToUtf8(int point) noexcept; void InitUtf8Table(); // Helper to display a little (?) mark which shows a tooltip when hovered. // In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.md) static void HelpMarker(const char *desc) { ImGui::TextDisabled("(?)"); if (ImGui::BeginItemTooltip()) { ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); ImGui::TextUnformatted(desc); ImGui::PopTextWrapPos(); ImGui::EndTooltip(); } } struct ExampleAsset { ImGuiID ID; int Type; ExampleAsset(ImGuiID id, int type) { ID = id; Type = type; } static const ImGuiTableSortSpecs *&Gets_current_sort_specs() { static const ImGuiTableSortSpecs *p = nullptr; return p; } static void SortWithSortSpecs(ImGuiTableSortSpecs *sort_specs, ExampleAsset *items, int items_count) { Gets_current_sort_specs() = sort_specs; // Store in variable accessible by the sort function. if (items_count > 1) qsort(items, (size_t)items_count, sizeof(items[0]), ExampleAsset::CompareWithSortSpecs); Gets_current_sort_specs() = NULL; } // Compare function to be used by qsort() static int IMGUI_CDECL CompareWithSortSpecs(const void *lhs, const void *rhs) { const ExampleAsset *a = (const ExampleAsset *)lhs; const ExampleAsset *b = (const ExampleAsset *)rhs; for (int n = 0; n < Gets_current_sort_specs()->SpecsCount; n++) { const ImGuiTableColumnSortSpecs *sort_spec = &Gets_current_sort_specs()->Specs[n]; int delta = 0; if (sort_spec->ColumnIndex == 0) delta = ((int)a->ID - (int)b->ID); else if (sort_spec->ColumnIndex == 1) delta = (a->Type - b->Type); if (delta > 0) return (sort_spec->SortDirection == ImGuiSortDirection_Ascending) ? +1 : -1; if (delta < 0) return (sort_spec->SortDirection == ImGuiSortDirection_Ascending) ? -1 : +1; } return ((int)a->ID - (int)b->ID); } }; // Extra functions to add deletion support to ImGuiSelectionBasicStorage struct ExampleSelectionWithDeletion : ImGuiSelectionBasicStorage { // Find which item should be Focused after deletion. // Call _before_ item submission. Retunr an index in the before-deletion item list, your item loop should call // SetKeyboardFocusHere() on it. The subsequent ApplyDeletionPostLoop() code will use it to apply Selection. // - We cannot provide this logic in core Dear ImGui because we don't have access to selection data. // - We don't actually manipulate the ImVector<> here, only in ApplyDeletionPostLoop(), but using similar API for // consistency and flexibility. // - Important: Deletion only works if the underlying ImGuiID for your items are stable: aka not depend on their // index, but on e.g. item id/ptr. // FIXME-MULTISELECT: Doesn't take account of the possibility focus target will be moved during deletion. Need // refocus or scroll offset. int ApplyDeletionPreLoop(ImGuiMultiSelectIO *ms_io, int items_count) { if (Size == 0) return -1; // If focused item is not selected... const int focused_idx = (int)ms_io->NavIdItem; // Index of currently focused item if (ms_io->NavIdSelected == false) // This is merely a shortcut, == Contains(adapter->IndexToStorage(items, focused_idx)) { ms_io->RangeSrcReset = true; // Request to recover RangeSrc from NavId next frame. Would be ok to reset even // when NavIdSelected==true, but it would take an extra frame to recover // RangeSrc when deleting a selected item. return focused_idx; // Request to focus same item after deletion. } // If focused item is selected: land on first unselected item after focused item. for (int idx = focused_idx + 1; idx < items_count; idx++) if (!Contains(GetStorageIdFromIndex(idx))) return idx; // If focused item is selected: otherwise return last unselected item before focused item. for (int idx = IM_MIN(focused_idx, items_count) - 1; idx >= 0; idx--) if (!Contains(GetStorageIdFromIndex(idx))) return idx; return -1; } // Rewrite item list (delete items) + update selection. // - Call after EndMultiSelect() // - We cannot provide this logic in core Dear ImGui because we don't have access to your items, nor to selection // data. template void ApplyDeletionPostLoop(ImGuiMultiSelectIO *ms_io, ImVector &items, int item_curr_idx_to_select) { // Rewrite item list (delete items) + convert old selection index (before deletion) to new selection index // (after selection). If NavId was not part of selection, we will stay on same item. ImVector new_items; new_items.reserve(items.Size - Size); int item_next_idx_to_select = -1; for (int idx = 0; idx < items.Size; idx++) { if (!Contains(GetStorageIdFromIndex(idx))) new_items.push_back(items[idx]); if (item_curr_idx_to_select == idx) item_next_idx_to_select = new_items.Size - 1; } items.swap(new_items); // Update selection Clear(); if (item_next_idx_to_select != -1 && ms_io->NavIdSelected) SetItemSelected(GetStorageIdFromIndex(item_next_idx_to_select), true); } }; struct ExampleAssetsBrowser { // Options bool ShowTypeOverlay = true; bool AllowSorting = true; bool AllowDragUnselected = false; bool AllowBoxSelect = true; float IconSize = 32.0f; int IconSpacing = 10; int IconHitSpacing = 4; // Increase hit-spacing if you want to make it possible to clear or box-select from gaps. Some spacing is // required to able to amend with Shift+box-select. Value is small in Explorer. bool StretchSpacing = true; // State ImVector Items; // Our items ExampleSelectionWithDeletion Selection; // Our selection (ImGuiSelectionBasicStorage + helper funcs to handle deletion) ImGuiID NextItemId = 0; // Unique identifier when creating new items bool RequestDelete = false; // Deferred deletion request bool RequestSort = false; // Deferred sort request float ZoomWheelAccum = 0.0f; // Mouse wheel accumulator to handle smooth wheels better // Calculated sizes for layout, output of UpdateLayoutSizes(). Could be locals but our code is simpler this way. ImVec2 LayoutItemSize; ImVec2 LayoutItemStep; // == LayoutItemSize + LayoutItemSpacing float LayoutItemSpacing = 0.0f; float LayoutSelectableSpacing = 0.0f; float LayoutOuterPadding = 0.0f; int LayoutColumnCount = 0; int LayoutLineCount = 0; // Functions ExampleAssetsBrowser(); void AddItems(int count) { if (Items.Size == 0) NextItemId = 0; Items.reserve(Items.Size + count); for (int n = 0; n < count; n++, NextItemId++) Items.push_back(ExampleAsset(NextItemId, (NextItemId % 20) < 15 ? 0 : (NextItemId % 20) < 18 ? 1 : 2)); RequestSort = true; } void ClearItems() { Items.clear(); Selection.Clear(); } // Logic would be written in the main code BeginChild() and outputing to local variables. // We extracted it into a function so we can call it easily from multiple places. void UpdateLayoutSizes(float avail_width) { // Layout: when not stretching: allow extending into right-most spacing. LayoutItemSpacing = (float)IconSpacing; if (StretchSpacing == false) avail_width += floorf(LayoutItemSpacing * 0.5f); // Layout: calculate number of icon per line and number of lines LayoutItemSize = ImVec2(floorf(IconSize), floorf(IconSize)); LayoutColumnCount = IM_MAX((int)(avail_width / (LayoutItemSize.x + LayoutItemSpacing)), 1); LayoutLineCount = (Items.Size + LayoutColumnCount - 1) / LayoutColumnCount; // Layout: when stretching: allocate remaining space to more spacing. Round before division, so item_spacing may // be non-integer. if (StretchSpacing && LayoutColumnCount > 1) LayoutItemSpacing = floorf(avail_width - LayoutItemSize.x * LayoutColumnCount) / LayoutColumnCount; LayoutItemStep = ImVec2(LayoutItemSize.x + LayoutItemSpacing, LayoutItemSize.y + LayoutItemSpacing); LayoutSelectableSpacing = IM_MAX(floorf(LayoutItemSpacing) - IconHitSpacing, 0.0f); LayoutOuterPadding = floorf(LayoutItemSpacing * 0.5f); } void Draw(const char *title, bool *p_open) { ImGui::SetNextWindowSize(ImVec2(IconSize * 25, IconSize * 15), ImGuiCond_FirstUseEver); if (!ImGui::Begin(title, p_open, ImGuiWindowFlags_MenuBar)) { ImGui::End(); return; } // Menu bar if (ImGui::BeginMenuBar()) { if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("Add 10000 items")) AddItems(10000); if (ImGui::MenuItem("Clear items")) ClearItems(); ImGui::Separator(); if (ImGui::MenuItem("Close", NULL, false, p_open != NULL)) *p_open = false; ImGui::EndMenu(); } if (ImGui::BeginMenu("Edit")) { if (ImGui::MenuItem("Delete", "Del", false, Selection.Size > 0)) RequestDelete = true; ImGui::EndMenu(); } if (ImGui::BeginMenu("Options")) { ImGui::PushItemWidth(ImGui::GetFontSize() * 10); ImGui::SeparatorText("Contents"); ImGui::Checkbox("Show Type Overlay", &ShowTypeOverlay); ImGui::Checkbox("Allow Sorting", &AllowSorting); ImGui::SeparatorText("Selection Behavior"); ImGui::Checkbox("Allow dragging unselected item", &AllowDragUnselected); ImGui::Checkbox("Allow box-selection", &AllowBoxSelect); ImGui::SeparatorText("Layout"); ImGui::SliderFloat("Icon Size", &IconSize, 16.0f, 128.0f, "%.0f"); ImGui::SameLine(); HelpMarker("Use CTRL+Wheel to zoom"); ImGui::SliderInt("Icon Spacing", &IconSpacing, 0, 32); ImGui::SliderInt("Icon Hit Spacing", &IconHitSpacing, 0, 32); ImGui::Checkbox("Stretch Spacing", &StretchSpacing); ImGui::PopItemWidth(); ImGui::EndMenu(); } ImGui::EndMenuBar(); } // Show a table with ONLY one header row to showcase the idea/possibility of using this to provide a sorting UI if (AllowSorting) { ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); ImGuiTableFlags table_flags_for_sort_specs = ImGuiTableFlags_Sortable | ImGuiTableFlags_SortMulti | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Borders; if (ImGui::BeginTable("for_sort_specs_only", 2, table_flags_for_sort_specs, ImVec2(0.0f, ImGui::GetFrameHeight()))) { ImGui::TableSetupColumn("Index"); ImGui::TableSetupColumn("Type"); ImGui::TableHeadersRow(); if (ImGuiTableSortSpecs *sort_specs = ImGui::TableGetSortSpecs()) if (sort_specs->SpecsDirty || RequestSort) { ExampleAsset::SortWithSortSpecs(sort_specs, Items.Data, Items.Size); sort_specs->SpecsDirty = RequestSort = false; } ImGui::EndTable(); } ImGui::PopStyleVar(); } ImGuiIO &io = ImGui::GetIO(); ImGui::SetNextWindowContentSize( ImVec2(0.0f, LayoutOuterPadding + LayoutLineCount * (LayoutItemSize.x + LayoutItemSpacing))); if (ImGui::BeginChild("Assets", ImVec2(0.0f, -ImGui::GetTextLineHeightWithSpacing()), ImGuiChildFlags_Border, ImGuiWindowFlags_NoMove)) { ImDrawList *draw_list = ImGui::GetWindowDrawList(); const float avail_width = ImGui::GetContentRegionAvail().x; UpdateLayoutSizes(avail_width); // Calculate and store start position. ImVec2 start_pos = ImGui::GetCursorScreenPos(); start_pos = ImVec2(start_pos.x + LayoutOuterPadding, start_pos.y + LayoutOuterPadding); ImGui::SetCursorScreenPos(start_pos); // Multi-select ImGuiMultiSelectFlags ms_flags = ImGuiMultiSelectFlags_ClearOnEscape | ImGuiMultiSelectFlags_ClearOnClickVoid; // - Enable box-select (in 2D mode, so that changing box-select rectangle X1/X2 boundaries will affect // clipped items) if (AllowBoxSelect) ms_flags |= ImGuiMultiSelectFlags_BoxSelect2d; // - This feature allows dragging an unselected item without selecting it (rarely used) if (AllowDragUnselected) ms_flags |= ImGuiMultiSelectFlags_SelectOnClickRelease; // - Enable keyboard wrapping on X axis // (FIXME-MULTISELECT: We haven't designed/exposed a general nav wrapping api yet, so this flag is provided // as a courtesy to avoid doing: // ImGui::NavMoveRequestTryWrapping(ImGui::GetCurrentWindow(), ImGuiNavMoveFlags_WrapX); // When we finish implementing a more general API for this, we will obsolete this flag in favor of the new // system) ms_flags |= ImGuiMultiSelectFlags_NavWrapX; ImGuiMultiSelectIO *ms_io = ImGui::BeginMultiSelect(ms_flags, Selection.Size, Items.Size); // Use custom selection adapter: store ID in selection (recommended) Selection.UserData = this; Selection.AdapterIndexToStorageId = [](ImGuiSelectionBasicStorage *self_, int idx) { ExampleAssetsBrowser *self = (ExampleAssetsBrowser *)self_->UserData; return self->Items[idx].ID; }; Selection.ApplyRequests(ms_io); const bool want_delete = (ImGui::Shortcut(ImGuiKey_Delete, ImGuiInputFlags_Repeat) && (Selection.Size > 0)) || RequestDelete; const int item_curr_idx_to_focus = want_delete ? Selection.ApplyDeletionPreLoop(ms_io, Items.Size) : -1; RequestDelete = false; // Push LayoutSelectableSpacing (which is LayoutItemSpacing minus hit-spacing, if we decide to have hit gaps // between items) Altering style ItemSpacing may seem unnecessary as we position every items using // SetCursorScreenPos()... But it is necessary for two reasons: // - Selectables uses it by default to visually fill the space between two items. // - The vertical spacing would be measured by Clipper to calculate line height if we didn't provide it // explicitly (here we do). ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(LayoutSelectableSpacing, LayoutSelectableSpacing)); // Rendering parameters const ImU32 icon_type_overlay_colors[3] = {0, IM_COL32(200, 70, 70, 255), IM_COL32(70, 170, 70, 255)}; const ImU32 icon_bg_color = ImGui::GetColorU32(ImGuiCol_MenuBarBg); const ImVec2 icon_type_overlay_size = ImVec2(4.0f, 4.0f); const bool display_label = (LayoutItemSize.x >= ImGui::CalcTextSize("999").x); const int column_count = LayoutColumnCount; ImGuiListClipper clipper; clipper.Begin(LayoutLineCount, LayoutItemStep.y); if (item_curr_idx_to_focus != -1) clipper.IncludeItemByIndex(item_curr_idx_to_focus / column_count); // Ensure focused item line is not clipped. if (ms_io->RangeSrcItem != -1) clipper.IncludeItemByIndex((int)ms_io->RangeSrcItem / column_count); // Ensure RangeSrc item line is not clipped. while (clipper.Step()) { for (int line_idx = clipper.DisplayStart; line_idx < clipper.DisplayEnd; line_idx++) { const int item_min_idx_for_current_line = line_idx * column_count; const int item_max_idx_for_current_line = IM_MIN((line_idx + 1) * column_count, Items.Size); for (int item_idx = item_min_idx_for_current_line; item_idx < item_max_idx_for_current_line; ++item_idx) { ExampleAsset *item_data = &Items[item_idx]; ImGui::PushID((int)item_data->ID); // Position item ImVec2 pos = ImVec2(start_pos.x + (item_idx % column_count) * LayoutItemStep.x, start_pos.y + line_idx * LayoutItemStep.y); ImGui::SetCursorScreenPos(pos); ImGui::SetNextItemSelectionUserData(item_idx); bool item_is_selected = Selection.Contains((ImGuiID)item_data->ID); bool item_is_visible = ImGui::IsRectVisible(LayoutItemSize); ImGui::Selectable("", item_is_selected, ImGuiSelectableFlags_None, LayoutItemSize); // Update our selection state immediately (without waiting for EndMultiSelect() requests) // because we use this to alter the color of our text/icon. if (ImGui::IsItemToggledSelection()) item_is_selected = !item_is_selected; // Focus (for after deletion) if (item_curr_idx_to_focus == item_idx) ImGui::SetKeyboardFocusHere(-1); // Drag and drop if (ImGui::BeginDragDropSource()) { // Create payload with full selection OR single unselected item. // (the later is only possible when using ImGuiMultiSelectFlags_SelectOnClickRelease) if (ImGui::GetDragDropPayload() == NULL) { ImVector payload_items; void *it = NULL; ImGuiID id = 0; if (!item_is_selected) payload_items.push_back(item_data->ID); else while (Selection.GetNextSelectedItem(&it, &id)) payload_items.push_back(id); ImGui::SetDragDropPayload("ASSETS_BROWSER_ITEMS", payload_items.Data, (size_t)payload_items.size_in_bytes()); } // Display payload content in tooltip, by extracting it from the payload data // (we could read from selection, but it is more correct and reusable to read from payload) const ImGuiPayload *payload = ImGui::GetDragDropPayload(); const int payload_count = (int)payload->DataSize / (int)sizeof(ImGuiID); ImGui::Text("%d assets", payload_count); ImGui::EndDragDropSource(); } // Render icon (a real app would likely display an image/thumbnail here) // Because we use ImGuiMultiSelectFlags_BoxSelect2d, clipping vertical may occasionally be // larger, so we coarse-clip our rendering as well. if (item_is_visible) { ImVec2 box_min(pos.x - 1, pos.y - 1); ImVec2 box_max(box_min.x + LayoutItemSize.x + 2, box_min.y + LayoutItemSize.y + 2); // Dubious draw_list->AddRectFilled(box_min, box_max, icon_bg_color); // Background color if (ShowTypeOverlay && item_data->Type != 0) { ImU32 type_col = icon_type_overlay_colors[item_data->Type % IM_ARRAYSIZE(icon_type_overlay_colors)]; draw_list->AddRectFilled( ImVec2(box_max.x - 2 - icon_type_overlay_size.x, box_min.y + 2), ImVec2(box_max.x - 2, box_min.y + 2 + icon_type_overlay_size.y), type_col); } if (display_label) { ImU32 label_col = ImGui::GetColorU32(item_is_selected ? ImGuiCol_Text : ImGuiCol_TextDisabled); char label[32]; sprintf(label, "%d", item_data->ID); //, utf8table[item_data->ID].data() draw_list->AddText(ImVec2(box_min.x, box_max.y - ImGui::GetFontSize()), label_col, label); } } ImGui::PopID(); } } } clipper.End(); ImGui::PopStyleVar(); // ImGuiStyleVar_ItemSpacing // Context menu if (ImGui::BeginPopupContextWindow()) { ImGui::Text("Selection: %d items", Selection.Size); ImGui::Separator(); if (ImGui::MenuItem("Delete", "Del", false, Selection.Size > 0)) RequestDelete = true; ImGui::EndPopup(); } ms_io = ImGui::EndMultiSelect(); Selection.ApplyRequests(ms_io); if (want_delete) Selection.ApplyDeletionPostLoop(ms_io, Items, item_curr_idx_to_focus); // Zooming with CTRL+Wheel if (ImGui::IsWindowAppearing()) ZoomWheelAccum = 0.0f; if (ImGui::IsWindowHovered() && io.MouseWheel != 0.0f && ImGui::IsKeyDown(ImGuiMod_Ctrl) && ImGui::IsAnyItemActive() == false) { ZoomWheelAccum += io.MouseWheel; if (fabsf(ZoomWheelAccum) >= 1.0f) { // Calculate hovered item index from mouse location // FIXME: Locking aiming on 'hovered_item_idx' (with a cool-down timer) would ensure zoom keeps on // it. const float hovered_item_nx = (io.MousePos.x - start_pos.x + LayoutItemSpacing * 0.5f) / LayoutItemStep.x; const float hovered_item_ny = (io.MousePos.y - start_pos.y + LayoutItemSpacing * 0.5f) / LayoutItemStep.y; const int hovered_item_idx = ((int)hovered_item_ny * LayoutColumnCount) + (int)hovered_item_nx; // ImGui::SetTooltip("%f,%f -> item %d", hovered_item_nx, hovered_item_ny, hovered_item_idx); // // Move those 4 lines in block above for easy debugging // Zoom IconSize *= powf(1.1f, (float)(int)ZoomWheelAccum); IconSize = IM_CLAMP(IconSize, 16.0f, 128.0f); ZoomWheelAccum -= (int)ZoomWheelAccum; UpdateLayoutSizes(avail_width); // Manipulate scroll to that we will land at the same Y location of currently hovered item. // - Calculate next frame position of item under mouse // - Set new scroll position to be used in next ImGui::BeginChild() call. float hovered_item_rel_pos_y = ((float)(hovered_item_idx / LayoutColumnCount) + fmodf(hovered_item_ny, 1.0f)) * LayoutItemStep.y; hovered_item_rel_pos_y += ImGui::GetStyle().WindowPadding.y; float mouse_local_y = io.MousePos.y - ImGui::GetWindowPos().y; ImGui::SetScrollY(hovered_item_rel_pos_y - mouse_local_y); } } } ImGui::EndChild(); ImGui::Text("Selected: %d/%d items", Selection.Size, Items.Size); ImGui::End(); } }; } // namespace uni_table ================================================ FILE: src/SmartCharsetConverter-imgui/main.cpp ================================================ // Dear ImGui: standalone example application for GLFW + OpenGL 3, using programmable pipeline // (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context // creation, etc.) // Learn about Dear ImGui: // - FAQ https://dearimgui.com/faq // - Getting Started https://dearimgui.com/getting-started // - Documentation https://dearimgui.com/docs (same as your local docs/ folder). // - Introduction, links and more at the top of imgui.cpp #include "MainWindow.h" #include "FontLoader.h" #include #include #include "imgui.h" #include "imgui_impl_glfw.h" #include "imgui_impl_opengl3.h" #include #include #define GL_SILENCE_DEPRECATION #if defined(IMGUI_IMPL_OPENGL_ES2) #include #endif #include // Will drag system OpenGL headers #include #include #include // [Win32] Our example includes a copy of glfw3.lib pre-compiled with VS2010 to maximize ease of testing and // compatibility with old VS compilers. To link with VS2010-era libraries, VS2015+ requires linking with // legacy_stdio_definitions.lib, which we do using this pragma. Your own project should not be affected, as you are // likely to link with a newer binary of GLFW that is adequate for your version of Visual Studio. #if defined(_MSC_VER) && (_MSC_VER >= 1900) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) #pragma comment(lib, "legacy_stdio_definitions") #endif // This example can also compile and run with Emscripten! See 'Makefile.emscripten' for details. #ifdef __EMSCRIPTEN__ #include "../libs/emscripten/emscripten_mainloop_stub.h" #endif static void glfw_error_callback(int error, const char *description) { fprintf(stderr, "GLFW Error %d: %s\n", error, description); } // File drop callback function void drop_callback(GLFWwindow *window, int count, const char **paths) { std::vector filenames; for (int i = 0; i < count; i++) { printf("send: %s\n", paths[i]); filenames.push_back(std::string(paths[i])); } nlohmann::json j; j["data"] = filenames; std::string s = j.dump(); if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceExtern | ImGuiDragDropFlags_SourceNoPreviewTooltip)) { ImGui::SetDragDropPayload("files", s.c_str(), s.size()); ImGui::EndDragDropSource(); } } #ifndef NDEBUG int main(int, char **) try { #else int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR szCmdLine, int nCmdShow) try { #endif std::setlocale(LC_CTYPE, ".UTF-8"); auto startTime = std::chrono::system_clock::now(); glfwSetErrorCallback(glfw_error_callback); if (!glfwInit()) return 1; // Decide GL+GLSL versions #if defined(IMGUI_IMPL_OPENGL_ES2) // GL ES 2.0 + GLSL 100 (WebGL 1.0) const char *glsl_version = "#version 100"; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); #elif defined(IMGUI_IMPL_OPENGL_ES3) // GL ES 3.0 + GLSL 300 es (WebGL 2.0) const char *glsl_version = "#version 300 es"; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); #elif defined(__APPLE__) // GL 3.2 + GLSL 150 const char *glsl_version = "#version 150"; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac #else // GL 3.0 + GLSL 130 const char *glsl_version = "#version 130"; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); // glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only // glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // 3.0+ only #endif // Create window with graphics context GLFWwindow *window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL3 example", nullptr, nullptr); if (window == nullptr) return 1; // Set the file drop callback glfwSetDropCallback(window, drop_callback); glfwMakeContextCurrent(window); glfwSwapInterval(1); // Enable vsync // Setup Dear ImGui context IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO &io = ImGui::GetIO(); (void)io; io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls // Setup Dear ImGui style ImGui::StyleColorsDark(); // Set DPI: Step 1/2: set global DPI scale factor float xscale = 1.0f, yscale = 1.0f; glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &xscale, &yscale); float scale = std::max(xscale, yscale); ImGui::GetStyle().ScaleAllSizes(scale); // Setup Platform/Renderer backends ImGui_ImplGlfw_InitForOpenGL(window, true); #ifdef __EMSCRIPTEN__ ImGui_ImplGlfw_InstallEmscriptenCallbacks(window, "#canvas"); #endif ImGui_ImplOpenGL3_Init(glsl_version); bool fontLoaded = false; FontLoader fontLoader; // Set DPI: Step 2/2: set font size fontLoader.StartAsyncLoad(scale); // Our state bool show_demo_window = true; bool show_another_window = false; ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); // 得到命令行参数 const std::vector args = GetCommandLineArgs(); // GUI模式下的初始输入文件。目的是文件拖到程序图标上时能够自动加载 std::vector inputFilenames; if (args.size() > 1) { for (int i = 1; i < args.size(); ++i) { auto path = std::filesystem::u8path(args[i]); if (!std::filesystem::is_regular_file(path) && !std::filesystem::is_directory(path)) { throw std::runtime_error(fmt::format("illegal path: {}", path.u8string())); // FIXME break; } inputFilenames.push_back(args[i]); } } // Main loop MainWindow mainWindow(window, inputFilenames); auto initEndTime = std::chrono::system_clock::now(); fmt::print("init time: {}s\n", std::chrono::duration(initEndTime - startTime).count()); // Main loop #ifdef __EMSCRIPTEN__ // For an Emscripten build we are disabling file-system access, so let's not attempt to do a fopen() of the // imgui.ini file. You may manually call LoadIniSettingsFromMemory() to load settings from your own storage. io.IniFilename = nullptr; EMSCRIPTEN_MAINLOOP_BEGIN #else while (!glfwWindowShouldClose(window)) #endif { // Poll and handle events (inputs, window resize, etc.) // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your // inputs. // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or // clear/overwrite your copy of the mouse data. // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or // clear/overwrite your copy of the keyboard data. Generally you may always pass all inputs to dear imgui, and // hide them from your application based on those two flags. glfwPollEvents(); if (glfwGetWindowAttrib(window, GLFW_ICONIFIED) != 0) { std::this_thread::sleep_for(std::chrono::milliseconds(10)); continue; } auto newIoFonts = fontLoader.TryGetFontAtlas(); if (newIoFonts) { ImGui_ImplOpenGL3_DestroyFontsTexture(); io.Fonts = newIoFonts.release(); ImGui_ImplOpenGL3_CreateFontsTexture(); } // Start the Dear ImGui frame ImGui_ImplOpenGL3_NewFrame(); ImGui_ImplGlfw_NewFrame(); ImGui::NewFrame(); mainWindow.Render(); // Rendering ImGui::Render(); int display_w, display_h; glfwGetFramebufferSize(window, &display_w, &display_h); glViewport(0, 0, display_w, display_h); glClearColor(clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w); glClear(GL_COLOR_BUFFER_BIT); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); glfwSwapBuffers(window); } #ifdef __EMSCRIPTEN__ EMSCRIPTEN_MAINLOOP_END; #endif // Cleanup ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplGlfw_Shutdown(); ImGui::DestroyContext(); glfwDestroyWindow(window); glfwTerminate(); return 0; } catch (const std::exception &e) { MessageBoxW(NULL, utf8_to_wstring(e.what()).c_str(), L"Error", MB_ICONERROR | MB_OK); return -1; } ================================================ FILE: src/SmartCharsetConverter-imgui/resource.h ================================================ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ 生成的包含文件。 // 供 SmartCharsetConverter.rc 使用 // #define IDD_DIALOG_MAIN 101 #define IDI_ICON1 102 #define IDR_MENU_RIGHT 106 #define IDR_MENU_SELECT_LANGUAGES 107 #define IDR_LANGUAGEJSON_ENGLISH 108 #define IDR_LANGUAGEJSON2 109 #define IDR_LANGUAGEJSON_SIMPLIFIED_CHINESE 109 #define IDR_LANGUAGEJSON1 111 #define IDR_LANGUAGEJSON_SPANISH 111 #define IDC_RADIO_STRETEGY_SMART 1001 #define IDC_RADIO_STRETEGY_MANUAL 1002 #define IDC_RADIO_STRETEGY_NO_FILTER 1003 #define IDC_EDIT_INCLUDE_TEXT 1004 #define IDC_BUTTON_ADD_DIR 1010 #define IDC_BUTTON_ADD_FILES 1011 #define IDC_RADIO_TO_ORIGIN 1020 #define IDC_RADIO_TO_DIR 1021 #define IDC_EDIT_OUTPUT_DIR 1022 #define IDC_BUTTON_SET_OUTPUT_DIR 1023 #define IDC_RADIO_UTF8 1030 #define IDC_RADIO_UTF8BOM 1031 #define IDC_RADIO_GB18030 1032 #define IDC_RADIO_OTHER 1033 #define IDC_COMBO_OTHER_CHARSET 1034 #define IDC_LISTVIEW 1040 #define IDC_BUTTON_START 1050 #define IDC_BUTTON_CLEAR 1051 #define IDC_CHECK_CONVERT_RETURN 1052 #define IDC_RADIO_CRLF 1053 #define IDC_RADIO_LF 1054 #define IDC_RADIO_CR 1055 #define IDC_SYSLINK1 1057 #define IDC_BUTTON1 1058 #define IDC_BUTTON_SETTINGS 1058 #define IDC_STATIC_FILE_LISTS 1059 #define IDC_STATIC_SET_FILTER_MODE 1060 #define IDC_STATIC_ADD_FILES_OR_FOLDER 1061 #define IDC_STATIC_SET_OUTPUT 1062 #define IDC_STATIC_SET_OUTPUT_CHARSET 1063 #define ID_OPEN_WITH_NOTEPAD 40003 #define ID_REMOVE_ITEM 40004 #define ID_40005 40005 #define ID_SPECIFY_ORIGIN_CHARSET 40006 #define ID_40007 40007 #define ID_LANGUAGE 40008 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 112 #define _APS_NEXT_COMMAND_VALUE 40009 #define _APS_NEXT_CONTROL_VALUE 1064 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif ================================================ FILE: src/Translator/CMakeLists.txt ================================================ # ============================================= find_package(nlohmann_json CONFIG REQUIRED) # ======================================= file(GLOB_RECURSE SRC_CODE *.h *.cpp ) add_library(Translator STATIC ${SRC_CODE}) target_link_libraries(Translator PUBLIC nlohmann_json::nlohmann_json Core ) target_include_directories(Translator PUBLIC .. ) ================================================ FILE: src/Translator/LanguageService.cpp ================================================ #include "LanguageService.h" #include #include #include const char DEFAULT_LANGUAGE[] = u8"English"; LanguageService::LanguageService(LanguageServiceOption option) : option(option) { /* 加载流程: 先从内置的json语言文件加载。 然后加载外置的json语言文件。如果和内置的重复,那么覆盖内置的。 从配置读取当前语言,如果没有设置, 那么读取系统语言。如果系统语言没有对应的语言包,那么加载英语。 */ LoadLanguageNameFromInnerRCFile(); LoadLanguageNameFromDir("lang"); std::string lang = option.languageName; if (lang.empty()) { LANGID langId = GetUserDefaultLangID(); lang = GetLanguageNameByLangIdFromLoadedLanguages(langId); if (lang.empty()) { lang = DEFAULT_LANGUAGE; } } if (languages.find(lang) == languages.end()) { throw std::runtime_error( "language json file is lost. language name = " + lang + "\r\n\r\nTip: Remove the configuration json file could make program load default language."); } currentLang = languages[lang].get(); } std::string LanguageService::GetCurrentLanguage() const noexcept { return currentLang->language; } const std::string &LanguageService::GetUtf8String(v0_2::StringId id) const noexcept { return currentLang->GetString(id); } std::wstring LanguageService::GetWString(v0_2::StringId id) const noexcept { return utf8_to_wstring(GetUtf8String(id)); } void LanguageService::LoadLanguageNameFromInnerRCFile() noexcept { for (auto id : option.resourceIds) { internal::LanguagePack langPack(id, option.resourceType); auto langName = langPack.language; languages.emplace(langName, std::make_unique(std::move(langPack))); } } void LanguageService::LoadLanguageNameFromDir(const std::filesystem::path &dir) { // 得到命令行参数 const std::vector args = GetCommandLineArgs(); std::string selfPath = args[0]; std::filesystem::path exeDir = std::filesystem::u8path(selfPath).parent_path(); std::filesystem::path langDir = exeDir / dir; if (!std::filesystem::is_directory(langDir)) { return; } for (auto path : std::filesystem::directory_iterator(exeDir / dir)) { std::unique_ptr langPack; try { langPack = std::make_unique(path.path().wstring()); } catch (const nlohmann::json::exception &err) { throw std::runtime_error("failed to load language file from " + path.path().u8string() + " \r\nReason: " + err.what()); } if (langPack->language.empty()) { throw std::runtime_error("failed to load language file from " + path.path().u8string() + " \r\nReason: \"language\" field is empty"); } auto langName = langPack->language; // make external language file override inner language file from the .rc file languages[langName] = std::move(langPack); } } bool LanguageService::HasLanguagePack(const std::string &lang) const noexcept { return languages.find(lang) != languages.end(); } std::string LanguageService::GetLanguageNameByLangIdFromLoadedLanguages(int langId) const noexcept { for (auto &pr : languages) { if (pr.second->langId == langId) { return pr.first; } } return ""; } void LanguageService::SetCurrentLanguage(const std::string &languageName) { currentLang = languages.at(languageName).get(); } std::vector LanguageService::GetLanguageArray() const noexcept { std::vector ret; for (auto &pr : languages) { ret.push_back(pr.first); } return ret; } std::string LanguageService::MessageIdToString(MessageId mid) const noexcept { return GetUtf8String(static_cast(mid)); } ================================================ FILE: src/Translator/LanguageService.h ================================================ #pragma once #include "StringId.h" #include "internal/Language.h" #include #include struct LanguageServiceOption { // specify the language at starting. // the content should be equal of "language" field data of one of language json files. std::string languageName; std::wstring resourceType; std::vector resourceIds; }; /* 多语言支持 加载流程: 先从内置的json语言文件加载。 然后加载外置的json语言文件。如果和内置的重复,那么覆盖内置的。 等待配置读取当前语言,如果没有设置, 那么读取系统语言。如果系统语言没有对应的语言包,那么加载英语。 */ class LanguageService : public TranslatorBase { public: /** * @exception json解析失败抛出异常 */ LanguageService(LanguageServiceOption option); std::string GetCurrentLanguage() const noexcept; /** * 设置当前语言。会校验语言包,如果校验失败抛出异常。 * @exception std::runtime_error 校验失败 */ void SetCurrentLanguage(const std::string &languageName); const std::string &GetUtf8String(v0_2::StringId id) const noexcept; std::wstring GetWString(v0_2::StringId id) const noexcept; std::vector GetLanguageArray() const noexcept; const std::unordered_map> &GetLanguagesTable() const noexcept; virtual std::string MessageIdToString(MessageId mid) const noexcept; private: LanguageServiceOption option; std::vector avaliableLanguages; internal::LanguagePack *currentLang; std::map> languages; void LoadLanguageNameFromInnerRCFile() noexcept; void LoadLanguageNameFromDir(const std::filesystem::path &dir); bool HasLanguagePack(const std::string &lang) const noexcept; std::string GetLanguageNameByLangIdFromLoadedLanguages(int langId) const noexcept; }; ================================================ FILE: src/Translator/StringId.h ================================================ #pragma once #include // third party // standard #include #include const std::string StringIdVersion = "0.2"; namespace v0_2 { enum class StringId { BEGIN = 100, // 序号 INDEX, FILENAME, SIZE, ENCODING, LINE_BREAKS, TEXT_PIECE, MSGBOX_ERROR, FAILED_ADD_BELOW, REASON, NON_TEXT_OR_NO_DETECTED, // 10 AND_SO_ON, TIPS_USE_NO_FILTER, PROMPT, NO_FILE_TO_CONVERT, INVALID_OUTPUT_DIR, SUCCEED_SOME_FILES, FAILED_CONVERT_BELOW, NO_DEAL_DUE_TO_CANCEL, CONVERT_RESULT, NOTICE_SHOW_AS_UTF8, // 20 SUPPORT_FORMAT_BELOW, SEPERATOR_DESCRIPTION, NO_SPECIFY_FILTER_EXTEND, INVALID_EXTEND_FILTER, ALL_FILES, FAILED_TO_SET_CHARSET_MANUALLY, NO_MEMORY, CANCEL, START_CONVERT, INVALID_CHARACTERS, // 30 WILL_LOST_CHARACTERS, NOT_SUPPORT_ENCODING, ADD_REDUNDANTLY, NO_DETECTED_ENCODING, FAILED_TO_WRITE_FILE, FILE_SIZE_OUT_OF_LIMIT, FAILED_TO_OPEN_FILE, FILE_LISTS, SET_FILTER_MODE, NO_FILTER, // 40 SMART_FILE_DETECTION, USE_FILE_EXTENSION, ADD_FILES_OR_FOLDER, ADD_FILES, ADD_FOLDER, SET_OUTPUT, OUTPUT_TO_ORIGIN, OUTPUT_TO_FOLDER, SET_OUTPUT_CHARSET, OTHERS, // 50 CHANGE_LINE_BREAKS, CLEAR_LISTS, OPEN_WITH_NOTEPAD, SPECIFY_ORIGIN_ENCODING, REMOVE, SELECT_FOLDER, END }; constexpr std::array, 2> STRING_ID_RANGES = { std::pair{static_cast(MessageId::BEGIN), static_cast(MessageId::END)}, std::pair{static_cast(StringId::BEGIN), static_cast(StringId::END)}, }; } // namespace v0_2 ================================================ FILE: src/Translator/Translator.cpp ================================================ #include "Translator.h" ================================================ FILE: src/Translator/Translator.h ================================================ #pragma once #include class Translator : public TranslatorBase { public: Translator() {} }; ================================================ FILE: src/Translator/internal/Language.cpp ================================================ #include "Language.h" #include "Translator/StringId.h" #include #include #include // standard #include #include #include #include namespace internal { LanguagePack::LanguagePack(const std::wstring &filename) { std::ifstream ifs(to_string(filename)); if (!ifs) { throw std::runtime_error("open file fail: " + to_utf8(filename)); } nlohmann::json j = nlohmann::json::parse(ifs); from_json(j, *this); ifs.close(); #ifndef NDEBUG // check file content at Debug CheckLanguagePack(); #endif } LanguagePack::LanguagePack(int resourceId, const std::wstring &resourceType) { std::vector jsonData = LoadCustomFileFromResource(resourceId, resourceType); jsonData.push_back('\0'); nlohmann::json j = nlohmann::json::parse(jsonData.data()); from_json(j, *this); #ifndef NDEBUG // check file content at Debug CheckLanguagePack(); #endif } const std::string &LanguagePack::GetString(v0_2::StringId sid) const { return data.at(static_cast(sid)); } void LanguagePack::CheckLanguagePack() { if (version != StringIdVersion) { throw std::runtime_error("unsupported language file version: " + version); } for (auto [begin, end] : v0_2::STRING_ID_RANGES) { for (int i = begin + 1; i < end; ++i) { v0_2::StringId sid = static_cast(i); bool found = data.find(static_cast(sid)) != data.end(); if (!found) { throw std::runtime_error("Error at language pack of " + language + "\r\ninvalid language pack: lack of id of " + std::to_string(i)); } } } } } // namespace internal ================================================ FILE: src/Translator/internal/Language.h ================================================ #pragma once #include "Translator/StringId.h" // third party #include // standard #include #include namespace internal { struct LanguagePack { std::string language; int langId; std::string author; std::string version; std::string date; std::unordered_map data; /** * @exception json解析失败抛出异常 */ LanguagePack(const std::wstring &filename); LanguagePack(int resourceId, const std::wstring &resourceType); const std::string &GetString(v0_2::StringId sid) const; /** * 校验语言包。检查是否所有的StringId都有对应的字段。 * @exception std::runtime_error 校验失败抛出异常。 */ void CheckLanguagePack(); }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(LanguagePack, language, langId, author, version, date, data) } // namespace internal ================================================ FILE: tests/CMakeLists.txt ================================================ find_package(GTest CONFIG REQUIRED) # === CoreUnitTest === file(GLOB TEST_CODE *.h *.cpp ) add_executable(CoreUnitTest ${TEST_CODE}) target_link_libraries(CoreUnitTest PRIVATE GTest::gtest_main Core ) # =========================================== set(SmartCharsetConverter_TEST_DIR u8\"${PROJECT_SOURCE_DIR}/sample\") configure_file(config.h.in config.h @ONLY) target_include_directories(CoreUnitTest PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") # =========================================== include(GoogleTest) gtest_discover_tests(CoreUnitTest) ================================================ FILE: tests/Core_Vietnamese_test.cpp ================================================ #include "config.h" #include "Core/Core.h" #include #include #include #include #include #include TEST(CoreVietnamese, ConvertToUtf8) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + "/tcvn/demo1-tcvn.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); ConvertParam param; param.originCode = CharsetCode::TCVN3; param.targetCode = CharsetCode::UTF8; param.doConvertLineBreaks = false; std::string utf8Str = Convert(std::string_view(buf.get(), bufSize), param); // WriteFileFromBuffer(std::string(SmartCharsetConverter_TEST_DIR) + L"/tcvn/demo1-got.txt", utf8Str.c_str(), // utf8Str.size()); std::string expectFilename = std::string(SmartCharsetConverter_TEST_DIR) + "/tcvn/demo1-utf8.txt"; auto [utf8Buf, utf8BufSize] = ReadFileToBuffer(expectFilename); std::string utf8ExpectStr(utf8Buf.get(), utf8BufSize); ASSERT_EQ(utf8Str.size(), utf8BufSize); ASSERT_EQ(utf8Str, utf8ExpectStr); } TEST(CoreVietnamese, ConvertToUtf16LE) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + "/tcvn/demo1-tcvn.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); ConvertParam param; param.originCode = CharsetCode::TCVN3; param.targetCode = CharsetCode::UTF16LE; param.doConvertLineBreaks = false; std::string ret = Convert(std::string_view(buf.get(), bufSize), param); std::u16string utf16LEStr; utf16LEStr.resize(ret.size() / sizeof(char16_t)); memcpy(utf16LEStr.data(), ret.data(), ret.size()); // WriteFileFromBuffer(std::string(SmartCharsetConverter_TEST_DIR) + L"/tcvn/demo1-got.txt", utf8Str.c_str(), // utf8Str.size()); std::string expectFilename = std::string(SmartCharsetConverter_TEST_DIR) + "/tcvn/demo1-utf16le.txt"; auto [utf16LEBuf, utf16LEBufSize] = ReadFileToBuffer(expectFilename); std::size_t utf16LEBufPsudoCharNums = utf16LEBufSize / sizeof(char16_t); std::u16string utf16LEExpectStr(reinterpret_cast(utf16LEBuf.get()), utf16LEBufPsudoCharNums); ASSERT_EQ(utf16LEStr.size(), utf16LEBufPsudoCharNums); ASSERT_EQ(utf16LEStr, utf16LEExpectStr); } TEST(CoreVietnamese, ConvertFromUtf8) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + "/tcvn/demo1-utf8.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); ConvertParam param; param.originCode = CharsetCode::UTF8; param.targetCode = CharsetCode::TCVN3; param.doConvertLineBreaks = false; std::string tcvn3StrGot = Convert(std::string_view(buf.get(), bufSize), param); // WriteFileFromBuffer(std::string(SmartCharsetConverter_TEST_DIR) + L"/tcvn/demo1-got.txt", utf8Str.c_str(), // utf8Str.size()); std::string expectFilename = std::string(SmartCharsetConverter_TEST_DIR) + "/tcvn/demo1-tcvn.txt"; auto [tcvn3BufExpected, tcvn3BufExpectedSize] = ReadFileToBuffer(expectFilename); std::string tcvn3StrExpected(tcvn3BufExpected.get(), tcvn3BufExpectedSize); ASSERT_EQ(tcvn3StrGot.size(), tcvn3BufExpectedSize); ASSERT_EQ(tcvn3StrGot, tcvn3StrExpected); } TEST(CoreVietnamese, ConvertFromUtf16LE) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + "/tcvn/demo1-utf16le.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); ConvertParam param; param.originCode = CharsetCode::UTF16LE; param.targetCode = CharsetCode::TCVN3; param.doConvertLineBreaks = false; std::string tcvn3StrGot = Convert(std::string_view((buf.get()), bufSize), param); // WriteFileFromBuffer(std::string(SmartCharsetConverter_TEST_DIR) + L"/tcvn/demo1-got.txt", utf8Str.c_str(), // utf8Str.size()); std::string expectFilename = std::string(SmartCharsetConverter_TEST_DIR) + "/tcvn/demo1-tcvn.txt"; auto [tcvn3BufExpected, tcvn3BufExpectedSize] = ReadFileToBuffer(expectFilename); std::string tcvn3StrExpected(tcvn3BufExpected.get(), tcvn3BufExpectedSize); ASSERT_EQ(tcvn3StrGot.size(), tcvn3BufExpectedSize); ASSERT_EQ(tcvn3StrGot, tcvn3StrExpected); } /** * @exception file_io_error * ConvertError */ void TestBuiltinConvertOtherToOther(CharsetCode middleEncoding) { std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + "/tcvn/demo1-tcvn.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); std::string vniStr; ConvertParam param; param.originCode = CharsetCode::TCVN3; param.targetCode = middleEncoding; param.doConvertLineBreaks = false; EXPECT_NO_THROW(vniStr = Convert(std::string_view(buf.get(), bufSize), param)); std::string tcvnStrGot; param.originCode = middleEncoding; param.targetCode = CharsetCode::TCVN3; EXPECT_NO_THROW(tcvnStrGot = Convert(vniStr, param)); EXPECT_EQ(bufSize, tcvnStrGot.size()); EXPECT_EQ(std::string(buf.get(), bufSize), tcvnStrGot); } TEST(CoreVietnamese, ConvertOtherToOther) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 TestBuiltinConvertOtherToOther(CharsetCode::VNI); TestBuiltinConvertOtherToOther(CharsetCode::VPS); TestBuiltinConvertOtherToOther(CharsetCode::VISCII); } ================================================ FILE: tests/Core_test.cpp ================================================ #include "config.h" #include "memory_leak_detection.h" #include "Helper.h" #include #include #include #include #include #include #include #include TEST(Core, EncodeWithUnassignedChars) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 // MemoryLeakDetection mld; try { Encode(u"abcdefg小舟从此逝,江海寄余生。asdfghjkl", CharsetCode::WINDOWS_1252); FAIL(); } catch (const UnassignedCharError &err) { ASSERT_EQ(err.GetUnassignedChar(), std::string(u8"小舟从此逝,江海寄余生。")); } } TEST(Core, DetectEncodingMulti) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 auto table = helper::ScanDirectoryForExpectedEncodingTable(std::string(SmartCharsetConverter_TEST_DIR) + "/expect_pass"); CoreInitOption opt; Core core("temp.json", opt); for (auto [filename, expectedEncoding] : table) { auto [buf, len] = ReadFileToBuffer(filename); auto charsetCode = DetectEncoding(core.GetUCharDet().get(), buf.get(), len); if (charsetCode == expectedEncoding) { continue; } std::cout << std::string(20, '=') << std::endl; std::cout << "file: " << filename << std::endl; std::cout << "detect: " << ToViewCharsetName(charsetCode) << std::endl; std::cout << "expected: " << ToViewCharsetName(expectedEncoding) << std::endl; std::cout << std::endl; EXPECT_EQ(charsetCode, expectedEncoding); SetConsoleColor(); } } ================================================ FILE: tests/Helper.cpp ================================================ #include "Helper.h" #include #include #include #include namespace helper { /** * scan directory for get the pairs of "filename" and "expected encoding". * @param pattern the pattern to tell regular expression engine how to get the encoding name from stem of file name. * for example: for the file name "[UTF-8]test.txt", its stem is "[UTF-8]test", the pattern could be * R"(\[([\S]+)\].*)" to catch the encoding part "UTF-8". */ std::unordered_map ScanDirectoryForExpectedEncodingTable(const std::string &dir, const std::string &pattern) { std::unordered_map table; // filename, expect encoding std::regex r(pattern); for (auto path : std::filesystem::recursive_directory_iterator(std::filesystem::u8path(dir))) { if (path.is_directory()) { continue; } std::string stem = path.path().stem().u8string(); std::smatch ret; bool ok = std::regex_match(stem, ret, r); if (!ok) { throw std::runtime_error( fmt::format("encoding description not found in filename: {}\nbasename should match this pattern {}", path.path().string(), pattern)); } table[path.path().u8string()] = ToCharsetCode(ret[1]); } return table; } } // namespace helper ================================================ FILE: tests/Helper.h ================================================ #pragma once #include #include #include namespace helper { /** * scan directory for get the pairs of "filename" and "expected encoding". * @param pattern the pattern of encoding. typical example: for the file name "[UTF-8]test.txt", the pattern should be * R"(\[([\S]+)\].*)" */ std::unordered_map ScanDirectoryForExpectedEncodingTable(const std::string &dir, const std::string &pattern = R"(\[([\S]+)\].*)"); } // namespace helper ================================================ FILE: tests/LineBreaks_test.cpp ================================================ #include "config.h" #include #include TEST(LineBreaks, LineBreaks) { std::u16string ws; ws = u"\r"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::CR); ws = u"\r\r"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::CR); ws = u"\r00\r"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::CR); ws = u"\r\r\n"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::MIX); ws = u"\n"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::LF); ws = u"\n\r"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::MIX); ws = u"\n\n"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::LF); ws = u"\n\n\r"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::MIX); ws = u"\r\n"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::CRLF); ws = u"\r\n\n"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::MIX); ws = u"\r\n\r"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::MIX); ws = u"\n\r"; ASSERT_EQ(GetLineBreaks(ws.c_str(), ws.length()), LineBreaks::MIX); } ================================================ FILE: tests/String_test.cpp ================================================ #include "config.h" #include #include TEST(Split, Split) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 struct Sample { std::string input; std::string sep; std::vector expect; }; std::vector samples = { Sample{u8"", u8" ", std::vector{}}, Sample{u8"a", u8" ", std::vector{u8"a"}}, Sample{u8" a ", u8" ", std::vector{u8"a"}}, Sample{u8" a", u8" ", std::vector{u8"a"}}, Sample{u8"a ", u8" ", std::vector{u8"a"}}, Sample{u8"a b c", u8" ", std::vector{u8"a", u8"b", u8"c"}}, Sample{u8" a b c", u8" ", std::vector{u8"a", u8"b", u8"c"}}, Sample{u8"a b c ", u8" ", std::vector{u8"a", u8"b", u8"c"}}, Sample{u8" a b c ", u8" ", std::vector{u8"a", u8"b", u8"c"}}, Sample{u8"a\tb c\t", u8" \t", std::vector{u8"a", u8"b", u8"c"}}, }; for (auto &sample : samples) { ASSERT_EQ(Split(sample.input, sample.sep), sample.expect); } } ================================================ FILE: tests/Vietnamese_test.cpp ================================================ #include "config.h" #include "Core/Vietnamese.h" #include #include #include #include #include #include TEST(Vietnamese, CheckEncoding) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 viet::Init(); std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-tcvn.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); EXPECT_FALSE(viet::CheckEncoding(buf.get(), bufSize, viet::Encoding::VNI)); EXPECT_FALSE(viet::CheckEncoding(buf.get(), bufSize, viet::Encoding::VPS)); EXPECT_TRUE(viet::CheckEncoding(buf.get(), bufSize, viet::Encoding::VISCII)); EXPECT_TRUE(viet::CheckEncoding(buf.get(), bufSize, viet::Encoding::TCVN3)); } TEST(Vietnamese, BuiltinConvertToUtf8) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 viet::Init(); std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-tcvn.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); std::string utf8Str = viet::ConvertToUtf8(std::string_view(buf.get(), bufSize), viet::Encoding::TCVN3); // WriteFileFromBuffer(utf8_to_wstring(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-got.txt", utf8Str.c_str(), // utf8Str.size()); std::string expectFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-utf8.txt"; auto [utf8Buf, utf8BufSize] = ReadFileToBuffer(expectFilename); std::string utf8ExpectStr(utf8Buf.get(), utf8BufSize); ASSERT_EQ(utf8Str.size(), utf8BufSize); ASSERT_EQ(utf8Str, utf8ExpectStr); } TEST(Vietnamese, BuiltinConvertToUtf16LE) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 viet::Init(); std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-tcvn.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); std::u16string utf16LEStr = viet::ConvertToUtf16LE(std::string_view(buf.get(), bufSize), viet::Encoding::TCVN3); // WriteFileFromBuffer(utf8_to_wstring(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-got.txt", utf8Str.c_str(), // utf8Str.size()); std::string expectFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-utf16le.txt"; auto [utf16LEBuf, utf16LEBufSize] = ReadFileToBuffer(expectFilename); std::size_t utf16LEBufPsudoCharNums = utf16LEBufSize / sizeof(char16_t); std::u16string utf16LEExpectStr(reinterpret_cast(utf16LEBuf.get()), utf16LEBufPsudoCharNums); ASSERT_EQ(utf16LEStr.size(), utf16LEBufPsudoCharNums); ASSERT_EQ(utf16LEStr, utf16LEExpectStr); } TEST(Vietnamese, BuiltinConvertFromUtf8) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 viet::Init(); std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-utf8.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); std::string tcvn3StrGot = viet::ConvertFromUtf8(std::string_view(buf.get(), bufSize), viet::Encoding::TCVN3); // WriteFileFromBuffer(utf8_to_wstring(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-got.txt", utf8Str.c_str(), // utf8Str.size()); std::string expectFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-tcvn.txt"; auto [tcvn3BufExpected, tcvn3BufExpectedSize] = ReadFileToBuffer(expectFilename); std::string tcvn3StrExpected(tcvn3BufExpected.get(), tcvn3BufExpectedSize); ASSERT_EQ(tcvn3StrGot.size(), tcvn3BufExpectedSize); ASSERT_EQ(tcvn3StrGot, tcvn3StrExpected); } TEST(Vietnamese, BuiltinConvertFromUtf16LE) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 viet::Init(); std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-utf16le.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); std::string tcvn3StrGot = viet::ConvertFromUtf16LE( std::u16string_view(reinterpret_cast(buf.get()), bufSize / sizeof(char16_t)), viet::Encoding::TCVN3); // WriteFileFromBuffer(utf8_to_wstring(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-got.txt", utf8Str.c_str(), // utf8Str.size()); std::string expectFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-tcvn.txt"; auto [tcvn3BufExpected, tcvn3BufExpectedSize] = ReadFileToBuffer(expectFilename); std::string tcvn3StrExpected(tcvn3BufExpected.get(), tcvn3BufExpectedSize); ASSERT_EQ(tcvn3StrGot.size(), tcvn3BufExpectedSize); ASSERT_EQ(tcvn3StrGot, tcvn3StrExpected); } /** * @exception file_io_error * ConvertError */ void TestBuiltinConvertOtherToOther(viet::Encoding middleEncoding) { viet::Init(); std::string inputFilename = std::string(SmartCharsetConverter_TEST_DIR) + u8"/tcvn/demo1-tcvn.txt"; auto [buf, bufSize] = ReadFileToBuffer(inputFilename); std::string vniStr; EXPECT_NO_THROW(vniStr = viet::Convert(std::string_view(buf.get(), bufSize), viet::Encoding::TCVN3, middleEncoding)); std::string tcvnStrGot; EXPECT_NO_THROW(tcvnStrGot = viet::Convert(vniStr, middleEncoding, viet::Encoding::TCVN3)); EXPECT_EQ(bufSize, tcvnStrGot.size()); EXPECT_EQ(std::string(buf.get(), bufSize), tcvnStrGot); } TEST(Vietnamese, BuiltinConvertOtherToOther) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 TestBuiltinConvertOtherToOther(viet::Encoding::VNI); TestBuiltinConvertOtherToOther(viet::Encoding::VPS); TestBuiltinConvertOtherToOther(viet::Encoding::VISCII); } TEST(Vietnamese, ConvertFuzz) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 viet::Init(); const int count = 1024; std::string randUtf8Str; std::default_random_engine eng( static_cast(std::chrono::high_resolution_clock::now().time_since_epoch().count())); std::uniform_int_distribution unif(0, viet::internal::TABLE_LENGTH - 1); for (int i = 0; i < count; ++i) { int index = unif(eng); randUtf8Str += viet::internal::utf8Table[index]; } { std::string dialect = viet::ConvertFromUtf8(randUtf8Str, viet::Encoding::VNI); std::string gotUtf8 = viet::ConvertToUtf8(dialect, viet::Encoding::VNI); EXPECT_EQ(gotUtf8, randUtf8Str); } { std::string dialect = viet::ConvertFromUtf8(randUtf8Str, viet::Encoding::VPS); std::string gotUtf8 = viet::ConvertToUtf8(dialect, viet::Encoding::VPS); EXPECT_EQ(gotUtf8, randUtf8Str); } { std::string dialect = viet::ConvertFromUtf8(randUtf8Str, viet::Encoding::VISCII); std::string gotUtf8 = viet::ConvertToUtf8(dialect, viet::Encoding::VISCII); EXPECT_EQ(gotUtf8, randUtf8Str); } // TCVN3比较特殊,不能用上面的方法来测试。原因是TCVN3的映射表虽然有2字节的,但TCVN3并不是一个多字节字符集(MBCS)。 // 所以,这里构造TCVN3的测试方法为:构造由随机的单字节TCVN3字符组成的字符串,再和UTF8互转。 { std::string randTCVN3; std::uniform_int_distribution unifASCII(32, 126); for (int i = 0; i < count; ++i) { int rn = unif(eng); if (rn % 2) { randTCVN3 += static_cast(unifASCII(eng)); } else { while (1) { auto &tcvn3Word = viet::internal::tcvn3Table[rn]; if (tcvn3Word.size() == 1) { randTCVN3 += tcvn3Word; break; } rn = unif(eng); } } } std::string middleUtf8 = viet::ConvertToUtf8(randTCVN3, viet::Encoding::TCVN3); std::string gotTCVN3 = viet::ConvertFromUtf8(middleUtf8, viet::Encoding::TCVN3); EXPECT_EQ(gotTCVN3, randTCVN3); } } TEST(Vietnamese, ConvertWithUTF16LEFuzz) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 viet::Init(); const int count = 1024; std::u16string randUtf16LEStr; std::default_random_engine eng( static_cast(std::chrono::high_resolution_clock::now().time_since_epoch().count())); std::uniform_int_distribution unif(0, viet::internal::TABLE_LENGTH - 1); for (int i = 0; i < count; ++i) { int index = unif(eng); randUtf16LEStr += viet::internal::utf16LETable[index]; } { std::string dialect = viet::ConvertFromUtf16LE(randUtf16LEStr, viet::Encoding::VNI); std::u16string gotUtf16LE = viet::ConvertToUtf16LE(dialect, viet::Encoding::VNI); EXPECT_EQ(gotUtf16LE, randUtf16LEStr); } { std::string dialect = viet::ConvertFromUtf16LE(randUtf16LEStr, viet::Encoding::VPS); std::u16string gotUtf16LE = viet::ConvertToUtf16LE(dialect, viet::Encoding::VPS); EXPECT_EQ(gotUtf16LE, randUtf16LEStr); } { std::string dialect = viet::ConvertFromUtf16LE(randUtf16LEStr, viet::Encoding::VISCII); std::u16string gotUtf16LE = viet::ConvertToUtf16LE(dialect, viet::Encoding::VISCII); EXPECT_EQ(gotUtf16LE, randUtf16LEStr); } // TCVN3比较特殊,不能用上面的方法来测试。原因是TCVN3的映射表虽然有2字节的,但TCVN3并不是一个多字节字符集(MBCS)。 // 所以,这里构造TCVN3的测试方法为:构造由随机的单字节TCVN3字符组成的字符串,再和UTF8互转。 { std::string randTCVN3; std::uniform_int_distribution unifASCII(32, 126); for (int i = 0; i < count; ++i) { int rn = unif(eng); if (rn % 2) { randTCVN3 += static_cast(unifASCII(eng)); } else { while (1) { auto &tcvn3Word = viet::internal::tcvn3Table[rn]; if (tcvn3Word.size() == 1) { randTCVN3 += tcvn3Word; break; } rn = unif(eng); } } } std::u16string middleUtf16LE = viet::ConvertToUtf16LE(randTCVN3, viet::Encoding::TCVN3); std::string gotTCVN3 = viet::ConvertFromUtf16LE(middleUtf16LE, viet::Encoding::TCVN3); EXPECT_EQ(gotTCVN3, randTCVN3); } } ================================================ FILE: tests/config.h.in ================================================ #cmakedefine SmartCharsetConverter_TEST_DIR @SmartCharsetConverter_TEST_DIR@ ================================================ FILE: tests/icu_test.cpp ================================================ #include "config.h" #include "memory_leak_detection.h" #include #include #include #include #include #include #include TEST(Core, icu) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 std::unordered_set icuEncodings; UErrorCode err; UEnumeration *allNames = ucnv_openAllNames(&err); while (1) { auto name = uenum_next(allNames, nullptr, &err); if (name == nullptr) { break; } icuEncodings.insert(name); std::cout << name << std::endl; } std::vector noICUNames; std::vector errors; for (int i = static_cast(CharsetCode::UTF8); i < static_cast(CharsetCode::CHARSET_CODE_END); i++) { CharsetCode code = static_cast(i); if (GetConvertEngine(code) != ConvertEngine::ICU) { continue; } std::string icuName = ToICUCharsetName(code); if (icuEncodings.count(icuName) == 0) { std::cout << "Encoding \"" << icuName << "\" not found in icu supported name\n"; try { Encode(u"abcdefg", code); } catch (const std::runtime_error &err) { std::cerr << err.what() << std::endl; errors.push_back(err); } } } ASSERT_TRUE(errors.empty()); } ================================================ FILE: tests/memory_leak_detection.h ================================================ #pragma once #ifdef WIN32 #include "memory_leak_detection_win.h" #else class MemoryLeakDetection final { public: MemoryLeakDetection() {} }; #endif ================================================ FILE: tests/memory_leak_detection_win.h ================================================ #pragma once #ifdef WIN32 #include #undef max #undef min #define _CRTDBG_MAP_ALLOC // to get more details #include #include //for malloc and free #include #include #include class MemoryLeakDetection final { public: MemoryLeakDetection() { _CrtMemCheckpoint(&sOld); // take a snapshot } ~MemoryLeakDetection() { _CrtMemCheckpoint(&sNew); // take a snapshot if (_CrtMemDifference(&sDiff, &sOld, &sNew)) // if there is a difference { // OutputDebugString(TEXT("-----------_CrtMemDumpStatistics ---------")); //_CrtMemDumpStatistics(&sDiff); // OutputDebugString(TEXT("-----------_CrtMemDumpAllObjectsSince ---------")); //_CrtMemDumpAllObjectsSince(&sOld); // OutputDebugString(TEXT("-----------_CrtDumpMemoryLeaks ---------")); _CrtDumpMemoryLeaks(); EXPECT_TRUE(0 && "Memory leak is detected! See debug output for detail."); } } void SetBreakAlloc(long index) const noexcept { (index); _CrtSetBreakAlloc(index); } private: _CrtMemState sOld; _CrtMemState sNew; _CrtMemState sDiff; }; #endif ================================================ FILE: tests/uchardet_samples_test.cpp ================================================ #include "config.h" #include "memory_leak_detection.h" #include "Helper.h" #include #include #include #include #include #include #include TEST(Core, uchardet_sample_test) { SetConsoleOutputCP(65001); // 设置代码页为UTF-8 const std::string uchardetSampleDir = std::string(SmartCharsetConverter_TEST_DIR) + "/uchardet_test_samples"; auto table = helper::ScanDirectoryForExpectedEncodingTable(uchardetSampleDir, R"((.*))"); auto expectPassTable = helper::ScanDirectoryForExpectedEncodingTable(std::string(SmartCharsetConverter_TEST_DIR) + "/expect_pass"); auto notPassYetTable = helper::ScanDirectoryForExpectedEncodingTable(std::string(SmartCharsetConverter_TEST_DIR) + "/not_pass_yet"); table.merge(std::move(expectPassTable)); table.merge(std::move(notPassYetTable)); CoreInitOption opt; Core core(u8"temp.json", opt); int passed = 0; for (auto [filename, expectedEncoding] : table) { auto [buf, len] = ReadFileToBuffer(filename); auto charsetCode = DetectEncoding(core.GetUCharDet().get(), buf.get(), len); if (charsetCode == expectedEncoding) { passed++; continue; } std::cout << std::string(20, '=') << std::endl; std::cout << "file: " << filename << std::endl; std::cout << "detect: " << ToViewCharsetName(charsetCode) << std::endl; std::cout << "expected: " << ToViewCharsetName(expectedEncoding) << std::endl; std::cout << std::endl; // EXPECT_EQ(charsetCode, expectedEncoding); // not pass now } double rate = static_cast(passed) / static_cast(table.size()); std::cout << "PASSED: " << rate * 100.0 << "% \n"; // any changes to charset detection should increase this rate, not decrease it ASSERT_TRUE(rate > 0.337); } ================================================ FILE: third_party/CMakeLists.txt ================================================ # === CED === # 添加ced库 set(CED_ROOT "ced") set(CED_LIBRARY_SOURCES ${CED_ROOT}/compact_enc_det/compact_enc_det.cc ${CED_ROOT}/compact_enc_det/compact_enc_det_hint_code.cc ${CED_ROOT}/util/encodings/encodings.cc ${CED_ROOT}/util/languages/languages.cc ) add_library(ced STATIC ${CED_LIBRARY_SOURCES}) target_include_directories(ced PUBLIC ${CED_ROOT}) target_compile_options(ced PRIVATE -W0) # ===================================== add_subdirectory(uchardet/uchardet) target_compile_options(libuchardet_static PRIVATE -W0) add_subdirectory(guicon) ================================================ FILE: third_party/WTL/Include/atlapp.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLAPP_H__ #define __ATLAPP_H__ #pragma once #ifndef __cplusplus #error WTL requires C++ compilation (use a .cpp suffix) #endif #ifndef __ATLBASE_H__ #error atlapp.h requires atlbase.h to be included first #endif #ifdef _WIN32_WCE #error WTL10 doesn't support Windows CE #endif #ifdef _ATL_NO_COMMODULE #error WTL doesn't support _ATL_NO_COMMODULE #endif #ifdef _ATL_NO_WIN_SUPPORT #error WTL doesn't support _ATL_NO_WIN_SUPPORT #endif #if (_MSC_VER < 1400) #error WTL10 requires C++ compiler version 14 (Visual C++ 2005) or higher #endif #if (WINVER < 0x0501) #error WTL requires WINVER >= 0x0501 #endif #if (_WIN32_WINNT < 0x0501) #error WTL requires _WIN32_WINNT >= 0x0501 #endif #if (_WIN32_IE < 0x0600) #error WTL requires _WIN32_IE >= 0x0600 #endif #if (_ATL_VER < 0x0800) #error WTL10 requires ATL version 8 or higher #endif #ifdef _ATL_MIN_CRT #error WTL10 doesn't support _ATL_MIN_CRT #endif #ifdef _ATL_NO_MSIMG #error WTL10 doesn't support _ATL_NO_MSIMG #endif #include #ifdef _MT #include // for _beginthreadex #endif #include #pragma comment(lib, "comctl32.lib") #include #include // Check for VS2005 without newer WinSDK #if (_MSC_VER == 1400) && !defined(RB_GETEXTENDEDSTYLE) #error WTL10 requires WinSDK 6.0 ot higher #endif #include #pragma comment(lib, "uxtheme.lib") #if defined(_SYSINFOAPI_H_) && defined(NOT_BUILD_WINDOWS_DEPRECATE) #include #endif #include "atlres.h" /////////////////////////////////////////////////////////////////////////////// // WTL version number #define _WTL_VER 0x1000 // version 10.0 /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CMessageFilter // CIdleHandler // CMessageLoop // // CAppModule // CServerAppModule // // Global functions: // AtlInitCommonControls() // AtlGetDefaultGuiFont() // AtlCreateControlFont() // AtlCreateBoldFont() // AtlGetStringPtr() /////////////////////////////////////////////////////////////////////////////// // Miscellaneous global support // define useful macros from winuser.h #ifndef IS_INTRESOURCE #define IS_INTRESOURCE(_r) (((ULONG_PTR)(_r) >> 16) == 0) #endif // IS_INTRESOURCE // protect template members from windowsx.h macros #ifdef _INC_WINDOWSX #undef SubclassWindow #endif // _INC_WINDOWSX // define useful macros from windowsx.h #ifndef GET_X_LPARAM #define GET_X_LPARAM(lParam) ((int)(short)LOWORD(lParam)) #endif #ifndef GET_Y_LPARAM #define GET_Y_LPARAM(lParam) ((int)(short)HIWORD(lParam)) #endif // Dummy structs for compiling with /CLR #ifdef _MANAGED __if_not_exists(_IMAGELIST::_IMAGELIST) { struct _IMAGELIST { }; } __if_not_exists(_TREEITEM::_TREEITEM) { struct _TREEITEM { }; } __if_not_exists(_PSP::_PSP) { struct _PSP { }; } #endif // Forward declaration for ATL11 fix #if (_ATL_VER >= 0x0B00) namespace ATL { HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor); } #endif #ifndef WM_MOUSEHWHEEL #define WM_MOUSEHWHEEL 0x020E #endif // Used for stack allocations with ATL::CTempBuffer #ifndef _WTL_STACK_ALLOC_THRESHOLD #define _WTL_STACK_ALLOC_THRESHOLD 512 #endif namespace WTL { DECLARE_TRACE_CATEGORY(atlTraceUI) #ifdef _DEBUG __declspec(selectany) ATL::CTraceCategory atlTraceUI(_T("atlTraceUI")); #endif // _DEBUG // Common Controls initialization helper inline BOOL AtlInitCommonControls(DWORD dwFlags) { INITCOMMONCONTROLSEX iccx = { sizeof(INITCOMMONCONTROLSEX), dwFlags }; BOOL bRet = ::InitCommonControlsEx(&iccx); ATLASSERT(bRet); return bRet; } // Default GUI font helper - "MS Shell Dlg" stock font inline HFONT AtlGetDefaultGuiFont() { return (HFONT)::GetStockObject(DEFAULT_GUI_FONT); } // Control font helper - default font for controls not in a dialog // (NOTE: Caller owns the font, and should destroy it when it's no longer needed) inline HFONT AtlCreateControlFont() { LOGFONT lf = {}; ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); HFONT hFont = ::CreateFontIndirect(&lf); ATLASSERT(hFont != NULL); return hFont; } // Bold font helper // (NOTE: Caller owns the font, and should destroy it when it's no longer needed) inline HFONT AtlCreateBoldFont(HFONT hFont = NULL) { LOGFONT lf = {}; if(hFont == NULL) ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); else ATLVERIFY(::GetObject(hFont, sizeof(LOGFONT), &lf) == sizeof(LOGFONT)); lf.lfWeight = FW_BOLD; HFONT hFontBold = ::CreateFontIndirect(&lf); ATLASSERT(hFontBold != NULL); return hFontBold; } // Resource string pointer inline LPCWSTR AtlGetStringPtr(UINT uID, int* pch = NULL) { LPCWSTR lpstr = NULL; int nRet = ::LoadStringW(ATL::_AtlBaseModule.GetResourceInstance(), uID, (LPWSTR)&lpstr, 0); if(pch != NULL) *pch = nRet; return lpstr; } /////////////////////////////////////////////////////////////////////////////// // RunTimeHelper - helper functions for Windows version and structure sizes #ifndef _WTL_NO_RUNTIME_STRUCT_SIZE #ifndef _SIZEOF_STRUCT #define _SIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) #endif #if (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE) #define REBARBANDINFO_V6_SIZE _SIZEOF_STRUCT(REBARBANDINFO, cxHeader) #endif // (_WIN32_WINNT >= 0x0600) && !defined(REBARBANDINFO_V6_SIZE) #if (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE) #define LVGROUP_V5_SIZE _SIZEOF_STRUCT(LVGROUP, uAlign) #endif // (_WIN32_WINNT >= 0x0600) && !defined(LVGROUP_V5_SIZE) #if (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE) #define LVTILEINFO_V5_SIZE _SIZEOF_STRUCT(LVTILEINFO, puColumns) #endif // (_WIN32_WINNT >= 0x0600) && !defined(LVTILEINFO_V5_SIZE) #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE) #define MCHITTESTINFO_V1_SIZE _SIZEOF_STRUCT(MCHITTESTINFO, st) #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) && !defined(MCHITTESTINFO_V1_SIZE) #if (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) #define NONCLIENTMETRICS_V1_SIZE _SIZEOF_STRUCT(NONCLIENTMETRICS, lfMessageFont) #endif // (WINVER >= 0x0600) && !defined(NONCLIENTMETRICS_V1_SIZE) #ifndef TTTOOLINFO_V2_SIZE #define TTTOOLINFO_V2_SIZE _SIZEOF_STRUCT(TTTOOLINFO, lParam) #endif #endif // !_WTL_NO_RUNTIME_STRUCT_SIZE namespace RunTimeHelper { inline bool IsCommCtrl6() { DWORD dwMajor = 0, dwMinor = 0; HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); return (SUCCEEDED(hRet) && (dwMajor >= 6)); } inline bool IsVista() { #ifdef _versionhelpers_H_INCLUDED_ return ::IsWindowsVistaOrGreater(); #else // !_versionhelpers_H_INCLUDED_ OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; BOOL bRet = ::GetVersionEx(&ovi); return ((bRet != FALSE) && (ovi.dwMajorVersion >= 6)); #endif // _versionhelpers_H_INCLUDED_ } inline bool IsThemeAvailable() { return IsCommCtrl6() && (::IsThemeActive() != FALSE) && (::IsAppThemed() != FALSE); } inline bool IsWin7() { #ifdef _versionhelpers_H_INCLUDED_ return ::IsWindows7OrGreater(); #else // !_versionhelpers_H_INCLUDED_ OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; BOOL bRet = ::GetVersionEx(&ovi); return ((bRet != FALSE) && ((ovi.dwMajorVersion > 6) || ((ovi.dwMajorVersion == 6) && (ovi.dwMinorVersion >= 1)))); #endif // _versionhelpers_H_INCLUDED_ } inline bool IsRibbonUIAvailable() { static INT iRibbonUI = -1; #if defined(NTDDI_WIN7) && (NTDDI_VERSION >= NTDDI_WIN7) if (iRibbonUI == -1) { HMODULE hRibbonDLL = ::LoadLibrary(_T("propsys.dll")); if (hRibbonDLL != NULL) { const GUID CLSID_UIRibbonFramework = { 0x926749fa, 0x2615, 0x4987, { 0x88, 0x45, 0xc3, 0x3e, 0x65, 0xf2, 0xb9, 0x57 } }; // block - create instance { ATL::CComPtr pIUIFramework; iRibbonUI = SUCCEEDED(pIUIFramework.CoCreateInstance(CLSID_UIRibbonFramework)) ? 1 : 0; } ::FreeLibrary(hRibbonDLL); } else { iRibbonUI = 0; } } #endif // defined(NTDDI_WIN7) && (NTDDI_VERSION >= NTDDI_WIN7) return (iRibbonUI == 1); } inline UINT SizeOf_REBARBANDINFO() { UINT uSize = sizeof(REBARBANDINFO); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) if(!(IsVista() && IsCommCtrl6())) uSize = REBARBANDINFO_V6_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) return uSize; } inline UINT SizeOf_LVGROUP() { UINT uSize = sizeof(LVGROUP); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) if(!IsVista()) uSize = LVGROUP_V5_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) return uSize; } inline UINT SizeOf_LVTILEINFO() { UINT uSize = sizeof(LVTILEINFO); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) if(!IsVista()) uSize = LVTILEINFO_V5_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (_WIN32_WINNT >= 0x0600) return uSize; } inline UINT SizeOf_MCHITTESTINFO() { UINT uSize = sizeof(MCHITTESTINFO); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) if(!(IsVista() && IsCommCtrl6())) uSize = MCHITTESTINFO_V1_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) return uSize; } inline UINT SizeOf_NONCLIENTMETRICS() { UINT uSize = sizeof(NONCLIENTMETRICS); #if !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) if(!IsVista()) uSize = NONCLIENTMETRICS_V1_SIZE; #endif // !defined(_WTL_NO_RUNTIME_STRUCT_SIZE) && (WINVER >= 0x0600) return uSize; } inline UINT SizeOf_TOOLINFO() { UINT uSize = sizeof(TOOLINFO); #ifndef _WTL_NO_RUNTIME_STRUCT_SIZE if(!IsVista()) uSize = TTTOOLINFO_V2_SIZE; #endif return uSize; } } // namespace RunTimeHelper /////////////////////////////////////////////////////////////////////////////// // ModuleHelper - helper functions for ATL (deprecated) namespace ModuleHelper { inline HINSTANCE GetModuleInstance() { return ATL::_AtlBaseModule.GetModuleInstance(); } inline HINSTANCE GetResourceInstance() { return ATL::_AtlBaseModule.GetResourceInstance(); } inline void AddCreateWndData(ATL::_AtlCreateWndData* pData, void* pObject) { ATL::_AtlWinModule.AddCreateWndData(pData, pObject); } inline void* ExtractCreateWndData() { return ATL::_AtlWinModule.ExtractCreateWndData(); } } // namespace ModuleHelper /////////////////////////////////////////////////////////////////////////////// // SecureHelper - WTL10 requires use of secure functions // these are here only for compatibility with existing projects namespace SecureHelper { inline void strcpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) { ATL::Checked::strcpy_s(lpstrDest, cchDest, lpstrSrc); } inline void strcpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) { ATL::Checked::wcscpy_s(lpstrDest, cchDest, lpstrSrc); } inline void strcpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) { #ifdef _UNICODE strcpyW_x(lpstrDest, cchDest, lpstrSrc); #else strcpyA_x(lpstrDest, cchDest, lpstrSrc); #endif } inline errno_t strncpyA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc, size_t cchCount) { return ATL::Checked::strncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); } inline errno_t strncpyW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc, size_t cchCount) { return ATL::Checked::wcsncpy_s(lpstrDest, cchDest, lpstrSrc, cchCount); } inline errno_t strncpy_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc, size_t cchCount) { #ifdef _UNICODE return strncpyW_x(lpstrDest, cchDest, lpstrSrc, cchCount); #else return strncpyA_x(lpstrDest, cchDest, lpstrSrc, cchCount); #endif } inline void strcatA_x(char* lpstrDest, size_t cchDest, const char* lpstrSrc) { ATL::Checked::strcat_s(lpstrDest, cchDest, lpstrSrc); } inline void strcatW_x(wchar_t* lpstrDest, size_t cchDest, const wchar_t* lpstrSrc) { ATL::Checked::wcscat_s(lpstrDest, cchDest, lpstrSrc); } inline void strcat_x(LPTSTR lpstrDest, size_t cchDest, LPCTSTR lpstrSrc) { #ifdef _UNICODE strcatW_x(lpstrDest, cchDest, lpstrSrc); #else strcatA_x(lpstrDest, cchDest, lpstrSrc); #endif } inline void memcpy_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) { ATL::Checked::memcpy_s(pDest, cbDest, pSrc, cbSrc); } inline void memmove_x(void* pDest, size_t cbDest, const void* pSrc, size_t cbSrc) { ATL::Checked::memmove_s(pDest, cbDest, pSrc, cbSrc); } inline int vsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) { return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); } inline int wvsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, va_list args) { return _vstprintf_s(lpstrBuff, cchBuff, lpstrFormat, args); } inline int sprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...) { va_list args; va_start(args, lpstrFormat); int nRes = vsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args); va_end(args); return nRes; } inline int wsprintf_x(LPTSTR lpstrBuff, size_t cchBuff, LPCTSTR lpstrFormat, ...) { va_list args; va_start(args, lpstrFormat); int nRes = wvsprintf_x(lpstrBuff, cchBuff, lpstrFormat, args); va_end(args); return nRes; } } // namespace SecureHelper /////////////////////////////////////////////////////////////////////////////// // MinCrtHelper - WTL10 doesn't support _ATL_MIN_CRT, // these are here only for compatibility with existing projects namespace MinCrtHelper { inline int _isspace(TCHAR ch) { return _istspace(ch); } inline int _isdigit(TCHAR ch) { return _istdigit(ch); } inline int _atoi(LPCTSTR str) { return _ttoi(str); } inline LPCTSTR _strrchr(LPCTSTR str, TCHAR ch) { return _tcsrchr(str, ch); } inline LPTSTR _strrchr(LPTSTR str, TCHAR ch) { return _tcsrchr(str, ch); } } // namespace MinCrtHelper /////////////////////////////////////////////////////////////////////////////// // GenericWndClass - generic window class usable for subclassing // Use in dialog templates to specify a placeholder to be subclassed // Specify as a custom control with class name WTL_GenericWindow // Call Rregister() before creating dialog (for example, in WinMain) namespace GenericWndClass { inline LPCTSTR GetName() { return _T("WTL_GenericWindow"); } inline ATOM Register() { WNDCLASSEX wc = { sizeof(WNDCLASSEX) }; wc.lpfnWndProc = ::DefWindowProc; wc.hInstance = ModuleHelper::GetModuleInstance(); wc.hCursor = ::LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszClassName = GetName(); ATOM atom = ::RegisterClassEx(&wc); ATLASSERT(atom != 0); return atom; } inline BOOL Unregister() // only needed for DLLs or tmp use { return ::UnregisterClass(GetName(), ModuleHelper::GetModuleInstance()); } } // namespace GenericWndClass /////////////////////////////////////////////////////////////////////////////// // CMessageFilter - Interface for message filter support class ATL_NO_VTABLE CMessageFilter { public: virtual BOOL PreTranslateMessage(MSG* pMsg) = 0; }; /////////////////////////////////////////////////////////////////////////////// // CIdleHandler - Interface for idle processing class ATL_NO_VTABLE CIdleHandler { public: virtual BOOL OnIdle() = 0; }; /////////////////////////////////////////////////////////////////////////////// // CMessageLoop - message loop implementation class CMessageLoop { public: ATL::CSimpleArray m_aMsgFilter; ATL::CSimpleArray m_aIdleHandler; MSG m_msg; CMessageLoop() { memset(&m_msg, 0, sizeof(m_msg)); } virtual ~CMessageLoop() { } // Message filter operations BOOL AddMessageFilter(CMessageFilter* pMessageFilter) { return m_aMsgFilter.Add(pMessageFilter); } BOOL RemoveMessageFilter(CMessageFilter* pMessageFilter) { return m_aMsgFilter.Remove(pMessageFilter); } // Idle handler operations BOOL AddIdleHandler(CIdleHandler* pIdleHandler) { return m_aIdleHandler.Add(pIdleHandler); } BOOL RemoveIdleHandler(CIdleHandler* pIdleHandler) { return m_aIdleHandler.Remove(pIdleHandler); } // message loop int Run() { BOOL bDoIdle = TRUE; int nIdleCount = 0; BOOL bRet = FALSE; for(;;) { while(bDoIdle && !::PeekMessage(&m_msg, NULL, 0, 0, PM_NOREMOVE)) { if(!OnIdle(nIdleCount++)) bDoIdle = FALSE; } bRet = ::GetMessage(&m_msg, NULL, 0, 0); if(bRet == -1) { ATLTRACE2(atlTraceUI, 0, _T("::GetMessage returned -1 (error)\n")); continue; // error, don't process } else if(!bRet) { ATLTRACE2(atlTraceUI, 0, _T("CMessageLoop::Run - exiting\n")); break; // WM_QUIT, exit message loop } if(!PreTranslateMessage(&m_msg)) { ::TranslateMessage(&m_msg); ::DispatchMessage(&m_msg); } if(IsIdleMessage(&m_msg)) { bDoIdle = TRUE; nIdleCount = 0; } } return (int)m_msg.wParam; } // Overrideables // Override to change message filtering virtual BOOL PreTranslateMessage(MSG* pMsg) { // loop backwards for(int i = m_aMsgFilter.GetSize() - 1; i >= 0; i--) { CMessageFilter* pMessageFilter = m_aMsgFilter[i]; if((pMessageFilter != NULL) && pMessageFilter->PreTranslateMessage(pMsg)) return TRUE; } return FALSE; // not translated } // override to change idle processing virtual BOOL OnIdle(int /*nIdleCount*/) { for(int i = 0; i < m_aIdleHandler.GetSize(); i++) { CIdleHandler* pIdleHandler = m_aIdleHandler[i]; if(pIdleHandler != NULL) pIdleHandler->OnIdle(); } return FALSE; // don't continue } // override to change non-idle messages virtual BOOL IsIdleMessage(MSG* pMsg) const { // These messages should NOT cause idle processing switch(pMsg->message) { case WM_MOUSEMOVE: case WM_NCMOUSEMOVE: case WM_PAINT: case 0x0118: // WM_SYSTIMER (caret blink) return FALSE; } return TRUE; } }; /////////////////////////////////////////////////////////////////////////////// // CStaticDataInitCriticalSectionLock and CWindowCreateCriticalSectionLock // internal classes to manage critical sections for ATL (deprecated) class CStaticDataInitCriticalSectionLock { public: ATL::CComCritSecLock m_cslock; CStaticDataInitCriticalSectionLock() : m_cslock(ATL::_pAtlModule->m_csStaticDataInitAndTypeInfo, false) { } HRESULT Lock() { return m_cslock.Lock(); } void Unlock() { m_cslock.Unlock(); } }; class CWindowCreateCriticalSectionLock { public: ATL::CComCritSecLock m_cslock; CWindowCreateCriticalSectionLock() : m_cslock(ATL::_AtlWinModule.m_csWindowCreate, false) { } HRESULT Lock() { return m_cslock.Lock(); } void Unlock() { m_cslock.Unlock(); } }; /////////////////////////////////////////////////////////////////////////////// // CAppModule - module class for an application #if (_MSC_VER == 1400) // VS2005 #pragma warning(push) #pragma warning(disable : 4244) #pragma warning(disable : 4312) #endif class CAppModule : public ATL::CComModule { public: DWORD m_dwMainThreadID; ATL::CSimpleMap* m_pMsgLoopMap; ATL::CSimpleArray* m_pSettingChangeNotify; CAppModule() : m_dwMainThreadID(0), m_pMsgLoopMap(NULL), m_pSettingChangeNotify(NULL) { } // Overrides of CComModule::Init and Term HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL) { HRESULT hRet = CComModule::Init(pObjMap, hInstance, pLibID); if(FAILED(hRet)) return hRet; m_dwMainThreadID = ::GetCurrentThreadId(); typedef ATL::CSimpleMap _mapClass; m_pMsgLoopMap = NULL; ATLTRY(m_pMsgLoopMap = new _mapClass); if(m_pMsgLoopMap == NULL) return E_OUTOFMEMORY; m_pSettingChangeNotify = NULL; return hRet; } void Term() { TermSettingChangeNotify(); delete m_pMsgLoopMap; CComModule::Term(); } // Message loop map methods BOOL AddMessageLoop(CMessageLoop* pMsgLoop) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddMessageLoop.\n")); ATLASSERT(FALSE); return FALSE; } ATLASSERT(pMsgLoop != NULL); ATLASSERT(m_pMsgLoopMap->Lookup(::GetCurrentThreadId()) == NULL); // not in map yet BOOL bRet = m_pMsgLoopMap->Add(::GetCurrentThreadId(), pMsgLoop); lock.Unlock(); return bRet; } BOOL RemoveMessageLoop() { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveMessageLoop.\n")); ATLASSERT(FALSE); return FALSE; } BOOL bRet = m_pMsgLoopMap->Remove(::GetCurrentThreadId()); lock.Unlock(); return bRet; } CMessageLoop* GetMessageLoop(DWORD dwThreadID = ::GetCurrentThreadId()) const { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::GetMessageLoop.\n")); ATLASSERT(FALSE); return NULL; } CMessageLoop* pLoop = m_pMsgLoopMap->Lookup(dwThreadID); lock.Unlock(); return pLoop; } // Setting change notify methods // Note: Call this from the main thread for MSDI apps BOOL InitSettingChangeNotify(DLGPROC pfnDlgProc = _SettingChangeDlgProc) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::InitSettingChangeNotify.\n")); ATLASSERT(FALSE); return FALSE; } if(m_pSettingChangeNotify == NULL) { typedef ATL::CSimpleArray _notifyClass; ATLTRY(m_pSettingChangeNotify = new _notifyClass); ATLASSERT(m_pSettingChangeNotify != NULL); } BOOL bRet = (m_pSettingChangeNotify != NULL); if(bRet && (m_pSettingChangeNotify->GetSize() == 0)) { // init everything _ATL_EMPTY_DLGTEMPLATE templ; HWND hNtfWnd = ::CreateDialogIndirect(GetModuleInstance(), &templ, NULL, pfnDlgProc); ATLASSERT(::IsWindow(hNtfWnd)); if(::IsWindow(hNtfWnd)) { ::SetWindowLongPtr(hNtfWnd, GWLP_USERDATA, (LONG_PTR)this); bRet = m_pSettingChangeNotify->Add(hNtfWnd); } else { bRet = FALSE; } } lock.Unlock(); return bRet; } void TermSettingChangeNotify() { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::TermSettingChangeNotify.\n")); ATLASSERT(FALSE); return; } if((m_pSettingChangeNotify != NULL) && (m_pSettingChangeNotify->GetSize() > 0)) ::DestroyWindow((*m_pSettingChangeNotify)[0]); delete m_pSettingChangeNotify; m_pSettingChangeNotify = NULL; lock.Unlock(); } BOOL AddSettingChangeNotify(HWND hWnd) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::AddSettingChangeNotify.\n")); ATLASSERT(FALSE); return FALSE; } ATLASSERT(::IsWindow(hWnd)); BOOL bRet = FALSE; if(InitSettingChangeNotify() != FALSE) bRet = m_pSettingChangeNotify->Add(hWnd); lock.Unlock(); return bRet; } BOOL RemoveSettingChangeNotify(HWND hWnd) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CAppModule::RemoveSettingChangeNotify.\n")); ATLASSERT(FALSE); return FALSE; } BOOL bRet = FALSE; if(m_pSettingChangeNotify != NULL) bRet = m_pSettingChangeNotify->Remove(hWnd); lock.Unlock(); return bRet; } // Implementation - setting change notify dialog template and dialog procedure struct _ATL_EMPTY_DLGTEMPLATE : DLGTEMPLATE { _ATL_EMPTY_DLGTEMPLATE() { memset(this, 0, sizeof(_ATL_EMPTY_DLGTEMPLATE)); style = WS_POPUP; } WORD wMenu, wClass, wTitle; }; static INT_PTR CALLBACK _SettingChangeDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if(uMsg == WM_SETTINGCHANGE) { CAppModule* pModule = (CAppModule*)::GetWindowLongPtr(hWnd, GWLP_USERDATA); ATLASSERT(pModule != NULL); ATLASSERT(pModule->m_pSettingChangeNotify != NULL); const UINT uTimeout = 1500; // ms for(int i = 1; i < pModule->m_pSettingChangeNotify->GetSize(); i++) ::SendMessageTimeout((*pModule->m_pSettingChangeNotify)[i], uMsg, wParam, lParam, SMTO_ABORTIFHUNG, uTimeout, NULL); return TRUE; } return FALSE; } }; #if (_MSC_VER == 1400) // VS2005 #pragma warning(pop) #endif /////////////////////////////////////////////////////////////////////////////// // CServerAppModule - module class for a COM server application class CServerAppModule : public CAppModule { public: HANDLE m_hEventShutdown; bool m_bActivity; DWORD m_dwTimeOut; DWORD m_dwPause; CServerAppModule() : m_hEventShutdown(NULL), m_bActivity(false), m_dwTimeOut(5000), m_dwPause(1000) { } // Override of CAppModule::Init HRESULT Init(ATL::_ATL_OBJMAP_ENTRY* pObjMap, HINSTANCE hInstance, const GUID* pLibID = NULL) { m_dwTimeOut = 5000; m_dwPause = 1000; return CAppModule::Init(pObjMap, hInstance, pLibID); } void Term() { if((m_hEventShutdown != NULL) && ::CloseHandle(m_hEventShutdown)) m_hEventShutdown = NULL; CAppModule::Term(); } // COM Server methods LONG Unlock() throw() { LONG lRet = CComModule::Unlock(); if(lRet == 0) { m_bActivity = true; ::SetEvent(m_hEventShutdown); // tell monitor that we transitioned to zero } return lRet; } void MonitorShutdown() { for(;;) { ::WaitForSingleObject(m_hEventShutdown, INFINITE); DWORD dwWait = 0; do { m_bActivity = false; dwWait = ::WaitForSingleObject(m_hEventShutdown, m_dwTimeOut); } while(dwWait == WAIT_OBJECT_0); // timed out if(!m_bActivity && (m_nLockCnt == 0)) // if no activity let's really bail { #if defined(_WIN32_DCOM) && defined(_ATL_FREE_THREADED) ::CoSuspendClassObjects(); if(!m_bActivity && (m_nLockCnt == 0)) #endif break; } } // This handle should be valid now. If it isn't, // check if _Module.Term was called first (it shouldn't) if(::CloseHandle(m_hEventShutdown)) m_hEventShutdown = NULL; ::PostThreadMessage(m_dwMainThreadID, WM_QUIT, 0, 0); } bool StartMonitor() { m_hEventShutdown = ::CreateEvent(NULL, false, false, NULL); if(m_hEventShutdown == NULL) return false; DWORD dwThreadID = 0; #ifdef _MT HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))MonitorProc, this, 0, (UINT*)&dwThreadID); #else HANDLE hThread = ::CreateThread(NULL, 0, MonitorProc, this, 0, &dwThreadID); #endif bool bRet = (hThread != NULL); if(bRet) ::CloseHandle(hThread); return bRet; } static DWORD WINAPI MonitorProc(void* pv) { CServerAppModule* p = (CServerAppModule*)pv; p->MonitorShutdown(); return 0; } }; /////////////////////////////////////////////////////////////////////////////// // CRegKeyEx - not used any more, here only for compatibility with old projects typedef ATL::CRegKey CRegKeyEx; } // namespace WTL /////////////////////////////////////////////////////////////////////////////// // CString forward reference (enables CString use in atluser.h and atlgdi.h) #if (defined(_WTL_USE_CSTRING) || defined(_WTL_FORWARD_DECLARE_CSTRING)) && !defined(__ATLSTR_H__) #include #endif // CString namespace #define _CSTRING_NS ATL // Type classes namespace #define _WTYPES_NS /////////////////////////////////////////////////////////////////////////////// // General DLL version helpers (removed in ATL11) #if (_ATL_VER >= 0x0B00) namespace ATL { inline HRESULT AtlGetDllVersion(HINSTANCE hInstDLL, DLLVERSIONINFO* pDllVersionInfo) { ATLASSERT(pDllVersionInfo != NULL); if(pDllVersionInfo == NULL) return E_INVALIDARG; // We must get this function explicitly because some DLLs don't implement it. DLLGETVERSIONPROC pfnDllGetVersion = (DLLGETVERSIONPROC)::GetProcAddress(hInstDLL, "DllGetVersion"); if(pfnDllGetVersion == NULL) return E_NOTIMPL; return (*pfnDllGetVersion)(pDllVersionInfo); } inline HRESULT AtlGetDllVersion(LPCTSTR lpstrDllName, DLLVERSIONINFO* pDllVersionInfo) { HINSTANCE hInstDLL = ::LoadLibrary(lpstrDllName); if(hInstDLL == NULL) return E_FAIL; HRESULT hRet = AtlGetDllVersion(hInstDLL, pDllVersionInfo); ::FreeLibrary(hInstDLL); return hRet; } // Common Control Versions: // Win95/WinNT 4.0 maj=4 min=00 // IE 3.x maj=4 min=70 // IE 4.0 maj=4 min=71 inline HRESULT AtlGetCommCtrlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) { ATLASSERT((pdwMajor != NULL) && (pdwMinor != NULL)); if((pdwMajor == NULL) || (pdwMinor == NULL)) return E_INVALIDARG; DLLVERSIONINFO dvi; ::ZeroMemory(&dvi, sizeof(dvi)); dvi.cbSize = sizeof(dvi); HRESULT hRet = AtlGetDllVersion(_T("comctl32.dll"), &dvi); if(SUCCEEDED(hRet)) { *pdwMajor = dvi.dwMajorVersion; *pdwMinor = dvi.dwMinorVersion; } else if(hRet == E_NOTIMPL) { // If DllGetVersion is not there, then the DLL is a version // previous to the one shipped with IE 3.x *pdwMajor = 4; *pdwMinor = 0; hRet = S_OK; } return hRet; } // Shell Versions: // Win95/WinNT 4.0 maj=4 min=00 // IE 3.x, IE 4.0 without Web Integrated Desktop maj=4 min=00 // IE 4.0 with Web Integrated Desktop maj=4 min=71 // IE 4.01 with Web Integrated Desktop maj=4 min=72 inline HRESULT AtlGetShellVersion(LPDWORD pdwMajor, LPDWORD pdwMinor) { ATLASSERT((pdwMajor != NULL) && (pdwMinor != NULL)); if((pdwMajor == NULL) || (pdwMinor == NULL)) return E_INVALIDARG; DLLVERSIONINFO dvi; ::ZeroMemory(&dvi, sizeof(dvi)); dvi.cbSize = sizeof(dvi); HRESULT hRet = AtlGetDllVersion(_T("shell32.dll"), &dvi); if(SUCCEEDED(hRet)) { *pdwMajor = dvi.dwMajorVersion; *pdwMinor = dvi.dwMinorVersion; } else if(hRet == E_NOTIMPL) { // If DllGetVersion is not there, then the DLL is a version // previous to the one shipped with IE 4.x *pdwMajor = 4; *pdwMinor = 0; hRet = S_OK; } return hRet; } } // namespace ATL #endif // (_ATL_VER >= 0x0B00) // These are always included #include "atlwinx.h" #include "atluser.h" #include "atlgdi.h" #ifndef _WTL_NO_AUTOMATIC_NAMESPACE using namespace WTL; #endif // !_WTL_NO_AUTOMATIC_NAMESPACE #endif // __ATLAPP_H__ ================================================ FILE: third_party/WTL/Include/atlcrack.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLCRACK_H__ #define __ATLCRACK_H__ #pragma once #ifndef __ATLAPP_H__ #error atlcrack.h requires atlapp.h to be included first #endif /////////////////////////////////////////////////////////////////////////////// // Message map macro for cracked handlers // Note about message maps with cracked handlers: // You can use BEGIN_MSG_MAP for classes that derive from CWindowImpl/CDialogImpl, // but must use BEGIN_MSG_MAP_EX for classes that don't. #define BEGIN_MSG_MAP_EX(theClass) \ public: \ BOOL m_bMsgHandled; \ /* "handled" management for cracked handlers */ \ BOOL IsMsgHandled() const \ { \ return m_bMsgHandled; \ } \ void SetMsgHandled(BOOL bHandled) \ { \ m_bMsgHandled = bHandled; \ } \ BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \ { \ BOOL bOldMsgHandled = m_bMsgHandled; \ BOOL bRet = _ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, dwMsgMapID); \ m_bMsgHandled = bOldMsgHandled; \ return bRet; \ } \ BOOL _ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID) \ { \ BOOL bHandled = TRUE; \ (hWnd); \ (uMsg); \ (wParam); \ (lParam); \ (lResult); \ (bHandled); \ switch(dwMsgMapID) \ { \ case 0: /////////////////////////////////////////////////////////////////////////////// // Standard Windows message macros // int OnCreate(LPCREATESTRUCT lpCreateStruct) #define MSG_WM_CREATE(func) \ if (uMsg == WM_CREATE) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam) #define MSG_WM_INITDIALOG(func) \ if (uMsg == WM_INITDIALOG) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HWND)wParam, lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnCopyData(CWindow wnd, PCOPYDATASTRUCT pCopyDataStruct) #define MSG_WM_COPYDATA(func) \ if (uMsg == WM_COPYDATA) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HWND)wParam, (PCOPYDATASTRUCT)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDestroy() #define MSG_WM_DESTROY(func) \ if (uMsg == WM_DESTROY) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMove(CPoint ptPos) #define MSG_WM_MOVE(func) \ if (uMsg == WM_MOVE) \ { \ this->SetMsgHandled(TRUE); \ func(::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSize(UINT nType, CSize size) #define MSG_WM_SIZE(func) \ if (uMsg == WM_SIZE) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnActivate(UINT nState, BOOL bMinimized, CWindow wndOther) #define MSG_WM_ACTIVATE(func) \ if (uMsg == WM_ACTIVATE) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)LOWORD(wParam), (BOOL)HIWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSetFocus(CWindow wndOld) #define MSG_WM_SETFOCUS(func) \ if (uMsg == WM_SETFOCUS) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnKillFocus(CWindow wndFocus) #define MSG_WM_KILLFOCUS(func) \ if (uMsg == WM_KILLFOCUS) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnEnable(BOOL bEnable) #define MSG_WM_ENABLE(func) \ if (uMsg == WM_ENABLE) \ { \ this->SetMsgHandled(TRUE); \ func((BOOL)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnPaint(CDCHandle dc) #define MSG_WM_PAINT(func) \ if (uMsg == WM_PAINT) \ { \ this->SetMsgHandled(TRUE); \ func((HDC)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnClose() #define MSG_WM_CLOSE(func) \ if (uMsg == WM_CLOSE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnQueryEndSession(UINT nSource, UINT uLogOff) #define MSG_WM_QUERYENDSESSION(func) \ if (uMsg == WM_QUERYENDSESSION) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)wParam, (UINT)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnQueryOpen() #define MSG_WM_QUERYOPEN(func) \ if (uMsg == WM_QUERYOPEN) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func(); \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnEraseBkgnd(CDCHandle dc) #define MSG_WM_ERASEBKGND(func) \ if (uMsg == WM_ERASEBKGND) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSysColorChange() #define MSG_WM_SYSCOLORCHANGE(func) \ if (uMsg == WM_SYSCOLORCHANGE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnEndSession(BOOL bEnding, UINT uLogOff) #define MSG_WM_ENDSESSION(func) \ if (uMsg == WM_ENDSESSION) \ { \ this->SetMsgHandled(TRUE); \ func((BOOL)wParam, (UINT)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnShowWindow(BOOL bShow, UINT nStatus) #define MSG_WM_SHOWWINDOW(func) \ if (uMsg == WM_SHOWWINDOW) \ { \ this->SetMsgHandled(TRUE); \ func((BOOL)wParam, (int)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnCtlColorEdit(CDCHandle dc, CEdit edit) #define MSG_WM_CTLCOLOREDIT(func) \ if (uMsg == WM_CTLCOLOREDIT) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnCtlColorListBox(CDCHandle dc, CListBox listBox) #define MSG_WM_CTLCOLORLISTBOX(func) \ if (uMsg == WM_CTLCOLORLISTBOX) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnCtlColorBtn(CDCHandle dc, CButton button) #define MSG_WM_CTLCOLORBTN(func) \ if (uMsg == WM_CTLCOLORBTN) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnCtlColorDlg(CDCHandle dc, CWindow wnd) #define MSG_WM_CTLCOLORDLG(func) \ if (uMsg == WM_CTLCOLORDLG) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar) #define MSG_WM_CTLCOLORSCROLLBAR(func) \ if (uMsg == WM_CTLCOLORSCROLLBAR) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnCtlColorStatic(CDCHandle dc, CStatic wndStatic) #define MSG_WM_CTLCOLORSTATIC(func) \ if (uMsg == WM_CTLCOLORSTATIC) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSettingChange(UINT uFlags, LPCTSTR lpszSection) #define MSG_WM_SETTINGCHANGE(func) \ if (uMsg == WM_SETTINGCHANGE) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPCTSTR)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDevModeChange(LPCTSTR lpDeviceName) #define MSG_WM_DEVMODECHANGE(func) \ if (uMsg == WM_DEVMODECHANGE) \ { \ this->SetMsgHandled(TRUE); \ func((LPCTSTR)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnActivateApp(BOOL bActive, DWORD dwThreadID) #define MSG_WM_ACTIVATEAPP(func) \ if (uMsg == WM_ACTIVATEAPP) \ { \ this->SetMsgHandled(TRUE); \ func((BOOL)wParam, (DWORD)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnFontChange() #define MSG_WM_FONTCHANGE(func) \ if (uMsg == WM_FONTCHANGE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnTimeChange() #define MSG_WM_TIMECHANGE(func) \ if (uMsg == WM_TIMECHANGE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCancelMode() #define MSG_WM_CANCELMODE(func) \ if (uMsg == WM_CANCELMODE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnSetCursor(CWindow wnd, UINT nHitTest, UINT message) #define MSG_WM_SETCURSOR(func) \ if (uMsg == WM_SETCURSOR) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnMouseActivate(CWindow wndTopLevel, UINT nHitTest, UINT message) #define MSG_WM_MOUSEACTIVATE(func) \ if (uMsg == WM_MOUSEACTIVATE) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnChildActivate() #define MSG_WM_CHILDACTIVATE(func) \ if (uMsg == WM_CHILDACTIVATE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnGetMinMaxInfo(LPMINMAXINFO lpMMI) #define MSG_WM_GETMINMAXINFO(func) \ if (uMsg == WM_GETMINMAXINFO) \ { \ this->SetMsgHandled(TRUE); \ func((LPMINMAXINFO)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnIconEraseBkgnd(CDCHandle dc) #define MSG_WM_ICONERASEBKGND(func) \ if (uMsg == WM_ICONERASEBKGND) \ { \ this->SetMsgHandled(TRUE); \ func((HDC)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSpoolerStatus(UINT nStatus, UINT nJobs) #define MSG_WM_SPOOLERSTATUS(func) \ if (uMsg == WM_SPOOLERSTATUS) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (UINT)LOWORD(lParam)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) #define MSG_WM_DRAWITEM(func) \ if (uMsg == WM_DRAWITEM) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) #define MSG_WM_MEASUREITEM(func) \ if (uMsg == WM_MEASUREITEM) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct) #define MSG_WM_DELETEITEM(func) \ if (uMsg == WM_DELETEITEM) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } //int OnCharToItem(UINT nChar, UINT nIndex, CListBox listBox) #define MSG_WM_CHARTOITEM(func) \ if (uMsg == WM_CHARTOITEM) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox) #define MSG_WM_VKEYTOITEM(func) \ if (uMsg == WM_VKEYTOITEM) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HCURSOR OnQueryDragIcon() #define MSG_WM_QUERYDRAGICON(func) \ if (uMsg == WM_QUERYDRAGICON) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func(); \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct) #define MSG_WM_COMPAREITEM(func) \ if (uMsg == WM_COMPAREITEM) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCompacting(UINT nCpuTime) #define MSG_WM_COMPACTING(func) \ if (uMsg == WM_COMPACTING) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct) #define MSG_WM_NCCREATE(func) \ if (uMsg == WM_NCCREATE) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((LPCREATESTRUCT)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcDestroy() #define MSG_WM_NCDESTROY(func) \ if (uMsg == WM_NCDESTROY) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnNcCalcSize(BOOL bCalcValidRects, LPARAM lParam) #define MSG_WM_NCCALCSIZE(func) \ if (uMsg == WM_NCCALCSIZE) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((BOOL)wParam, lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // UINT OnNcHitTest(CPoint point) #define MSG_WM_NCHITTEST(func) \ if (uMsg == WM_NCHITTEST) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func(::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcPaint(CRgnHandle rgn) #define MSG_WM_NCPAINT(func) \ if (uMsg == WM_NCPAINT) \ { \ this->SetMsgHandled(TRUE); \ func((HRGN)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnNcActivate(BOOL bActive) #define MSG_WM_NCACTIVATE(func) \ if (uMsg == WM_NCACTIVATE) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((BOOL)wParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // UINT OnGetDlgCode(LPMSG lpMsg) #define MSG_WM_GETDLGCODE(func) \ if (uMsg == WM_GETDLGCODE) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((LPMSG)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcMouseMove(UINT nHitTest, CPoint point) #define MSG_WM_NCMOUSEMOVE(func) \ if (uMsg == WM_NCMOUSEMOVE) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcLButtonDown(UINT nHitTest, CPoint point) #define MSG_WM_NCLBUTTONDOWN(func) \ if (uMsg == WM_NCLBUTTONDOWN) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcLButtonUp(UINT nHitTest, CPoint point) #define MSG_WM_NCLBUTTONUP(func) \ if (uMsg == WM_NCLBUTTONUP) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcLButtonDblClk(UINT nHitTest, CPoint point) #define MSG_WM_NCLBUTTONDBLCLK(func) \ if (uMsg == WM_NCLBUTTONDBLCLK) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcRButtonDown(UINT nHitTest, CPoint point) #define MSG_WM_NCRBUTTONDOWN(func) \ if (uMsg == WM_NCRBUTTONDOWN) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcRButtonUp(UINT nHitTest, CPoint point) #define MSG_WM_NCRBUTTONUP(func) \ if (uMsg == WM_NCRBUTTONUP) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcRButtonDblClk(UINT nHitTest, CPoint point) #define MSG_WM_NCRBUTTONDBLCLK(func) \ if (uMsg == WM_NCRBUTTONDBLCLK) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcMButtonDown(UINT nHitTest, CPoint point) #define MSG_WM_NCMBUTTONDOWN(func) \ if (uMsg == WM_NCMBUTTONDOWN) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcMButtonUp(UINT nHitTest, CPoint point) #define MSG_WM_NCMBUTTONUP(func) \ if (uMsg == WM_NCMBUTTONUP) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcMButtonDblClk(UINT nHitTest, CPoint point) #define MSG_WM_NCMBUTTONDBLCLK(func) \ if (uMsg == WM_NCMBUTTONDBLCLK) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_KEYDOWN(func) \ if (uMsg == WM_KEYDOWN) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_KEYUP(func) \ if (uMsg == WM_KEYUP) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnChar(TCHAR chChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_CHAR(func) \ if (uMsg == WM_CHAR) \ { \ this->SetMsgHandled(TRUE); \ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDeadChar(TCHAR chChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_DEADCHAR(func) \ if (uMsg == WM_DEADCHAR) \ { \ this->SetMsgHandled(TRUE); \ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_SYSKEYDOWN(func) \ if (uMsg == WM_SYSKEYDOWN) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_SYSKEYUP(func) \ if (uMsg == WM_SYSKEYUP) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSysChar(TCHAR chChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_SYSCHAR(func) \ if (uMsg == WM_SYSCHAR) \ { \ this->SetMsgHandled(TRUE); \ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSysDeadChar(TCHAR chChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_SYSDEADCHAR(func) \ if (uMsg == WM_SYSDEADCHAR) \ { \ this->SetMsgHandled(TRUE); \ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSysCommand(UINT nID, CPoint point) #define MSG_WM_SYSCOMMAND(func) \ if (uMsg == WM_SYSCOMMAND) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnTCard(UINT idAction, DWORD dwActionData) #define MSG_WM_TCARD(func) \ if (uMsg == WM_TCARD) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (DWORD)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnTimer(UINT_PTR nIDEvent) #define MSG_WM_TIMER(func) \ if (uMsg == WM_TIMER) \ { \ this->SetMsgHandled(TRUE); \ func((UINT_PTR)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) #define MSG_WM_HSCROLL(func) \ if (uMsg == WM_HSCROLL) \ { \ this->SetMsgHandled(TRUE); \ func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) #define MSG_WM_VSCROLL(func) \ if (uMsg == WM_VSCROLL) \ { \ this->SetMsgHandled(TRUE); \ func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnInitMenu(CMenuHandle menu) #define MSG_WM_INITMENU(func) \ if (uMsg == WM_INITMENU) \ { \ this->SetMsgHandled(TRUE); \ func((HMENU)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnInitMenuPopup(CMenuHandle menuPopup, UINT nIndex, BOOL bSysMenu) #define MSG_WM_INITMENUPOPUP(func) \ if (uMsg == WM_INITMENUPOPUP) \ { \ this->SetMsgHandled(TRUE); \ func((HMENU)wParam, (UINT)LOWORD(lParam), (BOOL)HIWORD(lParam)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMenuSelect(UINT nItemID, UINT nFlags, CMenuHandle menu) #define MSG_WM_MENUSELECT(func) \ if (uMsg == WM_MENUSELECT) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenuHandle menu) #define MSG_WM_MENUCHAR(func) \ if (uMsg == WM_MENUCHAR) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((TCHAR)LOWORD(wParam), (UINT)HIWORD(wParam), (HMENU)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnNotify(int idCtrl, LPNMHDR pnmh) #define MSG_WM_NOTIFY(func) \ if (uMsg == WM_NOTIFY) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((int)wParam, (LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnEnterIdle(UINT nWhy, CWindow wndWho) #define MSG_WM_ENTERIDLE(func) \ if (uMsg == WM_ENTERIDLE) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMouseMove(UINT nFlags, CPoint point) #define MSG_WM_MOUSEMOVE(func) \ if (uMsg == WM_MOUSEMOVE) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) #define MSG_WM_MOUSEWHEEL(func) \ if (uMsg == WM_MOUSEWHEEL) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnLButtonDown(UINT nFlags, CPoint point) #define MSG_WM_LBUTTONDOWN(func) \ if (uMsg == WM_LBUTTONDOWN) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnLButtonUp(UINT nFlags, CPoint point) #define MSG_WM_LBUTTONUP(func) \ if (uMsg == WM_LBUTTONUP) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnLButtonDblClk(UINT nFlags, CPoint point) #define MSG_WM_LBUTTONDBLCLK(func) \ if (uMsg == WM_LBUTTONDBLCLK) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnRButtonDown(UINT nFlags, CPoint point) #define MSG_WM_RBUTTONDOWN(func) \ if (uMsg == WM_RBUTTONDOWN) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnRButtonUp(UINT nFlags, CPoint point) #define MSG_WM_RBUTTONUP(func) \ if (uMsg == WM_RBUTTONUP) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnRButtonDblClk(UINT nFlags, CPoint point) #define MSG_WM_RBUTTONDBLCLK(func) \ if (uMsg == WM_RBUTTONDBLCLK) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMButtonDown(UINT nFlags, CPoint point) #define MSG_WM_MBUTTONDOWN(func) \ if (uMsg == WM_MBUTTONDOWN) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMButtonUp(UINT nFlags, CPoint point) #define MSG_WM_MBUTTONUP(func) \ if (uMsg == WM_MBUTTONUP) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMButtonDblClk(UINT nFlags, CPoint point) #define MSG_WM_MBUTTONDBLCLK(func) \ if (uMsg == WM_MBUTTONDBLCLK) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnParentNotify(UINT message, UINT nChildID, LPARAM lParam) #define MSG_WM_PARENTNOTIFY(func) \ if (uMsg == WM_PARENTNOTIFY) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMDIActivate(CWindow wndDeactivate, CWindow wndActivate) #define MSG_WM_MDIACTIVATE(func) \ if (uMsg == WM_MDIACTIVATE) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam, (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnRenderFormat(UINT nFormat) #define MSG_WM_RENDERFORMAT(func) \ if (uMsg == WM_RENDERFORMAT) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnRenderAllFormats() #define MSG_WM_RENDERALLFORMATS(func) \ if (uMsg == WM_RENDERALLFORMATS) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDestroyClipboard() #define MSG_WM_DESTROYCLIPBOARD(func) \ if (uMsg == WM_DESTROYCLIPBOARD) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDrawClipboard() #define MSG_WM_DRAWCLIPBOARD(func) \ if (uMsg == WM_DRAWCLIPBOARD) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnPaintClipboard(CWindow wndViewer, const LPPAINTSTRUCT lpPaintStruct) #define MSG_WM_PAINTCLIPBOARD(func) \ if (uMsg == WM_PAINTCLIPBOARD) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam, (const LPPAINTSTRUCT)::GlobalLock((HGLOBAL)lParam)); \ ::GlobalUnlock((HGLOBAL)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnVScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos) #define MSG_WM_VSCROLLCLIPBOARD(func) \ if (uMsg == WM_VSCROLLCLIPBOARD) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnContextMenu(CWindow wnd, CPoint point) #define MSG_WM_CONTEXTMENU(func) \ if (uMsg == WM_CONTEXTMENU) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSizeClipboard(CWindow wndViewer, const LPRECT lpRect) #define MSG_WM_SIZECLIPBOARD(func) \ if (uMsg == WM_SIZECLIPBOARD) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam, (const LPRECT)::GlobalLock((HGLOBAL)lParam)); \ ::GlobalUnlock((HGLOBAL)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnAskCbFormatName(UINT nMaxCount, LPTSTR lpszString) #define MSG_WM_ASKCBFORMATNAME(func) \ if (uMsg == WM_ASKCBFORMATNAME) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPTSTR)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnChangeCbChain(CWindow wndRemove, CWindow wndAfter) #define MSG_WM_CHANGECBCHAIN(func) \ if (uMsg == WM_CHANGECBCHAIN) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam, (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnHScrollClipboard(CWindow wndViewer, UINT nSBCode, UINT nPos) #define MSG_WM_HSCROLLCLIPBOARD(func) \ if (uMsg == WM_HSCROLLCLIPBOARD) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnQueryNewPalette() #define MSG_WM_QUERYNEWPALETTE(func) \ if (uMsg == WM_QUERYNEWPALETTE) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func(); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnPaletteChanged(CWindow wndFocus) #define MSG_WM_PALETTECHANGED(func) \ if (uMsg == WM_PALETTECHANGED) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnPaletteIsChanging(CWindow wndPalChg) #define MSG_WM_PALETTEISCHANGING(func) \ if (uMsg == WM_PALETTEISCHANGING) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDropFiles(HDROP hDropInfo) #define MSG_WM_DROPFILES(func) \ if (uMsg == WM_DROPFILES) \ { \ this->SetMsgHandled(TRUE); \ func((HDROP)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnWindowPosChanging(LPWINDOWPOS lpWndPos) #define MSG_WM_WINDOWPOSCHANGING(func) \ if (uMsg == WM_WINDOWPOSCHANGING) \ { \ this->SetMsgHandled(TRUE); \ func((LPWINDOWPOS)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnWindowPosChanged(LPWINDOWPOS lpWndPos) #define MSG_WM_WINDOWPOSCHANGED(func) \ if (uMsg == WM_WINDOWPOSCHANGED) \ { \ this->SetMsgHandled(TRUE); \ func((LPWINDOWPOS)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnExitMenuLoop(BOOL fIsTrackPopupMenu) #define MSG_WM_EXITMENULOOP(func) \ if (uMsg == WM_EXITMENULOOP) \ { \ this->SetMsgHandled(TRUE); \ func((BOOL)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnEnterMenuLoop(BOOL fIsTrackPopupMenu) #define MSG_WM_ENTERMENULOOP(func) \ if (uMsg == WM_ENTERMENULOOP) \ { \ this->SetMsgHandled(TRUE); \ func((BOOL)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct) #define MSG_WM_STYLECHANGED(func) \ if (uMsg == WM_STYLECHANGED) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPSTYLESTRUCT)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnStyleChanging(int nStyleType, LPSTYLESTRUCT lpStyleStruct) #define MSG_WM_STYLECHANGING(func) \ if (uMsg == WM_STYLECHANGING) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPSTYLESTRUCT)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSizing(UINT fwSide, LPRECT pRect) #define MSG_WM_SIZING(func) \ if (uMsg == WM_SIZING) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPRECT)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMoving(UINT fwSide, LPRECT pRect) #define MSG_WM_MOVING(func) \ if (uMsg == WM_MOVING) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPRECT)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCaptureChanged(CWindow wnd) #define MSG_WM_CAPTURECHANGED(func) \ if (uMsg == WM_CAPTURECHANGED) \ { \ this->SetMsgHandled(TRUE); \ func((HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData) #define MSG_WM_DEVICECHANGE(func) \ if (uMsg == WM_DEVICECHANGE) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)wParam, (DWORD_PTR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCommand(UINT uNotifyCode, int nID, CWindow wndCtl) #define MSG_WM_COMMAND(func) \ if (uMsg == WM_COMMAND) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDisplayChange(UINT uBitsPerPixel, CSize sizeScreen) #define MSG_WM_DISPLAYCHANGE(func) \ if (uMsg == WM_DISPLAYCHANGE) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnEnterSizeMove() #define MSG_WM_ENTERSIZEMOVE(func) \ if (uMsg == WM_ENTERSIZEMOVE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnExitSizeMove() #define MSG_WM_EXITSIZEMOVE(func) \ if (uMsg == WM_EXITSIZEMOVE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // HFONT OnGetFont() #define MSG_WM_GETFONT(func) \ if (uMsg == WM_GETFONT) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func(); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnGetHotKey() #define MSG_WM_GETHOTKEY(func) \ if (uMsg == WM_GETHOTKEY) \ { \ this->SetMsgHandled(TRUE); \ lResult = func(); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HICON OnGetIcon() #define MSG_WM_GETICON(func) \ if (uMsg == WM_GETICON) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)wParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnGetText(int cchTextMax, LPTSTR lpszText) #define MSG_WM_GETTEXT(func) \ if (uMsg == WM_GETTEXT) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((int)wParam, (LPTSTR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnGetTextLength() #define MSG_WM_GETTEXTLENGTH(func) \ if (uMsg == WM_GETTEXTLENGTH) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func(); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnHelp(LPHELPINFO lpHelpInfo) #define MSG_WM_HELP(func) \ if (uMsg == WM_HELP) \ { \ this->SetMsgHandled(TRUE); \ func((LPHELPINFO)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnHotKey(int nHotKeyID, UINT uModifiers, UINT uVirtKey) #define MSG_WM_HOTKEY(func) \ if (uMsg == WM_HOTKEY) \ { \ this->SetMsgHandled(TRUE); \ func((int)wParam, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnInputLangChange(DWORD dwCharSet, HKL hKbdLayout) #define MSG_WM_INPUTLANGCHANGE(func) \ if (uMsg == WM_INPUTLANGCHANGE) \ { \ this->SetMsgHandled(TRUE); \ func((DWORD)wParam, (HKL)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnInputLangChangeRequest(BOOL bSysCharSet, HKL hKbdLayout) #define MSG_WM_INPUTLANGCHANGEREQUEST(func) \ if (uMsg == WM_INPUTLANGCHANGEREQUEST) \ { \ this->SetMsgHandled(TRUE); \ func((BOOL)wParam, (HKL)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNextDlgCtl(BOOL bHandle, WPARAM wCtlFocus) #define MSG_WM_NEXTDLGCTL(func) \ if (uMsg == WM_NEXTDLGCTL) \ { \ this->SetMsgHandled(TRUE); \ func((BOOL)LOWORD(lParam), wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNextMenu(int nVirtKey, LPMDINEXTMENU lpMdiNextMenu) #define MSG_WM_NEXTMENU(func) \ if (uMsg == WM_NEXTMENU) \ { \ this->SetMsgHandled(TRUE); \ func((int)wParam, (LPMDINEXTMENU)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnNotifyFormat(CWindow wndFrom, int nCommand) #define MSG_WM_NOTIFYFORMAT(func) \ if (uMsg == WM_NOTIFYFORMAT) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HWND)wParam, (int)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnPowerBroadcast(DWORD dwPowerEvent, DWORD_PTR dwData) #define MSG_WM_POWERBROADCAST(func) \ if (uMsg == WM_POWERBROADCAST) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((DWORD)wParam, (DWORD_PTR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnPrint(CDCHandle dc, UINT uFlags) #define MSG_WM_PRINT(func) \ if (uMsg == WM_PRINT) \ { \ this->SetMsgHandled(TRUE); \ func((HDC)wParam, (UINT)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnPrintClient(CDCHandle dc, UINT uFlags) #define MSG_WM_PRINTCLIENT(func) \ if (uMsg == WM_PRINTCLIENT) \ { \ this->SetMsgHandled(TRUE); \ func((HDC)wParam, (UINT)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnRasDialEvent(RASCONNSTATE rasconnstate, DWORD dwError) #define MSG_WM_RASDIALEVENT(func) \ if (uMsg == WM_RASDIALEVENT) \ { \ this->SetMsgHandled(TRUE); \ func((RASCONNSTATE)wParam, (DWORD)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSetFont(CFontHandle font, BOOL bRedraw) #define MSG_WM_SETFONT(func) \ if (uMsg == WM_SETFONT) \ { \ this->SetMsgHandled(TRUE); \ func((HFONT)wParam, (BOOL)LOWORD(lParam)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnSetHotKey(int nVirtKey, UINT uFlags) #define MSG_WM_SETHOTKEY(func) \ if (uMsg == WM_SETHOTKEY) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((int)LOBYTE(LOWORD(wParam)), (UINT)HIBYTE(LOWORD(wParam))); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HICON OnSetIcon(UINT uType, HICON hIcon) #define MSG_WM_SETICON(func) \ if (uMsg == WM_SETICON) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)wParam, (HICON)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnSetRedraw(BOOL bRedraw) #define MSG_WM_SETREDRAW(func) \ if (uMsg == WM_SETREDRAW) \ { \ this->SetMsgHandled(TRUE); \ func((BOOL)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnSetText(LPCTSTR lpstrText) #define MSG_WM_SETTEXT(func) \ if (uMsg == WM_SETTEXT) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((LPCTSTR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnUserChanged() #define MSG_WM_USERCHANGED(func) \ if (uMsg == WM_USERCHANGED) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } /////////////////////////////////////////////////////////////////////////////// // Newer Windows messages // void OnMouseHover(WPARAM wParam, CPoint ptPos) #define MSG_WM_MOUSEHOVER(func) \ if (uMsg == WM_MOUSEHOVER) \ { \ this->SetMsgHandled(TRUE); \ func(wParam, ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMouseLeave() #define MSG_WM_MOUSELEAVE(func) \ if (uMsg == WM_MOUSELEAVE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcMouseHover(UINT nHitTest, CPoint ptPos) #define MSG_WM_NCMOUSEHOVER(func) \ if (uMsg == WM_NCMOUSEHOVER) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, ::CPoint(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNcMouseLeave() #define MSG_WM_NCMOUSELEAVE(func) \ if (uMsg == WM_NCMOUSELEAVE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMenuRButtonUp(WPARAM wParam, CMenuHandle menu) #define MSG_WM_MENURBUTTONUP(func) \ if (uMsg == WM_MENURBUTTONUP) \ { \ this->SetMsgHandled(TRUE); \ func(wParam, (HMENU)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnMenuDrag(WPARAM wParam, CMenuHandle menu) #define MSG_WM_MENUDRAG(func) \ if (uMsg == WM_MENUDRAG) \ { \ this->SetMsgHandled(TRUE); \ lResult = func(wParam, (HMENU)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnMenuGetObject(PMENUGETOBJECTINFO info) #define MSG_WM_MENUGETOBJECT(func) \ if (uMsg == WM_MENUGETOBJECT) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((PMENUGETOBJECTINFO)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnUnInitMenuPopup(UINT nID, CMenuHandle menu) #define MSG_WM_UNINITMENUPOPUP(func) \ if (uMsg == WM_UNINITMENUPOPUP) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(lParam), (HMENU)wParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnMenuCommand(WPARAM nIndex, CMenuHandle menu) #define MSG_WM_MENUCOMMAND(func) \ if (uMsg == WM_MENUCOMMAND) \ { \ this->SetMsgHandled(TRUE); \ func(wParam, (HMENU)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnAppCommand(CWindow wndFocus, short cmd, WORD uDevice, int dwKeys) #define MSG_WM_APPCOMMAND(func) \ if (uMsg == WM_APPCOMMAND) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HWND)wParam, GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNCXButtonDown(int fwButton, short nHittest, CPoint ptPos) #define MSG_WM_NCXBUTTONDOWN(func) \ if (uMsg == WM_NCXBUTTONDOWN) \ { \ this->SetMsgHandled(TRUE); \ func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = (LRESULT)TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNCXButtonUp(int fwButton, short nHittest, CPoint ptPos) #define MSG_WM_NCXBUTTONUP(func) \ if (uMsg == WM_NCXBUTTONUP) \ { \ this->SetMsgHandled(TRUE); \ func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = (LRESULT)TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnNCXButtonDblClk(int fwButton, short nHittest, CPoint ptPos) #define MSG_WM_NCXBUTTONDBLCLK(func) \ if (uMsg == WM_NCXBUTTONDBLCLK) \ { \ this->SetMsgHandled(TRUE); \ func(GET_XBUTTON_WPARAM(wParam), GET_NCHITTEST_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = (LRESULT)TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnXButtonDown(int fwButton, int dwKeys, CPoint ptPos) #define MSG_WM_XBUTTONDOWN(func) \ if (uMsg == WM_XBUTTONDOWN) \ { \ this->SetMsgHandled(TRUE); \ func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = (LRESULT)TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnXButtonUp(int fwButton, int dwKeys, CPoint ptPos) #define MSG_WM_XBUTTONUP(func) \ if (uMsg == WM_XBUTTONUP) \ { \ this->SetMsgHandled(TRUE); \ func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = (LRESULT)TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnXButtonDblClk(int fwButton, int dwKeys, CPoint ptPos) #define MSG_WM_XBUTTONDBLCLK(func) \ if (uMsg == WM_XBUTTONDBLCLK) \ { \ this->SetMsgHandled(TRUE); \ func(GET_XBUTTON_WPARAM(wParam), GET_KEYSTATE_WPARAM(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ lResult = (LRESULT)TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnChangeUIState(WORD nAction, WORD nState) #define MSG_WM_CHANGEUISTATE(func) \ if (uMsg == WM_CHANGEUISTATE) \ { \ this->SetMsgHandled(TRUE); \ func(LOWORD(wParam), HIWORD(wParam)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnUpdateUIState(WORD nAction, WORD nState) #define MSG_WM_UPDATEUISTATE(func) \ if (uMsg == WM_UPDATEUISTATE) \ { \ this->SetMsgHandled(TRUE); \ func(LOWORD(wParam), HIWORD(wParam)); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnQueryUIState() #define MSG_WM_QUERYUISTATE(func) \ if (uMsg == WM_QUERYUISTATE) \ { \ this->SetMsgHandled(TRUE); \ lResult = func(); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnInput(WPARAM RawInputCode, HRAWINPUT hRawInput) #define MSG_WM_INPUT(func) \ if (uMsg == WM_INPUT) \ { \ this->SetMsgHandled(TRUE); \ func(GET_RAWINPUT_CODE_WPARAM(wParam), (HRAWINPUT)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnUniChar(TCHAR nChar, UINT nRepCnt, UINT nFlags) #define MSG_WM_UNICHAR(func) \ if (uMsg == WM_UNICHAR) \ { \ this->SetMsgHandled(TRUE); \ func((TCHAR)wParam, (UINT)lParam & 0xFFFF, (UINT)((lParam & 0xFFFF0000) >> 16)); \ if(this->IsMsgHandled()) \ { \ lResult = (wParam == UNICODE_NOCHAR) ? TRUE : FALSE; \ return TRUE; \ } \ } // void OnWTSSessionChange(WPARAM nStatusCode, DWORD dwSessionID) #define MSG_WM_WTSSESSION_CHANGE(func) \ if (uMsg == WM_WTSSESSION_CHANGE) \ { \ this->SetMsgHandled(TRUE); \ func(wParam, (DWORD)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnThemeChanged() #define MSG_WM_THEMECHANGED(func) \ if (uMsg == WM_THEMECHANGED) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } #if (_WIN32_WINNT >= 0x0600) // BOOL OnMouseHWheel(UINT nFlags, short zDelta, CPoint pt) #define MSG_WM_MOUSEHWHEEL(func) \ if (uMsg == WM_MOUSEHWHEEL) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)LOWORD(wParam), (short)HIWORD(wParam), ::CPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); \ if(this->IsMsgHandled()) \ return TRUE; \ } #endif // (_WIN32_WINNT >= 0x0600) #if (WINVER >= 0x0601) // void OnGesture(ULONGLONG ullArguments, HGESTUREINFO hGestureInfo) #define MSG_WM_GESTURE(func) \ if (uMsg == WM_GESTURE) \ { \ this->SetMsgHandled(TRUE); \ func((ULONGLONG)wParam, (HGESTUREINFO)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnGestureNotify(PGESTURENOTIFYSTRUCT pGestureNotifyStruct) #define MSG_WM_GESTURENOTIFY(func) \ if (uMsg == WM_GESTURENOTIFY) \ { \ func((PGESTURENOTIFYSTRUCT)lParam); \ } // void OnDpiChanged(UINT nDpiX, UINT nDpiY, PRECT pRect) #define MSG_WM_DPICHANGED(func) \ if (uMsg == WM_DPICHANGED) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (PRECT)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } #endif // (WINVER >= 0x0601) #if (WINVER >= 0x0605) // void OnDpiChangedBeforeParent() #define MSG_WM_DPICHANGED_BEFOREPARENT(func) \ if (uMsg == WM_DPICHANGED_BEFOREPARENT) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDpiChangedAfterParent() #define MSG_WM_DPICHANGED_AFTERPARENT(func) \ if (uMsg == WM_DPICHANGED_AFTERPARENT) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // BOOL OnGetDpiScaledSize(UINT uDpi, PSIZE pSize) #define MSG_WM_GETDPISCALEDSIZE(func) \ if (uMsg == WM_GETDPISCALEDSIZE) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)wParam, (PSIZE)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } #endif // (WINVER >= 0x0605) /////////////////////////////////////////////////////////////////////////////// // ATL defined messages // BOOL OnForwardMsg(LPMSG Msg, DWORD nUserData) #define MSG_WM_FORWARDMSG(func) \ if (uMsg == WM_FORWARDMSG) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((LPMSG)lParam, (DWORD)wParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } /////////////////////////////////////////////////////////////////////////////// // Dialog specific messages // LRESULT OnDMGetDefID() #define MSG_DM_GETDEFID(func) \ if (uMsg == DM_GETDEFID) \ { \ this->SetMsgHandled(TRUE); \ lResult = func(); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDMSetDefID(UINT DefID) #define MSG_DM_SETDEFID(func) \ if (uMsg == DM_SETDEFID) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnDMReposition() #define MSG_DM_REPOSITION(func) \ if (uMsg == DM_REPOSITION) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } /////////////////////////////////////////////////////////////////////////////// // Reflected messages // void OnReflectedCommand(UINT uNotifyCode, int nID, CWindow wndCtl) #define MSG_OCM_COMMAND(func) \ if (uMsg == OCM_COMMAND) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnReflectedNotify(int idCtrl, LPNMHDR pnmh) #define MSG_OCM_NOTIFY(func) \ if (uMsg == OCM_NOTIFY) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((int)wParam, (LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnReflectedParentNotify(UINT message, UINT nChildID, LPARAM lParam) #define MSG_OCM_PARENTNOTIFY(func) \ if (uMsg == OCM_PARENTNOTIFY) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnReflectedDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) #define MSG_OCM_DRAWITEM(func) \ if (uMsg == OCM_DRAWITEM) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPDRAWITEMSTRUCT)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnReflectedMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) #define MSG_OCM_MEASUREITEM(func) \ if (uMsg == OCM_MEASUREITEM) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPMEASUREITEMSTRUCT)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnReflectedCompareItem(int nIDCtl, LPCOMPAREITEMSTRUCT lpCompareItemStruct) #define MSG_OCM_COMPAREITEM(func) \ if (uMsg == OCM_COMPAREITEM) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)wParam, (LPCOMPAREITEMSTRUCT)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnReflectedDeleteItem(int nIDCtl, LPDELETEITEMSTRUCT lpDeleteItemStruct) #define MSG_OCM_DELETEITEM(func) \ if (uMsg == OCM_DELETEITEM) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)wParam, (LPDELETEITEMSTRUCT)lParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } // int OnReflectedVKeyToItem(UINT nKey, UINT nIndex, CListBox listBox) #define MSG_OCM_VKEYTOITEM(func) \ if (uMsg == OCM_VKEYTOITEM) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } //int OnReflectedCharToItem(UINT nChar, UINT nIndex, CListBox listBox) #define MSG_OCM_CHARTOITEM(func) \ if (uMsg == OCM_CHARTOITEM) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((UINT)LOWORD(wParam), (UINT)HIWORD(wParam), (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnReflectedHScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) #define MSG_OCM_HSCROLL(func) \ if (uMsg == OCM_HSCROLL) \ { \ this->SetMsgHandled(TRUE); \ func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnReflectedVScroll(UINT nSBCode, UINT nPos, CScrollBar pScrollBar) #define MSG_OCM_VSCROLL(func) \ if (uMsg == OCM_VSCROLL) \ { \ this->SetMsgHandled(TRUE); \ func((int)LOWORD(wParam), (short)HIWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnReflectedCtlColorEdit(CDCHandle dc, CEdit edit) #define MSG_OCM_CTLCOLOREDIT(func) \ if (uMsg == OCM_CTLCOLOREDIT) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnReflectedCtlColorListBox(CDCHandle dc, CListBox listBox) #define MSG_OCM_CTLCOLORLISTBOX(func) \ if (uMsg == OCM_CTLCOLORLISTBOX) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnReflectedCtlColorBtn(CDCHandle dc, CButton button) #define MSG_OCM_CTLCOLORBTN(func) \ if (uMsg == OCM_CTLCOLORBTN) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnReflectedCtlColorDlg(CDCHandle dc, CWindow wnd) #define MSG_OCM_CTLCOLORDLG(func) \ if (uMsg == OCM_CTLCOLORDLG) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnReflectedCtlColorScrollBar(CDCHandle dc, CScrollBar scrollBar) #define MSG_OCM_CTLCOLORSCROLLBAR(func) \ if (uMsg == OCM_CTLCOLORSCROLLBAR) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // HBRUSH OnReflectedCtlColorStatic(CDCHandle dc, CStatic wndStatic) #define MSG_OCM_CTLCOLORSTATIC(func) \ if (uMsg == OCM_CTLCOLORSTATIC) \ { \ this->SetMsgHandled(TRUE); \ lResult = (LRESULT)func((HDC)wParam, (HWND)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } /////////////////////////////////////////////////////////////////////////////// // Edit specific messages // void OnClear() #define MSG_WM_CLEAR(func) \ if (uMsg == WM_CLEAR) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCopy() #define MSG_WM_COPY(func) \ if (uMsg == WM_COPY) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCut() #define MSG_WM_CUT(func) \ if (uMsg == WM_CUT) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnPaste() #define MSG_WM_PASTE(func) \ if (uMsg == WM_PASTE) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnUndo() #define MSG_WM_UNDO(func) \ if (uMsg == WM_UNDO) \ { \ this->SetMsgHandled(TRUE); \ func(); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } /////////////////////////////////////////////////////////////////////////////// // Generic message handlers // LRESULT OnMessageHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam) #define MESSAGE_HANDLER_EX(msg, func) \ if(uMsg == msg) \ { \ this->SetMsgHandled(TRUE); \ lResult = func(uMsg, wParam, lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnMessageRangeHandlerEX(UINT uMsg, WPARAM wParam, LPARAM lParam) #define MESSAGE_RANGE_HANDLER_EX(msgFirst, msgLast, func) \ if((uMsg >= msgFirst) && (uMsg <= msgLast)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func(uMsg, wParam, lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } /////////////////////////////////////////////////////////////////////////////// // Commands and notifications // void OnCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_HANDLER_EX(id, code, func) \ if ((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (id == LOWORD(wParam))) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_ID_HANDLER_EX(id, func) \ if ((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_CODE_HANDLER_EX(code, func) \ if ((uMsg == WM_COMMAND) && (code == HIWORD(wParam))) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnNotifyHandlerEX(LPNMHDR pnmh) #define NOTIFY_HANDLER_EX(id, cd, func) \ if ((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnNotifyIDHandlerEX(LPNMHDR pnmh) #define NOTIFY_ID_HANDLER_EX(id, func) \ if ((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnNotifyCodeHandlerEX(LPNMHDR pnmh) #define NOTIFY_CODE_HANDLER_EX(cd, func) \ if ((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ if((uMsg == WM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ if((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnNotifyRangeHandlerEX(LPNMHDR pnmh) #define NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ if((uMsg == WM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnNotifyRangeCodeHandlerEX(LPNMHDR pnmh) #define NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnReflectedCommandHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_HANDLER_EX(id, code, func) \ if ((uMsg == OCM_COMMAND) && (code == HIWORD(wParam)) && (id == LOWORD(wParam))) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnReflectedCommandIDHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_ID_HANDLER_EX(id, func) \ if ((uMsg == OCM_COMMAND) && (id == LOWORD(wParam))) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnReflectedCommandCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_CODE_HANDLER_EX(code, func) \ if ((uMsg == OCM_COMMAND) && (code == HIWORD(wParam))) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnReflectedNotifyHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_HANDLER_EX(id, cd, func) \ if ((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnReflectedNotifyIDHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_ID_HANDLER_EX(id, func) \ if ((uMsg == OCM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnReflectedNotifyCodeHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_CODE_HANDLER_EX(cd, func) \ if ((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnReflectedCommandRangeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func) \ if((uMsg == OCM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnReflectedCommandRangeCodeHandlerEX(UINT uNotifyCode, int nID, CWindow wndCtl) #define REFLECTED_COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code, func) \ if((uMsg == OCM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ this->SetMsgHandled(TRUE); \ func((UINT)HIWORD(wParam), (int)LOWORD(wParam), (HWND)lParam); \ lResult = 0; \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnReflectedNotifyRangeHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_RANGE_HANDLER_EX(idFirst, idLast, func) \ if((uMsg == OCM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // LRESULT OnReflectedNotifyRangeCodeHandlerEX(LPNMHDR pnmh) #define REFLECTED_NOTIFY_RANGE_CODE_HANDLER_EX(idFirst, idLast, cd, func) \ if((uMsg == OCM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ this->SetMsgHandled(TRUE); \ lResult = func((LPNMHDR)lParam); \ if(this->IsMsgHandled()) \ return TRUE; \ } // void OnAppCommandHandler(UINT uDevice, DWORD dwKeys, CWindow wndFocus) #define APPCOMMAND_HANDLER_EX(cmd, func) \ if((uMsg == WM_APPCOMMAND) && (cmd == GET_APPCOMMAND_LPARAM(lParam))) \ { \ this->SetMsgHandled(TRUE); \ func(GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam), (HWND)wParam); \ lResult = TRUE; \ if(this->IsMsgHandled()) \ return TRUE; \ } #endif // __ATLCRACK_H__ ================================================ FILE: third_party/WTL/Include/atlctrls.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLCTRLS_H__ #define __ATLCTRLS_H__ #pragma once #ifndef __ATLAPP_H__ #error atlctrls.h requires atlapp.h to be included first #endif #ifndef __ATLWIN_H__ #error atlctrls.h requires atlwin.h to be included first #endif #include #include #if (_RICHEDIT_VER < 0x0300) #error WTL10 requires _RICHEDIT_VER >= 0x0300 #endif // protect template members from windowsx.h macros #ifdef _INC_WINDOWSX #undef GetNextSibling #undef GetPrevSibling #endif // _INC_WINDOWSX /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CStaticT - CStatic // CButtonT - CButton // CListBoxT - CListBox // CComboBoxT - CComboBox // CEditT - CEdit // CEditCommands // CScrollBarT - CScrollBar // // CImageListT - CImageList, CImageListManaged // CListViewCtrlT - CListViewCtrl // CTreeViewCtrlT - CTreeViewCtrl // CTreeItemT - CTreeItem // CTreeViewCtrlExT - CTreeViewCtrlEx // CHeaderCtrlT - CHeaderCtrl // CToolBarCtrlT - CToolBarCtrl // CStatusBarCtrlT - CStatusBarCtrl // CTabCtrlT - CTabCtrl // CToolInfo // CToolTipCtrlT - CToolTipCtrl // CTrackBarCtrlT - CTrackBarCtrl // CUpDownCtrlT - CUpDownCtrl // CProgressBarCtrlT - CProgressBarCtrl // CHotKeyCtrlT - CHotKeyCtrl // CAnimateCtrlT - CAnimateCtrl // CRichEditCtrlT - CRichEditCtrl // CRichEditCommands // CDragListBoxT - CDragListBox // CDragListNotifyImpl // CReBarCtrlT - CReBarCtrl // CComboBoxExT - CComboBoxEx // CDateTimePickerCtrlT - CDateTimePickerCtrl // CMonthCalendarCtrlT - CMonthCalendarCtrl // CFlatScrollBarImpl // CFlatScrollBarT - CFlatScrollBar // CIPAddressCtrlT - CIPAddressCtrl // CPagerCtrlT - CPagerCtrl // CLinkCtrlT - CLinkCtrl // // CCustomDraw namespace WTL { // These are wrapper classes for Windows standard and common controls. // To implement a window based on a control, use following: // Example: Implementing a window based on a list box // // class CMyListBox : CWindowImpl // { // public: // BEGIN_MSG_MAP(CMyListBox) // // put your message handler entries here // END_MSG_MAP() // }; // --- Standard Windows controls --- /////////////////////////////////////////////////////////////////////////////// // CStatic - client side for a Windows STATIC control template class CStaticT : public TBase { public: // Constructors CStaticT(HWND hWnd = NULL) : TBase(hWnd) { } CStaticT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return _T("STATIC"); } HICON GetIcon() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HICON)::SendMessage(this->m_hWnd, STM_GETICON, 0, 0L); } HICON SetIcon(HICON hIcon) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HICON)::SendMessage(this->m_hWnd, STM_SETICON, (WPARAM)hIcon, 0L); } HENHMETAFILE GetEnhMetaFile() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HENHMETAFILE)::SendMessage(this->m_hWnd, STM_GETIMAGE, IMAGE_ENHMETAFILE, 0L); } HENHMETAFILE SetEnhMetaFile(HENHMETAFILE hMetaFile) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HENHMETAFILE)::SendMessage(this->m_hWnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hMetaFile); } CBitmapHandle GetBitmap() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CBitmapHandle((HBITMAP)::SendMessage(this->m_hWnd, STM_GETIMAGE, IMAGE_BITMAP, 0L)); } CBitmapHandle SetBitmap(HBITMAP hBitmap) { ATLASSERT(::IsWindow(this->m_hWnd)); return CBitmapHandle((HBITMAP)::SendMessage(this->m_hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); } HCURSOR GetCursor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HCURSOR)::SendMessage(this->m_hWnd, STM_GETIMAGE, IMAGE_CURSOR, 0L); } HCURSOR SetCursor(HCURSOR hCursor) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HCURSOR)::SendMessage(this->m_hWnd, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM)hCursor); } }; typedef CStaticT CStatic; /////////////////////////////////////////////////////////////////////////////// // CButton - client side for a Windows BUTTON control template class CButtonT : public TBase { public: // Constructors CButtonT(HWND hWnd = NULL) : TBase(hWnd) { } CButtonT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return _T("BUTTON"); } UINT GetState() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, BM_GETSTATE, 0, 0L); } void SetState(BOOL bHighlight) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, BM_SETSTATE, bHighlight, 0L); } int GetCheck() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, BM_GETCHECK, 0, 0L); } void SetCheck(int nCheck) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, BM_SETCHECK, nCheck, 0L); } UINT GetButtonStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::GetWindowLong(this->m_hWnd, GWL_STYLE) & 0xFFFF; } void SetButtonStyle(UINT nStyle, BOOL bRedraw = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, BM_SETSTYLE, nStyle, (LPARAM)bRedraw); } HICON GetIcon() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HICON)::SendMessage(this->m_hWnd, BM_GETIMAGE, IMAGE_ICON, 0L); } HICON SetIcon(HICON hIcon) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HICON)::SendMessage(this->m_hWnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon); } CBitmapHandle GetBitmap() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CBitmapHandle((HBITMAP)::SendMessage(this->m_hWnd, BM_GETIMAGE, IMAGE_BITMAP, 0L)); } CBitmapHandle SetBitmap(HBITMAP hBitmap) { ATLASSERT(::IsWindow(this->m_hWnd)); return CBitmapHandle((HBITMAP)::SendMessage(this->m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap)); } BOOL GetIdealSize(LPSIZE lpSize) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, BCM_GETIDEALSIZE, 0, (LPARAM)lpSize); } BOOL GetImageList(PBUTTON_IMAGELIST pButtonImagelist) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, BCM_GETIMAGELIST, 0, (LPARAM)pButtonImagelist); } BOOL SetImageList(PBUTTON_IMAGELIST pButtonImagelist) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, BCM_SETIMAGELIST, 0, (LPARAM)pButtonImagelist); } BOOL GetTextMargin(LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, BCM_GETTEXTMARGIN, 0, (LPARAM)lpRect); } BOOL SetTextMargin(LPRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, BCM_SETTEXTMARGIN, 0, (LPARAM)lpRect); } #if (WINVER >= 0x0600) void SetDontClick(BOOL bDontClick) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, BM_SETDONTCLICK, (WPARAM)bDontClick, 0L); } #endif // (WINVER >= 0x0600) #if (_WIN32_WINNT >= 0x0600) BOOL SetDropDownState(BOOL bDropDown) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); return (BOOL)::SendMessage(this->m_hWnd, BCM_SETDROPDOWNSTATE, (WPARAM)bDropDown, 0L); } BOOL GetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); return (BOOL)::SendMessage(this->m_hWnd, BCM_GETSPLITINFO, 0, (LPARAM)pSplitInfo); } BOOL SetSplitInfo(PBUTTON_SPLITINFO pSplitInfo) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (BS_SPLITBUTTON | BS_DEFSPLITBUTTON)) != 0); return (BOOL)::SendMessage(this->m_hWnd, BCM_SETSPLITINFO, 0, (LPARAM)pSplitInfo); } int GetNoteLength() const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); return (int)::SendMessage(this->m_hWnd, BCM_GETNOTELENGTH, 0, 0L); } BOOL GetNote(LPWSTR lpstrNoteText, int cchNoteText) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); return (BOOL)::SendMessage(this->m_hWnd, BCM_GETNOTE, cchNoteText, (LPARAM)lpstrNoteText); } BOOL SetNote(LPCWSTR lpstrNoteText) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (BS_COMMANDLINK | BS_DEFCOMMANDLINK)) != 0); return (BOOL)::SendMessage(this->m_hWnd, BCM_SETNOTE, 0, (LPARAM)lpstrNoteText); } LRESULT SetElevationRequiredState(BOOL bSet) { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SendMessage(this->m_hWnd, BCM_SETSHIELD, 0, (LPARAM)bSet); } #endif // (_WIN32_WINNT >= 0x0600) // Operations void Click() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, BM_CLICK, 0, 0L); } }; typedef CButtonT CButton; /////////////////////////////////////////////////////////////////////////////// // CListBox - client side for a Windows LISTBOX control template class CListBoxT : public TBase { public: // Constructors CListBoxT(HWND hWnd = NULL) : TBase(hWnd) { } CListBoxT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return _T("LISTBOX"); } // for entire listbox int GetCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_GETCOUNT, 0, 0L); } int SetCount(int cItems) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(((this->GetStyle() & LBS_NODATA) != 0) && ((this->GetStyle() & LBS_HASSTRINGS) == 0)); return (int)::SendMessage(this->m_hWnd, LB_SETCOUNT, cItems, 0L); } int GetHorizontalExtent() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_GETHORIZONTALEXTENT, 0, 0L); } void SetHorizontalExtent(int cxExtent) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LB_SETHORIZONTALEXTENT, cxExtent, 0L); } int GetTopIndex() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_GETTOPINDEX, 0, 0L); } int SetTopIndex(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_SETTOPINDEX, nIndex, 0L); } LCID GetLocale() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (LCID)::SendMessage(this->m_hWnd, LB_GETLOCALE, 0, 0L); } LCID SetLocale(LCID nNewLocale) { ATLASSERT(::IsWindow(this->m_hWnd)); return (LCID)::SendMessage(this->m_hWnd, LB_SETLOCALE, (WPARAM)nNewLocale, 0L); } DWORD GetListBoxInfo() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, LB_GETLISTBOXINFO, 0, 0L); } // for single-selection listboxes int GetCurSel() const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); return (int)::SendMessage(this->m_hWnd, LB_GETCURSEL, 0, 0L); } int SetCurSel(int nSelect) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); return (int)::SendMessage(this->m_hWnd, LB_SETCURSEL, nSelect, 0L); } // for multiple-selection listboxes int GetSel(int nIndex) const // also works for single-selection { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_GETSEL, nIndex, 0L); } int SetSel(int nIndex, BOOL bSelect = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); return (int)::SendMessage(this->m_hWnd, LB_SETSEL, bSelect, nIndex); } int GetSelCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); return (int)::SendMessage(this->m_hWnd, LB_GETSELCOUNT, 0, 0L); } int GetSelItems(int nMaxItems, LPINT rgIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); return (int)::SendMessage(this->m_hWnd, LB_GETSELITEMS, nMaxItems, (LPARAM)rgIndex); } int GetAnchorIndex() const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); return (int)::SendMessage(this->m_hWnd, LB_GETANCHORINDEX, 0, 0L); } void SetAnchorIndex(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); ::SendMessage(this->m_hWnd, LB_SETANCHORINDEX, nIndex, 0L); } int GetCaretIndex() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_GETCARETINDEX, 0, 0); } int SetCaretIndex(int nIndex, BOOL bScroll = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_SETCARETINDEX, nIndex, MAKELONG(bScroll, 0)); } // for listbox items DWORD_PTR GetItemData(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD_PTR)::SendMessage(this->m_hWnd, LB_GETITEMDATA, nIndex, 0L); } int SetItemData(int nIndex, DWORD_PTR dwItemData) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_SETITEMDATA, nIndex, (LPARAM)dwItemData); } void* GetItemDataPtr(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (void*)::SendMessage(this->m_hWnd, LB_GETITEMDATA, nIndex, 0L); } int SetItemDataPtr(int nIndex, void* pData) { ATLASSERT(::IsWindow(this->m_hWnd)); return SetItemData(nIndex, (DWORD_PTR)pData); } int GetItemRect(int nIndex, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_GETITEMRECT, nIndex, (LPARAM)lpRect); } int GetText(int nIndex, LPTSTR lpszBuffer) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_GETTEXT, nIndex, (LPARAM)lpszBuffer); } #ifdef _OLEAUTO_H_ BOOL GetTextBSTR(int nIndex, BSTR& bstrText) const { USES_CONVERSION; ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); int nLen = GetTextLen(nIndex); if(nLen == LB_ERR) return FALSE; ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(nLen + 1); if(lpstrText == NULL) return FALSE; if(GetText(nIndex, lpstrText) == LB_ERR) return FALSE; bstrText = ::SysAllocString(T2OLE(lpstrText)); return (bstrText != NULL) ? TRUE : FALSE; } #endif // _OLEAUTO_H_ #ifdef __ATLSTR_H__ int GetText(int nIndex, ATL::CString& strText) const { ATLASSERT(::IsWindow(this->m_hWnd)); int cchLen = GetTextLen(nIndex); if(cchLen == LB_ERR) return LB_ERR; int nRet = LB_ERR; LPTSTR lpstr = strText.GetBufferSetLength(cchLen); if(lpstr != NULL) { nRet = GetText(nIndex, lpstr); strText.ReleaseBuffer(); } return nRet; } #endif // __ATLSTR_H__ int GetTextLen(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_GETTEXTLEN, nIndex, 0L); } int GetItemHeight(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_GETITEMHEIGHT, nIndex, 0L); } int SetItemHeight(int nIndex, UINT cyItemHeight) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); } // Settable only attributes void SetColumnWidth(int cxWidth) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LB_SETCOLUMNWIDTH, cxWidth, 0L); } BOOL SetTabStops(int nTabStops, LPINT rgTabStops) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & LBS_USETABSTOPS) != 0); return (BOOL)::SendMessage(this->m_hWnd, LB_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); } BOOL SetTabStops() { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & LBS_USETABSTOPS) != 0); return (BOOL)::SendMessage(this->m_hWnd, LB_SETTABSTOPS, 0, 0L); } BOOL SetTabStops(const int& cxEachStop) // takes an 'int' { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & LBS_USETABSTOPS) != 0); return (BOOL)::SendMessage(this->m_hWnd, LB_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); } // Operations int InitStorage(int nItems, UINT nBytes) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_INITSTORAGE, (WPARAM)nItems, nBytes); } void ResetContent() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LB_RESETCONTENT, 0, 0L); } UINT ItemFromPoint(POINT pt, BOOL& bOutside) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dw = (DWORD)::SendMessage(this->m_hWnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(pt.x, pt.y)); bOutside = (BOOL)HIWORD(dw); return (UINT)LOWORD(dw); } // manipulating listbox items int AddString(LPCTSTR lpszItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); } int DeleteString(UINT nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_DELETESTRING, nIndex, 0L); } int InsertString(int nIndex, LPCTSTR lpszItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); } int Dir(UINT attr, LPCTSTR lpszWildCard) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_DIR, attr, (LPARAM)lpszWildCard); } int AddFile(LPCTSTR lpstrFileName) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_ADDFILE, 0, (LPARAM)lpstrFileName); } // selection helpers int FindString(int nStartAfter, LPCTSTR lpszItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_FINDSTRING, nStartAfter, (LPARAM)lpszItem); } int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); } int SelectString(int nStartAfter, LPCTSTR lpszItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LB_SELECTSTRING, nStartAfter, (LPARAM)lpszItem); } int SelItemRange(BOOL bSelect, int nFirstItem, int nLastItem) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != 0); ATLASSERT(nFirstItem <= nLastItem); return bSelect ? (int)::SendMessage(this->m_hWnd, LB_SELITEMRANGEEX, nFirstItem, nLastItem) : (int)::SendMessage(this->m_hWnd, LB_SELITEMRANGEEX, nLastItem, nFirstItem); } }; typedef CListBoxT CListBox; /////////////////////////////////////////////////////////////////////////////// // CComboBox - client side for a Windows COMBOBOX control template class CComboBoxT : public TBase { public: // Constructors CComboBoxT(HWND hWnd = NULL) : TBase(hWnd) { } CComboBoxT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return _T("COMBOBOX"); } // for entire combo box int GetCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_GETCOUNT, 0, 0L); } int GetCurSel() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_GETCURSEL, 0, 0L); } int SetCurSel(int nSelect) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_SETCURSEL, nSelect, 0L); } LCID GetLocale() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (LCID)::SendMessage(this->m_hWnd, CB_GETLOCALE, 0, 0L); } LCID SetLocale(LCID nNewLocale) { ATLASSERT(::IsWindow(this->m_hWnd)); return (LCID)::SendMessage(this->m_hWnd, CB_SETLOCALE, (WPARAM)nNewLocale, 0L); } int GetTopIndex() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_GETTOPINDEX, 0, 0L); } int SetTopIndex(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_SETTOPINDEX, nIndex, 0L); } UINT GetHorizontalExtent() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, CB_GETHORIZONTALEXTENT, 0, 0L); } void SetHorizontalExtent(UINT nExtent) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, CB_SETHORIZONTALEXTENT, nExtent, 0L); } int GetDroppedWidth() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_GETDROPPEDWIDTH, 0, 0L); } int SetDroppedWidth(UINT nWidth) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_SETDROPPEDWIDTH, nWidth, 0L); } BOOL GetComboBoxInfo(PCOMBOBOXINFO pComboBoxInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CB_GETCOMBOBOXINFO, 0, (LPARAM)pComboBoxInfo); } // for edit control DWORD GetEditSel() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, CB_GETEDITSEL, 0, 0L); } BOOL SetEditSel(int nStartChar, int nEndChar) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CB_SETEDITSEL, 0, MAKELONG(nStartChar, nEndChar)); } // for combobox item DWORD_PTR GetItemData(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD_PTR)::SendMessage(this->m_hWnd, CB_GETITEMDATA, nIndex, 0L); } int SetItemData(int nIndex, DWORD_PTR dwItemData) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_SETITEMDATA, nIndex, (LPARAM)dwItemData); } void* GetItemDataPtr(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (void*)GetItemData(nIndex); } int SetItemDataPtr(int nIndex, void* pData) { ATLASSERT(::IsWindow(this->m_hWnd)); return SetItemData(nIndex, (DWORD_PTR)pData); } int GetLBText(int nIndex, LPTSTR lpszText) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_GETLBTEXT, nIndex, (LPARAM)lpszText); } BOOL GetLBTextBSTR(int nIndex, BSTR& bstrText) const { USES_CONVERSION; ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); int nLen = GetLBTextLen(nIndex); if(nLen == CB_ERR) return FALSE; ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(nLen + 1); if(lpstrText == NULL) return FALSE; if(GetLBText(nIndex, lpstrText) == CB_ERR) return FALSE; bstrText = ::SysAllocString(T2OLE(lpstrText)); return (bstrText != NULL) ? TRUE : FALSE; } #ifdef __ATLSTR_H__ int GetLBText(int nIndex, ATL::CString& strText) const { ATLASSERT(::IsWindow(this->m_hWnd)); int cchLen = GetLBTextLen(nIndex); if(cchLen == CB_ERR) return CB_ERR; int nRet = CB_ERR; LPTSTR lpstr = strText.GetBufferSetLength(cchLen); if(lpstr != NULL) { nRet = GetLBText(nIndex, lpstr); strText.ReleaseBuffer(); } return nRet; } #endif // __ATLSTR_H__ int GetLBTextLen(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_GETLBTEXTLEN, nIndex, 0L); } int GetItemHeight(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_GETITEMHEIGHT, nIndex, 0L); } int SetItemHeight(int nIndex, UINT cyItemHeight) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); } BOOL GetExtendedUI() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CB_GETEXTENDEDUI, 0, 0L); } int SetExtendedUI(BOOL bExtended = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_SETEXTENDEDUI, bExtended, 0L); } void GetDroppedControlRect(LPRECT lprect) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)lprect); } BOOL GetDroppedState() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CB_GETDROPPEDSTATE, 0, 0L); } int GetMinVisible() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_GETMINVISIBLE, 0, 0L); } BOOL SetMinVisible(int nMinVisible) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CB_SETMINVISIBLE, nMinVisible, 0L); } // Vista only BOOL GetCueBannerText(LPWSTR lpwText, int cchText) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CB_GETCUEBANNER, (WPARAM)lpwText, cchText); } // Vista only BOOL SetCueBannerText(LPCWSTR lpcwText) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CB_SETCUEBANNER, 0, (LPARAM)lpcwText); } // Operations int InitStorage(int nItems, UINT nBytes) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_INITSTORAGE, (WPARAM)nItems, nBytes); } void ResetContent() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, CB_RESETCONTENT, 0, 0L); } // for edit control BOOL LimitText(int nMaxChars) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CB_LIMITTEXT, nMaxChars, 0L); } // for drop-down combo boxes void ShowDropDown(BOOL bShowIt = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, CB_SHOWDROPDOWN, bShowIt, 0L); } // manipulating listbox items int AddString(LPCTSTR lpszString) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); } int DeleteString(UINT nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_DELETESTRING, nIndex, 0L); } int InsertString(int nIndex, LPCTSTR lpszString) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_INSERTSTRING, nIndex, (LPARAM)lpszString); } int Dir(UINT attr, LPCTSTR lpszWildCard) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_DIR, attr, (LPARAM)lpszWildCard); } // selection helpers int FindString(int nStartAfter, LPCTSTR lpszString) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_FINDSTRING, nStartAfter, (LPARAM)lpszString); } int FindStringExact(int nIndexStart, LPCTSTR lpszFind) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); } int SelectString(int nStartAfter, LPCTSTR lpszString) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CB_SELECTSTRING, nStartAfter, (LPARAM)lpszString); } // Clipboard operations void Clear() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_CLEAR, 0, 0L); } void Copy() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_COPY, 0, 0L); } void Cut() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_CUT, 0, 0L); } void Paste() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_PASTE, 0, 0L); } }; typedef CComboBoxT CComboBox; /////////////////////////////////////////////////////////////////////////////// // CEdit - client side for a Windows EDIT control template class CEditT : public TBase { public: // Constructors CEditT(HWND hWnd = NULL) : TBase(hWnd) { } CEditT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return _T("EDIT"); } BOOL CanUndo() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_CANUNDO, 0, 0L); } int GetLineCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETLINECOUNT, 0, 0L); } BOOL GetModify() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_GETMODIFY, 0, 0L); } void SetModify(BOOL bModified = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETMODIFY, bModified, 0L); } void GetRect(LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); } DWORD GetSel() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_GETSEL, 0, 0L); } void GetSel(int& nStartChar, int& nEndChar) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); } HLOCAL GetHandle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HLOCAL)::SendMessage(this->m_hWnd, EM_GETHANDLE, 0, 0L); } void SetHandle(HLOCAL hBuffer) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETHANDLE, (WPARAM)hBuffer, 0L); } DWORD GetMargins() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_GETMARGINS, 0, 0L); } void GetMargins(UINT& nLeft, UINT& nRight) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, EM_GETMARGINS, 0, 0L); nLeft = LOWORD(dwRet); nRight = HIWORD(dwRet); } void SetMargins(UINT nLeft, UINT nRight, WORD wFlags = EC_LEFTMARGIN | EC_RIGHTMARGIN) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETMARGINS, wFlags, MAKELONG(nLeft, nRight)); } UINT GetLimitText() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, EM_GETLIMITTEXT, 0, 0L); } void SetLimitText(UINT nMax) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETLIMITTEXT, nMax, 0L); } POINT PosFromChar(UINT nChar) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, EM_POSFROMCHAR, nChar, 0); POINT point = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; return point; } int CharFromPos(POINT pt, int* pLine = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, EM_CHARFROMPOS, 0, MAKELPARAM(pt.x, pt.y)); if(pLine != NULL) *pLine = (int)(short)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); } // NOTE: first word in lpszBuffer must contain the size of the buffer! int GetLine(int nIndex, LPTSTR lpszBuffer) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); } int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const { ATLASSERT(::IsWindow(this->m_hWnd)); *(LPWORD)lpszBuffer = (WORD)nMaxLength; return (int)::SendMessage(this->m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); } TCHAR GetPasswordChar() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (TCHAR)::SendMessage(this->m_hWnd, EM_GETPASSWORDCHAR, 0, 0L); } void SetPasswordChar(TCHAR ch) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETPASSWORDCHAR, ch, 0L); } EDITWORDBREAKPROC GetWordBreakProc() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (EDITWORDBREAKPROC)::SendMessage(this->m_hWnd, EM_GETWORDBREAKPROC, 0, 0L); } void SetWordBreakProc(EDITWORDBREAKPROC ewbprc) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc); } int GetFirstVisibleLine() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); } int GetThumb() const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & ES_MULTILINE) != 0); return (int)::SendMessage(this->m_hWnd, EM_GETTHUMB, 0, 0L); } BOOL SetReadOnly(BOOL bReadOnly = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETREADONLY, bReadOnly, 0L); } UINT GetImeStatus(UINT uStatus) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, EM_GETIMESTATUS, uStatus, 0L); } UINT SetImeStatus(UINT uStatus, UINT uData) { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, EM_SETIMESTATUS, uStatus, uData); } BOOL GetCueBannerText(LPCWSTR lpstrText, int cchText) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_GETCUEBANNER, (WPARAM)lpstrText, cchText); } // bKeepWithFocus - Vista only BOOL SetCueBannerText(LPCWSTR lpstrText, BOOL bKeepWithFocus = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCUEBANNER, (WPARAM)bKeepWithFocus, (LPARAM)(lpstrText)); } // Operations void EmptyUndoBuffer() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); } BOOL FmtLines(BOOL bAddEOL) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_FMTLINES, bAddEOL, 0L); } void LimitText(int nChars = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_LIMITTEXT, nChars, 0L); } int LineFromChar(int nIndex = -1) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_LINEFROMCHAR, nIndex, 0L); } int LineIndex(int nLine = -1) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_LINEINDEX, nLine, 0L); } int LineLength(int nLine = -1) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_LINELENGTH, nLine, 0L); } void LineScroll(int nLines, int nChars = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_LINESCROLL, nChars, nLines); } void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); } void SetRect(LPCRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); } void SetRectNP(LPCRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETRECTNP, 0, (LPARAM)lpRect); } void SetSel(DWORD dwSelection, BOOL bNoScroll = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETSEL, LOWORD(dwSelection), HIWORD(dwSelection)); if(!bNoScroll) ::SendMessage(this->m_hWnd, EM_SCROLLCARET, 0, 0L); } void SetSel(int nStartChar, int nEndChar, BOOL bNoScroll = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETSEL, nStartChar, nEndChar); if(!bNoScroll) ::SendMessage(this->m_hWnd, EM_SCROLLCARET, 0, 0L); } void SetSelAll(BOOL bNoScroll = FALSE) { SetSel(0, -1, bNoScroll); } void SetSelNone(BOOL bNoScroll = FALSE) { SetSel(-1, 0, bNoScroll); } BOOL SetTabStops(int nTabStops, LPINT rgTabStops) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); } BOOL SetTabStops() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, 0, 0L); } BOOL SetTabStops(const int& cxEachStop) // takes an 'int' { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); } void ScrollCaret() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SCROLLCARET, 0, 0L); } int Scroll(int nScrollAction) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & ES_MULTILINE) != 0); LRESULT lRet = ::SendMessage(this->m_hWnd, EM_SCROLL, nScrollAction, 0L); if(!(BOOL)HIWORD(lRet)) return -1; // failed return (int)(short)LOWORD(lRet); } void InsertText(int nInsertAfterChar, LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE) { SetSel(nInsertAfterChar, nInsertAfterChar, bNoScroll); ReplaceSel(lpstrText, bCanUndo); } void AppendText(LPCTSTR lpstrText, BOOL bNoScroll = FALSE, BOOL bCanUndo = FALSE) { InsertText(this->GetWindowTextLength(), lpstrText, bNoScroll, bCanUndo); } BOOL ShowBalloonTip(PEDITBALLOONTIP pEditBaloonTip) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SHOWBALLOONTIP, 0, (LPARAM)pEditBaloonTip); } BOOL HideBalloonTip() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_HIDEBALLOONTIP, 0, 0L); } #if (_WIN32_WINNT >= 0x0600) DWORD GetHilite() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_GETHILITE, 0, 0L); } void GetHilite(int& nStartChar, int& nEndChar) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, EM_GETHILITE, 0, 0L); nStartChar = (int)(short)LOWORD(dwRet); nEndChar = (int)(short)HIWORD(dwRet); } void SetHilite(int nStartChar, int nEndChar) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETHILITE, nStartChar, nEndChar); } #endif // (_WIN32_WINNT >= 0x0600) // Clipboard operations BOOL Undo() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_UNDO, 0, 0L); } void Clear() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_CLEAR, 0, 0L); } void Copy() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_COPY, 0, 0L); } void Cut() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_CUT, 0, 0L); } void Paste() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_PASTE, 0, 0L); } // New messages added in Windows 10.0.17763 #if defined(NTDDI_VERSION) && defined(NTDDI_WIN10_RS5) && (NTDDI_VERSION >= NTDDI_WIN10_RS5) DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SendMessage(this->m_hWnd, EM_SETEXTENDEDSTYLE, dwMask, dwStyle); } DWORD GetExtendedStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SendMessage(this->m_hWnd, EM_GETEXTENDEDSTYLE, 0, 0L); } BOOL SetEndOfLine(EC_ENDOFLINE eolType) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETENDOFLINE, eolType, 0L); } EC_ENDOFLINE GetEndOfLine() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (EC_ENDOFLINE)::SendMessage(this->m_hWnd, EM_GETENDOFLINE, 0, 0L); } BOOL EnableSearchWeb(BOOL bEnable) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_ENABLESEARCHWEB, (WPARAM)bEnable, 0L); } void SearchWeb() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SEARCHWEB, 0, 0L); } BOOL SetCaretIndex(DWORD dwCaretIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCARETINDEX, dwCaretIndex, 0L); } DWORD GetCaretIndex() const { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SendMessage(this->m_hWnd, EM_GETCARETINDEX, 0, 0L); } BOOL GetZoom(int& nNum, int& nDen) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_GETZOOM, (WPARAM)&nNum, (LPARAM)&nDen); } BOOL SetZoom(int nNum, int nDen) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((nNum >= 0) && (nNum <= 64)); ATLASSERT((nDen >= 0) && (nDen <= 64)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETZOOM, nNum, nDen); } DWORD GetFileLineFromChar(DWORD dwCharIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SendMessage(this->m_hWnd, EM_FILELINEFROMCHAR, dwCharIndex, 0L); } DWORD GetFileLineIndex(DWORD dwLineNum) const { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SendMessage(this->m_hWnd, EM_FILELINEINDEX, dwLineNum, 0L); } DWORD GetFileLineLength(DWORD dwCharIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SendMessage(this->m_hWnd, EM_FILELINELENGTH, dwCharIndex, 0L); } DWORD GetFileLine(DWORD dwLineNum, LPTSTR lpstrLine, WORD wLen) const { ATLASSERT(::IsWindow(this->m_hWnd)); WORD* pw = (WORD*)lpstrLine; *pw = wLen; return ::SendMessage(this->m_hWnd, EM_GETFILELINE, dwLineNum, (LPARAM)lpstrLine); } #ifdef __ATLSTR_H__ ATL::CString GetFileLine(DWORD dwLineNum) const { ATL::CString strLine; DWORD dwCharIndex = GetFileLineIndex(dwLineNum); if(dwCharIndex != (DWORD)-1) { DWORD dwLen = GetFileLineLength(dwCharIndex); if(dwLen > 0) { LPTSTR lpstrLine = strLine.GetBufferSetLength(dwLen); ATLVERIFY(GetFileLine(dwLineNum, lpstrLine, (WORD)dwLen) == dwLen); strLine.ReleaseBuffer(); } } return strLine; } #endif // __ATLSTR_H__ DWORD GetFileLineCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SendMessage(this->m_hWnd, EM_GETFILELINECOUNT, 0, 0L); } #endif // defined(NTDDI_VERSION) && defined(NTDDI_WIN10_RS5) && (NTDDI_VERSION >= NTDDI_WIN10_RS5) }; typedef CEditT CEdit; /////////////////////////////////////////////////////////////////////////////// // CEditCommands - message handlers for standard EDIT commands // Chain to CEditCommands message map. Your class must also derive from CEdit. // Example: // class CMyEdit : public CWindowImpl, // public CEditCommands // { // public: // BEGIN_MSG_MAP(CMyEdit) // // your handlers... // CHAIN_MSG_MAP_ALT(CEditCommands, 1) // END_MSG_MAP() // // other stuff... // }; template class CEditCommands { public: BEGIN_MSG_MAP(CEditCommands< T >) ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_EDIT_CLEAR, OnEditClear) COMMAND_ID_HANDLER(ID_EDIT_CLEAR_ALL, OnEditClearAll) COMMAND_ID_HANDLER(ID_EDIT_COPY, OnEditCopy) COMMAND_ID_HANDLER(ID_EDIT_CUT, OnEditCut) COMMAND_ID_HANDLER(ID_EDIT_PASTE, OnEditPaste) COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, OnEditSelectAll) COMMAND_ID_HANDLER(ID_EDIT_UNDO, OnEditUndo) END_MSG_MAP() LRESULT OnEditClear(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->Clear(); return 0; } LRESULT OnEditClearAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->SetSel(0, -1); pT->Clear(); return 0; } LRESULT OnEditCopy(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->Copy(); return 0; } LRESULT OnEditCut(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->Cut(); return 0; } LRESULT OnEditPaste(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->Paste(); return 0; } LRESULT OnEditSelectAll(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->SetSel(0, -1); return 0; } LRESULT OnEditUndo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->Undo(); return 0; } // State (update UI) helpers BOOL CanCut() const { return HasSelection(); } BOOL CanCopy() const { return HasSelection(); } BOOL CanClear() const { return HasSelection(); } BOOL CanSelectAll() const { return HasText(); } BOOL CanFind() const { return HasText(); } BOOL CanRepeat() const { return HasText(); } BOOL CanReplace() const { return HasText(); } BOOL CanClearAll() const { return HasText(); } // Implementation BOOL HasSelection() const { const T* pT = static_cast(this); int nMin = 0, nMax = 0; ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nMin, (LPARAM)&nMax); return (nMin != nMax); } BOOL HasText() const { const T* pT = static_cast(this); return (pT->GetWindowTextLength() > 0); } }; /////////////////////////////////////////////////////////////////////////////// // CScrollBar - client side for a Windows SCROLLBAR control template class CScrollBarT : public TBase { public: // Constructors CScrollBarT(HWND hWnd = NULL) : TBase(hWnd) { } CScrollBarT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return _T("SCROLLBAR"); } int GetScrollPos() const { ATLASSERT(::IsWindow(this->m_hWnd)); return ::GetScrollPos(this->m_hWnd, SB_CTL); } int SetScrollPos(int nPos, BOOL bRedraw = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SetScrollPos(this->m_hWnd, SB_CTL, nPos, bRedraw); } void GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::GetScrollRange(this->m_hWnd, SB_CTL, lpMinPos, lpMaxPos); } void SetScrollRange(int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SetScrollRange(this->m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw); } BOOL GetScrollInfo(LPSCROLLINFO lpScrollInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return ::GetScrollInfo(this->m_hWnd, SB_CTL, lpScrollInfo); } int SetScrollInfo(LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return ::SetScrollInfo(this->m_hWnd, SB_CTL, lpScrollInfo, bRedraw); } int GetScrollLimit() const { SCROLLINFO info = { sizeof(SCROLLINFO), SIF_RANGE | SIF_PAGE }; ::GetScrollInfo(this->m_hWnd, SB_CTL, &info); if(info.nPage > 1) info.nMax -= info.nPage - 1; return info.nMax; } BOOL GetScrollBarInfo(PSCROLLBARINFO pScrollBarInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)pScrollBarInfo); } // Operations void ShowScrollBar(BOOL bShow = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::ShowScrollBar(this->m_hWnd, SB_CTL, bShow); } BOOL EnableScrollBar(UINT nArrowFlags = ESB_ENABLE_BOTH) { ATLASSERT(::IsWindow(this->m_hWnd)); return ::EnableScrollBar(this->m_hWnd, SB_CTL, nArrowFlags); } }; typedef CScrollBarT CScrollBar; // --- Windows Common Controls --- /////////////////////////////////////////////////////////////////////////////// // CImageList // forward declarations template class CImageListT; typedef CImageListT CImageList; typedef CImageListT CImageListManaged; template class CImageListT { public: // Data members HIMAGELIST m_hImageList; // Constructor/destructor/operators CImageListT(HIMAGELIST hImageList = NULL) : m_hImageList(hImageList) { } ~CImageListT() { if(t_bManaged && (m_hImageList != NULL)) Destroy(); } CImageListT& operator =(HIMAGELIST hImageList) { Attach(hImageList); return *this; } void Attach(HIMAGELIST hImageList) { if(t_bManaged && (m_hImageList != NULL) && (m_hImageList != hImageList)) ImageList_Destroy(m_hImageList); m_hImageList = hImageList; } HIMAGELIST Detach() { HIMAGELIST hImageList = m_hImageList; m_hImageList = NULL; return hImageList; } operator HIMAGELIST() const { return m_hImageList; } bool IsNull() const { return (m_hImageList == NULL); } // Attributes int GetImageCount() const { ATLASSERT(m_hImageList != NULL); return ImageList_GetImageCount(m_hImageList); } COLORREF GetBkColor() const { ATLASSERT(m_hImageList != NULL); return ImageList_GetBkColor(m_hImageList); } COLORREF SetBkColor(COLORREF cr) { ATLASSERT(m_hImageList != NULL); return ImageList_SetBkColor(m_hImageList, cr); } BOOL GetImageInfo(int nImage, IMAGEINFO* pImageInfo) const { ATLASSERT(m_hImageList != NULL); return ImageList_GetImageInfo(m_hImageList, nImage, pImageInfo); } HICON GetIcon(int nIndex, UINT uFlags = ILD_NORMAL) const { ATLASSERT(m_hImageList != NULL); return ImageList_GetIcon(m_hImageList, nIndex, uFlags); } BOOL GetIconSize(int& cx, int& cy) const { ATLASSERT(m_hImageList != NULL); return ImageList_GetIconSize(m_hImageList, &cx, &cy); } BOOL GetIconSize(SIZE& size) const { ATLASSERT(m_hImageList != NULL); return ImageList_GetIconSize(m_hImageList, (int*)&size.cx, (int*)&size.cy); } BOOL SetIconSize(int cx, int cy) { ATLASSERT(m_hImageList != NULL); return ImageList_SetIconSize(m_hImageList, cx, cy); } BOOL SetIconSize(SIZE size) { ATLASSERT(m_hImageList != NULL); return ImageList_SetIconSize(m_hImageList, size.cx, size.cy); } BOOL SetImageCount(UINT uNewCount) { ATLASSERT(m_hImageList != NULL); return ImageList_SetImageCount(m_hImageList, uNewCount); } BOOL SetOverlayImage(int nImage, int nOverlay) { ATLASSERT(m_hImageList != NULL); return ImageList_SetOverlayImage(m_hImageList, nImage, nOverlay); } // Operations BOOL Create(int cx, int cy, UINT nFlags, int nInitial, int nGrow) { ATLASSERT(m_hImageList == NULL); m_hImageList = ImageList_Create(cx, cy, nFlags, nInitial, nGrow); return (m_hImageList != NULL) ? TRUE : FALSE; } BOOL Create(ATL::_U_STRINGorID bitmap, int cx, int nGrow, COLORREF crMask) { ATLASSERT(m_hImageList == NULL); m_hImageList = ImageList_LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr, cx, nGrow, crMask); return (m_hImageList != NULL) ? TRUE : FALSE; } BOOL CreateFromImage(ATL::_U_STRINGorID image, int cx, int nGrow, COLORREF crMask, UINT uType, UINT uFlags = LR_DEFAULTCOLOR | LR_DEFAULTSIZE) { ATLASSERT(m_hImageList == NULL); m_hImageList = ImageList_LoadImage(ModuleHelper::GetResourceInstance(), image.m_lpstr, cx, nGrow, crMask, uType, uFlags); return (m_hImageList != NULL) ? TRUE : FALSE; } BOOL Merge(HIMAGELIST hImageList1, int nImage1, HIMAGELIST hImageList2, int nImage2, int dx, int dy) { ATLASSERT(m_hImageList == NULL); m_hImageList = ImageList_Merge(hImageList1, nImage1, hImageList2, nImage2, dx, dy); return (m_hImageList != NULL) ? TRUE : FALSE; } #ifdef __IStream_INTERFACE_DEFINED__ BOOL CreateFromStream(LPSTREAM lpStream) { ATLASSERT(m_hImageList == NULL); m_hImageList = ImageList_Read(lpStream); return (m_hImageList != NULL) ? TRUE : FALSE; } #endif // __IStream_INTERFACE_DEFINED__ BOOL Destroy() { if (m_hImageList == NULL) return FALSE; BOOL bRet = ImageList_Destroy(m_hImageList); if(bRet) m_hImageList = NULL; return bRet; } int Add(HBITMAP hBitmap, HBITMAP hBitmapMask = NULL) { ATLASSERT(m_hImageList != NULL); return ImageList_Add(m_hImageList, hBitmap, hBitmapMask); } int Add(HBITMAP hBitmap, COLORREF crMask) { ATLASSERT(m_hImageList != NULL); return ImageList_AddMasked(m_hImageList, hBitmap, crMask); } BOOL Remove(int nImage) { ATLASSERT(m_hImageList != NULL); return ImageList_Remove(m_hImageList, nImage); } BOOL RemoveAll() { ATLASSERT(m_hImageList != NULL); return ImageList_RemoveAll(m_hImageList); } BOOL Replace(int nImage, HBITMAP hBitmap, HBITMAP hBitmapMask) { ATLASSERT(m_hImageList != NULL); return ImageList_Replace(m_hImageList, nImage, hBitmap, hBitmapMask); } int AddIcon(HICON hIcon) { ATLASSERT(m_hImageList != NULL); return ImageList_AddIcon(m_hImageList, hIcon); } int ReplaceIcon(int nImage, HICON hIcon) { ATLASSERT(m_hImageList != NULL); return ImageList_ReplaceIcon(m_hImageList, nImage, hIcon); } HICON ExtractIcon(int nImage) { ATLASSERT(m_hImageList != NULL); return ImageList_ExtractIcon(NULL, m_hImageList, nImage); } BOOL Draw(HDC hDC, int nImage, int x, int y, UINT nStyle) { ATLASSERT(m_hImageList != NULL); ATLASSERT(hDC != NULL); return ImageList_Draw(m_hImageList, nImage, hDC, x, y, nStyle); } BOOL Draw(HDC hDC, int nImage, POINT pt, UINT nStyle) { ATLASSERT(m_hImageList != NULL); ATLASSERT(hDC != NULL); return ImageList_Draw(m_hImageList, nImage, hDC, pt.x, pt.y, nStyle); } BOOL DrawEx(int nImage, HDC hDC, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle) { ATLASSERT(m_hImageList != NULL); ATLASSERT(hDC != NULL); return ImageList_DrawEx(m_hImageList, nImage, hDC, x, y, dx, dy, rgbBk, rgbFg, fStyle); } BOOL DrawEx(int nImage, HDC hDC, RECT& rect, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle) { ATLASSERT(m_hImageList != NULL); ATLASSERT(hDC != NULL); return ImageList_DrawEx(m_hImageList, nImage, hDC, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, rgbBk, rgbFg, fStyle); } static BOOL DrawIndirect(IMAGELISTDRAWPARAMS* pimldp) { return ImageList_DrawIndirect(pimldp); } BOOL Copy(int nSrc, int nDst, UINT uFlags = ILCF_MOVE) { ATLASSERT(m_hImageList != NULL); return ImageList_Copy(m_hImageList, nDst, m_hImageList, nSrc, uFlags); } #ifdef __IStream_INTERFACE_DEFINED__ static HIMAGELIST Read(LPSTREAM lpStream) { return ImageList_Read(lpStream); } BOOL Write(LPSTREAM lpStream) { ATLASSERT(m_hImageList != NULL); return ImageList_Write(m_hImageList, lpStream); } static HRESULT ReadEx(DWORD dwFlags, LPSTREAM lpStream, REFIID riid, PVOID* ppv) { return ImageList_ReadEx(dwFlags, lpStream, riid, ppv); } HRESULT WriteEx(DWORD dwFlags, LPSTREAM lpStream) { ATLASSERT(m_hImageList != NULL); return ImageList_WriteEx(m_hImageList, dwFlags, lpStream); } #endif // __IStream_INTERFACE_DEFINED__ // Drag operations BOOL BeginDrag(int nImage, POINT ptHotSpot) { ATLASSERT(m_hImageList != NULL); return ImageList_BeginDrag(m_hImageList, nImage, ptHotSpot.x, ptHotSpot.y); } BOOL BeginDrag(int nImage, int xHotSpot, int yHotSpot) { ATLASSERT(m_hImageList != NULL); return ImageList_BeginDrag(m_hImageList, nImage, xHotSpot, yHotSpot); } static void EndDrag() { ImageList_EndDrag(); } static BOOL DragMove(POINT pt) { return ImageList_DragMove(pt.x, pt.y); } static BOOL DragMove(int x, int y) { return ImageList_DragMove(x, y); } BOOL SetDragCursorImage(int nDrag, POINT ptHotSpot) { ATLASSERT(m_hImageList != NULL); return ImageList_SetDragCursorImage(m_hImageList, nDrag, ptHotSpot.x, ptHotSpot.y); } BOOL SetDragCursorImage(int nDrag, int xHotSpot, int yHotSpot) { ATLASSERT(m_hImageList != NULL); return ImageList_SetDragCursorImage(m_hImageList, nDrag, xHotSpot, yHotSpot); } static BOOL DragShowNolock(BOOL bShow = TRUE) { return ImageList_DragShowNolock(bShow); } static CImageList GetDragImage(LPPOINT lpPoint, LPPOINT lpPointHotSpot) { return CImageList(ImageList_GetDragImage(lpPoint, lpPointHotSpot)); } static BOOL DragEnter(HWND hWnd, POINT point) { return ImageList_DragEnter(hWnd, point.x, point.y); } static BOOL DragEnter(HWND hWnd, int x, int y) { return ImageList_DragEnter(hWnd, x, y); } static BOOL DragLeave(HWND hWnd) { return ImageList_DragLeave(hWnd); } CImageList Duplicate() const { ATLASSERT(m_hImageList != NULL); return CImageList(ImageList_Duplicate(m_hImageList)); } static CImageList Duplicate(HIMAGELIST hImageList) { ATLASSERT(hImageList != NULL); return CImageList(ImageList_Duplicate(hImageList)); } }; /////////////////////////////////////////////////////////////////////////////// // CToolTipCtrl class CToolInfo : public TOOLINFO { public: CToolInfo(UINT nFlags, HWND hWnd, UINT_PTR nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) { Init(nFlags, hWnd, nIDTool, lpRect, lpstrText, lUserParam); } operator LPTOOLINFO() { return this; } operator LPARAM() { return (LPARAM)this; } void Init(UINT nFlags, HWND hWnd, UINT_PTR nIDTool = 0, LPRECT lpRect = NULL, LPTSTR lpstrText = LPSTR_TEXTCALLBACK, LPARAM lUserParam = NULL) { ATLASSERT(::IsWindow(hWnd)); memset(this, 0, sizeof(TOOLINFO)); cbSize = RunTimeHelper::SizeOf_TOOLINFO(); uFlags = nFlags; if(nIDTool == 0) { hwnd = ::GetParent(hWnd); uFlags |= TTF_IDISHWND; uId = (UINT_PTR)hWnd; } else { hwnd = hWnd; uId = nIDTool; } if(lpRect != NULL) rect = *lpRect; hinst = ModuleHelper::GetResourceInstance(); lpszText = lpstrText; lParam = lUserParam; } }; template class CToolTipCtrlT : public TBase { public: // Constructors CToolTipCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CToolTipCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return TOOLTIPS_CLASS; } void GetText(LPTOOLINFO lpToolInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_GETTEXT, 0, (LPARAM)&lpToolInfo); } void GetText(LPTSTR lpstrText, HWND hWnd, UINT_PTR nIDTool = 0) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); ::SendMessage(this->m_hWnd, TTM_GETTEXT, 0, ti); } BOOL GetToolInfo(LPTOOLINFO lpToolInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TTM_GETTOOLINFO, 0, (LPARAM)lpToolInfo); } BOOL GetToolInfo(HWND hWnd, UINT_PTR nIDTool, UINT* puFlags, LPRECT lpRect, LPTSTR lpstrText) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); ATLASSERT(puFlags != NULL); ATLASSERT(lpRect != NULL); CToolInfo ti(0, hWnd, nIDTool, NULL, lpstrText); BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, TTM_GETTOOLINFO, 0, ti); if(bRet != FALSE) { *puFlags = ti.uFlags; *lpRect = ti.rect; } return bRet; } void SetToolInfo(LPTOOLINFO lpToolInfo) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_SETTOOLINFO, 0, (LPARAM)lpToolInfo); } void SetToolRect(LPTOOLINFO lpToolInfo) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_NEWTOOLRECT, 0, (LPARAM)lpToolInfo); } void SetToolRect(HWND hWnd, UINT_PTR nIDTool, LPCRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); ATLASSERT(nIDTool != 0); CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRect, NULL); ::SendMessage(this->m_hWnd, TTM_NEWTOOLRECT, 0, ti); } int GetToolCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TTM_GETTOOLCOUNT, 0, 0L); } int GetDelayTime(DWORD dwType) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TTM_GETDELAYTIME, dwType, 0L); } void SetDelayTime(DWORD dwType, int nTime) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_SETDELAYTIME, dwType, MAKELPARAM(nTime, 0)); } void GetMargin(LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_GETMARGIN, 0, (LPARAM)lpRect); } void SetMargin(LPRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_SETMARGIN, 0, (LPARAM)lpRect); } int GetMaxTipWidth() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TTM_GETMAXTIPWIDTH, 0, 0L); } int SetMaxTipWidth(int nWidth) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TTM_SETMAXTIPWIDTH, 0, nWidth); } COLORREF GetTipBkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TTM_GETTIPBKCOLOR, 0, 0L); } void SetTipBkColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_SETTIPBKCOLOR, (WPARAM)clr, 0L); } COLORREF GetTipTextColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TTM_GETTIPTEXTCOLOR, 0, 0L); } void SetTipTextColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_SETTIPTEXTCOLOR, (WPARAM)clr, 0L); } BOOL GetCurrentTool(LPTOOLINFO lpToolInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TTM_GETCURRENTTOOL, 0, (LPARAM)lpToolInfo); } SIZE GetBubbleSize(LPTOOLINFO lpToolInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, TTM_GETBUBBLESIZE, 0, (LPARAM)lpToolInfo); SIZE size = { GET_X_LPARAM(dwRet), GET_Y_LPARAM(dwRet) }; return size; } BOOL SetTitle(UINT_PTR uIcon, LPCTSTR lpstrTitle) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TTM_SETTITLE, uIcon, (LPARAM)lpstrTitle); } BOOL SetTitle(HICON hIcon, LPCTSTR lpstrTitle) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TTM_SETTITLE, (WPARAM)hIcon, (LPARAM)lpstrTitle); } void GetTitle(PTTGETTITLE pTTGetTitle) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_GETTITLE, 0, (LPARAM)pTTGetTitle); } void SetWindowTheme(LPCWSTR lpstrTheme) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); } // Operations void Activate(BOOL bActivate) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_ACTIVATE, bActivate, 0L); } BOOL AddTool(LPTOOLINFO lpToolInfo) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TTM_ADDTOOL, 0, (LPARAM)lpToolInfo); } BOOL AddTool(HWND hWnd, ATL::_U_STRINGorID text = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); // the toolrect and toolid must both be zero or both valid ATLASSERT(((lpRectTool != NULL) && (nIDTool != 0)) || ((lpRectTool == NULL) && (nIDTool == 0))); CToolInfo ti(0, hWnd, nIDTool, (LPRECT)lpRectTool, (LPTSTR)text.m_lpstr); return (BOOL)::SendMessage(this->m_hWnd, TTM_ADDTOOL, 0, ti); } void DelTool(LPTOOLINFO lpToolInfo) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_DELTOOL, 0, (LPARAM)lpToolInfo); } void DelTool(HWND hWnd, UINT_PTR nIDTool = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); CToolInfo ti(0, hWnd, nIDTool, NULL, NULL); ::SendMessage(this->m_hWnd, TTM_DELTOOL, 0, ti); } BOOL HitTest(LPTTHITTESTINFO lpHitTestInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TTM_HITTEST, 0, (LPARAM)lpHitTestInfo); } BOOL HitTest(HWND hWnd, POINT pt, LPTOOLINFO lpToolInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); ATLASSERT(lpToolInfo != NULL); TTHITTESTINFO hti = {}; hti.ti.cbSize = RunTimeHelper::SizeOf_TOOLINFO(); hti.hwnd = hWnd; hti.pt.x = pt.x; hti.pt.y = pt.y; if((BOOL)::SendMessage(this->m_hWnd, TTM_HITTEST, 0, (LPARAM)&hti) != FALSE) { *lpToolInfo = hti.ti; return TRUE; } return FALSE; } void RelayEvent(LPMSG lpMsg) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_RELAYEVENT, 0, (LPARAM)lpMsg); } void UpdateTipText(LPTOOLINFO lpToolInfo) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_UPDATETIPTEXT, 0, (LPARAM)lpToolInfo); } void UpdateTipText(ATL::_U_STRINGorID text, HWND hWnd, UINT_PTR nIDTool = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); CToolInfo ti(0, hWnd, nIDTool, NULL, (LPTSTR)text.m_lpstr); ::SendMessage(this->m_hWnd, TTM_UPDATETIPTEXT, 0, ti); } BOOL EnumTools(UINT_PTR nTool, LPTOOLINFO lpToolInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TTM_ENUMTOOLS, nTool, (LPARAM)lpToolInfo); } void Pop() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_POP, 0, 0L); } void TrackActivate(LPTOOLINFO lpToolInfo, BOOL bActivate) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_TRACKACTIVATE, bActivate, (LPARAM)lpToolInfo); } void TrackActivate(HWND hWnd, UINT_PTR nIDTool, BOOL bActivate) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(hWnd != NULL); CToolInfo ti(0, hWnd, nIDTool); ::SendMessage(this->m_hWnd, TTM_TRACKACTIVATE, bActivate, ti); } void TrackPosition(int xPos, int yPos) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_TRACKPOSITION, 0, MAKELPARAM(xPos, yPos)); } void Update() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_UPDATE, 0, 0L); } BOOL AdjustRect(LPRECT lpRect, BOOL bLarger /*= TRUE*/) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TTM_ADJUSTRECT, bLarger, (LPARAM)lpRect); } void Popup() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TTM_POPUP, 0, 0L); } }; typedef CToolTipCtrlT CToolTipCtrl; /////////////////////////////////////////////////////////////////////////////// // CHeaderCtrl template class CHeaderCtrlT : public TBase { public: // Constructors CHeaderCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CHeaderCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return WC_HEADER; } int GetItemCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_GETITEMCOUNT, 0, 0L); } BOOL GetItem(int nIndex, LPHDITEM pHeaderItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_GETITEM, nIndex, (LPARAM)pHeaderItem); } BOOL SetItem(int nIndex, LPHDITEM pHeaderItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_SETITEM, nIndex, (LPARAM)pHeaderItem); } CImageList GetImageList() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, HDM_GETIMAGELIST, 0, 0L)); } CImageList SetImageList(HIMAGELIST hImageList) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, HDM_SETIMAGELIST, 0, (LPARAM)hImageList)); } BOOL GetOrderArray(int nSize, int* lpnArray) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_GETORDERARRAY, nSize, (LPARAM)lpnArray); } BOOL SetOrderArray(int nSize, int* lpnArray) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_SETORDERARRAY, nSize, (LPARAM)lpnArray); } BOOL GetItemRect(int nIndex, LPRECT lpItemRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_GETITEMRECT, nIndex, (LPARAM)lpItemRect); } int SetHotDivider(BOOL bPos, DWORD dwInputValue) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_SETHOTDIVIDER, bPos, dwInputValue); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_SETUNICODEFORMAT, bUnicode, 0L); } int GetBitmapMargin() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_GETBITMAPMARGIN, 0, 0L); } int SetBitmapMargin(int nWidth) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_SETBITMAPMARGIN, nWidth, 0L); } int SetFilterChangeTimeout(DWORD dwTimeOut) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_SETFILTERCHANGETIMEOUT, 0, dwTimeOut); } #if (_WIN32_WINNT >= 0x0600) BOOL GetItemDropDownRect(int nIndex, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect); } BOOL GetOverflowRect(LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_GETOVERFLOWRECT, 0, (LPARAM)lpRect); } int GetFocusedItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_GETFOCUSEDITEM, 0, 0L); } BOOL SetFocusedItem(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_SETFOCUSEDITEM, 0, nIndex); } #endif // (_WIN32_WINNT >= 0x0600) // Operations int InsertItem(int nIndex, LPHDITEM phdi) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_INSERTITEM, nIndex, (LPARAM)phdi); } int AddItem(LPHDITEM phdi) { return InsertItem(GetItemCount(), phdi); } BOOL DeleteItem(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_DELETEITEM, nIndex, 0L); } BOOL Layout(HD_LAYOUT* pHeaderLayout) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, HDM_LAYOUT, 0, (LPARAM)pHeaderLayout); } int HitTest(LPHDHITTESTINFO lpHitTestInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_HITTEST, 0, (LPARAM)lpHitTestInfo); } int OrderToIndex(int nOrder) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_ORDERTOINDEX, nOrder, 0L); } CImageList CreateDragImage(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, HDM_CREATEDRAGIMAGE, nIndex, 0L)); } int EditFilter(int nColumn, BOOL bDiscardChanges) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_EDITFILTER, nColumn, MAKELPARAM(bDiscardChanges, 0)); } int ClearFilter(int nColumn) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_CLEARFILTER, nColumn, 0L); } int ClearAllFilters() { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, HDM_CLEARFILTER, (WPARAM)-1, 0L); } }; typedef CHeaderCtrlT CHeaderCtrl; /////////////////////////////////////////////////////////////////////////////// // CListViewCtrl template class CListViewCtrlT : public TBase { public: // Constructors CListViewCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CListViewCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return WC_LISTVIEW; } COLORREF GetBkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETBKCOLOR, 0, 0L); } BOOL SetBkColor(COLORREF cr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETBKCOLOR, 0, cr); } CImageList GetImageList(int nImageListType) const { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, LVM_GETIMAGELIST, nImageListType, 0L)); } CImageList SetImageList(HIMAGELIST hImageList, int nImageList) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, LVM_SETIMAGELIST, nImageList, (LPARAM)hImageList)); } int GetItemCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETITEMCOUNT, 0, 0L); } BOOL SetItemCount(int nItems) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMCOUNT, nItems, 0L); } BOOL GetItem(LPLVITEM pItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); } BOOL SetItem(const LVITEM* pItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEM, 0, (LPARAM)pItem); } BOOL SetItem(int nItem, int nSubItem, UINT nMask, LPCTSTR lpszItem, int nImage, UINT nState, UINT nStateMask, LPARAM lParam) { ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = {}; lvi.mask = nMask; lvi.iItem = nItem; lvi.iSubItem = nSubItem; lvi.stateMask = nStateMask; lvi.state = nState; lvi.pszText = (LPTSTR) lpszItem; lvi.iImage = nImage; lvi.lParam = lParam; return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEM, 0, (LPARAM)&lvi); } UINT GetItemState(int nItem, UINT nMask) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, LVM_GETITEMSTATE, nItem, nMask); } BOOL SetItemState(int nItem, UINT nState, UINT nStateMask) { ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = {}; lvi.state = nState; lvi.stateMask = nStateMask; return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi); } BOOL SetItemState(int nItem, LPLVITEM pItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)pItem); } BOOL GetItemText(int nItem, int nSubItem, BSTR& bstrText) const { USES_CONVERSION; ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); LVITEM lvi = {}; lvi.iSubItem = nSubItem; LPTSTR lpstrText = NULL; int nRes = 0; for(int nLen = 256; ; nLen *= 2) { ATLTRY(lpstrText = new TCHAR[nLen]); if(lpstrText == NULL) break; lpstrText[0] = NULL; lvi.cchTextMax = nLen; lvi.pszText = lpstrText; nRes = (int)::SendMessage(this->m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); if(nRes < nLen - 1) break; delete [] lpstrText; lpstrText = NULL; } if(lpstrText != NULL) { if(nRes != 0) bstrText = ::SysAllocString(T2OLE(lpstrText)); delete [] lpstrText; } return (bstrText != NULL) ? TRUE : FALSE; } #ifdef __ATLSTR_H__ int GetItemText(int nItem, int nSubItem, ATL::CString& strText) const { ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = {}; lvi.iSubItem = nSubItem; strText.Empty(); int nRes = 0; for(int nLen = 256; ; nLen *= 2) { lvi.cchTextMax = nLen; lvi.pszText = strText.GetBufferSetLength(nLen); if(lvi.pszText == NULL) { nRes = 0; break; } nRes = (int)::SendMessage(this->m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); if(nRes < nLen - 1) break; } strText.ReleaseBuffer(); return nRes; } #endif // __ATLSTR_H__ int GetItemText(int nItem, int nSubItem, LPTSTR lpszText, int nLen) const { ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = {}; lvi.iSubItem = nSubItem; lvi.cchTextMax = nLen; lvi.pszText = lpszText; return (int)::SendMessage(this->m_hWnd, LVM_GETITEMTEXT, (WPARAM)nItem, (LPARAM)&lvi); } BOOL SetItemText(int nItem, int nSubItem, LPCTSTR lpszText) { ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(nItem, nSubItem, LVIF_TEXT, lpszText, 0, 0, 0, 0); } DWORD_PTR GetItemData(int nItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = {}; lvi.iItem = nItem; lvi.mask = LVIF_PARAM; BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEM, 0, (LPARAM)&lvi); return (DWORD_PTR)(bRet ? lvi.lParam : NULL); } BOOL SetItemData(int nItem, DWORD_PTR dwData) { ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(nItem, 0, LVIF_PARAM, NULL, 0, 0, 0, (LPARAM)dwData); } UINT GetCallbackMask() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, LVM_GETCALLBACKMASK, 0, 0L); } BOOL SetCallbackMask(UINT nMask) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETCALLBACKMASK, nMask, 0L); } BOOL GetItemPosition(int nItem, LPPOINT lpPoint) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEMPOSITION, nItem, (LPARAM)lpPoint); } BOOL SetItemPosition(int nItem, POINT pt) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(((this->GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((this->GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); } BOOL SetItemPosition(int nItem, int x, int y) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(((this->GetStyle() & LVS_TYPEMASK) == LVS_ICON) || ((this->GetStyle() & LVS_TYPEMASK) == LVS_SMALLICON)); POINT pt = { x, y }; return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMPOSITION32, nItem, (LPARAM)&pt); } int GetStringWidth(LPCTSTR lpsz) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETSTRINGWIDTH, 0, (LPARAM)lpsz); } CEdit GetEditControl() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CEdit((HWND)::SendMessage(this->m_hWnd, LVM_GETEDITCONTROL, 0, 0L)); } BOOL GetColumn(int nCol, LVCOLUMN* pColumn) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETCOLUMN, nCol, (LPARAM)pColumn); } BOOL SetColumn(int nCol, const LVCOLUMN* pColumn) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETCOLUMN, nCol, (LPARAM)pColumn); } int GetColumnWidth(int nCol) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETCOLUMNWIDTH, nCol, 0L); } BOOL SetColumnWidth(int nCol, int cx) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0)); } BOOL GetViewRect(LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETVIEWRECT, 0, (LPARAM)lpRect); } COLORREF GetTextColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETTEXTCOLOR, 0, 0L); } BOOL SetTextColor(COLORREF cr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETTEXTCOLOR, 0, cr); } COLORREF GetTextBkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETTEXTBKCOLOR, 0, 0L); } BOOL SetTextBkColor(COLORREF cr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETTEXTBKCOLOR, 0, cr); } int GetTopIndex() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETTOPINDEX, 0, 0L); } int GetCountPerPage() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETCOUNTPERPAGE, 0, 0L); } BOOL GetOrigin(LPPOINT lpPoint) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETORIGIN, 0, (LPARAM)lpPoint); } UINT GetSelectedCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, LVM_GETSELECTEDCOUNT, 0, 0L); } BOOL GetItemRect(int nItem, LPRECT lpRect, UINT nCode) const { ATLASSERT(::IsWindow(this->m_hWnd)); lpRect->left = nCode; return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEMRECT, (WPARAM)nItem, (LPARAM)lpRect); } HCURSOR GetHotCursor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HCURSOR)::SendMessage(this->m_hWnd, LVM_GETHOTCURSOR, 0, 0L); } HCURSOR SetHotCursor(HCURSOR hHotCursor) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HCURSOR)::SendMessage(this->m_hWnd, LVM_SETHOTCURSOR, 0, (LPARAM)hHotCursor); } int GetHotItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETHOTITEM, 0, 0L); } int SetHotItem(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_SETHOTITEM, nIndex, 0L); } BOOL GetColumnOrderArray(int nCount, int* lpnArray) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); } BOOL SetColumnOrderArray(int nCount, int* lpnArray) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETCOLUMNORDERARRAY, nCount, (LPARAM)lpnArray); } CHeaderCtrl GetHeader() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CHeaderCtrl((HWND)::SendMessage(this->m_hWnd, LVM_GETHEADER, 0, 0L)); } BOOL GetSubItemRect(int nItem, int nSubItem, int nFlag, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & LVS_TYPEMASK) == LVS_REPORT); ATLASSERT(lpRect != NULL); lpRect->top = nSubItem; lpRect->left = nFlag; return (BOOL)::SendMessage(this->m_hWnd, LVM_GETSUBITEMRECT, nItem, (LPARAM)lpRect); } DWORD SetIconSpacing(int cx, int cy) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & LVS_TYPEMASK) == LVS_ICON); return (DWORD)::SendMessage(this->m_hWnd, LVM_SETICONSPACING, 0, MAKELPARAM(cx, cy)); } int GetISearchString(LPTSTR lpstr) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); } void GetItemSpacing(SIZE& sizeSpacing, BOOL bSmallIconView = FALSE) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, LVM_GETITEMSPACING, bSmallIconView, 0L); sizeSpacing.cx = GET_X_LPARAM(dwRet); sizeSpacing.cy = GET_Y_LPARAM(dwRet); } // single-selection only int GetSelectedIndex() const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & LVS_SINGLESEL) != 0); return (int)::SendMessage(this->m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); } BOOL GetSelectedItem(LPLVITEM pItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & LVS_SINGLESEL) != 0); ATLASSERT(pItem != NULL); pItem->iItem = (int)::SendMessage(this->m_hWnd, LVM_GETNEXTITEM, (WPARAM)-1, MAKELPARAM(LVNI_ALL | LVNI_SELECTED, 0)); if(pItem->iItem == -1) return FALSE; return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEM, 0, (LPARAM)pItem); } // extended list view styles DWORD GetExtendedListViewStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0L); } // dwExMask = 0 means all styles DWORD SetExtendedListViewStyle(DWORD dwExStyle, DWORD dwExMask = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, dwExMask, dwExStyle); } // checkboxes only BOOL GetCheckState(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((GetExtendedListViewStyle() & LVS_EX_CHECKBOXES) != 0); UINT uRet = GetItemState(nIndex, LVIS_STATEIMAGEMASK); return (uRet >> 12) - 1; } BOOL SetCheckState(int nItem, BOOL bCheck) { int nCheck = bCheck ? 2 : 1; // one based index return SetItemState(nItem, INDEXTOSTATEIMAGEMASK(nCheck), LVIS_STATEIMAGEMASK); } // view type DWORD GetViewType() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (this->GetStyle() & LVS_TYPEMASK); } DWORD SetViewType(DWORD dwType) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((dwType == LVS_ICON) || (dwType == LVS_SMALLICON) || (dwType == LVS_LIST) || (dwType == LVS_REPORT)); DWORD dwOldType = GetViewType(); if(dwType != dwOldType) this->ModifyStyle(LVS_TYPEMASK, (dwType & LVS_TYPEMASK)); return dwOldType; } BOOL GetBkImage(LPLVBKIMAGE plvbki) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETBKIMAGE, 0, (LPARAM)plvbki); } BOOL SetBkImage(LPLVBKIMAGE plvbki) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETBKIMAGE, 0, (LPARAM)plvbki); } int GetSelectionMark() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETSELECTIONMARK, 0, 0L); } int SetSelectionMark(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_SETSELECTIONMARK, 0, nIndex); } BOOL GetWorkAreas(int nWorkAreas, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETWORKAREAS, nWorkAreas, (LPARAM)lpRect); } BOOL SetWorkAreas(int nWorkAreas, LPRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETWORKAREAS, nWorkAreas, (LPARAM)lpRect); } DWORD GetHoverTime() const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); return (DWORD)::SendMessage(this->m_hWnd, LVM_GETHOVERTIME, 0, 0L); } DWORD SetHoverTime(DWORD dwHoverTime) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((GetExtendedListViewStyle() & (LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE | LVS_EX_TWOCLICKACTIVATE)) != 0); return (DWORD)::SendMessage(this->m_hWnd, LVM_SETHOVERTIME, 0, dwHoverTime); } BOOL GetNumberOfWorkAreas(int* pnWorkAreas) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETNUMBEROFWORKAREAS, 0, (LPARAM)pnWorkAreas); } BOOL SetItemCountEx(int nItems, DWORD dwFlags) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(((this->GetStyle() & LVS_OWNERDATA) != 0) && (((this->GetStyle() & LVS_TYPEMASK) == LVS_REPORT) || ((this->GetStyle() & LVS_TYPEMASK) == LVS_LIST))); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMCOUNT, nItems, dwFlags); } CToolTipCtrl GetToolTips() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, LVM_GETTOOLTIPS, 0, 0L)); } CToolTipCtrl SetToolTips(HWND hWndTT) { ATLASSERT(::IsWindow(this->m_hWnd)); return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, LVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETUNICODEFORMAT, bUnicode, 0L); } int GetSelectedColumn() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETSELECTEDCOLUMN, 0, 0L); } void SetSelectedColumn(int nColumn) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_SETSELECTEDCOLUMN, nColumn, 0L); } DWORD GetView() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, LVM_GETVIEW, 0, 0L); } int SetView(DWORD dwView) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_SETVIEW, dwView, 0L); } BOOL IsGroupViewEnabled() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_ISGROUPVIEWENABLED, 0, 0L); } int GetGroupInfo(int nGroupID, PLVGROUP pGroup) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETGROUPINFO, nGroupID, (LPARAM)pGroup); } int SetGroupInfo(int nGroupID, PLVGROUP pGroup) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_SETGROUPINFO, nGroupID, (LPARAM)pGroup); } void GetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_GETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); } void SetGroupMetrics(PLVGROUPMETRICS pGroupMetrics) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_SETGROUPMETRICS, 0, (LPARAM)pGroupMetrics); } void GetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_GETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); } BOOL SetTileViewInfo(PLVTILEVIEWINFO pTileViewInfo) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETTILEVIEWINFO, 0, (LPARAM)pTileViewInfo); } void GetTileInfo(PLVTILEINFO pTileInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_GETTILEINFO, 0, (LPARAM)pTileInfo); } BOOL SetTileInfo(PLVTILEINFO pTileInfo) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETTILEINFO, 0, (LPARAM)pTileInfo); } BOOL GetInsertMark(LPLVINSERTMARK pInsertMark) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETINSERTMARK, 0, (LPARAM)pInsertMark); } BOOL SetInsertMark(LPLVINSERTMARK pInsertMark) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETINSERTMARK, 0, (LPARAM)pInsertMark); } int GetInsertMarkRect(LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETINSERTMARKRECT, 0, (LPARAM)lpRect); } COLORREF GetInsertMarkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETINSERTMARKCOLOR, 0, 0L); } COLORREF SetInsertMarkColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, LVM_SETINSERTMARKCOLOR, 0, clr); } COLORREF GetOutlineColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, LVM_GETOUTLINECOLOR, 0, 0L); } COLORREF SetOutlineColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, LVM_SETOUTLINECOLOR, 0, clr); } #if (_WIN32_WINNT >= 0x0600) int GetGroupCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETGROUPCOUNT, 0, 0L); } BOOL GetGroupInfoByIndex(int nIndex, PLVGROUP pGroup) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETGROUPINFOBYINDEX, nIndex, (LPARAM)pGroup); } BOOL GetGroupRect(int nGroupID, int nType, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpRect != NULL); if(lpRect != NULL) lpRect->top = nType; return (BOOL)::SendMessage(this->m_hWnd, LVM_GETGROUPRECT, nGroupID, (LPARAM)lpRect); } UINT GetGroupState(int nGroupID, UINT uMask) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, LVM_GETGROUPSTATE, nGroupID, (LPARAM)uMask); } int GetFocusedGroup() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETFOCUSEDGROUP, 0, 0L); } BOOL GetEmptyText(LPWSTR lpstrText, int cchText) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETEMPTYTEXT, cchText, (LPARAM)lpstrText); } BOOL GetFooterRect(LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETFOOTERRECT, 0, (LPARAM)lpRect); } BOOL GetFooterInfo(LPLVFOOTERINFO lpFooterInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETFOOTERINFO, 0, (LPARAM)lpFooterInfo); } BOOL GetFooterItemRect(int nItem, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETFOOTERITEMRECT, nItem, (LPARAM)lpRect); } BOOL GetFooterItem(int nItem, LPLVFOOTERITEM lpFooterItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETFOOTERITEM, nItem, (LPARAM)lpFooterItem); } BOOL GetItemIndexRect(PLVITEMINDEX pItemIndex, int nSubItem, int nType, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(pItemIndex != NULL); ATLASSERT(lpRect != NULL); if(lpRect != NULL) { lpRect->top = nSubItem; lpRect->left = nType; } return (BOOL)::SendMessage(this->m_hWnd, LVM_GETITEMINDEXRECT, (WPARAM)pItemIndex, (LPARAM)lpRect); } BOOL SetItemIndexState(PLVITEMINDEX pItemIndex, UINT uState, UINT dwMask) { ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvi = {}; lvi.state = uState; lvi.stateMask = dwMask; return (BOOL)::SendMessage(this->m_hWnd, LVM_SETITEMINDEXSTATE, (WPARAM)pItemIndex, (LPARAM)&lvi); } BOOL GetNextItemIndex(PLVITEMINDEX pItemIndex, WORD wFlags) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_GETNEXTITEMINDEX, (WPARAM)pItemIndex, MAKELPARAM(wFlags, 0)); } #endif // (_WIN32_WINNT >= 0x0600) // Operations int InsertColumn(int nCol, const LVCOLUMN* pColumn) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_INSERTCOLUMN, nCol, (LPARAM)pColumn); } int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat = LVCFMT_LEFT, int nWidth = -1, int nSubItem = -1, int iImage = -1, int iOrder = -1) { LVCOLUMN column = {}; column.mask = LVCF_TEXT | LVCF_FMT; column.pszText = (LPTSTR)lpszColumnHeading; column.fmt = nFormat; if (nWidth != -1) { column.mask |= LVCF_WIDTH; column.cx = nWidth; } if (nSubItem != -1) { column.mask |= LVCF_SUBITEM; column.iSubItem = nSubItem; } if (iImage != -1) { column.mask |= LVCF_IMAGE; column.iImage = iImage; } if (iOrder != -1) { column.mask |= LVCF_ORDER; column.iOrder = iOrder; } return InsertColumn(nCol, &column); } BOOL DeleteColumn(int nCol) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_DELETECOLUMN, nCol, 0L); } int InsertItem(UINT nMask, int nItem, LPCTSTR lpszItem, UINT nState, UINT nStateMask, int nImage, LPARAM lParam) { ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM item = {}; item.mask = nMask; item.iItem = nItem; item.iSubItem = 0; item.pszText = (LPTSTR)lpszItem; item.state = nState; item.stateMask = nStateMask; item.iImage = nImage; item.lParam = lParam; return InsertItem(&item); } int InsertItem(const LVITEM* pItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_INSERTITEM, 0, (LPARAM)pItem); } int InsertItem(int nItem, LPCTSTR lpszItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(LVIF_TEXT, nItem, lpszItem, 0, 0, 0, 0); } int InsertItem(int nItem, LPCTSTR lpszItem, int nImage) { ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(LVIF_TEXT|LVIF_IMAGE, nItem, lpszItem, 0, 0, nImage, 0); } int GetNextItem(int nItem, int nFlags) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_GETNEXTITEM, nItem, MAKELPARAM(nFlags, 0)); } BOOL DeleteItem(int nItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_DELETEITEM, nItem, 0L); } BOOL DeleteAllItems() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_DELETEALLITEMS, 0, 0L); } int FindItem(LVFINDINFO* pFindInfo, int nStart = -1) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_FINDITEM, nStart, (LPARAM)pFindInfo); } int FindItem(LPCTSTR lpstrFind, bool bPartial = true, bool bWrap = false, int nStart = -1) const { ATLASSERT(::IsWindow(this->m_hWnd)); LVFINDINFO lvfi = {}; lvfi.flags = LVFI_STRING | (bWrap ? LVFI_WRAP : 0) | (bPartial ? LVFI_PARTIAL : 0); lvfi.psz = lpstrFind; return (int)::SendMessage(this->m_hWnd, LVM_FINDITEM, nStart, (LPARAM)&lvfi); } int HitTest(LVHITTESTINFO* pHitTestInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_HITTEST, 0, (LPARAM)pHitTestInfo); } int HitTest(POINT pt, UINT* pFlags) const { ATLASSERT(::IsWindow(this->m_hWnd)); LVHITTESTINFO hti = {}; hti.pt = pt; int nRes = (int)::SendMessage(this->m_hWnd, LVM_HITTEST, 0, (LPARAM)&hti); if (pFlags != NULL) *pFlags = hti.flags; return nRes; } BOOL EnsureVisible(int nItem, BOOL bPartialOK) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_ENSUREVISIBLE, nItem, MAKELPARAM(bPartialOK, 0)); } BOOL Scroll(int cx, int cy) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SCROLL, cx, cy); } BOOL Scroll(SIZE size) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SCROLL, size.cx, size.cy); } BOOL RedrawItems(int nFirst, int nLast) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_REDRAWITEMS, nFirst, nLast); } BOOL Arrange(UINT nCode) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_ARRANGE, nCode, 0L); } CEdit EditLabel(int nItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return CEdit((HWND)::SendMessage(this->m_hWnd, LVM_EDITLABEL, nItem, 0L)); } BOOL Update(int nItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_UPDATE, nItem, 0L); } BOOL SortItems(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SORTITEMS, (WPARAM)lParamSort, (LPARAM)pfnCompare); } CImageList RemoveImageList(int nImageList) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, LVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); } CImageList CreateDragImage(int nItem, LPPOINT lpPoint) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, LVM_CREATEDRAGIMAGE, nItem, (LPARAM)lpPoint)); } DWORD ApproximateViewRect(int cx = -1, int cy = -1, int nCount = -1) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, LVM_APPROXIMATEVIEWRECT, nCount, MAKELPARAM(cx, cy)); } int SubItemHitTest(LPLVHITTESTINFO lpInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_SUBITEMHITTEST, 0, (LPARAM)lpInfo); } int AddColumn(LPCTSTR strColumn, int nItem, int nSubItem = -1, int nMask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM, int nFmt = LVCFMT_LEFT) { const int cxOffset = 15; ATLASSERT(::IsWindow(this->m_hWnd)); LVCOLUMN lvc = {}; lvc.mask = nMask; lvc.fmt = nFmt; lvc.pszText = (LPTSTR)strColumn; lvc.cx = GetStringWidth(lvc.pszText) + cxOffset; if(nMask & LVCF_SUBITEM) lvc.iSubItem = (nSubItem != -1) ? nSubItem : nItem; return InsertColumn(nItem, &lvc); } int AddItem(int nItem, int nSubItem, LPCTSTR strItem, int nImageIndex = -3) { ATLASSERT(::IsWindow(this->m_hWnd)); LVITEM lvItem = {}; lvItem.mask = LVIF_TEXT; lvItem.iItem = nItem; lvItem.iSubItem = nSubItem; lvItem.pszText = (LPTSTR)strItem; if(nImageIndex != -3) { lvItem.mask |= LVIF_IMAGE; lvItem.iImage = nImageIndex; } if(nSubItem == 0) return InsertItem(&lvItem); return SetItem(&lvItem) ? nItem : -1; } BOOL SortItemsEx(PFNLVCOMPARE pfnCompare, LPARAM lParamSort) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SORTITEMSEX, (WPARAM)lParamSort, (LPARAM)pfnCompare); } int InsertGroup(int nItem, PLVGROUP pGroup) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_INSERTGROUP, nItem, (LPARAM)pGroup); } int AddGroup(PLVGROUP pGroup) { return InsertGroup(-1, pGroup); } int RemoveGroup(int nGroupID) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_REMOVEGROUP, nGroupID, 0L); } void MoveGroup(int nGroupID, int nItem) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_MOVEGROUP, nGroupID, nItem); } void MoveItemToGroup(int nItem, int nGroupID) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_MOVEITEMTOGROUP, nItem, nGroupID); } int EnableGroupView(BOOL bEnable) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_ENABLEGROUPVIEW, bEnable, 0L); } int SortGroups(PFNLVGROUPCOMPARE pCompareFunc, LPVOID lpVoid = NULL) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_SORTGROUPS, (WPARAM)pCompareFunc, (LPARAM)lpVoid); } void InsertGroupSorted(PLVINSERTGROUPSORTED pInsertGroupSorted) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_INSERTGROUPSORTED, (WPARAM)pInsertGroupSorted, 0L); } void RemoveAllGroups() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_REMOVEALLGROUPS, 0, 0L); } BOOL HasGroup(int nGroupID) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_HASGROUP, nGroupID, 0L); } BOOL InsertMarkHitTest(LPPOINT lpPoint, LPLVINSERTMARK pInsertMark) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)pInsertMark); } BOOL SetInfoTip(PLVSETINFOTIP pSetInfoTip) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_SETINFOTIP, 0, (LPARAM)pSetInfoTip); } void CancelEditLabel() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, LVM_CANCELEDITLABEL, 0, 0L); } UINT MapIndexToID(int nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, LVM_MAPINDEXTOID, nIndex, 0L); } int MapIDToIndex(UINT uID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_MAPIDTOINDEX, uID, 0L); } BOOL IsItemVisible(int nItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LVM_ISITEMVISIBLE, nItem, 0L); } #if (_WIN32_WINNT >= 0x0600) int HitTestEx(LPLVHITTESTINFO lpHitTestInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); } int HitTestEx(POINT pt, UINT* pFlags) const { ATLASSERT(::IsWindow(this->m_hWnd)); LVHITTESTINFO hti = {}; hti.pt = pt; int nRes = (int)::SendMessage(this->m_hWnd, LVM_HITTEST, (WPARAM)-1, (LPARAM)&hti); if (pFlags != NULL) *pFlags = hti.flags; return nRes; } int SubItemHitTestEx(LPLVHITTESTINFO lpHitTestInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LVM_SUBITEMHITTEST, (WPARAM)-1, (LPARAM)lpHitTestInfo); } #endif // (_WIN32_WINNT >= 0x0600) // Note: selects only one item BOOL SelectItem(int nIndex) // -1 to select none { ATLASSERT(::IsWindow(this->m_hWnd)); BOOL bRet = FALSE; if(nIndex != -1) { // multi-selection only: de-select all items if((this->GetStyle() & LVS_SINGLESEL) == 0) SetItemState(-1, 0, LVIS_SELECTED); bRet = SetItemState(nIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); if(bRet) { SetSelectionMark(nIndex); bRet = EnsureVisible(nIndex, FALSE); } } else // no item specified, just de-select { bRet = SetItemState(-1, 0, LVIS_SELECTED); } return bRet; } // multi-selection only BOOL SelectAllItems(bool bSelect = true) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & LVS_SINGLESEL) == 0); return SetItemState(-1, bSelect ? LVIS_SELECTED : 0, LVIS_SELECTED); } }; typedef CListViewCtrlT CListViewCtrl; /////////////////////////////////////////////////////////////////////////////// // CTreeViewCtrl template class CTreeViewCtrlT : public TBase { public: // Constructors CTreeViewCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CTreeViewCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return WC_TREEVIEW; } UINT GetCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, TVM_GETCOUNT, 0, 0L); } UINT GetIndent() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, TVM_GETINDENT, 0, 0L); } void SetIndent(UINT nIndent) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TVM_SETINDENT, nIndent, 0L); } CImageList GetImageList(int nImageListType = TVSIL_NORMAL) const { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TVM_GETIMAGELIST, (WPARAM)nImageListType, 0L)); } CImageList SetImageList(HIMAGELIST hImageList, int nImageListType = TVSIL_NORMAL) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageListType, (LPARAM)hImageList)); } BOOL GetItem(LPTVITEM pItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); } BOOL SetItem(LPTVITEM pItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); } BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) { ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = {}; item.hItem = hItem; item.mask = nMask; item.pszText = (LPTSTR) lpszItem; item.iImage = nImage; item.iSelectedImage = nSelectedImage; item.state = nState; item.stateMask = nStateMask; item.lParam = lParam; return (BOOL)::SendMessage(this->m_hWnd, TVM_SETITEM, 0, (LPARAM)&item); } BOOL GetItemText(HTREEITEM hItem, LPTSTR lpstrText, int nLen) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpstrText != NULL); TVITEM item = {}; item.hItem = hItem; item.mask = TVIF_TEXT; item.pszText = lpstrText; item.cchTextMax = nLen; return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); } BOOL GetItemText(HTREEITEM hItem, BSTR& bstrText) const { USES_CONVERSION; ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); TVITEM item = {}; item.hItem = hItem; item.mask = TVIF_TEXT; LPTSTR lpstrText = NULL; BOOL bRet = FALSE; for(int nLen = 256; ; nLen *= 2) { ATLTRY(lpstrText = new TCHAR[nLen]); if(lpstrText == NULL) break; lpstrText[0] = NULL; item.pszText = lpstrText; item.cchTextMax = nLen; bRet = (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); if(!bRet || (lstrlen(item.pszText) < (nLen - 1))) break; delete [] lpstrText; lpstrText = NULL; } if(lpstrText != NULL) { if(bRet) bstrText = ::SysAllocString(T2OLE(lpstrText)); delete [] lpstrText; } return (bstrText != NULL) ? TRUE : FALSE; } #ifdef __ATLSTR_H__ BOOL GetItemText(HTREEITEM hItem, ATL::CString& strText) const { ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = {}; item.hItem = hItem; item.mask = TVIF_TEXT; strText.Empty(); BOOL bRet = FALSE; for(int nLen = 256; ; nLen *= 2) { item.pszText = strText.GetBufferSetLength(nLen); if(item.pszText == NULL) { bRet = FALSE; break; } item.cchTextMax = nLen; bRet = (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); if(!bRet || (lstrlen(item.pszText) < (nLen - 1))) break; } strText.ReleaseBuffer(); return bRet; } #endif // __ATLSTR_H__ BOOL SetItemText(HTREEITEM hItem, LPCTSTR lpszItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(hItem, TVIF_TEXT, lpszItem, 0, 0, 0, 0, NULL); } BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage) const { ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = {}; item.hItem = hItem; item.mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE; BOOL bRes = (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); if (bRes) { nImage = item.iImage; nSelectedImage = item.iSelectedImage; } return bRes; } BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage) { ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(hItem, TVIF_IMAGE|TVIF_SELECTEDIMAGE, NULL, nImage, nSelectedImage, 0, 0, NULL); } UINT GetItemState(HTREEITEM hItem, UINT nStateMask) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (((UINT)::SendMessage(this->m_hWnd, TVM_GETITEMSTATE, (WPARAM)hItem, (LPARAM)nStateMask)) & nStateMask); } BOOL SetItemState(HTREEITEM hItem, UINT nState, UINT nStateMask) { ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(hItem, TVIF_STATE, NULL, 0, 0, nState, nStateMask, NULL); } DWORD_PTR GetItemData(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = {}; item.hItem = hItem; item.mask = TVIF_PARAM; BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); return (DWORD_PTR)(bRet ? item.lParam : NULL); } BOOL SetItemData(HTREEITEM hItem, DWORD_PTR dwData) { ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(hItem, TVIF_PARAM, NULL, 0, 0, 0, 0, (LPARAM)dwData); } CEdit GetEditControl() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CEdit((HWND)::SendMessage(this->m_hWnd, TVM_GETEDITCONTROL, 0, 0L)); } UINT GetVisibleCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, TVM_GETVISIBLECOUNT, 0, 0L); } BOOL GetItemRect(HTREEITEM hItem, LPRECT lpRect, BOOL bTextOnly) const { ATLASSERT(::IsWindow(this->m_hWnd)); *(HTREEITEM*)lpRect = hItem; return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEMRECT, (WPARAM)bTextOnly, (LPARAM)lpRect); } BOOL ItemHasChildren(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); TVITEM item = {}; item.hItem = hItem; item.mask = TVIF_CHILDREN; ::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)&item); return item.cChildren; } CToolTipCtrl GetToolTips() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TVM_GETTOOLTIPS, 0, 0L)); } CToolTipCtrl SetToolTips(HWND hWndTT) { ATLASSERT(::IsWindow(this->m_hWnd)); return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TVM_SETTOOLTIPS, (WPARAM)hWndTT, 0L)); } int GetISearchString(LPTSTR lpstr) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TVM_GETISEARCHSTRING, 0, (LPARAM)lpstr); } // checkboxes only BOOL GetCheckState(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & TVS_CHECKBOXES) != 0); UINT uRet = GetItemState(hItem, TVIS_STATEIMAGEMASK); return (uRet >> 12) - 1; } BOOL SetCheckState(HTREEITEM hItem, BOOL bCheck) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & TVS_CHECKBOXES) != 0); int nCheck = bCheck ? 2 : 1; // one based index return SetItemState(hItem, INDEXTOSTATEIMAGEMASK(nCheck), TVIS_STATEIMAGEMASK); } // for standard and extended checkboxes (0 = no checkbox, 1 = unchecked, 2 = checked, >2 = optional extended check states) UINT GetCheckStateEx(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(this->GetImageList(TVSIL_STATE) != NULL); UINT uRet = GetItemState(hItem, TVIS_STATEIMAGEMASK); return (uRet >> 12); } BOOL SetCheckStateEx(HTREEITEM hItem, UINT uCheckState) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(this->GetImageList(TVSIL_STATE) != NULL); ATLASSERT(uCheckState < (UINT)::ImageList_GetImageCount(this->GetImageList(TVSIL_STATE))); return SetItemState(hItem, INDEXTOSTATEIMAGEMASK(uCheckState), TVIS_STATEIMAGEMASK); } COLORREF GetBkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TVM_GETBKCOLOR, 0, 0L); } COLORREF SetBkColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TVM_SETBKCOLOR, 0, (LPARAM)clr); } COLORREF GetInsertMarkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TVM_GETINSERTMARKCOLOR, 0, 0L); } COLORREF SetInsertMarkColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr); } int GetItemHeight() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TVM_GETITEMHEIGHT, 0, 0L); } int SetItemHeight(int cyHeight) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TVM_SETITEMHEIGHT, cyHeight, 0L); } int GetScrollTime() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TVM_GETSCROLLTIME, 0, 0L); } int SetScrollTime(int nScrollTime) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TVM_SETSCROLLTIME, nScrollTime, 0L); } COLORREF GetTextColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TVM_GETTEXTCOLOR, 0, 0L); } COLORREF SetTextColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TVM_SETTEXTCOLOR, 0, (LPARAM)clr); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SETUNICODEFORMAT, bUnicode, 0L); } COLORREF GetLineColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TVM_GETLINECOLOR, 0, 0L); } COLORREF SetLineColor(COLORREF clrNew /*= CLR_DEFAULT*/) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TVM_SETLINECOLOR, 0, (LPARAM)clrNew); } BOOL GetItem(LPTVITEMEX pItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEM, 0, (LPARAM)pItem); } BOOL SetItem(LPTVITEMEX pItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SETITEM, 0, (LPARAM)pItem); } DWORD GetExtendedStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TVM_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TVM_SETEXTENDEDSTYLE, dwMask, dwStyle); } #if (_WIN32_WINNT >= 0x0600) BOOL SetAutoScrollInfo(UINT uPixPerSec, UINT uUpdateTime) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SETAUTOSCROLLINFO, (WPARAM)uPixPerSec, (LPARAM)uUpdateTime); } DWORD GetSelectedCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TVM_GETSELECTEDCOUNT, 0, 0L); } BOOL GetItemPartRect(HTREEITEM hItem, TVITEMPART partID, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); TVGETITEMPARTRECTINFO gipri = { hItem, lpRect, partID }; return (BOOL)::SendMessage(this->m_hWnd, TVM_GETITEMPARTRECT, 0, (LPARAM)&gipri); } #endif // (_WIN32_WINNT >= 0x0600) // Operations HTREEITEM InsertItem(LPTVINSERTSTRUCT lpInsertStruct) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); } HTREEITEM InsertItem(LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) { ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); } HTREEITEM InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) { ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); } HTREEITEM InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, HTREEITEM hParent, HTREEITEM hInsertAfter) { ATLASSERT(::IsWindow(this->m_hWnd)); TVINSERTSTRUCT tvis = {}; tvis.hParent = hParent; tvis.hInsertAfter = hInsertAfter; tvis.item.mask = nMask; tvis.item.pszText = (LPTSTR) lpszItem; tvis.item.iImage = nImage; tvis.item.iSelectedImage = nSelectedImage; tvis.item.state = nState; tvis.item.stateMask = nStateMask; tvis.item.lParam = lParam; return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); } BOOL DeleteItem(HTREEITEM hItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_DELETEITEM, 0, (LPARAM)hItem); } BOOL DeleteAllItems() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT); } BOOL Expand(HTREEITEM hItem, UINT nCode = TVE_EXPAND) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_EXPAND, nCode, (LPARAM)hItem); } HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); } HTREEITEM GetChildItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); } HTREEITEM GetNextSiblingItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); } HTREEITEM GetPrevSiblingItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); } HTREEITEM GetParentItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); } HTREEITEM GetFirstVisibleItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); } HTREEITEM GetNextVisibleItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); } HTREEITEM GetPrevVisibleItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); } HTREEITEM GetSelectedItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); } HTREEITEM GetDropHilightItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); } HTREEITEM GetRootItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); } HTREEITEM GetLastVisibleItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); } HTREEITEM GetNextSelectedItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, (LPARAM)hItem); } BOOL Select(HTREEITEM hItem, UINT nCode) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SELECTITEM, nCode, (LPARAM)hItem); } BOOL SelectItem(HTREEITEM hItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); } BOOL SelectDropTarget(HTREEITEM hItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SELECTITEM, TVGN_DROPHILITE, (LPARAM)hItem); } BOOL SelectSetFirstVisible(HTREEITEM hItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SELECTITEM, TVGN_FIRSTVISIBLE, (LPARAM)hItem); } CEdit EditLabel(HTREEITEM hItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return CEdit((HWND)::SendMessage(this->m_hWnd, TVM_EDITLABEL, 0, (LPARAM)hItem)); } BOOL EndEditLabelNow(BOOL bCancel) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_ENDEDITLABELNOW, bCancel, 0L); } HTREEITEM HitTest(TVHITTESTINFO* pHitTestInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); } HTREEITEM HitTest(POINT pt, UINT* pFlags) const { ATLASSERT(::IsWindow(this->m_hWnd)); TVHITTESTINFO hti = {}; hti.pt = pt; HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); if (pFlags != NULL) *pFlags = hti.flags; return hTreeItem; } BOOL SortChildren(HTREEITEM hItem, BOOL bRecurse = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SORTCHILDREN, (WPARAM)bRecurse, (LPARAM)hItem); } BOOL EnsureVisible(HTREEITEM hItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_ENSUREVISIBLE, 0, (LPARAM)hItem); } BOOL SortChildrenCB(LPTVSORTCB pSort, BOOL bRecurse = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SORTCHILDRENCB, (WPARAM)bRecurse, (LPARAM)pSort); } CImageList RemoveImageList(int nImageList) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TVM_SETIMAGELIST, (WPARAM)nImageList, NULL)); } CImageList CreateDragImage(HTREEITEM hItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TVM_CREATEDRAGIMAGE, 0, (LPARAM)hItem)); } BOOL SetInsertMark(HTREEITEM hTreeItem, BOOL bAfter) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SETINSERTMARK, bAfter, (LPARAM)hTreeItem); } BOOL RemoveInsertMark() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TVM_SETINSERTMARK, 0, 0L); } HTREEITEM MapAccIDToHTREEITEM(UINT uID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HTREEITEM)::SendMessage(this->m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); } UINT MapHTREEITEMToAccID(HTREEITEM hTreeItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, TVM_MAPHTREEITEMTOACCID, (WPARAM)hTreeItem, 0L); } #if (_WIN32_WINNT >= 0x0600) void ShowInfoTip(HTREEITEM hItem) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TVM_SHOWINFOTIP, 0, (LPARAM)hItem); } #endif // (_WIN32_WINNT >= 0x0600) }; typedef CTreeViewCtrlT CTreeViewCtrl; /////////////////////////////////////////////////////////////////////////////// // CTreeViewCtrlEx // forward declaration template class CTreeViewCtrlExT; // Note: TBase here is for CTreeViewCtrlExT, and not for CTreeItemT itself template class CTreeItemT { public: HTREEITEM m_hTreeItem; CTreeViewCtrlExT* m_pTreeView; // Construction CTreeItemT(HTREEITEM hTreeItem = NULL, CTreeViewCtrlExT* pTreeView = NULL) : m_hTreeItem(hTreeItem), m_pTreeView(pTreeView) { } CTreeItemT(const CTreeItemT& posSrc) { *this = posSrc; } operator HTREEITEM() { return m_hTreeItem; } CTreeItemT& operator =(const CTreeItemT& itemSrc) { m_hTreeItem = itemSrc.m_hTreeItem; m_pTreeView = itemSrc.m_pTreeView; return *this; } // Attributes CTreeViewCtrlExT* GetTreeView() const { return m_pTreeView; } BOOL operator !() const { return m_hTreeItem == NULL; } BOOL IsNull() const { return m_hTreeItem == NULL; } BOOL GetRect(LPRECT lpRect, BOOL bTextOnly) const; BOOL GetText(LPTSTR lpstrText, int nLen) const; BOOL GetText(BSTR& bstrText) const; #ifdef __ATLSTR_H__ BOOL GetText(ATL::CString& strText) const; #endif // __ATLSTR_H__ BOOL SetText(LPCTSTR lpszItem); BOOL GetImage(int& nImage, int& nSelectedImage) const; BOOL SetImage(int nImage, int nSelectedImage); UINT GetState(UINT nStateMask) const; BOOL SetState(UINT nState, UINT nStateMask); DWORD_PTR GetData() const; BOOL SetData(DWORD_PTR dwData); BOOL SetItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam); // Operations CTreeItemT InsertAfter(LPCTSTR lpstrItem, HTREEITEM hItemAfter, int nImageIndex) { return _Insert(lpstrItem, nImageIndex, hItemAfter); } CTreeItemT AddHead(LPCTSTR lpstrItem, int nImageIndex) { return _Insert(lpstrItem, nImageIndex, TVI_FIRST); } CTreeItemT AddTail(LPCTSTR lpstrItem, int nImageIndex) { return _Insert(lpstrItem, nImageIndex, TVI_LAST); } CTreeItemT GetChild() const; CTreeItemT GetNext(UINT nCode) const; CTreeItemT GetNextSibling() const; CTreeItemT GetPrevSibling() const; CTreeItemT GetParent() const; CTreeItemT GetFirstVisible() const; CTreeItemT GetNextVisible() const; CTreeItemT GetPrevVisible() const; CTreeItemT GetSelected() const; CTreeItemT GetDropHilight() const; CTreeItemT GetRoot() const; CTreeItemT GetLastVisible() const; CTreeItemT GetNextSelected() const; BOOL HasChildren() const; BOOL Delete(); BOOL Expand(UINT nCode = TVE_EXPAND); BOOL Select(UINT nCode); BOOL Select(); BOOL SelectDropTarget(); BOOL SelectSetFirstVisible(); HWND EditLabel(); HIMAGELIST CreateDragImage(); BOOL SortChildren(BOOL bRecurse = FALSE); BOOL EnsureVisible(); CTreeItemT _Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter); int GetImageIndex() const; BOOL SetInsertMark(BOOL bAfter); UINT MapHTREEITEMToAccID() const; #if (_WIN32_WINNT >= 0x0600) void ShowInfoTip(); BOOL GetPartRect(TVITEMPART partID, LPRECT lpRect) const; #endif // (_WIN32_WINNT >= 0x0600) }; typedef CTreeItemT CTreeItem; template class CTreeViewCtrlExT : public CTreeViewCtrlT< TBase > { public: // Constructors CTreeViewCtrlExT(HWND hWnd = NULL) : CTreeViewCtrlT< TBase >(hWnd) { } CTreeViewCtrlExT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } // Operations (overides that return CTreeItem) CTreeItemT InsertItem(LPTVINSERTSTRUCT lpInsertStruct) { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_INSERTITEM, 0, (LPARAM)lpInsertStruct); return CTreeItemT(hTreeItem, this); } CTreeItemT InsertItem(LPCTSTR lpszItem, int nImage, int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter) { ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, lpszItem, nImage, nSelectedImage, 0, 0, 0, hParent, hInsertAfter); } CTreeItemT InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter) { ATLASSERT(::IsWindow(this->m_hWnd)); return InsertItem(TVIF_TEXT, lpszItem, 0, 0, 0, 0, 0, hParent, hInsertAfter); } CTreeItemT GetNextItem(HTREEITEM hItem, UINT nCode) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, nCode, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetChildItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetNextSiblingItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetPrevSiblingItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUS, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetParentItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetFirstVisibleItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_FIRSTVISIBLE, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetNextVisibleItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTVISIBLE, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetPrevVisibleItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_PREVIOUSVISIBLE, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetSelectedItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_CARET, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetDropHilightItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_DROPHILITE, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetRootItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetLastVisibleItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_LASTVISIBLE, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT GetNextSelectedItem(HTREEITEM hItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_GETNEXTITEM, TVGN_NEXTSELECTED, (LPARAM)hItem); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT HitTest(TVHITTESTINFO* pHitTestInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_HITTEST, 0, (LPARAM)pHitTestInfo); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, HTREEITEM hParent, HTREEITEM hInsertAfter) { ATLASSERT(::IsWindow(this->m_hWnd)); TVINSERTSTRUCT tvis = {}; tvis.hParent = hParent; tvis.hInsertAfter = hInsertAfter; tvis.item.mask = nMask; tvis.item.pszText = (LPTSTR) lpszItem; tvis.item.iImage = nImage; tvis.item.iSelectedImage = nSelectedImage; tvis.item.state = nState; tvis.item.stateMask = nStateMask; tvis.item.lParam = lParam; HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_INSERTITEM, 0, (LPARAM)&tvis); return CTreeItemT(hTreeItem, this); } CTreeItemT HitTest(POINT pt, UINT* pFlags) const { ATLASSERT(::IsWindow(this->m_hWnd)); TVHITTESTINFO hti = {}; hti.pt = pt; HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_HITTEST, 0, (LPARAM)&hti); if (pFlags != NULL) *pFlags = hti.flags; return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } CTreeItemT MapAccIDToHTREEITEM(UINT uID) const { ATLASSERT(::IsWindow(this->m_hWnd)); HTREEITEM hTreeItem = (HTREEITEM)::SendMessage(this->m_hWnd, TVM_MAPACCIDTOHTREEITEM, uID, 0L); return CTreeItemT(hTreeItem, (CTreeViewCtrlExT*)this); } }; typedef CTreeViewCtrlExT CTreeViewCtrlEx; // CTreeItem inline methods template inline BOOL CTreeItemT::GetRect(LPRECT lpRect, BOOL bTextOnly) const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetItemRect(m_hTreeItem,lpRect,bTextOnly); } template inline CTreeItemT CTreeItemT::GetNext(UINT nCode) const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetNextItem(m_hTreeItem,nCode); } template inline CTreeItemT CTreeItemT::GetChild() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetChildItem(m_hTreeItem); } template inline CTreeItemT CTreeItemT::GetNextSibling() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetNextSiblingItem(m_hTreeItem); } template inline CTreeItemT CTreeItemT::GetPrevSibling() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetPrevSiblingItem(m_hTreeItem); } template inline CTreeItemT CTreeItemT::GetParent() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetParentItem(m_hTreeItem); } template inline CTreeItemT CTreeItemT::GetFirstVisible() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetFirstVisibleItem(); } template inline CTreeItemT CTreeItemT::GetNextVisible() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetNextVisibleItem(m_hTreeItem); } template inline CTreeItemT CTreeItemT::GetPrevVisible() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetPrevVisibleItem(m_hTreeItem); } template inline CTreeItemT CTreeItemT::GetSelected() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetSelectedItem(); } template inline CTreeItemT CTreeItemT::GetDropHilight() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetDropHilightItem(); } template inline CTreeItemT CTreeItemT::GetRoot() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetRootItem(); } template inline CTreeItemT CTreeItemT::GetLastVisible() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetLastVisibleItem(); } template inline CTreeItemT CTreeItemT::GetNextSelected() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetNextSelectedItem(m_hTreeItem); } template inline BOOL CTreeItemT::GetText(LPTSTR lpstrText, int nLen) const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetItemText(m_hTreeItem, lpstrText, nLen); } #ifdef _OLEAUTO_H_ template inline BOOL CTreeItemT::GetText(BSTR& bstrText) const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetItemText(m_hTreeItem, bstrText); } #endif // _OLEAUTO_H_ #ifdef __ATLSTR_H__ template inline BOOL CTreeItemT::GetText(ATL::CString& strText) const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetItemText(m_hTreeItem, strText); } #endif // __ATLSTR_H__ template inline BOOL CTreeItemT::GetImage(int& nImage, int& nSelectedImage) const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetItemImage(m_hTreeItem,nImage,nSelectedImage); } template inline UINT CTreeItemT::GetState(UINT nStateMask) const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetItemState(m_hTreeItem,nStateMask); } template inline DWORD_PTR CTreeItemT::GetData() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetItemData(m_hTreeItem); } template inline BOOL CTreeItemT::SetItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SetItem(m_hTreeItem, nMask, lpszItem, nImage, nSelectedImage, nState, nStateMask, lParam); } template inline BOOL CTreeItemT::SetText(LPCTSTR lpszItem) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SetItemText(m_hTreeItem,lpszItem); } template inline BOOL CTreeItemT::SetImage(int nImage, int nSelectedImage) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SetItemImage(m_hTreeItem,nImage,nSelectedImage); } template inline BOOL CTreeItemT::SetState(UINT nState, UINT nStateMask) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SetItemState(m_hTreeItem,nState,nStateMask); } template inline BOOL CTreeItemT::SetData(DWORD_PTR dwData) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SetItemData(m_hTreeItem,dwData); } template inline BOOL CTreeItemT::HasChildren() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->ItemHasChildren(m_hTreeItem); } template inline BOOL CTreeItemT::Delete() { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->DeleteItem(m_hTreeItem); } template inline BOOL CTreeItemT::Expand(UINT nCode /*= TVE_EXPAND*/) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->Expand(m_hTreeItem,nCode); } template inline BOOL CTreeItemT::Select(UINT nCode) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->Select(m_hTreeItem,nCode); } template inline BOOL CTreeItemT::Select() { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SelectItem(m_hTreeItem); } template inline BOOL CTreeItemT::SelectDropTarget() { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SelectDropTarget(m_hTreeItem); } template inline BOOL CTreeItemT::SelectSetFirstVisible() { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SelectSetFirstVisible(m_hTreeItem); } template inline HWND CTreeItemT::EditLabel() { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->EditLabel(m_hTreeItem); } template inline HIMAGELIST CTreeItemT::CreateDragImage() { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->CreateDragImage(m_hTreeItem); } template inline BOOL CTreeItemT::SortChildren(BOOL bRecurse /*= FALSE*/) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SortChildren(m_hTreeItem, bRecurse); } template inline BOOL CTreeItemT::EnsureVisible() { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->EnsureVisible(m_hTreeItem); } template inline CTreeItemT CTreeItemT::_Insert(LPCTSTR lpstrItem, int nImageIndex, HTREEITEM hItemAfter) { ATLASSERT(m_pTreeView != NULL); TVINSERTSTRUCT ins = {}; ins.hParent = m_hTreeItem; ins.hInsertAfter = hItemAfter; ins.item.mask = TVIF_TEXT; ins.item.pszText = (LPTSTR)lpstrItem; if(nImageIndex != -1) { ins.item.mask |= TVIF_IMAGE | TVIF_SELECTEDIMAGE; ins.item.iImage = nImageIndex; ins.item.iSelectedImage = nImageIndex; } return CTreeItemT(m_pTreeView->InsertItem(&ins), m_pTreeView); } template inline int CTreeItemT::GetImageIndex() const { ATLASSERT(m_pTreeView != NULL); TVITEM item = {}; item.mask = TVIF_HANDLE | TVIF_IMAGE; item.hItem = m_hTreeItem; m_pTreeView->GetItem(&item); return item.iImage; } template inline BOOL CTreeItemT::SetInsertMark(BOOL bAfter) { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->SetInsertMark(m_hTreeItem, bAfter); } template inline UINT CTreeItemT::MapHTREEITEMToAccID() const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->MapHTREEITEMToAccID(m_hTreeItem); } #if (_WIN32_WINNT >= 0x0600) template inline void CTreeItemT::ShowInfoTip() { ATLASSERT(m_pTreeView != NULL); m_pTreeView->ShowInfoTip(m_hTreeItem); } template inline BOOL CTreeItemT::GetPartRect(TVITEMPART partID, LPRECT lpRect) const { ATLASSERT(m_pTreeView != NULL); return m_pTreeView->GetItemPartRect(m_hTreeItem, partID, lpRect); } #endif // (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // CToolBarCtrl template class CToolBarCtrlT : public TBase { public: // Construction CToolBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CToolBarCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return TOOLBARCLASSNAME; } BOOL IsButtonEnabled(int nID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONENABLED, nID, 0L); } BOOL IsButtonChecked(int nID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONCHECKED, nID, 0L); } BOOL IsButtonPressed(int nID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONPRESSED, nID, 0L); } BOOL IsButtonHidden(int nID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return(BOOL) ::SendMessage(this->m_hWnd, TB_ISBUTTONHIDDEN, nID, 0L); } BOOL IsButtonIndeterminate(int nID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONINDETERMINATE, nID, 0L); } int GetState(int nID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_GETSTATE, nID, 0L); } BOOL SetState(int nID, UINT nState) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETSTATE, nID, MAKELPARAM(nState, 0)); } BOOL GetButton(int nIndex, LPTBBUTTON lpButton) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_GETBUTTON, nIndex, (LPARAM)lpButton); } int GetButtonCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_BUTTONCOUNT, 0, 0L); } BOOL GetItemRect(int nIndex, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_GETITEMRECT, nIndex, (LPARAM)lpRect); } void SetButtonStructSize(int nSize = sizeof(TBBUTTON)) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_BUTTONSTRUCTSIZE, nSize, 0L); } BOOL SetButtonSize(SIZE size) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(size.cx, size.cy)); } BOOL SetButtonSize(int cx, int cy) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONSIZE, 0, MAKELPARAM(cx, cy)); } BOOL SetBitmapSize(SIZE size) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(size.cx, size.cy)); } BOOL SetBitmapSize(int cx, int cy) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETBITMAPSIZE, 0, MAKELPARAM(cx, cy)); } CToolTipCtrl GetToolTips() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TB_GETTOOLTIPS, 0, 0L)); } void SetToolTips(HWND hWndToolTip) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); } void SetNotifyWnd(HWND hWnd) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_SETPARENT, (WPARAM)hWnd, 0L); } int GetRows() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_GETROWS, 0, 0L); } void SetRows(int nRows, BOOL bLarger, LPRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_SETROWS, MAKELPARAM(nRows, bLarger), (LPARAM)lpRect); } BOOL SetCmdID(int nIndex, UINT nID) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETCMDID, nIndex, nID); } DWORD GetBitmapFlags() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TB_GETBITMAPFLAGS, 0, 0L); } int GetBitmap(int nID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_GETBITMAP, nID, 0L); } int GetButtonText(int nID, LPTSTR lpstrText) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_GETBUTTONTEXT, nID, (LPARAM)lpstrText); } // nIndex - IE5 or higher only CImageList GetImageList(int nIndex = 0) const { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_GETIMAGELIST, nIndex, 0L)); } // nIndex - IE5 or higher only CImageList SetImageList(HIMAGELIST hImageList, int nIndex = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_SETIMAGELIST, nIndex, (LPARAM)hImageList)); } // nIndex - IE5 or higher only CImageList GetDisabledImageList(int nIndex = 0) const { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_GETDISABLEDIMAGELIST, nIndex, 0L)); } // nIndex - IE5 or higher only CImageList SetDisabledImageList(HIMAGELIST hImageList, int nIndex = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_SETDISABLEDIMAGELIST, nIndex, (LPARAM)hImageList)); } // nIndex - IE5 or higher only CImageList GetHotImageList(int nIndex = 0) const { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_GETHOTIMAGELIST, nIndex, 0L)); } // nIndex - IE5 or higher only CImageList SetHotImageList(HIMAGELIST hImageList, int nIndex = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_SETHOTIMAGELIST, nIndex, (LPARAM)hImageList)); } DWORD GetStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TB_GETSTYLE, 0, 0L); } void SetStyle(DWORD dwStyle) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_SETSTYLE, 0, dwStyle); } DWORD GetButtonSize() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TB_GETBUTTONSIZE, 0, 0L); } void GetButtonSize(SIZE& size) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, TB_GETBUTTONSIZE, 0, 0L); size.cx = LOWORD(dwRet); size.cy = HIWORD(dwRet); } BOOL GetRect(int nID, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_GETRECT, nID, (LPARAM)lpRect); } int GetTextRows() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_GETTEXTROWS, 0, 0L); } BOOL SetButtonWidth(int cxMin, int cxMax) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONWIDTH, 0, MAKELPARAM(cxMin, cxMax)); } BOOL SetIndent(int nIndent) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETINDENT, nIndent, 0L); } BOOL SetMaxTextRows(int nMaxTextRows) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETMAXTEXTROWS, nMaxTextRows, 0L); } BOOL GetAnchorHighlight() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_GETANCHORHIGHLIGHT, 0, 0L); } BOOL SetAnchorHighlight(BOOL bEnable = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETANCHORHIGHLIGHT, bEnable, 0L); } int GetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_GETBUTTONINFO, nID, (LPARAM)lptbbi); } BOOL SetButtonInfo(int nID, LPTBBUTTONINFO lptbbi) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)lptbbi); } BOOL SetButtonInfo(int nID, DWORD dwMask, BYTE Style, BYTE State, LPCTSTR lpszItem, int iImage, WORD cx, int iCommand, DWORD_PTR lParam) { ATLASSERT(::IsWindow(this->m_hWnd)); TBBUTTONINFO tbbi = {}; tbbi.cbSize = sizeof(TBBUTTONINFO); tbbi.dwMask = dwMask; tbbi.idCommand = iCommand; tbbi.iImage = iImage; tbbi.fsState = State; tbbi.fsStyle = Style; tbbi.cx = cx; tbbi.pszText = (LPTSTR) lpszItem; tbbi.lParam = lParam; return (BOOL)::SendMessage(this->m_hWnd, TB_SETBUTTONINFO, nID, (LPARAM)&tbbi); } int GetHotItem() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_GETHOTITEM, 0, 0L); } int SetHotItem(int nItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_SETHOTITEM, nItem, 0L); } BOOL IsButtonHighlighted(int nButtonID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_ISBUTTONHIGHLIGHTED, nButtonID, 0L); } DWORD SetDrawTextFlags(DWORD dwMask, DWORD dwFlags) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TB_SETDRAWTEXTFLAGS, dwMask, dwFlags); } BOOL GetColorScheme(LPCOLORSCHEME lpcs) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_GETCOLORSCHEME, 0, (LPARAM)lpcs); } void SetColorScheme(LPCOLORSCHEME lpcs) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_SETCOLORSCHEME, 0, (LPARAM)lpcs); } DWORD GetExtendedStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TB_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwStyle) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TB_SETEXTENDEDSTYLE, 0, dwStyle); } void GetInsertMark(LPTBINSERTMARK lptbim) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_GETINSERTMARK, 0, (LPARAM)lptbim); } void SetInsertMark(LPTBINSERTMARK lptbim) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_SETINSERTMARK, 0, (LPARAM)lptbim); } COLORREF GetInsertMarkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TB_GETINSERTMARKCOLOR, 0, 0L); } COLORREF SetInsertMarkColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, TB_SETINSERTMARKCOLOR, 0, (LPARAM)clr); } BOOL GetMaxSize(LPSIZE lpSize) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_GETMAXSIZE, 0, (LPARAM)lpSize); } void GetPadding(LPSIZE lpSizePadding) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpSizePadding != NULL); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, TB_GETPADDING, 0, 0L); lpSizePadding->cx = GET_X_LPARAM(dwRet); lpSizePadding->cy = GET_Y_LPARAM(dwRet); } void SetPadding(int cx, int cy, LPSIZE lpSizePadding = NULL) { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, TB_SETPADDING, 0, MAKELPARAM(cx, cy)); if(lpSizePadding != NULL) { lpSizePadding->cx = GET_X_LPARAM(dwRet); lpSizePadding->cy = GET_Y_LPARAM(dwRet); } } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_SETUNICODEFORMAT, bUnicode, 0L); } int GetString(int nString, LPTSTR lpstrString, int cchMaxLen) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(cchMaxLen, nString), (LPARAM)lpstrString); } int GetStringBSTR(int nString, BSTR& bstrString) const { USES_CONVERSION; ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrString == NULL); int nLength = (int)(short)LOWORD(::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); if(nLength != -1) { ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(nLength + 1); if(lpstrText != NULL) { nLength = (int)::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstrText); if(nLength != -1) bstrString = ::SysAllocString(T2OLE(lpstrText)); } else { nLength = -1; } } return nLength; } #ifdef __ATLSTR_H__ int GetString(int nString, ATL::CString& str) const { ATLASSERT(::IsWindow(this->m_hWnd)); int nLength = (int)(short)LOWORD(::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(0, nString), NULL)); if(nLength != -1) { LPTSTR lpstr = str.GetBufferSetLength(nLength + 1); if(lpstr != NULL) nLength = (int)::SendMessage(this->m_hWnd, TB_GETSTRING, MAKEWPARAM(nLength + 1, nString), (LPARAM)lpstr); else nLength = -1; str.ReleaseBuffer(); } return nLength; } #endif // __ATLSTR_H__ void GetMetrics(LPTBMETRICS lptbm) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_GETMETRICS, 0, (LPARAM)lptbm); } void SetMetrics(LPTBMETRICS lptbm) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_SETMETRICS, 0, (LPARAM)lptbm); } void SetWindowTheme(LPCWSTR lpstrTheme) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); } #if (_WIN32_WINNT >= 0x0600) CImageList GetPressedImageList(int nIndex = 0) const { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_GETPRESSEDIMAGELIST, nIndex, 0L)); } CImageList SetPressedImageList(HIMAGELIST hImageList, int nIndex = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TB_SETPRESSEDIMAGELIST, nIndex, (LPARAM)hImageList)); } void GetItemDropDownRect(int nIndex, LPRECT lpRect) const { #ifndef TB_GETITEMDROPDOWNRECT const int TB_GETITEMDROPDOWNRECT = WM_USER + 103; #endif ATLASSERT(::IsWindow(this->m_hWnd)); BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, TB_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect); (void)bRet; // avoid level 4 warning ATLASSERT(bRet != FALSE); } #endif // (_WIN32_WINNT >= 0x0600) // Operations BOOL EnableButton(int nID, BOOL bEnable = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_ENABLEBUTTON, nID, MAKELPARAM(bEnable, 0)); } BOOL CheckButton(int nID, BOOL bCheck = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_CHECKBUTTON, nID, MAKELPARAM(bCheck, 0)); } BOOL PressButton(int nID, BOOL bPress = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_PRESSBUTTON, nID, MAKELPARAM(bPress, 0)); } BOOL HideButton(int nID, BOOL bHide = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_HIDEBUTTON, nID, MAKELPARAM(bHide, 0)); } BOOL Indeterminate(int nID, BOOL bIndeterminate = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_INDETERMINATE, nID, MAKELPARAM(bIndeterminate, 0)); } int AddBitmap(int nNumButtons, UINT nBitmapID) { ATLASSERT(::IsWindow(this->m_hWnd)); TBADDBITMAP tbab = {}; tbab.hInst = ModuleHelper::GetResourceInstance(); ATLASSERT(tbab.hInst != NULL); tbab.nID = nBitmapID; return (int)::SendMessage(this->m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); } int AddBitmap(int nNumButtons, HBITMAP hBitmap) { ATLASSERT(::IsWindow(this->m_hWnd)); TBADDBITMAP tbab = {}; tbab.hInst = NULL; tbab.nID = (UINT_PTR)hBitmap; return (int)::SendMessage(this->m_hWnd, TB_ADDBITMAP, (WPARAM)nNumButtons, (LPARAM)&tbab); } BOOL AddButtons(int nNumButtons, LPCTBBUTTON lpButtons) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_ADDBUTTONS, nNumButtons, (LPARAM)lpButtons); } BOOL InsertButton(int nIndex, LPCTBBUTTON lpButton) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)lpButton); } BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, INT_PTR iString, DWORD_PTR lParam) { ATLASSERT(::IsWindow(this->m_hWnd)); TBBUTTON tbb = {}; tbb.fsStyle = Style; tbb.fsState = State; tbb.idCommand = iCommand; tbb.iBitmap = iBitmap; tbb.iString = iString; tbb.dwData = lParam; return (BOOL)::SendMessage(this->m_hWnd, TB_INSERTBUTTON, nIndex, (LPARAM)&tbb); } BOOL InsertButton(int nIndex, int iCommand, BYTE Style, BYTE State, int iBitmap, LPCTSTR lpszItem, DWORD_PTR lParam) { return InsertButton(nIndex, iCommand, Style, State, iBitmap, (INT_PTR)lpszItem, lParam); } BOOL AddButton(LPTBBUTTON lpButton) { return InsertButton(-1, lpButton); } BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, INT_PTR iString, DWORD_PTR lParam) { return InsertButton(-1, iCommand, Style, State, iBitmap, iString, lParam); } BOOL AddButton(int iCommand, BYTE Style, BYTE State, int iBitmap, LPCTSTR lpszItem, DWORD_PTR lParam) { return InsertButton(-1, iCommand, Style, State, iBitmap, lpszItem, lParam); } BOOL DeleteButton(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_DELETEBUTTON, nIndex, 0L); } BOOL InsertSeparator(int nIndex, int cxWidth = 8) { return InsertButton(nIndex, 0, BTNS_SEP, 0, cxWidth, (INT_PTR)0, 0); } BOOL AddSeparator(int cxWidth = 8) { return AddButton(0, BTNS_SEP, 0, cxWidth, (INT_PTR)0, 0); } int CommandToIndex(UINT nID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_COMMANDTOINDEX, nID, 0L); } void SaveState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) { ATLASSERT(::IsWindow(this->m_hWnd)); TBSAVEPARAMS tbs = {}; tbs.hkr = hKeyRoot; tbs.pszSubKey = lpszSubKey; tbs.pszValueName = lpszValueName; ::SendMessage(this->m_hWnd, TB_SAVERESTORE, (WPARAM)TRUE, (LPARAM)&tbs); } void RestoreState(HKEY hKeyRoot, LPCTSTR lpszSubKey, LPCTSTR lpszValueName) { ATLASSERT(::IsWindow(this->m_hWnd)); TBSAVEPARAMS tbs = {}; tbs.hkr = hKeyRoot; tbs.pszSubKey = lpszSubKey; tbs.pszValueName = lpszValueName; ::SendMessage(this->m_hWnd, TB_SAVERESTORE, (WPARAM)FALSE, (LPARAM)&tbs); } void Customize() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_CUSTOMIZE, 0, 0L); } int AddString(UINT nStringID) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_ADDSTRING, (WPARAM)ModuleHelper::GetResourceInstance(), (LPARAM)nStringID); } int AddStrings(LPCTSTR lpszStrings) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_ADDSTRING, 0, (LPARAM)lpszStrings); } void AutoSize() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TB_AUTOSIZE, 0, 0L); } BOOL ChangeBitmap(int nID, int nBitmap) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_CHANGEBITMAP, nID, MAKELPARAM(nBitmap, 0)); } int LoadImages(int nBitmapID) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)ModuleHelper::GetResourceInstance()); } int LoadStdImages(int nBitmapID) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_LOADIMAGES, nBitmapID, (LPARAM)HINST_COMMCTRL); } BOOL ReplaceBitmap(LPTBREPLACEBITMAP ptbrb) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_REPLACEBITMAP, 0, (LPARAM)ptbrb); } int HitTest(LPPOINT lpPoint) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TB_HITTEST, 0, (LPARAM)lpPoint); } BOOL InsertMarkHitTest(LPPOINT lpPoint, LPTBINSERTMARK lptbim) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)lpPoint, (LPARAM)lptbim); } BOOL InsertMarkHitTest(int x, int y, LPTBINSERTMARK lptbim) const { ATLASSERT(::IsWindow(this->m_hWnd)); POINT pt = { x, y }; return (BOOL)::SendMessage(this->m_hWnd, TB_INSERTMARKHITTEST, (WPARAM)&pt, (LPARAM)lptbim); } BOOL MapAccelerator(TCHAR chAccel, int& nID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_MAPACCELERATOR, (WPARAM)chAccel, (LPARAM)&nID); } BOOL MarkButton(int nID, BOOL bHighlight = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_MARKBUTTON, nID, MAKELPARAM(bHighlight, 0)); } BOOL MoveButton(int nOldPos, int nNewPos) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TB_MOVEBUTTON, nOldPos, nNewPos); } HRESULT GetObject(REFIID iid, LPVOID* ppvObject) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HRESULT)::SendMessage(this->m_hWnd, TB_GETOBJECT, (WPARAM)&iid, (LPARAM)ppvObject); } }; typedef CToolBarCtrlT CToolBarCtrl; /////////////////////////////////////////////////////////////////////////////// // CStatusBarCtrl template class CStatusBarCtrlT : public TBase { public: // Constructors CStatusBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CStatusBarCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Methods static LPCTSTR GetWndClassName() { return STATUSCLASSNAME; } int GetParts(int nParts, int* pParts) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, SB_GETPARTS, nParts, (LPARAM)pParts); } BOOL SetParts(int nParts, int* pWidths) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, SB_SETPARTS, nParts, (LPARAM)pWidths); } int GetTextLength(int nPane, int* pType = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L); if (pType != NULL) *pType = (int)(short)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); } int GetText(int nPane, LPTSTR lpszText, int* pType = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, SB_GETTEXT, (WPARAM)nPane, (LPARAM)lpszText); if(pType != NULL) *pType = (int)(short)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); } BOOL GetTextBSTR(int nPane, BSTR& bstrText, int* pType = NULL) const { USES_CONVERSION; ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); ATLASSERT(bstrText == NULL); int nLength = (int)(short)LOWORD(::SendMessage(this->m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); if(nLength == 0) return FALSE; ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(nLength + 1); if(lpstrText == NULL) return FALSE; if(!GetText(nPane, lpstrText, pType)) return FALSE; bstrText = ::SysAllocString(T2OLE(lpstrText)); return (bstrText != NULL) ? TRUE : FALSE; } #ifdef __ATLSTR_H__ int GetText(int nPane, ATL::CString& strText, int* pType = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); int nLength = (int)(short)LOWORD(::SendMessage(this->m_hWnd, SB_GETTEXTLENGTH, (WPARAM)nPane, 0L)); if(nLength == 0) return 0; LPTSTR lpstr = strText.GetBufferSetLength(nLength); if(lpstr == NULL) return 0; return GetText(nPane, lpstr, pType); } #endif // __ATLSTR_H__ BOOL SetText(int nPane, LPCTSTR lpszText, int nType = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); return (BOOL)::SendMessage(this->m_hWnd, SB_SETTEXT, (nPane | nType), (LPARAM)lpszText); } BOOL GetRect(int nPane, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); return (BOOL)::SendMessage(this->m_hWnd, SB_GETRECT, nPane, (LPARAM)lpRect); } BOOL GetBorders(int* pBorders) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, SB_GETBORDERS, 0, (LPARAM)pBorders); } BOOL GetBorders(int& nHorz, int& nVert, int& nSpacing) const { ATLASSERT(::IsWindow(this->m_hWnd)); int borders[3] = {}; BOOL bResult = (BOOL)::SendMessage(this->m_hWnd, SB_GETBORDERS, 0, (LPARAM)&borders); if(bResult) { nHorz = borders[0]; nVert = borders[1]; nSpacing = borders[2]; } return bResult; } void SetMinHeight(int nMin) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, SB_SETMINHEIGHT, nMin, 0L); } BOOL SetSimple(BOOL bSimple = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, SB_SIMPLE, bSimple, 0L); } BOOL IsSimple() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, SB_ISSIMPLE, 0, 0L); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, SB_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, SB_SETUNICODEFORMAT, bUnicode, 0L); } void GetTipText(int nPane, LPTSTR lpstrText, int nSize) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); ::SendMessage(this->m_hWnd, SB_GETTIPTEXT, MAKEWPARAM(nPane, nSize), (LPARAM)lpstrText); } void SetTipText(int nPane, LPCTSTR lpstrText) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); ::SendMessage(this->m_hWnd, SB_SETTIPTEXT, nPane, (LPARAM)lpstrText); } COLORREF SetBkColor(COLORREF clrBk) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, SB_SETBKCOLOR, 0, (LPARAM)clrBk); } HICON GetIcon(int nPane) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); return (HICON)::SendMessage(this->m_hWnd, SB_GETICON, nPane, 0L); } BOOL SetIcon(int nPane, HICON hIcon) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPane < 256); return (BOOL)::SendMessage(this->m_hWnd, SB_SETICON, nPane, (LPARAM)hIcon); } }; typedef CStatusBarCtrlT CStatusBarCtrl; /////////////////////////////////////////////////////////////////////////////// // CTabCtrl template class CTabCtrlT : public TBase { public: // Constructors CTabCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CTabCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return WC_TABCONTROL; } CImageList GetImageList() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TCM_GETIMAGELIST, 0, 0L)); } CImageList SetImageList(HIMAGELIST hImageList) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, TCM_SETIMAGELIST, 0, (LPARAM)hImageList)); } int GetItemCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TCM_GETITEMCOUNT, 0, 0L); } BOOL GetItem(int nItem, LPTCITEM pTabCtrlItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TCM_GETITEM, nItem, (LPARAM)pTabCtrlItem); } BOOL SetItem(int nItem, LPTCITEM pTabCtrlItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TCM_SETITEM, nItem, (LPARAM)pTabCtrlItem); } int SetItem(int nItem, UINT mask, LPCTSTR lpszItem, DWORD dwState, DWORD dwStateMask, int iImage, LPARAM lParam) { ATLASSERT(::IsWindow(this->m_hWnd)); TCITEM tci = {}; tci.mask = mask; tci.pszText = (LPTSTR) lpszItem; tci.dwState = dwState; tci.dwStateMask = dwStateMask; tci.iImage = iImage; tci.lParam = lParam; return (int)::SendMessage(this->m_hWnd, TCM_SETITEM, nItem, (LPARAM)&tci); } BOOL GetItemRect(int nItem, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TCM_GETITEMRECT, nItem, (LPARAM)lpRect); } int GetCurSel() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TCM_GETCURSEL, 0, 0L); } int SetCurSel(int nItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TCM_SETCURSEL, nItem, 0L); } SIZE SetItemSize(SIZE size) { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwSize = (DWORD)::SendMessage(this->m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(size.cx, size.cy)); SIZE sizeRet = { GET_X_LPARAM(dwSize), GET_Y_LPARAM(dwSize) }; return sizeRet; } void SetItemSize(int cx, int cy) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TCM_SETITEMSIZE, 0, MAKELPARAM(cx, cy)); } void SetPadding(SIZE size) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TCM_SETPADDING, 0, MAKELPARAM(size.cx, size.cy)); } int GetRowCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TCM_GETROWCOUNT, 0, 0L); } CToolTipCtrl GetToolTips() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TCM_GETTOOLTIPS, 0, 0L)); } // this method is deprecated, please use GetToolTips CToolTipCtrl GetTooltips() const { return GetToolTips(); } void SetToolTips(HWND hWndToolTip) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TCM_SETTOOLTIPS, (WPARAM)hWndToolTip, 0L); } // this method is deprecated, please use SetToolTips void SetTooltips(HWND hWndToolTip) { SetToolTips(hWndToolTip); } int GetCurFocus() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TCM_GETCURFOCUS, 0, 0L); } void SetCurFocus(int nItem) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TCM_SETCURFOCUS, nItem, 0L); } BOOL SetItemExtra(int cbExtra) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(GetItemCount() == 0); // must be empty return (BOOL)::SendMessage(this->m_hWnd, TCM_SETITEMEXTRA, cbExtra, 0L); } int SetMinTabWidth(int nWidth = -1) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TCM_SETMINTABWIDTH, 0, nWidth); } DWORD GetExtendedStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TCM_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, TCM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TCM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TCM_SETUNICODEFORMAT, bUnicode, 0L); } // Operations int InsertItem(int nItem, LPTCITEM pTabCtrlItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)pTabCtrlItem); } int InsertItem(int nItem, UINT mask, LPCTSTR lpszItem, int iImage, LPARAM lParam) { ATLASSERT(::IsWindow(this->m_hWnd)); TCITEM tci = {}; tci.mask = mask; tci.pszText = (LPTSTR) lpszItem; tci.iImage = iImage; tci.lParam = lParam; return (int)::SendMessage(this->m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); } int InsertItem(int nItem, LPCTSTR lpszItem) { ATLASSERT(::IsWindow(this->m_hWnd)); TCITEM tci = {}; tci.mask = TCIF_TEXT; tci.pszText = (LPTSTR) lpszItem; return (int)::SendMessage(this->m_hWnd, TCM_INSERTITEM, nItem, (LPARAM)&tci); } int AddItem(LPTCITEM pTabCtrlItem) { return InsertItem(GetItemCount(), pTabCtrlItem); } int AddItem(UINT mask, LPCTSTR lpszItem, int iImage, LPARAM lParam) { return InsertItem(GetItemCount(), mask, lpszItem, iImage, lParam); } int AddItem(LPCTSTR lpszItem) { return InsertItem(GetItemCount(), lpszItem); } BOOL DeleteItem(int nItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TCM_DELETEITEM, nItem, 0L); } BOOL DeleteAllItems() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TCM_DELETEALLITEMS, 0, 0L); } void AdjustRect(BOOL bLarger, LPRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TCM_ADJUSTRECT, bLarger, (LPARAM)lpRect); } void RemoveImage(int nImage) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TCM_REMOVEIMAGE, nImage, 0L); } int HitTest(TC_HITTESTINFO* pHitTestInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TCM_HITTEST, 0, (LPARAM)pHitTestInfo); } void DeselectAll(BOOL bExcludeFocus = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TCM_DESELECTALL, bExcludeFocus, 0L); } BOOL HighlightItem(int nIndex, BOOL bHighlight = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TCM_HIGHLIGHTITEM, nIndex, MAKELPARAM(bHighlight, 0)); } }; typedef CTabCtrlT CTabCtrl; /////////////////////////////////////////////////////////////////////////////// // CTrackBarCtrl template class CTrackBarCtrlT : public TBase { public: // Constructors CTrackBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CTrackBarCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return TRACKBAR_CLASS; } int GetLineSize() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETLINESIZE, 0, 0L); } int SetLineSize(int nSize) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_SETLINESIZE, 0, nSize); } int GetPageSize() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETPAGESIZE, 0, 0L); } int SetPageSize(int nSize) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_SETPAGESIZE, 0, nSize); } int GetRangeMin() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETRANGEMIN, 0, 0L); } void SetRangeMin(int nMin, BOOL bRedraw = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETRANGEMIN, bRedraw, nMin); } int GetRangeMax() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETRANGEMAX, 0, 0L); } void SetRangeMax(int nMax, BOOL bRedraw = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETRANGEMAX, bRedraw, nMax); } void GetRange(int& nMin, int& nMax) const { nMin = GetRangeMin(); nMax = GetRangeMax(); } void SetRange(int nMin, int nMax, BOOL bRedraw = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETRANGE, bRedraw, MAKELPARAM(nMin, nMax)); } int GetSelStart() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETSELSTART, 0, 0L); } void SetSelStart(int nMin, BOOL bRedraw = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETSELSTART, bRedraw, (LPARAM)nMin); } int GetSelEnd() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETSELEND, 0, 0L); } void SetSelEnd(int nMax, BOOL bRedraw = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETSELEND, bRedraw, (LPARAM)nMax); } void GetSelection(int& nMin, int& nMax) const { nMin = GetSelStart(); nMax = GetSelEnd(); } void SetSelection(int nMin, int nMax, BOOL bRedraw = TRUE) { SetSelStart(nMin, FALSE); SetSelEnd(nMax, bRedraw); } void GetChannelRect(LPRECT lprc) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_GETCHANNELRECT, 0, (LPARAM)lprc); } void GetThumbRect(LPRECT lprc) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_GETTHUMBRECT, 0, (LPARAM)lprc); } int GetPos() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETPOS, 0, 0L); } void SetPos(int nPos) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETPOS, TRUE, nPos); } UINT GetNumTics() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, TBM_GETNUMTICS, 0, 0L); } DWORD* GetTicArray() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD*)::SendMessage(this->m_hWnd, TBM_GETPTICS, 0, 0L); } int GetTic(int nTic) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETTIC, nTic, 0L); } BOOL SetTic(int nTic) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TBM_SETTIC, 0, nTic); } int GetTicPos(int nTic) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETTICPOS, nTic, 0L); } void SetTicFreq(int nFreq) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETTICFREQ, nFreq, 0L); } int GetThumbLength() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_GETTHUMBLENGTH, 0, 0L); } void SetThumbLength(int nLength) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETTHUMBLENGTH, nLength, 0L); } void SetSel(int nStart, int nEnd, BOOL bRedraw = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & TBS_ENABLESELRANGE) != 0); ::SendMessage(this->m_hWnd, TBM_SETSEL, bRedraw, MAKELPARAM(nStart, nEnd)); } ATL::CWindow GetBuddy(BOOL bLeft = TRUE) const { ATLASSERT(::IsWindow(this->m_hWnd)); return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, TBM_GETBUDDY, bLeft, 0L)); } ATL::CWindow SetBuddy(HWND hWndBuddy, BOOL bLeft = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, TBM_SETBUDDY, bLeft, (LPARAM)hWndBuddy)); } CToolTipCtrl GetToolTips() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, TBM_GETTOOLTIPS, 0, 0L)); } void SetToolTips(HWND hWndTT) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETTOOLTIPS, (WPARAM)hWndTT, 0L); } int SetTipSide(int nSide) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, TBM_SETTIPSIDE, nSide, 0L); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TBM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, TBM_SETUNICODEFORMAT, bUnicode, 0L); } // Operations void ClearSel(BOOL bRedraw = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_CLEARSEL, bRedraw, 0L); } void VerifyPos() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_SETPOS, FALSE, 0L); } void ClearTics(BOOL bRedraw = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, TBM_CLEARTICS, bRedraw, 0L); } }; typedef CTrackBarCtrlT CTrackBarCtrl; /////////////////////////////////////////////////////////////////////////////// // CUpDownCtrl template class CUpDownCtrlT : public TBase { public: // Constructors CUpDownCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CUpDownCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return UPDOWN_CLASS; } UINT GetAccel(int nAccel, UDACCEL* pAccel) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)LOWORD(::SendMessage(this->m_hWnd, UDM_GETACCEL, nAccel, (LPARAM)pAccel)); } BOOL SetAccel(int nAccel, UDACCEL* pAccel) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)LOWORD(::SendMessage(this->m_hWnd, UDM_SETACCEL, nAccel, (LPARAM)pAccel)); } UINT GetBase() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)LOWORD(::SendMessage(this->m_hWnd, UDM_GETBASE, 0, 0L)); } int SetBase(int nBase) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, UDM_SETBASE, nBase, 0L); } ATL::CWindow GetBuddy() const { ATLASSERT(::IsWindow(this->m_hWnd)); return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, UDM_GETBUDDY, 0, 0L)); } ATL::CWindow SetBuddy(HWND hWndBuddy) { ATLASSERT(::IsWindow(this->m_hWnd)); return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, UDM_SETBUDDY, (WPARAM)hWndBuddy, 0L)); } int GetPos(LPBOOL lpbError = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, UDM_GETPOS, 0, 0L); // Note: Seems that Windows always sets error to TRUE if // UDS_SETBUDDYINT style is not used if(lpbError != NULL) *lpbError = (HIWORD(dwRet) != 0) ? TRUE : FALSE; return (int)(short)LOWORD(dwRet); } int SetPos(int nPos) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)(short)LOWORD(::SendMessage(this->m_hWnd, UDM_SETPOS, 0, MAKELPARAM(nPos, 0))); } DWORD GetRange() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, UDM_GETRANGE, 0, 0L); } void GetRange(int& nLower, int& nUpper) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, UDM_GETRANGE, 0, 0L); nLower = (int)(short)HIWORD(dwRet); nUpper = (int)(short)LOWORD(dwRet); } void SetRange(int nLower, int nUpper) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, UDM_SETRANGE, 0, MAKELPARAM(nUpper, nLower)); } void SetRange32(int nLower, int nUpper) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, UDM_SETRANGE32, nLower, nUpper); } void GetRange32(int& nLower, int& nUpper) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, UDM_GETRANGE32, (WPARAM)&nLower, (LPARAM)&nUpper); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, UDM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, UDM_SETUNICODEFORMAT, bUnicode, 0L); } int GetPos32(LPBOOL lpbError = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); // Note: Seems that Windows always sets error to TRUE if // UDS_SETBUDDYINT style is not used return (int)::SendMessage(this->m_hWnd, UDM_GETPOS32, 0, (LPARAM)lpbError); } int SetPos32(int nPos) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, UDM_SETPOS32, 0, (LPARAM)nPos); } }; typedef CUpDownCtrlT CUpDownCtrl; /////////////////////////////////////////////////////////////////////////////// // CProgressBarCtrl template class CProgressBarCtrlT : public TBase { public: // Constructors CProgressBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CProgressBarCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return PROGRESS_CLASS; } DWORD SetRange(int nLower, int nUpper) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, PBM_SETRANGE, 0, MAKELPARAM(nLower, nUpper)); } int SetPos(int nPos) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)(short)LOWORD(::SendMessage(this->m_hWnd, PBM_SETPOS, nPos, 0L)); } int OffsetPos(int nPos) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)(short)LOWORD(::SendMessage(this->m_hWnd, PBM_DELTAPOS, nPos, 0L)); } int SetStep(int nStep) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)(short)LOWORD(::SendMessage(this->m_hWnd, PBM_SETSTEP, nStep, 0L)); } UINT GetPos() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, PBM_GETPOS, 0, 0L); } void GetRange(PPBRANGE pPBRange) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(pPBRange != NULL); ::SendMessage(this->m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)pPBRange); } void GetRange(int& nLower, int& nUpper) const { ATLASSERT(::IsWindow(this->m_hWnd)); PBRANGE range = {}; ::SendMessage(this->m_hWnd, PBM_GETRANGE, TRUE, (LPARAM)&range); nLower = range.iLow; nUpper = range.iHigh; } int GetRangeLimit(BOOL bLowLimit) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PBM_GETRANGE, bLowLimit, (LPARAM)NULL); } DWORD SetRange32(int nMin, int nMax) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, PBM_SETRANGE32, nMin, nMax); } COLORREF SetBarColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, PBM_SETBARCOLOR, 0, (LPARAM)clr); } COLORREF SetBkColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, PBM_SETBKCOLOR, 0, (LPARAM)clr); } #ifdef PBM_SETMARQUEE BOOL SetMarquee(BOOL bMarquee, UINT uUpdateTime = 0U) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, PBM_SETMARQUEE, (WPARAM)bMarquee, (LPARAM)uUpdateTime); } #endif #if (_WIN32_WINNT >= 0x0600) int GetStep() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PBM_GETSTEP, 0, 0L); } COLORREF GetBkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, PBM_GETBKCOLOR, 0, 0L); } COLORREF GetBarColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, PBM_GETBARCOLOR, 0, 0L); } int GetState() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PBM_GETSTATE, 0, 0L); } int SetState(int nState) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PBM_SETSTATE, nState, 0L); } #endif // (_WIN32_WINNT >= 0x0600) // Operations int StepIt() { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)(short)LOWORD(::SendMessage(this->m_hWnd, PBM_STEPIT, 0, 0L)); } }; typedef CProgressBarCtrlT CProgressBarCtrl; /////////////////////////////////////////////////////////////////////////////// // CHotKeyCtrl template class CHotKeyCtrlT : public TBase { public: // Constructors CHotKeyCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CHotKeyCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return HOTKEY_CLASS; } DWORD GetHotKey() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, HKM_GETHOTKEY, 0, 0L); } void GetHotKey(WORD &wVirtualKeyCode, WORD &wModifiers) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dw = (DWORD)::SendMessage(this->m_hWnd, HKM_GETHOTKEY, 0, 0L); wVirtualKeyCode = LOBYTE(LOWORD(dw)); wModifiers = HIBYTE(LOWORD(dw)); } void SetHotKey(WORD wVirtualKeyCode, WORD wModifiers) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, HKM_SETHOTKEY, MAKEWORD(wVirtualKeyCode, wModifiers), 0L); } void SetRules(WORD wInvalidComb, WORD wModifiers) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, HKM_SETRULES, wInvalidComb, MAKELPARAM(wModifiers, 0)); } }; typedef CHotKeyCtrlT CHotKeyCtrl; /////////////////////////////////////////////////////////////////////////////// // CAnimateCtrl template class CAnimateCtrlT : public TBase { public: // Constructors CAnimateCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CAnimateCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return ANIMATE_CLASS; } // Operations BOOL Open(ATL::_U_STRINGorID FileName) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, ACM_OPEN, 0, (LPARAM)FileName.m_lpstr); } BOOL Play(UINT nFrom, UINT nTo, UINT nRep) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, ACM_PLAY, nRep, MAKELPARAM(nFrom, nTo)); } BOOL Stop() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, ACM_STOP, 0, 0L); } BOOL Close() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, ACM_OPEN, 0, 0L); } BOOL Seek(UINT nTo) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, ACM_PLAY, 0, MAKELPARAM(nTo, nTo)); } // Vista only BOOL IsPlaying() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, ACM_ISPLAYING, 0, 0L); } }; typedef CAnimateCtrlT CAnimateCtrl; /////////////////////////////////////////////////////////////////////////////// // CRichEditCtrl #if !defined(_UNICODE) && (_RICHEDIT_VER >= 0x0500) #undef MSFTEDIT_CLASS #define MSFTEDIT_CLASS "RICHEDIT50W" #endif template class CRichEditCtrlT : public TBase { public: // Constructors CRichEditCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CRichEditCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { #if (_RICHEDIT_VER >= 0x0500) return MSFTEDIT_CLASS; #else return RICHEDIT_CLASS; #endif } static LPCTSTR GetLibraryName() { #if (_RICHEDIT_VER >= 0x0500) return _T("MSFTEDIT.DLL"); #else return _T("RICHED20.DLL"); #endif } int GetLineCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETLINECOUNT, 0, 0L); } BOOL GetModify() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_GETMODIFY, 0, 0L); } void SetModify(BOOL bModified = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETMODIFY, bModified, 0L); } void GetRect(LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); } DWORD GetOptions() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_GETOPTIONS, 0, 0L); } DWORD SetOptions(WORD wOperation, DWORD dwOptions) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_SETOPTIONS, wOperation, dwOptions); } // NOTE: first word in lpszBuffer must contain the size of the buffer! int GetLine(int nIndex, LPTSTR lpszBuffer) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); } int GetLine(int nIndex, LPTSTR lpszBuffer, int nMaxLength) const { ATLASSERT(::IsWindow(this->m_hWnd)); *(LPWORD)lpszBuffer = (WORD)nMaxLength; return (int)::SendMessage(this->m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); } BOOL CanUndo() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_CANUNDO, 0, 0L); } BOOL CanPaste(UINT nFormat = 0) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_CANPASTE, nFormat, 0L); } void GetSel(LONG& nStartChar, LONG& nEndChar) const { ATLASSERT(::IsWindow(this->m_hWnd)); CHARRANGE cr = {}; ::SendMessage(this->m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); nStartChar = cr.cpMin; nEndChar = cr.cpMax; } void GetSel(CHARRANGE &cr) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); } int SetSel(LONG nStartChar, LONG nEndChar) { ATLASSERT(::IsWindow(this->m_hWnd)); CHARRANGE cr = { nStartChar, nEndChar }; return (int)::SendMessage(this->m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); } int SetSel(CHARRANGE &cr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_EXSETSEL, 0, (LPARAM)&cr); } int SetSelAll() { return SetSel(0, -1); } int SetSelNone() { return SetSel(-1, 0); } DWORD GetDefaultCharFormat(CHARFORMAT& cf) const { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); return (DWORD)::SendMessage(this->m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); } DWORD GetSelectionCharFormat(CHARFORMAT& cf) const { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); return (DWORD)::SendMessage(this->m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); } DWORD GetEventMask() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_GETEVENTMASK, 0, 0L); } LONG GetLimitText() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (LONG)::SendMessage(this->m_hWnd, EM_GETLIMITTEXT, 0, 0L); } DWORD GetParaFormat(PARAFORMAT& pf) const { ATLASSERT(::IsWindow(this->m_hWnd)); pf.cbSize = sizeof(PARAFORMAT); return (DWORD)::SendMessage(this->m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); } LONG GetSelText(LPTSTR lpstrBuff) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (LONG)::SendMessage(this->m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrBuff); } BOOL GetSelTextBSTR(BSTR& bstrText) const { USES_CONVERSION; ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); CHARRANGE cr = {}; ::SendMessage(this->m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(cr.cpMax - cr.cpMin + 1); if(lpstrText == NULL) return FALSE; if(::SendMessage(this->m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText) == 0) return FALSE; bstrText = ::SysAllocString(T2W(lpstrText)); return (bstrText != NULL) ? TRUE : FALSE; } #ifdef __ATLSTR_H__ LONG GetSelText(ATL::CString& strText) const { ATLASSERT(::IsWindow(this->m_hWnd)); CHARRANGE cr = {}; ::SendMessage(this->m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); LONG lLen = 0; LPTSTR lpstrText = strText.GetBufferSetLength(cr.cpMax - cr.cpMin); if(lpstrText != NULL) { lLen = (LONG)::SendMessage(this->m_hWnd, EM_GETSELTEXT, 0, (LPARAM)lpstrText); strText.ReleaseBuffer(); } return lLen; } #endif // __ATLSTR_H__ WORD GetSelectionType() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (WORD)::SendMessage(this->m_hWnd, EM_SELECTIONTYPE, 0, 0L); } COLORREF SetBackgroundColor(COLORREF cr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, EM_SETBKGNDCOLOR, 0, cr); } COLORREF SetBackgroundColor() // sets to system background { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, EM_SETBKGNDCOLOR, 1, 0); } BOOL SetCharFormat(CHARFORMAT& cf, WORD wFlags) { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); } BOOL SetDefaultCharFormat(CHARFORMAT& cf) { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); } BOOL SetSelectionCharFormat(CHARFORMAT& cf) { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } BOOL SetWordCharFormat(CHARFORMAT& cf) { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); } DWORD SetEventMask(DWORD dwEventMask) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_SETEVENTMASK, 0, dwEventMask); } BOOL SetParaFormat(PARAFORMAT& pf) { ATLASSERT(::IsWindow(this->m_hWnd)); pf.cbSize = sizeof(PARAFORMAT); return (BOOL)::SendMessage(this->m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); } BOOL SetTargetDevice(HDC hDC, int cxLineWidth) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETTARGETDEVICE, (WPARAM)hDC, cxLineWidth); } int GetTextLength() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, WM_GETTEXTLENGTH, 0, 0L); } BOOL SetReadOnly(BOOL bReadOnly = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETREADONLY, bReadOnly, 0L); } int GetFirstVisibleLine() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); } int GetTextRange(TEXTRANGE* pTextRange) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)pTextRange); } int GetTextRange(LONG nStartChar, LONG nEndChar, LPTSTR lpstrText) const { ATLASSERT(::IsWindow(this->m_hWnd)); TEXTRANGE tr = {}; tr.chrg.cpMin = nStartChar; tr.chrg.cpMax = nEndChar; tr.lpstrText = lpstrText; return (int)::SendMessage(this->m_hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); } DWORD GetDefaultCharFormat(CHARFORMAT2& cf) const { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); return (DWORD)::SendMessage(this->m_hWnd, EM_GETCHARFORMAT, 0, (LPARAM)&cf); } BOOL SetCharFormat(CHARFORMAT2& cf, WORD wFlags) { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, (WPARAM)wFlags, (LPARAM)&cf); } BOOL SetDefaultCharFormat(CHARFORMAT2& cf) { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, 0, (LPARAM)&cf); } DWORD GetSelectionCharFormat(CHARFORMAT2& cf) const { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); return (DWORD)::SendMessage(this->m_hWnd, EM_GETCHARFORMAT, 1, (LPARAM)&cf); } BOOL SetSelectionCharFormat(CHARFORMAT2& cf) { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); } BOOL SetWordCharFormat(CHARFORMAT2& cf) { ATLASSERT(::IsWindow(this->m_hWnd)); cf.cbSize = sizeof(CHARFORMAT2); return (BOOL)::SendMessage(this->m_hWnd, EM_SETCHARFORMAT, SCF_SELECTION | SCF_WORD, (LPARAM)&cf); } DWORD GetParaFormat(PARAFORMAT2& pf) const { ATLASSERT(::IsWindow(this->m_hWnd)); pf.cbSize = sizeof(PARAFORMAT2); return (DWORD)::SendMessage(this->m_hWnd, EM_GETPARAFORMAT, 0, (LPARAM)&pf); } BOOL SetParaFormat(PARAFORMAT2& pf) { ATLASSERT(::IsWindow(this->m_hWnd)); pf.cbSize = sizeof(PARAFORMAT2); return (BOOL)::SendMessage(this->m_hWnd, EM_SETPARAFORMAT, 0, (LPARAM)&pf); } TEXTMODE GetTextMode() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (TEXTMODE)::SendMessage(this->m_hWnd, EM_GETTEXTMODE, 0, 0L); } BOOL SetTextMode(TEXTMODE enumTextMode) { ATLASSERT(::IsWindow(this->m_hWnd)); return !(BOOL)::SendMessage(this->m_hWnd, EM_SETTEXTMODE, enumTextMode, 0L); } UNDONAMEID GetUndoName() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UNDONAMEID)::SendMessage(this->m_hWnd, EM_GETUNDONAME, 0, 0L); } UNDONAMEID GetRedoName() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UNDONAMEID)::SendMessage(this->m_hWnd, EM_GETREDONAME, 0, 0L); } BOOL CanRedo() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_CANREDO, 0, 0L); } BOOL GetAutoURLDetect() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_GETAUTOURLDETECT, 0, 0L); } BOOL SetAutoURLDetect(BOOL bAutoDetect = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return !(BOOL)::SendMessage(this->m_hWnd, EM_AUTOURLDETECT, bAutoDetect, 0L); } // this method is deprecated, please use SetAutoURLDetect BOOL EnableAutoURLDetect(BOOL bEnable = TRUE) { return SetAutoURLDetect(bEnable); } UINT SetUndoLimit(UINT uUndoLimit) { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, EM_SETUNDOLIMIT, uUndoLimit, 0L); } void SetPalette(HPALETTE hPalette) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETPALETTE, (WPARAM)hPalette, 0L); } int GetTextEx(GETTEXTEX* pGetTextEx, LPTSTR lpstrText) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETTEXTEX, (WPARAM)pGetTextEx, (LPARAM)lpstrText); } int GetTextEx(LPTSTR lpstrText, int nTextLen, DWORD dwFlags = GT_DEFAULT, UINT uCodePage = CP_ACP, LPCSTR lpDefaultChar = NULL, LPBOOL lpUsedDefChar = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); GETTEXTEX gte = {}; gte.cb = nTextLen * sizeof(TCHAR); gte.codepage = uCodePage; gte.flags = dwFlags; gte.lpDefaultChar = lpDefaultChar; gte.lpUsedDefChar = lpUsedDefChar; return (int)::SendMessage(this->m_hWnd, EM_GETTEXTEX, (WPARAM)>e, (LPARAM)lpstrText); } int GetTextLengthEx(GETTEXTLENGTHEX* pGetTextLengthEx) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)pGetTextLengthEx, 0L); } int GetTextLengthEx(DWORD dwFlags = GTL_DEFAULT, UINT uCodePage = CP_ACP) const { ATLASSERT(::IsWindow(this->m_hWnd)); GETTEXTLENGTHEX gtle = {}; gtle.codepage = uCodePage; gtle.flags = dwFlags; return (int)::SendMessage(this->m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM)>le, 0L); } EDITWORDBREAKPROC GetWordBreakProc() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (EDITWORDBREAKPROC)::SendMessage(this->m_hWnd, EM_GETWORDBREAKPROC, 0, 0L); } void SetWordBreakProc(EDITWORDBREAKPROC ewbprc) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc); } int SetTextEx(SETTEXTEX* pSetTextEx, LPCTSTR lpstrText) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_SETTEXTEX, (WPARAM)pSetTextEx, (LPARAM)lpstrText); } int SetTextEx(LPCTSTR lpstrText, DWORD dwFlags = ST_DEFAULT, UINT uCodePage = CP_ACP) { ATLASSERT(::IsWindow(this->m_hWnd)); SETTEXTEX ste = {}; ste.flags = dwFlags; ste.codepage = uCodePage; return (int)::SendMessage(this->m_hWnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpstrText); } int GetEditStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_GETEDITSTYLE, 0, 0L); } int SetEditStyle(int nStyle, int nMask = -1) { ATLASSERT(::IsWindow(this->m_hWnd)); if(nMask == -1) nMask = nStyle; // set everything specified return (int)::SendMessage(this->m_hWnd, EM_SETEDITSTYLE, nStyle, nMask); } BOOL SetFontSize(int nFontSizeDelta) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((nFontSizeDelta >= -1637) && (nFontSizeDelta <= 1638)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETFONTSIZE, nFontSizeDelta, 0L); } void GetScrollPos(LPPOINT lpPoint) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpPoint != NULL); ::SendMessage(this->m_hWnd, EM_GETSCROLLPOS, 0, (LPARAM)lpPoint); } void SetScrollPos(LPPOINT lpPoint) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpPoint != NULL); ::SendMessage(this->m_hWnd, EM_SETSCROLLPOS, 0, (LPARAM)lpPoint); } BOOL GetZoom(int& nNum, int& nDen) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_GETZOOM, (WPARAM)&nNum, (LPARAM)&nDen); } BOOL SetZoom(int nNum, int nDen) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((nNum >= 0) && (nNum <= 64)); ATLASSERT((nDen >= 0) && (nDen <= 64)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETZOOM, nNum, nDen); } BOOL SetZoomOff() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETZOOM, 0, 0L); } void SetMargins(UINT nLeft, UINT nRight, WORD wFlags = EC_LEFTMARGIN | EC_RIGHTMARGIN) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETMARGINS, wFlags, MAKELONG(nLeft, nRight)); } WORD GetTypographyOptions() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (WORD)::SendMessage(this->m_hWnd, EM_GETTYPOGRAPHYOPTIONS, 0, 0L); } BOOL SetTypographyOptions(WORD wOptions, WORD wMask) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETTYPOGRAPHYOPTIONS, wOptions, wMask); } // Operations void LimitText(LONG nChars = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_EXLIMITTEXT, 0, nChars); } int LineFromChar(LONG nIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_EXLINEFROMCHAR, 0, nIndex); } POINT PosFromChar(LONG nChar) const { ATLASSERT(::IsWindow(this->m_hWnd)); POINT point = {}; ::SendMessage(this->m_hWnd, EM_POSFROMCHAR, (WPARAM)&point, nChar); return point; } int CharFromPos(POINT pt) const { ATLASSERT(::IsWindow(this->m_hWnd)); POINTL ptl = { pt.x, pt.y }; return (int)::SendMessage(this->m_hWnd, EM_CHARFROMPOS, 0, (LPARAM)&ptl); } void EmptyUndoBuffer() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0L); } int LineIndex(int nLine = -1) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_LINEINDEX, nLine, 0L); } int LineLength(int nLine = -1) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, EM_LINELENGTH, nLine, 0L); } BOOL LineScroll(int nLines) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_LINESCROLL, 0, nLines); } void ReplaceSel(LPCTSTR lpszNewText, BOOL bCanUndo = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_REPLACESEL, (WPARAM) bCanUndo, (LPARAM)lpszNewText); } void SetRect(LPCRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); } BOOL DisplayBand(LPRECT pDisplayRect) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_DISPLAYBAND, 0, (LPARAM)pDisplayRect); } LONG FindText(DWORD dwFlags, FINDTEXT& ft) const { ATLASSERT(::IsWindow(this->m_hWnd)); #ifdef _UNICODE return (LONG)::SendMessage(this->m_hWnd, EM_FINDTEXTW, dwFlags, (LPARAM)&ft); #else return (LONG)::SendMessage(this->m_hWnd, EM_FINDTEXT, dwFlags, (LPARAM)&ft); #endif } LONG FindText(DWORD dwFlags, FINDTEXTEX& ft) const { ATLASSERT(::IsWindow(this->m_hWnd)); #ifdef _UNICODE return (LONG)::SendMessage(this->m_hWnd, EM_FINDTEXTEXW, dwFlags, (LPARAM)&ft); #else return (LONG)::SendMessage(this->m_hWnd, EM_FINDTEXTEX, dwFlags, (LPARAM)&ft); #endif } LONG FormatRange(FORMATRANGE& fr, BOOL bDisplay = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (LONG)::SendMessage(this->m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)&fr); } LONG FormatRange(FORMATRANGE* pFormatRange, BOOL bDisplay = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (LONG)::SendMessage(this->m_hWnd, EM_FORMATRANGE, bDisplay, (LPARAM)pFormatRange); } void HideSelection(BOOL bHide = TRUE, BOOL bChangeStyle = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_HIDESELECTION, bHide, bChangeStyle); } void PasteSpecial(UINT uClipFormat, DWORD dwAspect = 0, HMETAFILE hMF = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); REPASTESPECIAL reps = { dwAspect, (DWORD_PTR)hMF }; ::SendMessage(this->m_hWnd, EM_PASTESPECIAL, uClipFormat, (LPARAM)&reps); } void RequestResize() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_REQUESTRESIZE, 0, 0L); } LONG StreamIn(UINT uFormat, EDITSTREAM& es) { ATLASSERT(::IsWindow(this->m_hWnd)); return (LONG)::SendMessage(this->m_hWnd, EM_STREAMIN, uFormat, (LPARAM)&es); } LONG StreamOut(UINT uFormat, EDITSTREAM& es) { ATLASSERT(::IsWindow(this->m_hWnd)); return (LONG)::SendMessage(this->m_hWnd, EM_STREAMOUT, uFormat, (LPARAM)&es); } DWORD FindWordBreak(int nCode, LONG nStartChar) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_FINDWORDBREAK, nCode, nStartChar); } // Additional operations void ScrollCaret() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SCROLLCARET, 0, 0L); } int InsertText(long nInsertAfterChar, LPCTSTR lpstrText, BOOL bCanUndo = FALSE) { int nRet = SetSel(nInsertAfterChar, nInsertAfterChar); ReplaceSel(lpstrText, bCanUndo); return nRet; } int AppendText(LPCTSTR lpstrText, BOOL bCanUndo = FALSE) { return InsertText(this->GetWindowTextLength(), lpstrText, bCanUndo); } // Clipboard operations BOOL Undo() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_UNDO, 0, 0L); } void Clear() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_CLEAR, 0, 0L); } void Copy() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_COPY, 0, 0L); } void Cut() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_CUT, 0, 0L); } void Paste() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, WM_PASTE, 0, 0L); } // OLE support IRichEditOle* GetOleInterface() const { ATLASSERT(::IsWindow(this->m_hWnd)); IRichEditOle *pRichEditOle = NULL; ::SendMessage(this->m_hWnd, EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle); return pRichEditOle; } BOOL SetOleCallback(IRichEditOleCallback* pCallback) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETOLECALLBACK, 0, (LPARAM)pCallback); } BOOL Redo() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_REDO, 0, 0L); } void StopGroupTyping() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_STOPGROUPTYPING, 0, 0L); } void ShowScrollBar(int nBarType, BOOL bVisible = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SHOWSCROLLBAR, nBarType, bVisible); } BOOL SetTabStops(int nTabStops, LPINT rgTabStops) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); } BOOL SetTabStops() { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, 0, 0L); } BOOL SetTabStops(const int& cxEachStop) // takes an 'int' { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); } #if (_RICHEDIT_VER >= 0x0800) AutoCorrectProc GetAutoCorrectProc() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (AutoCorrectProc)::SendMessage(this->m_hWnd, EM_GETAUTOCORRECTPROC, 0, 0L); } BOOL SetAutoCorrectProc(AutoCorrectProc pfn) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETAUTOCORRECTPROC, (WPARAM)pfn, 0L); } BOOL CallAutoCorrectProc(WCHAR ch) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_CALLAUTOCORRECTPROC, (WPARAM)ch, 0L); } DWORD GetEditStyleEx() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_GETEDITSTYLEEX, 0, 0L); } DWORD SetEditStyleEx(DWORD dwStyleEx, DWORD dwMask) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_SETEDITSTYLEEX, dwStyleEx, dwMask); } DWORD GetStoryType(int nStoryIndex) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_GETSTORYTYPE, nStoryIndex, 0L); } DWORD SetStoryType(int nStoryIndex, DWORD dwStoryType) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, EM_SETSTORYTYPE, nStoryIndex, dwStoryType); } DWORD GetEllipsisMode() const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwMode = 0; BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, EM_GETELLIPSISMODE, 0, (LPARAM)&dwMode); (void)bRet; // avoid level 4 warning ATLASSERT(bRet != FALSE); return dwMode; } BOOL SetEllipsisMode(DWORD dwEllipsisMode) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETELLIPSISMODE, 0, dwEllipsisMode); } BOOL GetEllipsisState() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_GETELLIPSISSTATE, 0, 0L); } BOOL GetTouchOptions(int nTouchOptions) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_GETTOUCHOPTIONS, nTouchOptions, 0L); } void SetTouchOptions(int nTouchOptions, BOOL bEnable) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, EM_SETTOUCHOPTIONS, nTouchOptions, bEnable); } HRESULT InsertTable(TABLEROWPARMS* pRowParams, TABLECELLPARMS* pCellParams) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HRESULT)::SendMessage(this->m_hWnd, EM_INSERTTABLE, (WPARAM)pRowParams, (LPARAM)pCellParams); } HRESULT GetTableParams(TABLEROWPARMS* pRowParams, TABLECELLPARMS* pCellParams) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HRESULT)::SendMessage(this->m_hWnd, EM_GETTABLEPARMS, (WPARAM)pRowParams, (LPARAM)pCellParams); } HRESULT SetTableParams(TABLEROWPARMS* pRowParams, TABLECELLPARMS* pCellParams) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HRESULT)::SendMessage(this->m_hWnd, EM_SETTABLEPARMS, (WPARAM)pRowParams, (LPARAM)pCellParams); } HRESULT InsertImage(RICHEDIT_IMAGE_PARAMETERS* pParams) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HRESULT)::SendMessage(this->m_hWnd, EM_INSERTIMAGE, 0, (LPARAM)pParams); } BOOL SetUiaName(LPCTSTR lpstrName) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, EM_SETUIANAME, 0, (LPARAM)lpstrName); } #endif // (_RICHEDIT_VER >= 0x0800) }; typedef CRichEditCtrlT CRichEditCtrl; /////////////////////////////////////////////////////////////////////////////// // CRichEditCommands - message handlers for standard EDIT commands // Chain to CRichEditCommands message map. Your class must also derive from CRichEditCtrl. // Example: // class CMyRichEdit : public CWindowImpl, // public CRichEditCommands // { // public: // BEGIN_MSG_MAP(CMyRichEdit) // // your handlers... // CHAIN_MSG_MAP_ALT(CRichEditCommands, 1) // END_MSG_MAP() // // other stuff... // }; template class CRichEditCommands : public CEditCommands< T > { public: BEGIN_MSG_MAP(CRichEditCommands< T >) ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_EDIT_CLEAR, CEditCommands< T >::OnEditClear) COMMAND_ID_HANDLER(ID_EDIT_CLEAR_ALL, CEditCommands< T >::OnEditClearAll) COMMAND_ID_HANDLER(ID_EDIT_COPY, CEditCommands< T >::OnEditCopy) COMMAND_ID_HANDLER(ID_EDIT_CUT, CEditCommands< T >::OnEditCut) COMMAND_ID_HANDLER(ID_EDIT_PASTE, CEditCommands< T >::OnEditPaste) COMMAND_ID_HANDLER(ID_EDIT_SELECT_ALL, CEditCommands< T >::OnEditSelectAll) COMMAND_ID_HANDLER(ID_EDIT_UNDO, CEditCommands< T >::OnEditUndo) COMMAND_ID_HANDLER(ID_EDIT_REDO, OnEditRedo) END_MSG_MAP() LRESULT OnEditRedo(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->Redo(); return 0; } // State (update UI) helpers BOOL CanCut() const { return HasSelection(); } BOOL CanCopy() const { return HasSelection(); } BOOL CanClear() const { return HasSelection(); } // Implementation BOOL HasSelection() const { const T* pT = static_cast(this); return (pT->GetSelectionType() != SEL_EMPTY); } }; /////////////////////////////////////////////////////////////////////////////// // CDragListBox template class CDragListBoxT : public CListBoxT< TBase > { public: // Constructors CDragListBoxT(HWND hWnd = NULL) : CListBoxT< TBase >(hWnd) { } CDragListBoxT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { HWND hWnd = TBase::Create(TBase::GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); if(hWnd != NULL) MakeDragList(); return hWnd; } // Operations BOOL MakeDragList() { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((this->GetStyle() & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == 0); return ::MakeDragList(this->m_hWnd); } int LBItemFromPt(POINT pt, BOOL bAutoScroll = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return ::LBItemFromPt(this->m_hWnd, pt, bAutoScroll); } void DrawInsert(int nItem) { ATLASSERT(::IsWindow(this->m_hWnd)); ::DrawInsert(this->GetParent(), this->m_hWnd, nItem); } static UINT GetDragListMessage() { static UINT uDragListMessage = 0; if(uDragListMessage == 0) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CDragListBox::GetDragListMessage.\n")); ATLASSERT(FALSE); return 0; } if(uDragListMessage == 0) uDragListMessage = ::RegisterWindowMessage(DRAGLISTMSGSTRING); lock.Unlock(); } ATLASSERT(uDragListMessage != 0); return uDragListMessage; } }; typedef CDragListBoxT CDragListBox; template class CDragListNotifyImpl { public: BEGIN_MSG_MAP(CDragListNotifyImpl< T >) MESSAGE_HANDLER(CDragListBox::GetDragListMessage(), OnDragListNotify) END_MSG_MAP() LRESULT OnDragListNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { (void)uMsg; // avoid level 4 warning ATLASSERT(uMsg == CDragListBox::GetDragListMessage()); T* pT = static_cast(this); LPDRAGLISTINFO lpDragListInfo = (LPDRAGLISTINFO)lParam; LRESULT lRet = 0; switch(lpDragListInfo->uNotification) { case DL_BEGINDRAG: lRet = (LPARAM)pT->OnBeginDrag((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); break; case DL_CANCELDRAG: pT->OnCancelDrag((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); break; case DL_DRAGGING: lRet = (LPARAM)pT->OnDragging((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); break; case DL_DROPPED: pT->OnDropped((int)wParam, lpDragListInfo->hWnd, lpDragListInfo->ptCursor); break; default: ATLTRACE2(atlTraceUI, 0, _T("Unknown DragListBox notification\n")); bHandled = FALSE; // don't handle it break; } return lRet; } // Overrideables BOOL OnBeginDrag(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) { return TRUE; // allow dragging } void OnCancelDrag(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) { // nothing to do } int OnDragging(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) { return 0; // don't change cursor } void OnDropped(int /*nCtlID*/, HWND /*hWndDragList*/, POINT /*ptCursor*/) { // nothing to do } }; /////////////////////////////////////////////////////////////////////////////// // CReBarCtrl template class CReBarCtrlT : public TBase { public: // Constructors CReBarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CReBarCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return REBARCLASSNAME; } UINT GetBandCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, RB_GETBANDCOUNT, 0, 0L); } BOOL GetBandInfo(int nBand, LPREBARBANDINFO lprbbi) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_GETBANDINFO, nBand, (LPARAM)lprbbi); } BOOL SetBandInfo(int nBand, LPREBARBANDINFO lprbbi) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_SETBANDINFO, nBand, (LPARAM)lprbbi); } BOOL GetBarInfo(LPREBARINFO lprbi) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_GETBARINFO, 0, (LPARAM)lprbi); } BOOL SetBarInfo(LPREBARINFO lprbi) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_SETBARINFO, 0, (LPARAM)lprbi); } CImageList GetImageList() const { ATLASSERT(::IsWindow(this->m_hWnd)); REBARINFO rbi = {}; rbi.cbSize = sizeof(REBARINFO); rbi.fMask = RBIM_IMAGELIST; BOOL bRet = (BOOL)::SendMessage(this->m_hWnd, RB_GETBARINFO, 0, (LPARAM)&rbi); return CImageList((bRet != FALSE) ? rbi.himl : NULL); } BOOL SetImageList(HIMAGELIST hImageList) { ATLASSERT(::IsWindow(this->m_hWnd)); REBARINFO rbi = {}; rbi.cbSize = sizeof(REBARINFO); rbi.fMask = RBIM_IMAGELIST; rbi.himl = hImageList; return (BOOL)::SendMessage(this->m_hWnd, RB_SETBARINFO, 0, (LPARAM)&rbi); } UINT GetRowCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, RB_GETROWCOUNT, 0, 0L); } UINT GetRowHeight(int nBand) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, RB_GETROWHEIGHT, nBand, 0L); } COLORREF GetTextColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, RB_GETTEXTCOLOR, 0, 0L); } COLORREF SetTextColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, RB_SETTEXTCOLOR, 0, (LPARAM)clr); } COLORREF GetBkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, RB_GETBKCOLOR, 0, 0L); } COLORREF SetBkColor(COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, RB_SETBKCOLOR, 0, (LPARAM)clr); } UINT GetBarHeight() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (UINT)::SendMessage(this->m_hWnd, RB_GETBARHEIGHT, 0, 0L); } BOOL GetRect(int nBand, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_GETRECT, nBand, (LPARAM)lpRect); } CToolTipCtrl GetToolTips() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CToolTipCtrl((HWND)::SendMessage(this->m_hWnd, RB_GETTOOLTIPS, 0, 0L)); } void SetToolTips(HWND hwndToolTip) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_SETTOOLTIPS, (WPARAM)hwndToolTip, 0L); } void GetBandBorders(int nBand, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpRect != NULL); ::SendMessage(this->m_hWnd, RB_GETBANDBORDERS, nBand, (LPARAM)lpRect); } BOOL GetColorScheme(LPCOLORSCHEME lpColorScheme) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpColorScheme != NULL); return (BOOL)::SendMessage(this->m_hWnd, RB_GETCOLORSCHEME, 0, (LPARAM)lpColorScheme); } void SetColorScheme(LPCOLORSCHEME lpColorScheme) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpColorScheme != NULL); ::SendMessage(this->m_hWnd, RB_SETCOLORSCHEME, 0, (LPARAM)lpColorScheme); } HPALETTE GetPalette() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HPALETTE)::SendMessage(this->m_hWnd, RB_GETPALETTE, 0, 0L); } HPALETTE SetPalette(HPALETTE hPalette) { ATLASSERT(::IsWindow(this->m_hWnd)); return (HPALETTE)::SendMessage(this->m_hWnd, RB_SETPALETTE, 0, (LPARAM)hPalette); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_SETUNICODEFORMAT, bUnicode, 0L); } // requires uxtheme.h to be included to use MARGINS struct #ifndef _UXTHEME_H_ typedef struct _MARGINS* PMARGINS; #endif // !_UXTHEME_H_ void GetBandMargins(PMARGINS pMargins) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_GETBANDMARGINS, 0, (LPARAM)pMargins); } void SetWindowTheme(LPCWSTR lpstrTheme) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); } DWORD GetExtendedStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, RB_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwStyle, DWORD dwMask) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, RB_SETEXTENDEDSTYLE, dwMask, dwStyle); } // Operations BOOL InsertBand(int nBand, LPREBARBANDINFO lprbbi) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_INSERTBAND, nBand, (LPARAM)lprbbi); } BOOL AddBand(LPREBARBANDINFO lprbbi) { return InsertBand(-1, lprbbi); } BOOL DeleteBand(int nBand) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_DELETEBAND, nBand, 0L); } ATL::CWindow SetNotifyWnd(HWND hWnd) { ATLASSERT(::IsWindow(this->m_hWnd)); return ATL::CWindow((HWND)::SendMessage(this->m_hWnd, RB_SETPARENT, (WPARAM)hWnd, 0L)); } void BeginDrag(int nBand, DWORD dwPos) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_BEGINDRAG, nBand, dwPos); } void BeginDrag(int nBand, int xPos, int yPos) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_BEGINDRAG, nBand, MAKELPARAM(xPos, yPos)); } void EndDrag() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_ENDDRAG, 0, 0L); } void DragMove(DWORD dwPos) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_DRAGMOVE, 0, dwPos); } void DragMove(int xPos, int yPos) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_DRAGMOVE, 0, MAKELPARAM(xPos, yPos)); } void GetDropTarget(IDropTarget** ppDropTarget) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_GETDROPTARGET, 0, (LPARAM)ppDropTarget); } void MaximizeBand(int nBand, BOOL bIdeal = FALSE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_MAXIMIZEBAND, nBand, bIdeal); } void MinimizeBand(int nBand) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_MINIMIZEBAND, nBand, 0L); } BOOL SizeToRect(LPRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_SIZETORECT, 0, (LPARAM)lpRect); } int IdToIndex(UINT uBandID) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, RB_IDTOINDEX, uBandID, 0L); } int HitTest(LPRBHITTESTINFO lprbht) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, RB_HITTEST, 0, (LPARAM)lprbht); } BOOL ShowBand(int nBand, BOOL bShow) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_SHOWBAND, nBand, bShow); } BOOL MoveBand(int nBand, int nNewPos) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((nNewPos >= 0) && (nNewPos <= ((int)GetBandCount() - 1))); return (BOOL)::SendMessage(this->m_hWnd, RB_MOVEBAND, nBand, nNewPos); } void PushChevron(int nBand, LPARAM lAppValue) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, RB_PUSHCHEVRON, nBand, lAppValue); } // Extra operations void LockBands(bool bLock) { int nBandCount = GetBandCount(); for(int i =0; i < nBandCount; i++) { REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO() }; rbbi.fMask = RBBIM_STYLE; BOOL bRet = GetBandInfo(i, &rbbi); ATLASSERT(bRet); if((rbbi.fStyle & RBBS_GRIPPERALWAYS) == 0) { rbbi.fStyle |= RBBS_GRIPPERALWAYS; bRet = SetBandInfo(i, &rbbi); ATLASSERT(bRet); rbbi.fStyle &= ~RBBS_GRIPPERALWAYS; } if(bLock) rbbi.fStyle |= RBBS_NOGRIPPER; else rbbi.fStyle &= ~RBBS_NOGRIPPER; bRet = SetBandInfo(i, &rbbi); ATLASSERT(bRet); } } #if (_WIN32_WINNT >= 0x0600) BOOL SetBandWidth(int nBand, int cxWidth) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, RB_SETBANDWIDTH, nBand, cxWidth); } #endif // (_WIN32_WINNT >= 0x0600) }; typedef CReBarCtrlT CReBarCtrl; /////////////////////////////////////////////////////////////////////////////// // CComboBoxEx template class CComboBoxExT : public CComboBoxT< TBase > { public: // Constructors CComboBoxExT(HWND hWnd = NULL) : CComboBoxT< TBase >(hWnd) { } CComboBoxExT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return WC_COMBOBOXEX; } CImageList GetImageList() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, CBEM_GETIMAGELIST, 0, 0L)); } CImageList SetImageList(HIMAGELIST hImageList) { ATLASSERT(::IsWindow(this->m_hWnd)); return CImageList((HIMAGELIST)::SendMessage(this->m_hWnd, CBEM_SETIMAGELIST, 0, (LPARAM)hImageList)); } DWORD GetExtendedStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, CBEM_GETEXTENDEDSTYLE, 0, 0L); } DWORD SetExtendedStyle(DWORD dwExMask, DWORD dwExStyle) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, CBEM_SETEXTENDEDSTYLE, dwExMask, dwExStyle); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CBEM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CBEM_SETUNICODEFORMAT, bUnicode, 0L); } void SetWindowTheme(LPCWSTR lpstrTheme) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, CBEM_SETWINDOWTHEME, 0, (LPARAM)lpstrTheme); } // Operations int InsertItem(const COMBOBOXEXITEM* lpcCBItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)lpcCBItem); } int InsertItem(UINT nMask, int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, int iOverlay, LPARAM lParam) { ATLASSERT(::IsWindow(this->m_hWnd)); COMBOBOXEXITEM cbex = {}; cbex.mask = nMask; cbex.iItem = nIndex; cbex.pszText = (LPTSTR) lpszItem; cbex.iImage = nImage; cbex.iSelectedImage = nSelImage; cbex.iIndent = iIndent; cbex.iOverlay = iOverlay; cbex.lParam = lParam; return (int)::SendMessage(this->m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); } int InsertItem(int nIndex, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, LPARAM lParam = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); COMBOBOXEXITEM cbex = {}; cbex.mask = CBEIF_TEXT | CBEIF_IMAGE | CBEIF_SELECTEDIMAGE | CBEIF_INDENT | CBEIF_LPARAM; cbex.iItem = nIndex; cbex.pszText = (LPTSTR) lpszItem; cbex.iImage = nImage; cbex.iSelectedImage = nSelImage; cbex.iIndent = iIndent; cbex.lParam = lParam; return (int)::SendMessage(this->m_hWnd, CBEM_INSERTITEM, 0, (LPARAM)&cbex); } int AddItem(UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, int iOverlay, LPARAM lParam) { return InsertItem(nMask, -1, lpszItem, nImage, nSelImage, iIndent, iOverlay, lParam); } int AddItem(LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, LPARAM lParam = 0) { return InsertItem(-1, lpszItem, nImage, nSelImage, iIndent, lParam); } int DeleteItem(int nIndex) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, CBEM_DELETEITEM, nIndex, 0L); } BOOL GetItem(PCOMBOBOXEXITEM pCBItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CBEM_GETITEM, 0, (LPARAM)pCBItem); } BOOL SetItem(const COMBOBOXEXITEM* lpcCBItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CBEM_SETITEM, 0, (LPARAM)lpcCBItem); } int SetItem(int nIndex, UINT nMask, LPCTSTR lpszItem, int nImage, int nSelImage, int iIndent, int iOverlay, LPARAM lParam) { ATLASSERT(::IsWindow(this->m_hWnd)); COMBOBOXEXITEM cbex = {}; cbex.mask = nMask; cbex.iItem = nIndex; cbex.pszText = (LPTSTR) lpszItem; cbex.iImage = nImage; cbex.iSelectedImage = nSelImage; cbex.iIndent = iIndent; cbex.iOverlay = iOverlay; cbex.lParam = lParam; return (int)::SendMessage(this->m_hWnd, CBEM_SETITEM, 0, (LPARAM)&cbex); } BOOL GetItemText(int nIndex, LPTSTR lpszItem, int nLen) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(lpszItem != NULL); COMBOBOXEXITEM cbex = {}; cbex.mask = CBEIF_TEXT; cbex.iItem = nIndex; cbex.pszText = lpszItem; cbex.cchTextMax = nLen; return (BOOL)::SendMessage(this->m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); } BOOL GetItemText(int nIndex, BSTR& bstrText) const { USES_CONVERSION; ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(bstrText == NULL); COMBOBOXEXITEM cbex = {}; cbex.mask = CBEIF_TEXT; cbex.iItem = nIndex; LPTSTR lpstrText = NULL; BOOL bRet = FALSE; for(int nLen = 256; ; nLen *= 2) { ATLTRY(lpstrText = new TCHAR[nLen]); if(lpstrText == NULL) break; lpstrText[0] = NULL; cbex.pszText = lpstrText; cbex.cchTextMax = nLen; bRet = (BOOL)::SendMessage(this->m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); if(!bRet || (lstrlen(cbex.pszText) < (nLen - 1))) break; delete [] lpstrText; lpstrText = NULL; } if(lpstrText != NULL) { if(bRet) bstrText = ::SysAllocString(T2OLE(lpstrText)); delete [] lpstrText; } return (bstrText != NULL) ? TRUE : FALSE; } #ifdef __ATLSTR_H__ BOOL GetItemText(int nIndex, ATL::CString& strText) const { ATLASSERT(::IsWindow(this->m_hWnd)); COMBOBOXEXITEM cbex = {}; cbex.mask = CBEIF_TEXT; cbex.iItem = nIndex; strText.Empty(); BOOL bRet = FALSE; for(int nLen = 256; ; nLen *= 2) { cbex.pszText = strText.GetBufferSetLength(nLen); if(cbex.pszText == NULL) { bRet = FALSE; break; } cbex.cchTextMax = nLen; bRet = (BOOL)::SendMessage(this->m_hWnd, CBEM_GETITEM, 0, (LPARAM)&cbex); if(!bRet || (lstrlen(cbex.pszText) < (nLen - 1))) break; } strText.ReleaseBuffer(); return bRet; } #endif // __ATLSTR_H__ BOOL SetItemText(int nIndex, LPCTSTR lpszItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return SetItem(nIndex, CBEIF_TEXT, lpszItem, 0, 0, 0, 0, 0); } CComboBox GetComboCtrl() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CComboBox((HWND)::SendMessage(this->m_hWnd, CBEM_GETCOMBOCONTROL, 0, 0L)); } CEdit GetEditCtrl() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CEdit((HWND)::SendMessage(this->m_hWnd, CBEM_GETEDITCONTROL, 0, 0L)); } BOOL HasEditChanged() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, CBEM_HASEDITCHANGED, 0, 0L); } // Non-functional int AddString(LPCTSTR /*lpszItem*/) { ATLASSERT(FALSE); // Not available in CComboBoxEx; use InsertItem return 0; } int InsertString(int /*nIndex*/, LPCTSTR /*lpszString*/) { ATLASSERT(FALSE); // Not available in CComboBoxEx; use InsertItem return 0; } int Dir(UINT /*attr*/, LPCTSTR /*lpszWildCard*/) { ATLASSERT(FALSE); // Not available in CComboBoxEx return 0; } int FindString(int /*nStartAfter*/, LPCTSTR /*lpszString*/) const { ATLASSERT(FALSE); // Not available in CComboBoxEx; try FindStringExact return 0; } }; typedef CComboBoxExT CComboBoxEx; /////////////////////////////////////////////////////////////////////////////// // CMonthCalendarCtrl template class CMonthCalendarCtrlT : public TBase { public: // Constructors CMonthCalendarCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CMonthCalendarCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return MONTHCAL_CLASS; } COLORREF GetColor(int nColorType) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, MCM_GETCOLOR, nColorType, 0L); } COLORREF SetColor(int nColorType, COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, MCM_SETCOLOR, nColorType, clr); } BOOL GetCurSel(LPSYSTEMTIME lpSysTime) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_GETCURSEL, 0, (LPARAM)lpSysTime); } BOOL SetCurSel(LPSYSTEMTIME lpSysTime) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_SETCURSEL, 0, (LPARAM)lpSysTime); } int GetFirstDayOfWeek(BOOL* pbLocaleVal = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, MCM_GETFIRSTDAYOFWEEK, 0, 0L); if(pbLocaleVal != NULL) *pbLocaleVal = (BOOL)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); } int SetFirstDayOfWeek(int nDay, BOOL* pbLocaleVal = NULL) { ATLASSERT(::IsWindow(this->m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(this->m_hWnd, MCM_SETFIRSTDAYOFWEEK, 0, nDay); if(pbLocaleVal != NULL) *pbLocaleVal = (BOOL)HIWORD(dwRet); return (int)(short)LOWORD(dwRet); } int GetMaxSelCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, MCM_GETMAXSELCOUNT, 0, 0L); } BOOL SetMaxSelCount(int nMax) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_SETMAXSELCOUNT, nMax, 0L); } int GetMonthDelta() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, MCM_GETMONTHDELTA, 0, 0L); } int SetMonthDelta(int nDelta) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, MCM_SETMONTHDELTA, nDelta, 0L); } DWORD GetRange(LPSYSTEMTIME lprgSysTimeArray) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, MCM_GETRANGE, 0, (LPARAM)lprgSysTimeArray); } BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_SETRANGE, dwFlags, (LPARAM)lprgSysTimeArray); } BOOL GetSelRange(LPSYSTEMTIME lprgSysTimeArray) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_GETSELRANGE, 0, (LPARAM)lprgSysTimeArray); } BOOL SetSelRange(LPSYSTEMTIME lprgSysTimeArray) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_SETSELRANGE, 0, (LPARAM)lprgSysTimeArray); } BOOL GetToday(LPSYSTEMTIME lpSysTime) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_GETTODAY, 0, (LPARAM)lpSysTime); } void SetToday(LPSYSTEMTIME lpSysTime) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, MCM_SETTODAY, 0, (LPARAM)lpSysTime); } BOOL GetMinReqRect(LPRECT lpRectInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_GETMINREQRECT, 0, (LPARAM)lpRectInfo); } int GetMaxTodayWidth() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, MCM_GETMAXTODAYWIDTH, 0, 0L); } BOOL GetUnicodeFormat() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_GETUNICODEFORMAT, 0, 0L); } BOOL SetUnicodeFormat(BOOL bUnicode = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_SETUNICODEFORMAT, bUnicode, 0L); } #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) DWORD GetCurrentView() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, MCM_GETCURRENTVIEW, 0, 0L); } BOOL SetCurrentView(DWORD dwView) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_SETCURRENTVIEW, 0, dwView); } DWORD GetCalendarCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, MCM_GETCALENDARCOUNT, 0, 0L); } BOOL GetCalendarGridInfo(PMCGRIDINFO pGridInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_GETCALENDARGRIDINFO, 0, (LPARAM)pGridInfo); } CALID GetCALID() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (CALID)::SendMessage(this->m_hWnd, MCM_GETCALID, 0, 0L); } void SetCALID(CALID calid) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, MCM_SETCALID, (LPARAM)calid, 0L); } int GetCalendarBorder() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, MCM_GETCALENDARBORDER, 0, 0L); } void SetCalendarBorder(int cxyBorder, BOOL bSet = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, MCM_SETCALENDARBORDER, (WPARAM)bSet, (LPARAM)cxyBorder); } #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) // Operations int GetMonthRange(DWORD dwFlags, LPSYSTEMTIME lprgSysTimeArray) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, MCM_GETMONTHRANGE, dwFlags, (LPARAM)lprgSysTimeArray); } BOOL SetDayState(int nMonths, LPMONTHDAYSTATE lpDayStateArray) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, MCM_SETDAYSTATE, nMonths, (LPARAM)lpDayStateArray); } DWORD HitTest(PMCHITTESTINFO pMCHitTest) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, MCM_HITTEST, 0, (LPARAM)pMCHitTest); } #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) void SizeRectToMin(LPRECT lpRect) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, MCM_SIZERECTTOMIN, 0, (LPARAM)lpRect); } #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) }; typedef CMonthCalendarCtrlT CMonthCalendarCtrl; /////////////////////////////////////////////////////////////////////////////// // CDateTimePickerCtrl template class CDateTimePickerCtrlT : public TBase { public: // Constructors CDateTimePickerCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CDateTimePickerCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Operations static LPCTSTR GetWndClassName() { return DATETIMEPICK_CLASS; } BOOL SetFormat(LPCTSTR lpszFormat) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, DTM_SETFORMAT, 0, (LPARAM)lpszFormat); } COLORREF GetMonthCalColor(int nColorType) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, DTM_GETMCCOLOR, nColorType, 0L); } COLORREF SetMonthCalColor(int nColorType, COLORREF clr) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, DTM_SETMCCOLOR, nColorType, clr); } DWORD GetRange(LPSYSTEMTIME lpSysTimeArray) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, DTM_GETRANGE, 0, (LPARAM)lpSysTimeArray); } BOOL SetRange(DWORD dwFlags, LPSYSTEMTIME lpSysTimeArray) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, DTM_SETRANGE, dwFlags, (LPARAM)lpSysTimeArray); } DWORD GetSystemTime(LPSYSTEMTIME lpSysTime) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)lpSysTime); } BOOL SetSystemTime(DWORD dwFlags, LPSYSTEMTIME lpSysTime) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, DTM_SETSYSTEMTIME, dwFlags, (LPARAM)lpSysTime); } CMonthCalendarCtrl GetMonthCal() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CMonthCalendarCtrl((HWND)::SendMessage(this->m_hWnd, DTM_GETMONTHCAL, 0, 0L)); } CFontHandle GetMonthCalFont() const { ATLASSERT(::IsWindow(this->m_hWnd)); return CFontHandle((HFONT)::SendMessage(this->m_hWnd, DTM_GETMCFONT, 0, 0L)); } void SetMonthCalFont(HFONT hFont, BOOL bRedraw = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, DTM_SETMCFONT, (WPARAM)hFont, MAKELPARAM(bRedraw, 0)); } #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) DWORD GetMonthCalStyle() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, DTM_GETMCSTYLE, 0, 0L); } DWORD SetMonthCalStyle(DWORD dwStyle) { ATLASSERT(::IsWindow(this->m_hWnd)); return (DWORD)::SendMessage(this->m_hWnd, DTM_SETMCSTYLE, 0, (LPARAM)dwStyle); } void GetDateTimePickerInfo(LPDATETIMEPICKERINFO lpPickerInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, DTM_GETDATETIMEPICKERINFO, 0, (LPARAM)lpPickerInfo); } BOOL GetIdealSize(LPSIZE lpSize) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, DTM_GETIDEALSIZE, 0, (LPARAM)lpSize); } void CloseMonthCal() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, DTM_CLOSEMONTHCAL, 0, 0L); } #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) }; typedef CDateTimePickerCtrlT CDateTimePickerCtrl; /////////////////////////////////////////////////////////////////////////////// // CFlatScrollBarImpl - support for flat scroll bars template class CFlatScrollBarImpl { public: // Initialization BOOL FlatSB_Initialize() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::InitializeFlatSB(pT->m_hWnd); } HRESULT FlatSB_Uninitialize() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::UninitializeFlatSB(pT->m_hWnd); } // Flat scroll bar properties BOOL FlatSB_GetScrollProp(UINT uIndex, LPINT lpnValue) const { const T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_GetScrollProp(pT->m_hWnd, uIndex, lpnValue); } BOOL FlatSB_SetScrollProp(UINT uIndex, int nValue, BOOL bRedraw = TRUE) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_SetScrollProp(pT->m_hWnd, uIndex, nValue, bRedraw); } // Attributes int FlatSB_GetScrollPos(int nBar) const { const T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_GetScrollPos(pT->m_hWnd, nBar); } int FlatSB_SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_SetScrollPos(pT->m_hWnd, nBar, nPos, bRedraw); } BOOL FlatSB_GetScrollRange(int nBar, LPINT lpMinPos, LPINT lpMaxPos) const { const T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_GetScrollRange(pT->m_hWnd, nBar, lpMinPos, lpMaxPos); } BOOL FlatSB_SetScrollRange(int nBar, int nMinPos, int nMaxPos, BOOL bRedraw = TRUE) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_SetScrollRange(pT->m_hWnd, nBar, nMinPos, nMaxPos, bRedraw); } BOOL FlatSB_GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) const { const T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_GetScrollInfo(pT->m_hWnd, nBar, lpScrollInfo); } int FlatSB_SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_SetScrollInfo(pT->m_hWnd, nBar, lpScrollInfo, bRedraw); } // Operations BOOL FlatSB_ShowScrollBar(UINT nBar, BOOL bShow = TRUE) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_ShowScrollBar(pT->m_hWnd, nBar, bShow); } BOOL FlatSB_EnableScrollBar(UINT uSBFlags, UINT uArrowFlags = ESB_ENABLE_BOTH) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::FlatSB_EnableScrollBar(pT->m_hWnd, uSBFlags, uArrowFlags); } }; template class CFlatScrollBarT : public TBase, public CFlatScrollBarImpl > { public: CFlatScrollBarT(HWND hWnd = NULL) : TBase(hWnd) { } CFlatScrollBarT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } }; typedef CFlatScrollBarT CFlatScrollBar; /////////////////////////////////////////////////////////////////////////////// // CIPAddressCtrl template class CIPAddressCtrlT : public TBase { public: // Constructors CIPAddressCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CIPAddressCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Atteributes static LPCTSTR GetWndClassName() { return WC_IPADDRESS; } BOOL IsBlank() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, IPM_ISBLANK, 0, 0L); } int GetAddress(LPDWORD lpdwAddress) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, IPM_GETADDRESS, 0, (LPARAM)lpdwAddress); } void SetAddress(DWORD dwAddress) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, IPM_SETADDRESS, 0, dwAddress); } void ClearAddress() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, IPM_CLEARADDRESS, 0, 0L); } void SetRange(int nField, WORD wRange) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, IPM_SETRANGE, nField, wRange); } void SetRange(int nField, BYTE nMin, BYTE nMax) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, IPM_SETRANGE, nField, MAKEIPRANGE(nMin, nMax)); } void SetFocus(int nField) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, IPM_SETFOCUS, nField, 0L); } }; typedef CIPAddressCtrlT CIPAddressCtrl; /////////////////////////////////////////////////////////////////////////////// // CPagerCtrl template class CPagerCtrlT : public TBase { public: // Constructors CPagerCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CPagerCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { return WC_PAGESCROLLER; } int GetButtonSize() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PGM_GETBUTTONSIZE, 0, 0L); } int SetButtonSize(int nButtonSize) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PGM_SETBUTTONSIZE, 0, nButtonSize); } DWORD GetButtonState(int nButton) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((nButton == PGB_TOPORLEFT) || (nButton == PGB_BOTTOMORRIGHT)); return (DWORD)::SendMessage(this->m_hWnd, PGM_GETBUTTONSTATE, 0, nButton); } COLORREF GetBkColor() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, PGM_GETBKCOLOR, 0, 0L); } COLORREF SetBkColor(COLORREF clrBk) { ATLASSERT(::IsWindow(this->m_hWnd)); return (COLORREF)::SendMessage(this->m_hWnd, PGM_SETBKCOLOR, 0, (LPARAM)clrBk); } int GetBorder() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PGM_GETBORDER, 0, 0L); } int SetBorder(int nBorderSize) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PGM_SETBORDER, 0, nBorderSize); } int GetPos() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PGM_GETPOS, 0, 0L); } int SetPos(int nPos) { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, PGM_SETPOS, 0, nPos); } // Operations void SetChild(HWND hWndChild) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, PGM_SETCHILD, 0, (LPARAM)hWndChild); } void ForwardMouse(BOOL bForward = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, PGM_FORWARDMOUSE, bForward, 0L); } void RecalcSize() { ATLASSERT(::IsWindow(this->m_hWnd)); ::SendMessage(this->m_hWnd, PGM_RECALCSIZE, 0, 0L); } void GetDropTarget(IDropTarget** ppDropTarget) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(ppDropTarget != NULL); ::SendMessage(this->m_hWnd, PGM_GETDROPTARGET, 0, (LPARAM)ppDropTarget); } }; typedef CPagerCtrlT CPagerCtrl; /////////////////////////////////////////////////////////////////////////////// // CLinkCtrl - Windows SYSLINK control template class CLinkCtrlT : public TBase { public: // Constructors CLinkCtrlT(HWND hWnd = NULL) : TBase(hWnd) { } CLinkCtrlT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, ATL::_U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL) { return TBase::Create(GetWndClassName(), hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, MenuOrID.m_hMenu, lpCreateParam); } // Attributes static LPCTSTR GetWndClassName() { #ifdef _UNICODE return WC_LINK; #else // !_UNICODE return "SysLink"; #endif // !_UNICODE } int GetIdealHeight(int cxMaxWidth = 0) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LM_GETIDEALHEIGHT, cxMaxWidth, 0L); } BOOL GetItem(PLITEM pLItem) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LM_GETITEM, 0, (LPARAM)pLItem); } BOOL SetItem(PLITEM pLItem) { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LM_SETITEM, 0, (LPARAM)pLItem); } // Vista only int GetIdealSize(SIZE& size, int cxMaxWidth = 0) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (int)::SendMessage(this->m_hWnd, LM_GETIDEALSIZE, cxMaxWidth, (LPARAM)&size); } // Operations BOOL HitTest(PLHITTESTINFO pLHitTestInfo) const { ATLASSERT(::IsWindow(this->m_hWnd)); return (BOOL)::SendMessage(this->m_hWnd, LM_HITTEST, 0, (LPARAM)pLHitTestInfo); } }; typedef CLinkCtrlT CLinkCtrl; /////////////////////////////////////////////////////////////////////////////// // CCustomDraw - MI class for custom-draw support template class CCustomDraw { public: // Message map and handlers BEGIN_MSG_MAP(CCustomDraw< T >) NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) ALT_MSG_MAP(1) REFLECTED_NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnCustomDraw) END_MSG_MAP() // message handler LRESULT OnCustomDraw(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) { T* pT = static_cast(this); pT->SetMsgHandled(TRUE); LPNMCUSTOMDRAW lpNMCustomDraw = (LPNMCUSTOMDRAW)pnmh; DWORD dwRet = 0; switch(lpNMCustomDraw->dwDrawStage) { case CDDS_PREPAINT: dwRet = pT->OnPrePaint(idCtrl, lpNMCustomDraw); break; case CDDS_POSTPAINT: dwRet = pT->OnPostPaint(idCtrl, lpNMCustomDraw); break; case CDDS_PREERASE: dwRet = pT->OnPreErase(idCtrl, lpNMCustomDraw); break; case CDDS_POSTERASE: dwRet = pT->OnPostErase(idCtrl, lpNMCustomDraw); break; case CDDS_ITEMPREPAINT: dwRet = pT->OnItemPrePaint(idCtrl, lpNMCustomDraw); break; case CDDS_ITEMPOSTPAINT: dwRet = pT->OnItemPostPaint(idCtrl, lpNMCustomDraw); break; case CDDS_ITEMPREERASE: dwRet = pT->OnItemPreErase(idCtrl, lpNMCustomDraw); break; case CDDS_ITEMPOSTERASE: dwRet = pT->OnItemPostErase(idCtrl, lpNMCustomDraw); break; case (CDDS_ITEMPREPAINT | CDDS_SUBITEM): dwRet = pT->OnSubItemPrePaint(idCtrl, lpNMCustomDraw); break; default: pT->SetMsgHandled(FALSE); break; } bHandled = pT->IsMsgHandled(); return dwRet; } // Overrideables DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } DWORD OnPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } DWORD OnPreErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } DWORD OnPostErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } DWORD OnItemPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } DWORD OnItemPreErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } DWORD OnItemPostErase(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } DWORD OnSubItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_DODEFAULT; } }; } // namespace WTL #endif // __ATLCTRLS_H__ ================================================ FILE: third_party/WTL/Include/atlctrlw.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLCTRLW_H__ #define __ATLCTRLW_H__ #pragma once #ifndef __ATLAPP_H__ #error atlctrlw.h requires atlapp.h to be included first #endif #ifndef __ATLCTRLS_H__ #error atlctrlw.h requires atlctrls.h to be included first #endif // Define _WTL_CMDBAR_VISTA_MENUS as 0 to exclude Vista menus support #ifndef _WTL_CMDBAR_VISTA_MENUS #define _WTL_CMDBAR_VISTA_MENUS 1 #endif // Note: Define _WTL_CMDBAR_VISTA_STD_MENUBAR to use Vista standard menubar look with Vista menus /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CCommandBarCtrlImpl // CCommandBarCtrl // CMDICommandBarCtrlImpl // CMDICommandBarCtrl namespace WTL { /////////////////////////////////////////////////////////////////////////////// // Command Bars // Window Styles: #define CBRWS_TOP CCS_TOP #define CBRWS_BOTTOM CCS_BOTTOM #define CBRWS_NORESIZE CCS_NORESIZE #define CBRWS_NOPARENTALIGN CCS_NOPARENTALIGN #define CBRWS_NODIVIDER CCS_NODIVIDER // Extended styles #define CBR_EX_TRANSPARENT 0x00000001L #define CBR_EX_SHAREMENU 0x00000002L #define CBR_EX_ALTFOCUSMODE 0x00000004L #define CBR_EX_TRACKALWAYS 0x00000008L #define CBR_EX_NOVISTAMENUS 0x00000010L // standard command bar styles #define ATL_SIMPLE_CMDBAR_PANE_STYLE \ (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CBRWS_NODIVIDER | CBRWS_NORESIZE | CBRWS_NOPARENTALIGN) // Messages - support chevrons for frame windows #define CBRM_GETCMDBAR (WM_USER + 301) // returns command bar HWND #define CBRM_GETMENU (WM_USER + 302) // returns loaded or attached menu #define CBRM_TRACKPOPUPMENU (WM_USER + 303) // displays a popup menu typedef struct tagCBRPOPUPMENU { int cbSize; HMENU hMenu; // popup menu do display UINT uFlags; // TPM_* flags for ::TrackPopupMenuEx int x; int y; LPTPMPARAMS lptpm; // ptr to TPMPARAMS for ::TrackPopupMenuEx } CBRPOPUPMENU, *LPCBRPOPUPMENU; // helper class template class CSimpleStack : public ATL::CSimpleArray< T > { public: BOOL Push(T t) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-PUSH (%8.8X) size = %i\n"), t, GetSize()); #endif return this->Add(t); } T Pop() { int nLast = this->GetSize() - 1; if(nLast < 0) return NULL; // must be able to convert to NULL T t = this->m_aT[nLast]; #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - STACK-POP (%8.8X) size = %i\n"), t, GetSize()); #endif if(!this->RemoveAt(nLast)) return NULL; return t; } T GetCurrent() { int nLast = this->GetSize() - 1; if(nLast < 0) return NULL; // must be able to convert to NULL return this->m_aT[nLast]; } }; /////////////////////////////////////////////////////////////////////////////// // CCommandBarCtrlBase - base class for the Command Bar implementation class CCommandBarCtrlBase : public CToolBarCtrl { public: struct _MsgHookData { HHOOK hMsgHook; DWORD dwUsage; _MsgHookData() : hMsgHook(NULL), dwUsage(0) { } }; typedef ATL::CSimpleMap CMsgHookMap; static CMsgHookMap* s_pmapMsgHook; static HHOOK s_hCreateHook; static CCommandBarCtrlBase* s_pCurrentBar; static bool s_bStaticInit; CSimpleStack m_stackMenuWnd; CSimpleStack m_stackMenuHandle; HWND m_hWndHook; DWORD m_dwMagic; CCommandBarCtrlBase() : m_hWndHook(NULL), m_dwMagic(1314) { // init static variables if(!s_bStaticInit) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlBase::CCommandBarCtrlBase.\n")); ATLASSERT(FALSE); return; } if(!s_bStaticInit) { // Just in case... AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES); // done s_bStaticInit = true; } lock.Unlock(); } } bool IsCommandBarBase() const { return m_dwMagic == 1314; } }; __declspec(selectany) CCommandBarCtrlBase::CMsgHookMap* CCommandBarCtrlBase::s_pmapMsgHook = NULL; __declspec(selectany) HHOOK CCommandBarCtrlBase::s_hCreateHook = NULL; __declspec(selectany) CCommandBarCtrlBase* CCommandBarCtrlBase::s_pCurrentBar = NULL; __declspec(selectany) bool CCommandBarCtrlBase::s_bStaticInit = false; /////////////////////////////////////////////////////////////////////////////// // CCommandBarCtrl - ATL implementation of Command Bars template class ATL_NO_VTABLE CCommandBarCtrlImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > { public: DECLARE_WND_SUPERCLASS2(NULL, T, TBase::GetWndClassName()) // Declarations struct _MenuItemData // menu item data { DWORD dwMagic; LPTSTR lpstrText; UINT fType; UINT fState; int iButton; _MenuItemData() : dwMagic(0x1313), lpstrText(NULL), fType(0U), fState(0U), iButton(0) { } bool IsCmdBarMenuItem() { return (dwMagic == 0x1313); } }; struct _ToolBarData // toolbar resource data { WORD wVersion; WORD wWidth; WORD wHeight; WORD wItemCount; //WORD aItems[wItemCount] WORD* items() { return (WORD*)(this+1); } }; // Constants enum _CmdBarDrawConstants { s_kcxGap = 1, s_kcxTextMargin = 2, s_kcxButtonMargin = 3, s_kcyButtonMargin = 3 }; enum { _nMaxMenuItemTextLength = 100, _chChevronShortcut = _T('/') }; // Data members HMENU m_hMenu; HIMAGELIST m_hImageList; ATL::CSimpleValArray m_arrCommand; DWORD m_dwExtendedStyle; // Command Bar specific extended styles ATL::CContainedWindow m_wndParent; bool m_bMenuActive:1; bool m_bAttachedMenu:1; bool m_bImagesVisible:1; bool m_bPopupItem:1; bool m_bContextMenu:1; bool m_bEscapePressed:1; bool m_bSkipMsg:1; bool m_bParentActive:1; bool m_bFlatMenus:1; bool m_bUseKeyboardCues:1; bool m_bShowKeyboardCues:1; bool m_bAllowKeyboardCues:1; bool m_bKeyboardInput:1; bool m_bAlphaImages:1; bool m_bLayoutRTL:1; bool m_bSkipPostDown:1; bool m_bVistaMenus:1; int m_nPopBtn; int m_nNextPopBtn; SIZE m_szBitmap; SIZE m_szButton; COLORREF m_clrMask; CFont m_fontMenu; // used internally, only to measure text UINT m_uSysKey; HWND m_hWndFocus; // Alternate focus mode int m_cxExtraSpacing; #if _WTL_CMDBAR_VISTA_MENUS ATL::CSimpleValArray m_arrVistaBitmap; // Bitmaps for Vista menus #endif // _WTL_CMDBAR_VISTA_MENUS // Constructor/destructor CCommandBarCtrlImpl() : m_hMenu(NULL), m_hImageList(NULL), m_dwExtendedStyle(CBR_EX_TRANSPARENT | CBR_EX_SHAREMENU | CBR_EX_TRACKALWAYS), m_wndParent(this, 1), m_bMenuActive(false), m_bAttachedMenu(false), m_bImagesVisible(true), m_bPopupItem(false), m_bContextMenu(false), m_bEscapePressed(false), m_bSkipMsg(false), m_bParentActive(true), m_bFlatMenus(false), m_bUseKeyboardCues(false), m_bShowKeyboardCues(false), m_bAllowKeyboardCues(true), m_bKeyboardInput(false), m_bAlphaImages(false), m_bLayoutRTL(false), m_bSkipPostDown(false), m_bVistaMenus(false), m_nPopBtn(-1), m_nNextPopBtn(-1), m_clrMask(RGB(192, 192, 192)), m_uSysKey(0), m_hWndFocus(NULL), m_cxExtraSpacing(0) { SetImageSize(16, 15); // default } ~CCommandBarCtrlImpl() { if(m_wndParent.IsWindow()) /*scary!*/ m_wndParent.UnsubclassWindow(); if((m_hMenu != NULL) && ((m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0)) ::DestroyMenu(m_hMenu); if(m_hImageList != NULL) ::ImageList_Destroy(m_hImageList); } // Attributes DWORD GetCommandBarExtendedStyle() const { return m_dwExtendedStyle; } DWORD SetCommandBarExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) { DWORD dwPrevStyle = m_dwExtendedStyle; if(dwMask == 0) m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); return dwPrevStyle; } CMenuHandle GetMenu() const { ATLASSERT(::IsWindow(this->m_hWnd)); return m_hMenu; } COLORREF GetImageMaskColor() const { return m_clrMask; } COLORREF SetImageMaskColor(COLORREF clrMask) { COLORREF clrOld = m_clrMask; m_clrMask = clrMask; return clrOld; } bool GetImagesVisible() const { return m_bImagesVisible; } bool SetImagesVisible(bool bVisible) { bool bOld = m_bImagesVisible; m_bImagesVisible = bVisible; return bOld; } void GetImageSize(SIZE& size) const { size = m_szBitmap; } bool SetImageSize(SIZE& size) { return SetImageSize(size.cx, size.cy); } bool SetImageSize(int cx, int cy) { if(m_hImageList != NULL) { if(::ImageList_GetImageCount(m_hImageList) == 0) // empty { ::ImageList_Destroy(m_hImageList); m_hImageList = NULL; } else { return false; // can't set, image list exists } } if((cx == 0) || (cy == 0)) return false; m_szBitmap.cx = cx; m_szBitmap.cy = cy; m_szButton.cx = m_szBitmap.cx + 2 * s_kcxButtonMargin; m_szButton.cy = m_szBitmap.cy + 2 * s_kcyButtonMargin; return true; } bool GetAlphaImages() const { return m_bAlphaImages; } bool SetAlphaImages(bool bAlphaImages) { if(m_hImageList != NULL) { if(::ImageList_GetImageCount(m_hImageList) == 0) // empty { ::ImageList_Destroy(m_hImageList); m_hImageList = NULL; } else { return false; // can't set, image list exists } } m_bAlphaImages = bAlphaImages; return true; } HWND GetCmdBar() const { ATLASSERT(::IsWindow(this->m_hWnd)); return (HWND)::SendMessage(this->m_hWnd, CBRM_GETCMDBAR, 0, 0L); } // Methods HWND Create(HWND hWndParent, RECT& rcPos, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) { // These styles are required for command bars dwStyle |= TBSTYLE_LIST | TBSTYLE_FLAT; return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, rcPos, szWindowName, dwStyle, dwExStyle, nID, lpCreateParam); } BOOL AttachToWindow(HWND hWnd) { ATLASSERT(this->m_hWnd == NULL); ATLASSERT(::IsWindow(hWnd)); BOOL bRet = this->SubclassWindow(hWnd); if(bRet) { m_bAttachedMenu = true; T* pT = static_cast(this); pT->GetSystemSettings(); } return bRet; } BOOL LoadMenu(ATL::_U_STRINGorID menu) { ATLASSERT(::IsWindow(this->m_hWnd)); if(m_bAttachedMenu) // doesn't work in this mode return FALSE; if(menu.m_lpstr == NULL) return FALSE; HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); if(hMenu == NULL) return FALSE; return AttachMenu(hMenu); } BOOL AttachMenu(HMENU hMenu) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((hMenu == NULL) || ::IsMenu(hMenu)); if((hMenu != NULL) && !::IsMenu(hMenu)) return FALSE; #if _WTL_CMDBAR_VISTA_MENUS // remove Vista bitmaps if used if(m_bVistaMenus && (m_hMenu != NULL)) { T* pT = static_cast(this); pT->_RemoveVistaBitmapsFromMenu(); } #endif // _WTL_CMDBAR_VISTA_MENUS // destroy old menu, if needed, and set new one if((m_hMenu != NULL) && ((m_dwExtendedStyle & CBR_EX_SHAREMENU) == 0)) ::DestroyMenu(m_hMenu); m_hMenu = hMenu; if(m_bAttachedMenu) // Nothing else in this mode return TRUE; // Build buttons according to menu this->SetRedraw(FALSE); // Clear all buttons int nCount = this->GetButtonCount(); for(int i = 0; i < nCount; i++) ATLVERIFY(this->DeleteButton(0) != FALSE); // Add buttons for each menu item if(m_hMenu != NULL) { int nItems = ::GetMenuItemCount(m_hMenu); T* pT = static_cast(this); (void)pT; // avoid level 4 warning TCHAR szString[pT->_nMaxMenuItemTextLength] = {}; for(int i = 0; i < nItems; i++) { CMenuItemInfo mii; mii.fMask = MIIM_TYPE | MIIM_STATE | MIIM_SUBMENU; mii.fType = MFT_STRING; mii.dwTypeData = szString; mii.cch = pT->_nMaxMenuItemTextLength; BOOL bRet = ::GetMenuItemInfo(m_hMenu, i, TRUE, &mii); ATLASSERT(bRet); // If we have more than the buffer, we assume we have bitmaps bits if(lstrlen(szString) > pT->_nMaxMenuItemTextLength - 1) { mii.fType = MFT_BITMAP; ::SetMenuItemInfo(m_hMenu, i, TRUE, &mii); szString[0] = 0; } // NOTE: Command Bar currently supports only drop-down menu items ATLASSERT(mii.hSubMenu != NULL); TBBUTTON btn = {}; btn.iBitmap = 0; btn.idCommand = i; btn.fsState = (BYTE)(((mii.fState & MFS_DISABLED) == 0) ? TBSTATE_ENABLED : 0); btn.fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE | BTNS_DROPDOWN; btn.dwData = 0; btn.iString = 0; bRet = this->InsertButton(-1, &btn); ATLASSERT(bRet); TBBUTTONINFO bi = {}; bi.cbSize = sizeof(TBBUTTONINFO); bi.dwMask = TBIF_TEXT; bi.pszText = szString; bRet = this->SetButtonInfo(i, &bi); ATLASSERT(bRet); } } this->SetRedraw(TRUE); this->Invalidate(); this->UpdateWindow(); return TRUE; } BOOL LoadImages(ATL::_U_STRINGorID image) { return _LoadImagesHelper(image, false); } BOOL LoadMappedImages(UINT nIDImage, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) { return _LoadImagesHelper(nIDImage, true, nFlags , lpColorMap, nMapSize); } BOOL _LoadImagesHelper(ATL::_U_STRINGorID image, bool bMapped, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); HINSTANCE hInstance = ModuleHelper::GetResourceInstance(); HRSRC hRsrc = ::FindResource(hInstance, image.m_lpstr, (LPTSTR)RT_TOOLBAR); if(hRsrc == NULL) return FALSE; HGLOBAL hGlobal = ::LoadResource(hInstance, hRsrc); if(hGlobal == NULL) return FALSE; _ToolBarData* pData = (_ToolBarData*)::LockResource(hGlobal); if(pData == NULL) return FALSE; ATLASSERT(pData->wVersion == 1); WORD* pItems = pData->items(); int nItems = pData->wItemCount; // Set internal data SetImageSize(pData->wWidth, pData->wHeight); // Create image list if needed if(m_hImageList == NULL) { // Check if the bitmap is 32-bit (alpha channel) bitmap (valid for Windows XP only) T* pT = static_cast(this); m_bAlphaImages = AtlIsAlphaBitmapResource(image); if(!pT->CreateInternalImageList(pData->wItemCount)) return FALSE; } #if _WTL_CMDBAR_VISTA_MENUS int nOldImageCount = ::ImageList_GetImageCount(m_hImageList); #endif // _WTL_CMDBAR_VISTA_MENUS // Add bitmap to our image list CBitmap bmp; if(bMapped) { ATLASSERT(HIWORD(PtrToUlong(image.m_lpstr)) == 0); // if mapped, must be a numeric ID int nIDImage = (int)(short)LOWORD(PtrToUlong(image.m_lpstr)); bmp.LoadMappedBitmap(nIDImage, (WORD)nFlags, lpColorMap, nMapSize); } else { if(m_bAlphaImages) bmp = (HBITMAP)::LoadImage(ModuleHelper::GetResourceInstance(), image.m_lpstr, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); else bmp.LoadBitmap(image.m_lpstr); } ATLASSERT(bmp.m_hBitmap != NULL); if(bmp.m_hBitmap == NULL) return FALSE; if(::ImageList_AddMasked(m_hImageList, bmp, m_clrMask) == -1) return FALSE; // Fill the array with command IDs for(int i = 0; i < nItems; i++) { if(pItems[i] != 0) m_arrCommand.Add(pItems[i]); } int nImageCount = ::ImageList_GetImageCount(m_hImageList); ATLASSERT(nImageCount == m_arrCommand.GetSize()); if(nImageCount != m_arrCommand.GetSize()) return FALSE; #if _WTL_CMDBAR_VISTA_MENUS if(RunTimeHelper::IsVista()) { T* pT = static_cast(this); pT->_AddVistaBitmapsFromImageList(nOldImageCount, nImageCount - nOldImageCount); ATLASSERT(nImageCount == m_arrVistaBitmap.GetSize()); } #endif // _WTL_CMDBAR_VISTA_MENUS return TRUE; } BOOL AddBitmap(ATL::_U_STRINGorID bitmap, int nCommandID) { ATLASSERT(::IsWindow(this->m_hWnd)); CBitmap bmp; bmp.LoadBitmap(bitmap.m_lpstr); if(bmp.m_hBitmap == NULL) return FALSE; return AddBitmap(bmp, nCommandID); } BOOL AddBitmap(HBITMAP hBitmap, UINT nCommandID) { ATLASSERT(::IsWindow(this->m_hWnd)); T* pT = static_cast(this); // Create image list if it doesn't exist if(m_hImageList == NULL) { if(!pT->CreateInternalImageList(1)) return FALSE; } // check bitmap size CBitmapHandle bmp = hBitmap; SIZE size = {}; bmp.GetSize(size); if((size.cx != m_szBitmap.cx) || (size.cy != m_szBitmap.cy)) { ATLASSERT(FALSE); // must match size! return FALSE; } // add bitmap int nRet = ::ImageList_AddMasked(m_hImageList, hBitmap, m_clrMask); if(nRet == -1) return FALSE; BOOL bRet = m_arrCommand.Add((WORD)nCommandID); ATLASSERT(::ImageList_GetImageCount(m_hImageList) == m_arrCommand.GetSize()); #if _WTL_CMDBAR_VISTA_MENUS if(RunTimeHelper::IsVista()) { pT->_AddVistaBitmapFromImageList(m_arrCommand.GetSize() - 1); ATLASSERT(m_arrVistaBitmap.GetSize() == m_arrCommand.GetSize()); } #endif // _WTL_CMDBAR_VISTA_MENUS return bRet; } BOOL AddIcon(ATL::_U_STRINGorID icon, UINT nCommandID) { ATLASSERT(::IsWindow(this->m_hWnd)); HICON hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); if(hIcon == NULL) return FALSE; return AddIcon(hIcon, nCommandID); } BOOL AddIcon(HICON hIcon, UINT nCommandID) { ATLASSERT(::IsWindow(this->m_hWnd)); T* pT = static_cast(this); // create image list if it doesn't exist if(m_hImageList == NULL) { if(!pT->CreateInternalImageList(1)) return FALSE; } int nRet = ::ImageList_AddIcon(m_hImageList, hIcon); if(nRet == -1) return FALSE; BOOL bRet = m_arrCommand.Add((WORD)nCommandID); ATLASSERT(::ImageList_GetImageCount(m_hImageList) == m_arrCommand.GetSize()); #if _WTL_CMDBAR_VISTA_MENUS if(RunTimeHelper::IsVista()) { pT->_AddVistaBitmapFromImageList(m_arrCommand.GetSize() - 1); ATLASSERT(m_arrVistaBitmap.GetSize() == m_arrCommand.GetSize()); } #endif // _WTL_CMDBAR_VISTA_MENUS return bRet; } BOOL ReplaceBitmap(ATL::_U_STRINGorID bitmap, int nCommandID) { ATLASSERT(::IsWindow(this->m_hWnd)); CBitmap bmp; bmp.LoadBitmap(bitmap.m_lpstr); if(bmp.m_hBitmap == NULL) return FALSE; return ReplaceBitmap(bmp, nCommandID); } BOOL ReplaceBitmap(HBITMAP hBitmap, UINT nCommandID) { ATLASSERT(::IsWindow(this->m_hWnd)); BOOL bRet = FALSE; for(int i = 0; i < m_arrCommand.GetSize(); i++) { if(m_arrCommand[i] == nCommandID) { bRet = ::ImageList_Remove(m_hImageList, i); if(bRet) { m_arrCommand.RemoveAt(i); #if _WTL_CMDBAR_VISTA_MENUS if(RunTimeHelper::IsVista()) { if(m_arrVistaBitmap[i] != NULL) ::DeleteObject(m_arrVistaBitmap[i]); m_arrVistaBitmap.RemoveAt(i); } #endif // _WTL_CMDBAR_VISTA_MENUS } break; } } if(bRet) bRet = AddBitmap(hBitmap, nCommandID); return bRet; } BOOL ReplaceIcon(ATL::_U_STRINGorID icon, UINT nCommandID) { ATLASSERT(::IsWindow(this->m_hWnd)); HICON hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); if(hIcon == NULL) return FALSE; return ReplaceIcon(hIcon, nCommandID); } BOOL ReplaceIcon(HICON hIcon, UINT nCommandID) { ATLASSERT(::IsWindow(this->m_hWnd)); BOOL bRet = FALSE; for(int i = 0; i < m_arrCommand.GetSize(); i++) { if(m_arrCommand[i] == nCommandID) { bRet = (::ImageList_ReplaceIcon(m_hImageList, i, hIcon) != -1); #if _WTL_CMDBAR_VISTA_MENUS if(RunTimeHelper::IsVista() && (bRet != FALSE)) { T* pT = static_cast(this); pT->_ReplaceVistaBitmapFromImageList(i); } #endif // _WTL_CMDBAR_VISTA_MENUS break; } } return bRet; } BOOL RemoveImage(int nCommandID) { ATLASSERT(::IsWindow(this->m_hWnd)); BOOL bRet = FALSE; for(int i = 0; i < m_arrCommand.GetSize(); i++) { if(m_arrCommand[i] == nCommandID) { bRet = ::ImageList_Remove(m_hImageList, i); if(bRet) { m_arrCommand.RemoveAt(i); #if _WTL_CMDBAR_VISTA_MENUS if(RunTimeHelper::IsVista()) { if(m_arrVistaBitmap[i] != NULL) ::DeleteObject(m_arrVistaBitmap[i]); m_arrVistaBitmap.RemoveAt(i); } #endif // _WTL_CMDBAR_VISTA_MENUS } break; } } return bRet; } BOOL RemoveAllImages() { ATLASSERT(::IsWindow(this->m_hWnd)); ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Removing all images\n")); BOOL bRet = ::ImageList_RemoveAll(m_hImageList); if(bRet) { m_arrCommand.RemoveAll(); #if _WTL_CMDBAR_VISTA_MENUS for(int i = 0; i < m_arrVistaBitmap.GetSize(); i++) { if(m_arrVistaBitmap[i] != NULL) ::DeleteObject(m_arrVistaBitmap[i]); } m_arrVistaBitmap.RemoveAll(); #endif // _WTL_CMDBAR_VISTA_MENUS } return bRet; } BOOL TrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, LPTPMPARAMS lpParams = NULL) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(::IsMenu(hMenu)); if(!::IsMenu(hMenu)) return FALSE; m_bContextMenu = true; if(m_bUseKeyboardCues) m_bShowKeyboardCues = m_bKeyboardInput; T* pT = static_cast(this); return pT->DoTrackPopupMenu(hMenu, uFlags, x, y, lpParams); } BOOL SetMDIClient(HWND /*hWndMDIClient*/) { // Use CMDICommandBarCtrl for MDI support ATLASSERT(FALSE); return FALSE; } // Message map and handlers BEGIN_MSG_MAP(CCommandBarCtrlImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_INITMENU, OnInitMenu) MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup) MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) MESSAGE_HANDLER(GetAutoPopupMessage(), OnInternalAutoPopup) MESSAGE_HANDLER(GetGetBarMessage(), OnInternalGetBar) MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) MESSAGE_HANDLER(WM_MENUCHAR, OnMenuChar) MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus) MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) MESSAGE_HANDLER(WM_KEYUP, OnKeyUp) MESSAGE_HANDLER(WM_CHAR, OnChar) MESSAGE_HANDLER(WM_SYSKEYDOWN, OnSysKeyDown) MESSAGE_HANDLER(WM_SYSKEYUP, OnSysKeyUp) MESSAGE_HANDLER(WM_SYSCHAR, OnSysChar) // public API handlers - these stay to support chevrons in atlframe.h MESSAGE_HANDLER(CBRM_GETMENU, OnAPIGetMenu) MESSAGE_HANDLER(CBRM_TRACKPOPUPMENU, OnAPITrackPopupMenu) MESSAGE_HANDLER(CBRM_GETCMDBAR, OnAPIGetCmdBar) MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem) MESSAGE_HANDLER(WM_FORWARDMSG, OnForwardMsg) ALT_MSG_MAP(1) // Parent window messages NOTIFY_CODE_HANDLER(TBN_HOTITEMCHANGE, OnParentHotItemChange) NOTIFY_CODE_HANDLER(TBN_DROPDOWN, OnParentDropDown) MESSAGE_HANDLER(WM_INITMENUPOPUP, OnParentInitMenuPopup) MESSAGE_HANDLER(GetGetBarMessage(), OnParentInternalGetBar) MESSAGE_HANDLER(WM_SYSCOMMAND, OnParentSysCommand) MESSAGE_HANDLER(CBRM_GETMENU, OnParentAPIGetMenu) MESSAGE_HANDLER(WM_MENUCHAR, OnParentMenuChar) MESSAGE_HANDLER(CBRM_TRACKPOPUPMENU, OnParentAPITrackPopupMenu) MESSAGE_HANDLER(CBRM_GETCMDBAR, OnParentAPIGetCmdBar) MESSAGE_HANDLER(WM_SETTINGCHANGE, OnParentSettingChange) MESSAGE_HANDLER(WM_DRAWITEM, OnParentDrawItem) MESSAGE_HANDLER(WM_MEASUREITEM, OnParentMeasureItem) MESSAGE_HANDLER(WM_ACTIVATE, OnParentActivate) NOTIFY_CODE_HANDLER(NM_CUSTOMDRAW, OnParentCustomDraw) ALT_MSG_MAP(2) // MDI client window messages // Use CMDICommandBarCtrl for MDI support ALT_MSG_MAP(3) // Message hook messages MESSAGE_HANDLER(WM_MOUSEMOVE, OnHookMouseMove) MESSAGE_HANDLER(WM_SYSKEYDOWN, OnHookSysKeyDown) MESSAGE_HANDLER(WM_SYSKEYUP, OnHookSysKeyUp) MESSAGE_HANDLER(WM_SYSCHAR, OnHookSysChar) MESSAGE_HANDLER(WM_KEYDOWN, OnHookKeyDown) MESSAGE_HANDLER(WM_NEXTMENU, OnHookNextMenu) MESSAGE_HANDLER(WM_CHAR, OnHookChar) END_MSG_MAP() LRESULT OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { LPMSG pMsg = (LPMSG)lParam; if((pMsg->message >= WM_MOUSEFIRST) && (pMsg->message <= WM_MOUSELAST)) m_bKeyboardInput = false; else if((pMsg->message >= WM_KEYFIRST) && (pMsg->message <= WM_KEYLAST)) m_bKeyboardInput = true; LRESULT lRet = 0; ProcessWindowMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam, lRet, 3); return lRet; } LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { // Let the toolbar initialize itself LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); // get and use system settings T* pT = static_cast(this); pT->GetSystemSettings(); // Parent init ATL::CWindow wndParent = this->GetParent(); ATL::CWindow wndTopLevelParent = wndParent.GetTopLevelParent(); m_wndParent.SubclassWindow(wndTopLevelParent); // Toolbar Init this->SetButtonStructSize(); this->SetImageList(NULL); // Create message hook if needed CWindowCreateCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::OnCreate.\n")); ATLASSERT(FALSE); return -1; } if(this->s_pmapMsgHook == NULL) { ATLTRY(this->s_pmapMsgHook = new CCommandBarCtrlBase::CMsgHookMap); ATLASSERT(this->s_pmapMsgHook != NULL); } if(this->s_pmapMsgHook != NULL) { DWORD dwThreadID = ::GetCurrentThreadId(); CCommandBarCtrlBase::_MsgHookData* pData = this->s_pmapMsgHook->Lookup(dwThreadID); if(pData == NULL) { ATLTRY(pData = new CCommandBarCtrlBase::_MsgHookData); ATLASSERT(pData != NULL); HHOOK hMsgHook = ::SetWindowsHookEx(WH_GETMESSAGE, MessageHookProc, ModuleHelper::GetModuleInstance(), dwThreadID); ATLASSERT(hMsgHook != NULL); if((pData != NULL) && (hMsgHook != NULL)) { pData->hMsgHook = hMsgHook; pData->dwUsage = 1; BOOL bRet = this->s_pmapMsgHook->Add(dwThreadID, pData); (void)bRet; // avoid level 4 warning ATLASSERT(bRet); } } else { (pData->dwUsage)++; } } lock.Unlock(); // Get layout m_bLayoutRTL = ((this->GetExStyle() & WS_EX_LAYOUTRTL) != 0); return lRet; } LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); #if _WTL_CMDBAR_VISTA_MENUS if(m_bVistaMenus && (m_hMenu != NULL)) { T* pT = static_cast(this); pT->_RemoveVistaBitmapsFromMenu(); } for(int i = 0; i < m_arrVistaBitmap.GetSize(); i++) { if(m_arrVistaBitmap[i] != NULL) ::DeleteObject(m_arrVistaBitmap[i]); } #endif // _WTL_CMDBAR_VISTA_MENUS if(m_bAttachedMenu) // nothing to do in this mode return lRet; CWindowCreateCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::OnDestroy.\n")); ATLASSERT(FALSE); return lRet; } if(this->s_pmapMsgHook != NULL) { DWORD dwThreadID = ::GetCurrentThreadId(); CCommandBarCtrlBase::_MsgHookData* pData = this->s_pmapMsgHook->Lookup(dwThreadID); if(pData != NULL) { (pData->dwUsage)--; if(pData->dwUsage == 0) { BOOL bRet = ::UnhookWindowsHookEx(pData->hMsgHook); ATLASSERT(bRet); bRet = this->s_pmapMsgHook->Remove(dwThreadID); ATLASSERT(bRet); if(bRet) delete pData; } if(this->s_pmapMsgHook->GetSize() == 0) { delete this->s_pmapMsgHook; this->s_pmapMsgHook = NULL; } } } lock.Unlock(); return lRet; } LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyDown\n")); #endif if(m_bAttachedMenu) // nothing to do in this mode { bHandled = FALSE; return 1; } bHandled = FALSE; // Simulate Alt+Space for the parent if(wParam == VK_SPACE) { m_wndParent.PostMessage(WM_SYSKEYDOWN, wParam, lParam | (1 << 29)); bHandled = TRUE; } else if((wParam == VK_LEFT) || (wParam == VK_RIGHT)) { WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; if(!m_bMenuActive) { T* pT = static_cast(this); int nBtn = this->GetHotItem(); int nNextBtn = (wParam == wpNext) ? pT->GetNextMenuItem(nBtn) : pT->GetPreviousMenuItem(nBtn); if(nNextBtn == -2) { this->SetHotItem(-1); if(pT->DisplayChevronMenu()) bHandled = TRUE; } } } return 0; } LRESULT OnKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnKeyUp\n")); #endif if(m_bAttachedMenu) // nothing to do in this mode { bHandled = FALSE; return 1; } if(wParam != VK_SPACE) bHandled = FALSE; return 0; } LRESULT OnChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnChar\n")); #endif if(m_bAttachedMenu) // nothing to do in this mode { bHandled = FALSE; return 1; } if(wParam != VK_SPACE) bHandled = FALSE; else return 0; // Security if(!m_wndParent.IsWindowEnabled() || (::GetFocus() != this->m_hWnd)) return 0; // Handle mnemonic press when we have focus int nBtn = 0; if((wParam != VK_RETURN) && !this->MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) { if((TCHAR)LOWORD(wParam) != _chChevronShortcut) ::MessageBeep(0); } else { RECT rcClient = {}; this->GetClientRect(&rcClient); RECT rcBtn = {}; this->GetItemRect(nBtn, &rcBtn); TBBUTTON tbb = {}; this->GetButton(nBtn, &tbb); if(((tbb.fsState & TBSTATE_ENABLED) != 0) && ((tbb.fsState & TBSTATE_HIDDEN) == 0) && (rcBtn.right <= rcClient.right)) { this->PostMessage(WM_KEYDOWN, VK_DOWN, 0L); if(wParam != VK_RETURN) this->SetHotItem(nBtn); } else { ::MessageBeep(0); bHandled = TRUE; } } return 0; } LRESULT OnSysKeyDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysKeyDown\n")); #endif bHandled = FALSE; return 0; } LRESULT OnSysKeyUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysKeyUp\n")); #endif bHandled = FALSE; return 0; } LRESULT OnSysChar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnSysChar\n")); #endif bHandled = FALSE; return 0; } LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(m_bAttachedMenu || (m_dwExtendedStyle & CBR_EX_TRANSPARENT)) { bHandled = FALSE; return 0; } CDCHandle dc = (HDC)wParam; RECT rect = {}; this->GetClientRect(&rect); dc.FillRect(&rect, COLOR_MENU); return 1; // don't do the default erase } LRESULT OnInitMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { int nIndex = this->GetHotItem(); this->SendMessage(WM_MENUSELECT, MAKEWPARAM(nIndex, MF_POPUP|MF_HILITE), (LPARAM)m_hMenu); bHandled = FALSE; return 1; } LRESULT OnInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if((BOOL)HIWORD(lParam)) // System menu, do nothing { bHandled = FALSE; return 1; } if(!(m_bAttachedMenu || m_bMenuActive)) // Not attached or ours, do nothing { bHandled = FALSE; return 1; } #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnInitMenuPopup\n")); #endif // forward to the parent or subclassed window, so it can handle update UI LRESULT lRet = 0; if(m_bAttachedMenu) lRet = this->DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : this->GetHotItem()); else lRet = m_wndParent.DefWindowProc(uMsg, wParam, (lParam || m_bContextMenu) ? lParam : this->GetHotItem()); #if _WTL_CMDBAR_VISTA_MENUS // If Vista menus are active, just set bitmaps and return if(m_bVistaMenus) { CMenuHandle menu = (HMENU)wParam; ATLASSERT(menu.m_hMenu != NULL); for(int i = 0; i < menu.GetMenuItemCount(); i++) { WORD nID = (WORD)menu.GetMenuItemID(i); int nIndex = m_arrCommand.Find(nID); CMenuItemInfo mii; mii.fMask = MIIM_BITMAP; mii.hbmpItem = (m_bImagesVisible && (nIndex != -1)) ? m_arrVistaBitmap[nIndex] : NULL; menu.SetMenuItemInfo(i, TRUE, &mii); } return lRet; } #endif // _WTL_CMDBAR_VISTA_MENUS // Convert menu items to ownerdraw, add our data if(m_bImagesVisible) { CMenuHandle menuPopup = (HMENU)wParam; ATLASSERT(menuPopup.m_hMenu != NULL); T* pT = static_cast(this); (void)pT; // avoid level 4 warning TCHAR szString[pT->_nMaxMenuItemTextLength] = {}; BOOL bRet = FALSE; for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) { CMenuItemInfo mii; mii.cch = pT->_nMaxMenuItemTextLength; mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE | MIIM_SUBMENU | MIIM_TYPE; mii.dwTypeData = szString; bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); ATLASSERT(bRet); if(!(mii.fType & MFT_OWNERDRAW)) // Not already an ownerdraw item { mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; _MenuItemData* pMI = NULL; ATLTRY(pMI = new _MenuItemData); ATLASSERT(pMI != NULL); if(pMI != NULL) { pMI->fType = mii.fType; pMI->fState = mii.fState; mii.fType |= MFT_OWNERDRAW; pMI->iButton = -1; for(int j = 0; j < m_arrCommand.GetSize(); j++) { if(m_arrCommand[j] == mii.wID) { pMI->iButton = j; break; } } int cchLen = lstrlen(szString) + 1; pMI->lpstrText = NULL; ATLTRY(pMI->lpstrText = new TCHAR[cchLen]); ATLASSERT(pMI->lpstrText != NULL); if(pMI->lpstrText != NULL) ATL::Checked::tcscpy_s(pMI->lpstrText, cchLen, szString); mii.dwItemData = (ULONG_PTR)pMI; bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); ATLASSERT(bRet); } } } // Add it to the list this->m_stackMenuHandle.Push(menuPopup.m_hMenu); } return lRet; } LRESULT OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if(!m_bAttachedMenu) // Not attached, do nothing, forward to parent { m_bPopupItem = (lParam != NULL) && ((HMENU)lParam != m_hMenu) && (HIWORD(wParam) & MF_POPUP); if(m_wndParent.IsWindow()) m_wndParent.SendMessage(uMsg, wParam, lParam); bHandled = FALSE; return 1; } // Check if a menu is closing, do a cleanup if((HIWORD(wParam) == 0xFFFF) && (lParam == NULL)) // Menu closing { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnMenuSelect - CLOSING!!!!\n")); #endif ATLASSERT(this->m_stackMenuWnd.GetSize() == 0); // Restore the menu items to the previous state for all menus that were converted if(m_bImagesVisible) { HMENU hMenu = NULL; while((hMenu = this->m_stackMenuHandle.Pop()) != NULL) { CMenuHandle menuPopup = hMenu; ATLASSERT(menuPopup.m_hMenu != NULL); // Restore state and delete menu item data BOOL bRet = FALSE; for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) { CMenuItemInfo mii; mii.fMask = MIIM_DATA | MIIM_TYPE; bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); ATLASSERT(bRet); _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; if(_IsValidMem(pMI) && pMI->IsCmdBarMenuItem()) { mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; mii.fType = pMI->fType; mii.dwTypeData = pMI->lpstrText; mii.cch = lstrlen(pMI->lpstrText); mii.dwItemData = NULL; bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); ATLASSERT(bRet); delete [] pMI->lpstrText; pMI->dwMagic = 0x6666; delete pMI; } } } } } bHandled = FALSE; return 1; } LRESULT OnInternalAutoPopup(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { int nIndex = (int)wParam; T* pT = static_cast(this); pT->DoPopupMenu(nIndex, false); return 0; } LRESULT OnInternalGetBar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // Let's make sure we're not embedded in another process if((LPVOID)wParam != NULL) *((DWORD*)wParam) = GetCurrentProcessId(); if(this->IsWindowVisible()) return (LRESULT)static_cast(this); else return NULL; } LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if((wParam == SPI_SETNONCLIENTMETRICS) || (wParam == SPI_SETKEYBOARDCUES) || (wParam == SPI_SETFLATMENU)) { T* pT = static_cast(this); pT->GetSystemSettings(); } return 0; } LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); LPWINDOWPOS lpWP = (LPWINDOWPOS)lParam; int cyMin = ::GetSystemMetrics(SM_CYMENU); if(lpWP->cy < cyMin) lpWP->cy = cyMin; return lRet; } LRESULT OnMenuChar(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - OnMenuChar\n")); #endif bHandled = TRUE; T* pT = static_cast(this); LRESULT lRet; if(m_bMenuActive && (LOWORD(wParam) != 0x0D)) lRet = 0; else lRet = MAKELRESULT(1, 1); if(m_bMenuActive && (HIWORD(wParam) == MF_POPUP)) { // Convert character to lower/uppercase and possibly Unicode, using current keyboard layout TCHAR ch = (TCHAR)LOWORD(wParam); CMenuHandle menu = (HMENU)lParam; int nCount = ::GetMenuItemCount(menu); int nRetCode = MNC_EXECUTE; BOOL bRet = FALSE; TCHAR szString[pT->_nMaxMenuItemTextLength] = {}; WORD wMnem = 0; bool bFound = false; for(int i = 0; i < nCount; i++) { CMenuItemInfo mii; mii.cch = pT->_nMaxMenuItemTextLength; mii.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_ID | MIIM_STATE | MIIM_SUBMENU | MIIM_TYPE; mii.dwTypeData = szString; bRet = menu.GetMenuItemInfo(i, TRUE, &mii); if(!bRet || (mii.fType & MFT_SEPARATOR)) continue; _MenuItemData* pmd = (_MenuItemData*)mii.dwItemData; if(_IsValidMem(pmd) && pmd->IsCmdBarMenuItem()) { LPTSTR p = pmd->lpstrText; if(p != NULL) { while(*p && (*p != _T('&'))) p = ::CharNext(p); if((p != NULL) && *p) { DWORD dwP = MAKELONG(*(++p), 0); DWORD dwC = MAKELONG(ch, 0); if(::CharLower((LPTSTR)ULongToPtr(dwP)) == ::CharLower((LPTSTR)ULongToPtr(dwC))) { if(!bFound) { wMnem = (WORD)i; bFound = true; } else { nRetCode = MNC_SELECT; break; } } } } } } if(bFound) { if(nRetCode == MNC_EXECUTE) { this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); pT->GiveFocusBack(); } bHandled = TRUE; lRet = MAKELRESULT(wMnem, nRetCode); } } else if(!m_bMenuActive) { int nBtn = 0; if(!this->MapAccelerator((TCHAR)LOWORD(wParam), nBtn)) { bHandled = FALSE; this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); pT->GiveFocusBack(); // check if we should display chevron menu if((TCHAR)LOWORD(wParam) == pT->_chChevronShortcut) { if(pT->DisplayChevronMenu()) bHandled = TRUE; } } else if(m_wndParent.IsWindowEnabled()) { RECT rcClient = {}; this->GetClientRect(&rcClient); RECT rcBtn = {}; this->GetItemRect(nBtn, &rcBtn); TBBUTTON tbb = {}; this->GetButton(nBtn, &tbb); if(((tbb.fsState & TBSTATE_ENABLED) != 0) && ((tbb.fsState & TBSTATE_HIDDEN) == 0) && (rcBtn.right <= rcClient.right)) { if(m_bUseKeyboardCues && !m_bShowKeyboardCues) { m_bAllowKeyboardCues = true; ShowKeyboardCues(true); } pT->TakeFocus(); this->PostMessage(WM_KEYDOWN, VK_DOWN, 0L); this->SetHotItem(nBtn); } else { ::MessageBeep(0); } } } return lRet; } LRESULT OnKillFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_bUseKeyboardCues && m_bShowKeyboardCues) ShowKeyboardCues(false); bHandled = FALSE; return 1; } LRESULT OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { LPDRAWITEMSTRUCT lpDrawItemStruct = (LPDRAWITEMSTRUCT)lParam; _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; if((lpDrawItemStruct->CtlType == ODT_MENU) && _IsValidMem(pmd) && pmd->IsCmdBarMenuItem()) { T* pT = static_cast(this); pT->DrawItem(lpDrawItemStruct); } else { bHandled = FALSE; } return (LRESULT)TRUE; } LRESULT OnMeasureItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { LPMEASUREITEMSTRUCT lpMeasureItemStruct = (LPMEASUREITEMSTRUCT)lParam; _MenuItemData* pmd = (_MenuItemData*)lpMeasureItemStruct->itemData; if((lpMeasureItemStruct->CtlType == ODT_MENU) && _IsValidMem(pmd) && pmd->IsCmdBarMenuItem()) { T* pT = static_cast(this); pT->MeasureItem(lpMeasureItemStruct); } else { bHandled = FALSE; } return (LRESULT)TRUE; } // API message handlers LRESULT OnAPIGetMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return (LRESULT)m_hMenu; } LRESULT OnAPITrackPopupMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { if(lParam == NULL) return FALSE; LPCBRPOPUPMENU lpCBRPopupMenu = (LPCBRPOPUPMENU)lParam; if(lpCBRPopupMenu->cbSize != sizeof(CBRPOPUPMENU)) return FALSE; T* pT = static_cast(this); return pT->TrackPopupMenu(lpCBRPopupMenu->hMenu, lpCBRPopupMenu->uFlags, lpCBRPopupMenu->x, lpCBRPopupMenu->y, lpCBRPopupMenu->lptpm); } LRESULT OnAPIGetCmdBar(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return (LRESULT)this->m_hWnd; } // Parent window message handlers LRESULT OnParentHotItemChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { LPNMTBHOTITEM lpNMHT = (LPNMTBHOTITEM)pnmh; // Check if this comes from us if(pnmh->hwndFrom != this->m_hWnd) { bHandled = FALSE; return 0; } bool bBlockTracking = false; if((m_dwExtendedStyle & CBR_EX_TRACKALWAYS) == 0) { DWORD dwProcessID; ::GetWindowThreadProcessId(::GetActiveWindow(), &dwProcessID); bBlockTracking = (::GetCurrentProcessId() != dwProcessID); } if((!m_wndParent.IsWindowEnabled() || bBlockTracking) && (lpNMHT->dwFlags & HICF_MOUSE)) return 1; bHandled = FALSE; // Send WM_MENUSELECT to the app if it needs to display a status text if(!(lpNMHT->dwFlags & HICF_MOUSE) && !(lpNMHT->dwFlags & HICF_ACCELERATOR) && !(lpNMHT->dwFlags & HICF_LMOUSE)) { if(lpNMHT->dwFlags & HICF_ENTERING) m_wndParent.SendMessage(WM_MENUSELECT, 0, (LPARAM)m_hMenu); if(lpNMHT->dwFlags & HICF_LEAVING) m_wndParent.SendMessage(WM_MENUSELECT, MAKEWPARAM(0, 0xFFFF), NULL); } return 0; } LRESULT OnParentDropDown(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { // Check if this comes from us if(pnmh->hwndFrom != this->m_hWnd) { bHandled = FALSE; return 1; } T* pT = static_cast(this); if(::GetFocus() != this->m_hWnd) pT->TakeFocus(); LPNMTOOLBAR pNMToolBar = (LPNMTOOLBAR)pnmh; int nIndex = this->CommandToIndex(pNMToolBar->iItem); m_bContextMenu = false; m_bEscapePressed = false; pT->DoPopupMenu(nIndex, true); return TBDDRET_DEFAULT; } LRESULT OnParentInitMenuPopup(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return OnInitMenuPopup(uMsg, wParam, lParam, bHandled); } LRESULT OnParentInternalGetBar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return OnInternalGetBar(uMsg, wParam, lParam, bHandled); } LRESULT OnParentSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { bHandled = FALSE; if(((m_uSysKey == VK_MENU) || ((m_uSysKey == VK_F10) && !(::GetKeyState(VK_SHIFT) & 0x80)) || (m_uSysKey == VK_SPACE)) && (wParam == SC_KEYMENU)) { T* pT = static_cast(this); if(::GetFocus() == this->m_hWnd) { pT->GiveFocusBack(); // exit menu "loop" this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); } else if((m_uSysKey != VK_SPACE) && !m_bSkipMsg) { if(m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) ShowKeyboardCues(true); pT->TakeFocus(); // enter menu "loop" bHandled = TRUE; } else if(m_uSysKey != VK_SPACE) { bHandled = TRUE; } } m_bSkipMsg = false; return 0; } LRESULT OnParentAPIGetMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return OnAPIGetMenu(uMsg, wParam, lParam, bHandled); } LRESULT OnParentMenuChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return OnMenuChar(uMsg, wParam, lParam, bHandled); } LRESULT OnParentAPITrackPopupMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return OnAPITrackPopupMenu(uMsg, wParam, lParam, bHandled); } LRESULT OnParentAPIGetCmdBar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return OnAPIGetCmdBar(uMsg, wParam, lParam, bHandled); } LRESULT OnParentSettingChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { OnSettingChange(uMsg, wParam, lParam, bHandled); bHandled = FALSE; return 1; } LRESULT OnParentDrawItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return OnDrawItem(uMsg, wParam, lParam, bHandled); } LRESULT OnParentMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { return OnMeasureItem(uMsg, wParam, lParam, bHandled); } LRESULT OnParentActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); if(!m_bParentActive && m_bUseKeyboardCues && m_bShowKeyboardCues) { ShowKeyboardCues(false); // this will repaint our window } else { this->Invalidate(); this->UpdateWindow(); } bHandled = FALSE; return 1; } LRESULT OnParentCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { LRESULT lRet = CDRF_DODEFAULT; bHandled = FALSE; if(pnmh->hwndFrom == this->m_hWnd) { LPNMTBCUSTOMDRAW lpTBCustomDraw = (LPNMTBCUSTOMDRAW)pnmh; if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_PREPAINT) { lRet = CDRF_NOTIFYITEMDRAW; bHandled = TRUE; } else if(lpTBCustomDraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) { #if _WTL_CMDBAR_VISTA_MENUS && defined(_WTL_CMDBAR_VISTA_STD_MENUBAR) if(m_bVistaMenus) { ::SetRectEmpty(&lpTBCustomDraw->rcText); lRet = CDRF_NOTIFYPOSTPAINT; bHandled = TRUE; } else #endif // _WTL_CMDBAR_VISTA_MENUS && defined(_WTL_CMDBAR_VISTA_STD_MENUBAR) { if(m_bFlatMenus) { bool bDisabled = ((lpTBCustomDraw->nmcd.uItemState & CDIS_DISABLED) == CDIS_DISABLED); if(!bDisabled && (((lpTBCustomDraw->nmcd.uItemState & CDIS_HOT) == CDIS_HOT) || (lpTBCustomDraw->nmcd.uItemState & CDIS_SELECTED) == CDIS_SELECTED)) { ::FillRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_MENUHILIGHT)); ::FrameRect(lpTBCustomDraw->nmcd.hdc, &lpTBCustomDraw->nmcd.rc, ::GetSysColorBrush(COLOR_HIGHLIGHT)); lpTBCustomDraw->clrText = ::GetSysColor(m_bParentActive ? COLOR_HIGHLIGHTTEXT : COLOR_GRAYTEXT); } else if(bDisabled || !m_bParentActive) { lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); } _ParentCustomDrawHelper(lpTBCustomDraw); lRet = CDRF_SKIPDEFAULT; bHandled = TRUE; } else if(!m_bParentActive) { lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); bHandled = TRUE; } } } #if _WTL_CMDBAR_VISTA_MENUS && defined(_WTL_CMDBAR_VISTA_STD_MENUBAR) else if (lpTBCustomDraw->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT) { bool bDisabled = ((lpTBCustomDraw->nmcd.uItemState & CDIS_DISABLED) == CDIS_DISABLED); if(bDisabled || !m_bParentActive) lpTBCustomDraw->clrText = ::GetSysColor(COLOR_GRAYTEXT); _ParentCustomDrawHelper(lpTBCustomDraw); lRet = CDRF_SKIPDEFAULT; bHandled = TRUE; } #endif // _WTL_CMDBAR_VISTA_MENUS && defined(_WTL_CMDBAR_VISTA_STD_MENUBAR) } return lRet; } void _ParentCustomDrawHelper(LPNMTBCUSTOMDRAW lpTBCustomDraw) { CDCHandle dc = lpTBCustomDraw->nmcd.hdc; dc.SetTextColor(lpTBCustomDraw->clrText); dc.SetBkMode(lpTBCustomDraw->nStringBkMode); HFONT hFont = this->GetFont(); HFONT hFontOld = NULL; if(hFont != NULL) hFontOld = dc.SelectFont(hFont); const int cchText = 200; TCHAR szText[cchText] = {}; TBBUTTONINFO tbbi = {}; tbbi.cbSize = sizeof(TBBUTTONINFO); tbbi.dwMask = TBIF_TEXT; tbbi.pszText = szText; tbbi.cchText = cchText; this->GetButtonInfo((int)lpTBCustomDraw->nmcd.dwItemSpec, &tbbi); dc.DrawText(szText, -1, &lpTBCustomDraw->nmcd.rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); if(hFont != NULL) dc.SelectFont(hFontOld); } // Message hook handlers LRESULT OnHookMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { static POINT s_point = { -1, -1 }; DWORD dwPoint = ::GetMessagePos(); POINT point = { GET_X_LPARAM(dwPoint), GET_Y_LPARAM(dwPoint) }; bHandled = FALSE; if(m_bMenuActive) { if(::WindowFromPoint(point) == this->m_hWnd) { this->ScreenToClient(&point); int nHit = this->HitTest(&point); if(((point.x != s_point.x) || (point.y != s_point.y)) && (nHit >= 0) && (nHit < ::GetMenuItemCount(m_hMenu)) && (nHit != m_nPopBtn) && (m_nPopBtn != -1)) { TBBUTTON tbb = {}; this->GetButton(nHit, &tbb); if((tbb.fsState & TBSTATE_ENABLED) != 0) { m_nNextPopBtn = nHit | 0xFFFF0000; HWND hWndMenu = this->m_stackMenuWnd.GetCurrent(); ATLASSERT(hWndMenu != NULL); // this one is needed to close a menu if mouse button was down ::PostMessage(hWndMenu, WM_LBUTTONUP, 0, MAKELPARAM(point.x, point.y)); // this one closes a popup menu ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); bHandled = TRUE; } } } } else { this->ScreenToClient(&point); } s_point = point; return 0; } LRESULT OnHookSysKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { bHandled = FALSE; #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSKEYDOWN (0x%2.2X)\n"), wParam); #endif if((wParam == VK_MENU) && m_bParentActive && m_bUseKeyboardCues && !m_bShowKeyboardCues && m_bAllowKeyboardCues) ShowKeyboardCues(true); if((wParam != VK_SPACE) && !m_bMenuActive && (::GetFocus() == this->m_hWnd)) { m_bAllowKeyboardCues = false; this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); T* pT = static_cast(this); pT->GiveFocusBack(); m_bSkipMsg = true; } else { if((wParam == VK_SPACE) && m_bUseKeyboardCues && m_bShowKeyboardCues) { m_bAllowKeyboardCues = true; ShowKeyboardCues(false); } m_uSysKey = (UINT)wParam; } return 0; } LRESULT OnHookSysKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(!m_bAllowKeyboardCues) m_bAllowKeyboardCues = true; bHandled = FALSE; (void)wParam; // avoid level 4 warning #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSKEYUP (0x%2.2X)\n"), wParam); #endif return 0; } LRESULT OnHookSysChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { bHandled = FALSE; #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_SYSCHAR (0x%2.2X)\n"), wParam); #endif if(!m_bMenuActive && (this->m_hWndHook != this->m_hWnd) && (wParam != VK_SPACE)) bHandled = TRUE; return 0; } LRESULT OnHookKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_KEYDOWN (0x%2.2X)\n"), wParam); #endif bHandled = FALSE; T* pT = static_cast(this); if((wParam == VK_ESCAPE) && (this->m_stackMenuWnd.GetSize() <= 1)) { if(m_bMenuActive && !m_bContextMenu) { int nHot = this->GetHotItem(); if(nHot == -1) nHot = m_nPopBtn; if(nHot == -1) nHot = 0; this->SetHotItem(nHot); bHandled = TRUE; pT->TakeFocus(); m_bEscapePressed = true; // To keep focus m_bSkipPostDown = false; } else if((::GetFocus() == this->m_hWnd) && m_wndParent.IsWindow()) { this->SetHotItem(-1); pT->GiveFocusBack(); bHandled = TRUE; } } else if((wParam == VK_RETURN) || (wParam == VK_UP) || (wParam == VK_DOWN)) { if(!m_bMenuActive && (::GetFocus() == this->m_hWnd) && m_wndParent.IsWindow()) { int nHot = this->GetHotItem(); if(nHot != -1) { if(wParam != VK_RETURN) { if(!m_bSkipPostDown) { this->PostMessage(WM_KEYDOWN, VK_DOWN, 0L); m_bSkipPostDown = true; } else { ATLTRACE2(atlTraceUI, 0, _T("CmdBar - skipping posting another VK_DOWN\n")); m_bSkipPostDown = false; } } } else { ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Can't find hot button\n")); } } if((wParam == VK_RETURN) && m_bMenuActive) { this->PostMessage(TB_SETHOTITEM, (WPARAM)-1, 0L); m_nNextPopBtn = -1; pT->GiveFocusBack(); } } else if((wParam == VK_LEFT) || (wParam == VK_RIGHT)) { WPARAM wpNext = m_bLayoutRTL ? VK_LEFT : VK_RIGHT; WPARAM wpPrev = m_bLayoutRTL ? VK_RIGHT : VK_LEFT; if(m_bMenuActive && !m_bContextMenu && !((wParam == wpNext) && m_bPopupItem)) { bool bAction = false; if((wParam == wpPrev) && (this->s_pCurrentBar->m_stackMenuWnd.GetSize() == 1)) { m_nNextPopBtn = pT->GetPreviousMenuItem(m_nPopBtn); if(m_nNextPopBtn != -1) bAction = true; } else if(wParam == wpNext) { m_nNextPopBtn = pT->GetNextMenuItem(m_nPopBtn); if(m_nNextPopBtn != -1) bAction = true; } HWND hWndMenu = this->m_stackMenuWnd.GetCurrent(); ATLASSERT(hWndMenu != NULL); // Close the popup menu if(bAction) { ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); if(wParam == wpNext) { int cItem = this->m_stackMenuWnd.GetSize() - 1; while(cItem >= 0) { hWndMenu = this->m_stackMenuWnd[cItem]; if(hWndMenu != NULL) ::PostMessage(hWndMenu, WM_KEYDOWN, VK_ESCAPE, 0L); cItem--; } } if(m_nNextPopBtn == -2) { m_nNextPopBtn = -1; pT->DisplayChevronMenu(); } bHandled = TRUE; } } } return 0; } LRESULT OnHookNextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_NEXTMENU\n")); #endif bHandled = FALSE; return 1; } LRESULT OnHookChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook WM_CHAR (0x%2.2X)\n"), wParam); #endif bHandled = (wParam == VK_ESCAPE); return 0; } // Implementation - ownerdraw overrideables and helpers void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { T* pT = static_cast(this); if(m_bFlatMenus) pT->DrawItemFlat(lpDrawItemStruct); else pT->DrawItem3D(lpDrawItemStruct); } void DrawItem3D(LPDRAWITEMSTRUCT lpDrawItemStruct) { _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; CDCHandle dc = lpDrawItemStruct->hDC; const RECT& rcItem = lpDrawItemStruct->rcItem; T* pT = static_cast(this); if(pmd->fType & MFT_SEPARATOR) { // draw separator RECT rc = rcItem; rc.top += (rc.bottom - rc.top) / 2; // vertical center dc.DrawEdge(&rc, EDGE_ETCHED, BF_TOP); // draw separator line } else // not a separator { BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED; BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED; BOOL bHasImage = FALSE; if(LOWORD(lpDrawItemStruct->itemID) == (WORD)-1) bSelected = FALSE; RECT rcButn = { rcItem.left, rcItem.top, rcItem.left + m_szButton.cx, rcItem.top + m_szButton.cy }; // button rect ::OffsetRect(&rcButn, 0, ((rcItem.bottom - rcItem.top) - (rcButn.bottom - rcButn.top)) / 2); // center vertically int iButton = pmd->iButton; if(iButton >= 0) { bHasImage = TRUE; // calc drawing point SIZE sz = { rcButn.right - rcButn.left - m_szBitmap.cx, rcButn.bottom - rcButn.top - m_szBitmap.cy }; sz.cx /= 2; sz.cy /= 2; POINT point = { rcButn.left + sz.cx, rcButn.top + sz.cy }; // fill background depending on state if(!bChecked || (bSelected && !bDisabled)) { if(!bDisabled) dc.FillRect(&rcButn, (bChecked && !bSelected) ? COLOR_3DLIGHT : COLOR_MENU); else dc.FillRect(&rcButn, COLOR_MENU); } else { COLORREF crTxt = dc.SetTextColor(::GetSysColor(COLOR_BTNFACE)); COLORREF crBk = dc.SetBkColor(::GetSysColor(COLOR_BTNHILIGHT)); CBrush hbr(CDCHandle::GetHalftoneBrush()); dc.SetBrushOrg(rcButn.left, rcButn.top); dc.FillRect(&rcButn, hbr); dc.SetTextColor(crTxt); dc.SetBkColor(crBk); } // draw disabled or normal if(!bDisabled) { // draw pushed-in or popped-out edge if(bSelected || bChecked) { RECT rc2 = rcButn; dc.DrawEdge(&rc2, bChecked ? BDR_SUNKENOUTER : BDR_RAISEDINNER, BF_RECT); } // draw the image ::ImageList_Draw(m_hImageList, iButton, dc, point.x, point.y, ILD_TRANSPARENT); } else { HBRUSH hBrushBackground = bChecked ? NULL : ::GetSysColorBrush(COLOR_MENU); pT->DrawBitmapDisabled(dc, iButton, point, hBrushBackground); } } else { // no image - look for custom checked/unchecked bitmaps CMenuItemInfo info; info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); if(bChecked || (info.hbmpUnchecked != NULL)) { BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); bHasImage = pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); } } // draw item text int cxButn = m_szButton.cx; COLORREF colorBG = ::GetSysColor(bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); if(bSelected || (lpDrawItemStruct->itemAction == ODA_SELECT)) { RECT rcBG = rcItem; if(bHasImage) rcBG.left += cxButn + s_kcxGap; dc.FillRect(&rcBG, bSelected ? COLOR_HIGHLIGHT : COLOR_MENU); } // calc text rectangle and colors RECT rcText = rcItem; rcText.left += cxButn + s_kcxGap + s_kcxTextMargin; rcText.right -= cxButn; dc.SetBkMode(TRANSPARENT); COLORREF colorText = ::GetSysColor(bDisabled ? (bSelected ? COLOR_GRAYTEXT : COLOR_3DSHADOW) : (bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)); // font already selected by Windows if(bDisabled && (!bSelected || (colorText == colorBG))) { // disabled - draw shadow text shifted down and right 1 pixel (unles selected) RECT rcDisabled = rcText; ::OffsetRect(&rcDisabled, 1, 1); pT->DrawMenuText(dc, rcDisabled, pmd->lpstrText, ::GetSysColor(COLOR_3DHILIGHT)); } pT->DrawMenuText(dc, rcText, pmd->lpstrText, colorText); // finally! } } void DrawItemFlat(LPDRAWITEMSTRUCT lpDrawItemStruct) { _MenuItemData* pmd = (_MenuItemData*)lpDrawItemStruct->itemData; CDCHandle dc = lpDrawItemStruct->hDC; const RECT& rcItem = lpDrawItemStruct->rcItem; T* pT = static_cast(this); BOOL bDisabled = lpDrawItemStruct->itemState & ODS_GRAYED; BOOL bSelected = lpDrawItemStruct->itemState & ODS_SELECTED; BOOL bChecked = lpDrawItemStruct->itemState & ODS_CHECKED; // paint background if(bSelected || (lpDrawItemStruct->itemAction == ODA_SELECT)) { if(bSelected) { dc.FillRect(&rcItem, ::GetSysColorBrush(COLOR_MENUHILIGHT)); dc.FrameRect(&rcItem, ::GetSysColorBrush(COLOR_HIGHLIGHT)); } else { dc.FillRect(&rcItem, ::GetSysColorBrush(COLOR_MENU)); } } if(pmd->fType & MFT_SEPARATOR) { // draw separator RECT rc = rcItem; rc.top += (rc.bottom - rc.top) / 2; // vertical center dc.DrawEdge(&rc, EDGE_ETCHED, BF_TOP); // draw separator line } else // not a separator { if(LOWORD(lpDrawItemStruct->itemID) == (WORD)-1) bSelected = FALSE; RECT rcButn = { rcItem.left, rcItem.top, rcItem.left + m_szButton.cx, rcItem.top + m_szButton.cy }; // button rect ::OffsetRect(&rcButn, 0, ((rcItem.bottom - rcItem.top) - (rcButn.bottom - rcButn.top)) / 2); // center vertically // draw background and border for checked items if(bChecked) { RECT rcCheck = rcButn; ::InflateRect(&rcCheck, -1, -1); if(bSelected) dc.FillRect(&rcCheck, ::GetSysColorBrush(COLOR_MENU)); dc.FrameRect(&rcCheck, ::GetSysColorBrush(COLOR_HIGHLIGHT)); } int iButton = pmd->iButton; if(iButton >= 0) { // calc drawing point SIZE sz = { rcButn.right - rcButn.left - m_szBitmap.cx, rcButn.bottom - rcButn.top - m_szBitmap.cy }; sz.cx /= 2; sz.cy /= 2; POINT point = { rcButn.left + sz.cx, rcButn.top + sz.cy }; // draw disabled or normal if(!bDisabled) { ::ImageList_Draw(m_hImageList, iButton, dc, point.x, point.y, ILD_TRANSPARENT); } else { HBRUSH hBrushBackground = ::GetSysColorBrush((bSelected && !bChecked) ? COLOR_MENUHILIGHT : COLOR_MENU); HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW); pT->DrawBitmapDisabled(dc, iButton, point, hBrushBackground, hBrushBackground, hBrushDisabledImage); } } else { // no image - look for custom checked/unchecked bitmaps CMenuItemInfo info; info.fMask = MIIM_CHECKMARKS | MIIM_TYPE; ::GetMenuItemInfo((HMENU)lpDrawItemStruct->hwndItem, lpDrawItemStruct->itemID, MF_BYCOMMAND, &info); if(bChecked || (info.hbmpUnchecked != NULL)) { BOOL bRadio = ((info.fType & MFT_RADIOCHECK) != 0); pT->DrawCheckmark(dc, rcButn, bSelected, bDisabled, bRadio, bChecked ? info.hbmpChecked : info.hbmpUnchecked); } } // draw item text int cxButn = m_szButton.cx; // calc text rectangle and colors RECT rcText = rcItem; rcText.left += cxButn + s_kcxGap + s_kcxTextMargin; rcText.right -= cxButn; dc.SetBkMode(TRANSPARENT); COLORREF colorText = ::GetSysColor(bDisabled ? (bSelected ? COLOR_GRAYTEXT : COLOR_3DSHADOW) : (bSelected ? COLOR_HIGHLIGHTTEXT : COLOR_MENUTEXT)); pT->DrawMenuText(dc, rcText, pmd->lpstrText, colorText); // finally! } } void DrawMenuText(CDCHandle& dc, RECT& rc, LPCTSTR lpstrText, COLORREF color) { int nTab = -1; const int nLen = lstrlen(lpstrText); for(int i = 0; i < nLen; i++) { if(lpstrText[i] == _T('\t')) { nTab = i; break; } } dc.SetTextColor(color); dc.DrawText(lpstrText, nTab, &rc, DT_SINGLELINE | DT_LEFT | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); if(nTab != -1) dc.DrawText(&lpstrText[nTab + 1], -1, &rc, DT_SINGLELINE | DT_RIGHT | DT_VCENTER | (m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX)); } void DrawBitmapDisabled(CDCHandle& dc, int nImage, POINT point, HBRUSH hBrushBackground = ::GetSysColorBrush(COLOR_3DFACE), HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) { if(m_bAlphaImages) { IMAGELISTDRAWPARAMS ildp = {}; ildp.cbSize = sizeof(IMAGELISTDRAWPARAMS); ildp.himl = m_hImageList; ildp.i = nImage; ildp.hdcDst = dc; ildp.x = point.x; ildp.y = point.y; ildp.cx = 0; ildp.cy = 0; ildp.xBitmap = 0; ildp.yBitmap = 0; ildp.fStyle = ILD_TRANSPARENT; ildp.fState = ILS_SATURATE; ildp.Frame = 0; ::ImageList_DrawIndirect(&ildp); } else { // create memory DC CDC dcMem; dcMem.CreateCompatibleDC(dc); // create mono or color bitmap CBitmap bmp; bmp.CreateCompatibleBitmap(dc, m_szBitmap.cx, m_szBitmap.cy); ATLASSERT(bmp.m_hBitmap != NULL); // draw image into memory DC--fill BG white first HBITMAP hBmpOld = dcMem.SelectBitmap(bmp); dcMem.PatBlt(0, 0, m_szBitmap.cx, m_szBitmap.cy, WHITENESS); // If white is the text color, we can't use the normal painting since // it would blend with the WHITENESS, but the mask is OK UINT uDrawStyle = (::GetSysColor(COLOR_BTNTEXT) == RGB(255, 255, 255)) ? ILD_MASK : ILD_NORMAL; ::ImageList_Draw(m_hImageList, nImage, dcMem, 0, 0, uDrawStyle); dc.DitherBlt(point.x, point.y, m_szBitmap.cx, m_szBitmap.cy, dcMem, NULL, 0, 0, hBrushBackground, hBrush3DEffect, hBrushDisabledImage); dcMem.SelectBitmap(hBmpOld); // restore } } // old name BOOL Draw3DCheckmark(CDCHandle& dc, const RECT& rc, BOOL bSelected, BOOL bDisabled, BOOL bRadio, HBITMAP hBmpCheck) { return DrawCheckmark(dc, rc, bSelected, bDisabled, bRadio, hBmpCheck); } BOOL DrawCheckmark(CDCHandle& dc, const RECT& rc, BOOL bSelected, BOOL bDisabled, BOOL bRadio, HBITMAP hBmpCheck) { // get checkmark bitmap, if none, use Windows standard SIZE size = {}; CBitmapHandle bmp = hBmpCheck; if(hBmpCheck != NULL) { bmp.GetSize(size); } else { size.cx = ::GetSystemMetrics(SM_CXMENUCHECK); size.cy = ::GetSystemMetrics(SM_CYMENUCHECK); bmp.CreateCompatibleBitmap(dc, size.cx, size.cy); ATLASSERT(bmp.m_hBitmap != NULL); } // center bitmap in caller's rectangle RECT rcDest = rc; if((rc.right - rc.left) > size.cx) { rcDest.left = rc.left + (rc.right - rc.left - size.cx) / 2; rcDest.right = rcDest.left + size.cx; } if((rc.bottom - rc.top) > size.cy) { rcDest.top = rc.top + (rc.bottom - rc.top - size.cy) / 2; rcDest.bottom = rcDest.top + size.cy; } // paint background if(!m_bFlatMenus) { if(bSelected && !bDisabled) { dc.FillRect(&rcDest, COLOR_MENU); } else { COLORREF clrTextOld = dc.SetTextColor(::GetSysColor(COLOR_BTNFACE)); COLORREF clrBkOld = dc.SetBkColor(::GetSysColor(COLOR_BTNHILIGHT)); CBrush hbr(CDCHandle::GetHalftoneBrush()); dc.SetBrushOrg(rcDest.left, rcDest.top); dc.FillRect(&rcDest, hbr); dc.SetTextColor(clrTextOld); dc.SetBkColor(clrBkOld); } } // create source image CDC dcSource; dcSource.CreateCompatibleDC(dc); HBITMAP hBmpOld = dcSource.SelectBitmap(bmp); // set colors const COLORREF clrBlack = RGB(0, 0, 0); const COLORREF clrWhite = RGB(255, 255, 255); COLORREF clrTextOld = dc.SetTextColor(clrBlack); COLORREF clrBkOld = dc.SetBkColor(clrWhite); // create mask CDC dcMask; dcMask.CreateCompatibleDC(dc); CBitmap bmpMask; bmpMask.CreateBitmap(size.cx, size.cy, 1, 1, NULL); HBITMAP hBmpOld1 = dcMask.SelectBitmap(bmpMask); // draw the checkmark transparently int cx = rcDest.right - rcDest.left; int cy = rcDest.bottom - rcDest.top; if(hBmpCheck != NULL) { // build mask based on transparent color dcSource.SetBkColor(m_clrMask); dcMask.SetBkColor(clrBlack); dcMask.SetTextColor(clrWhite); dcMask.BitBlt(0, 0, size.cx, size.cy, dcSource, 0, 0, SRCCOPY); // draw bitmap using the mask dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, SRCINVERT); dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, SRCAND); dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, SRCINVERT); } else { const DWORD ROP_DSno = 0x00BB0226L; const DWORD ROP_DSa = 0x008800C6L; const DWORD ROP_DSo = 0x00EE0086L; const DWORD ROP_DSna = 0x00220326L; // draw mask RECT rcSource = { 0, 0, __min(size.cx, rc.right - rc.left), __min(size.cy, rc.bottom - rc.top) }; dcMask.DrawFrameControl(&rcSource, DFC_MENU, bRadio ? DFCS_MENUBULLET : DFCS_MENUCHECK); // draw shadow if disabled if(!m_bFlatMenus && bDisabled) { // offset by one pixel int x = rcDest.left + 1; int y = rcDest.top + 1; // paint source bitmap const int nColor = COLOR_3DHILIGHT; dcSource.FillRect(&rcSource, nColor); // draw checkmark - special case black and white colors COLORREF clrCheck = ::GetSysColor(nColor); if(clrCheck == clrWhite) { dc.BitBlt(x, y, cx, cy, dcMask, 0, 0, ROP_DSno); dc.BitBlt(x, y, cx, cy, dcSource, 0, 0, ROP_DSa); } else { if(clrCheck != clrBlack) { ATLASSERT(dcSource.GetTextColor() == clrBlack); ATLASSERT(dcSource.GetBkColor() == clrWhite); dcSource.BitBlt(0, 0, size.cx, size.cy, dcMask, 0, 0, ROP_DSna); } dc.BitBlt(x, y, cx, cy, dcMask, 0, 0, ROP_DSa); dc.BitBlt(x, y, cx, cy, dcSource, 0, 0, ROP_DSo); } } // paint source bitmap const int nColor = bDisabled ? COLOR_BTNSHADOW : COLOR_MENUTEXT; dcSource.FillRect(&rcSource, nColor); // draw checkmark - special case black and white colors COLORREF clrCheck = ::GetSysColor(nColor); if(clrCheck == clrWhite) { dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, ROP_DSno); dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, ROP_DSa); } else { if(clrCheck != clrBlack) { ATLASSERT(dcSource.GetTextColor() == clrBlack); ATLASSERT(dcSource.GetBkColor() == clrWhite); dcSource.BitBlt(0, 0, size.cx, size.cy, dcMask, 0, 0, ROP_DSna); } dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcMask, 0, 0, ROP_DSa); dc.BitBlt(rcDest.left, rcDest.top, cx, cy, dcSource, 0, 0, ROP_DSo); } } // restore all dc.SetTextColor(clrTextOld); dc.SetBkColor(clrBkOld); dcSource.SelectBitmap(hBmpOld); dcMask.SelectBitmap(hBmpOld1); if(hBmpCheck == NULL) bmp.DeleteObject(); // draw pushed-in hilight if(!m_bFlatMenus && !bDisabled) { if(rc.right - rc.left > size.cx) ::InflateRect(&rcDest, 1,1); // inflate checkmark by one pixel all around dc.DrawEdge(&rcDest, BDR_SUNKENOUTER, BF_RECT); } return TRUE; } void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) { _MenuItemData* pmd = (_MenuItemData*)lpMeasureItemStruct->itemData; if(pmd->fType & MFT_SEPARATOR) // separator - use half system height and zero width { lpMeasureItemStruct->itemHeight = ::GetSystemMetrics(SM_CYMENU) / 2; lpMeasureItemStruct->itemWidth = 0; } else { // compute size of text - use DrawText with DT_CALCRECT CWindowDC dc(NULL); CFont fontBold; HFONT hOldFont = NULL; if(pmd->fState & MFS_DEFAULT) { // need bold version of font LOGFONT lf = {}; m_fontMenu.GetLogFont(lf); lf.lfWeight += 200; fontBold.CreateFontIndirect(&lf); ATLASSERT(fontBold.m_hFont != NULL); hOldFont = dc.SelectFont(fontBold); } else { hOldFont = dc.SelectFont(m_fontMenu); } RECT rcText = {}; dc.DrawText(pmd->lpstrText, -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); int cx = rcText.right - rcText.left; dc.SelectFont(hOldFont); LOGFONT lf = {}; m_fontMenu.GetLogFont(lf); int cy = lf.lfHeight; if(cy < 0) cy = -cy; const int cyMargin = 8; cy += cyMargin; // height of item is the bigger of these two lpMeasureItemStruct->itemHeight = __max(cy, (int)m_szButton.cy); // width is width of text plus a bunch of stuff cx += 2 * s_kcxTextMargin; // L/R margin for readability cx += s_kcxGap; // space between button and menu text cx += 2 * m_szButton.cx; // button width (L=button; R=empty margin) cx += m_cxExtraSpacing; // extra between item text and accelerator keys // Windows adds 1 to returned value cx -= ::GetSystemMetrics(SM_CXMENUCHECK) - 1; lpMeasureItemStruct->itemWidth = cx; // done deal } } // Implementation - Hook procs static LRESULT CALLBACK CreateHookProc(int nCode, WPARAM wParam, LPARAM lParam) { const int cchClassName = 7; TCHAR szClassName[cchClassName] = {}; if(nCode == HCBT_CREATEWND) { HWND hWndMenu = (HWND)wParam; #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - HCBT_CREATEWND (HWND = %8.8X)\n"), hWndMenu); #endif ::GetClassName(hWndMenu, szClassName, cchClassName); if(!lstrcmp(_T("#32768"), szClassName)) CCommandBarCtrlBase::s_pCurrentBar->m_stackMenuWnd.Push(hWndMenu); } else if(nCode == HCBT_DESTROYWND) { HWND hWndMenu = (HWND)wParam; #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - HCBT_DESTROYWND (HWND = %8.8X)\n"), hWndMenu); #endif ::GetClassName(hWndMenu, szClassName, cchClassName); if(!lstrcmp(_T("#32768"), szClassName)) { ATLASSERT(hWndMenu == CCommandBarCtrlBase::s_pCurrentBar->m_stackMenuWnd.GetCurrent()); CCommandBarCtrlBase::s_pCurrentBar->m_stackMenuWnd.Pop(); } } return ::CallNextHookEx(CCommandBarCtrlBase::s_hCreateHook, nCode, wParam, lParam); } static LRESULT CALLBACK MessageHookProc(int nCode, WPARAM wParam, LPARAM lParam) { LPMSG pMsg = (LPMSG)lParam; if((nCode == HC_ACTION) && (wParam == PM_REMOVE) && (pMsg->message != GetGetBarMessage()) && (pMsg->message != WM_FORWARDMSG)) { CCommandBarCtrlBase* pCmdBar = NULL; HWND hWnd = pMsg->hwnd; DWORD dwPID = 0; while((pCmdBar == NULL) && (hWnd != NULL)) { pCmdBar = (CCommandBarCtrlBase*)::SendMessage(hWnd, GetGetBarMessage(), (WPARAM)&dwPID, 0L); hWnd = ::GetParent(hWnd); } if((pCmdBar != NULL) && (dwPID == GetCurrentProcessId())) { pCmdBar->m_hWndHook = pMsg->hwnd; ATLASSERT(pCmdBar->IsCommandBarBase()); if(::IsWindow(pCmdBar->m_hWnd)) pCmdBar->SendMessage(WM_FORWARDMSG, 0, (LPARAM)pMsg); else ATLTRACE2(atlTraceUI, 0, _T("CmdBar - Hook skipping message, can't find command bar!\n")); } } LRESULT lRet = 0; ATLASSERT(CCommandBarCtrlBase::s_pmapMsgHook != NULL); if(CCommandBarCtrlBase::s_pmapMsgHook != NULL) { DWORD dwThreadID = ::GetCurrentThreadId(); CCommandBarCtrlBase::_MsgHookData* pData = CCommandBarCtrlBase::s_pmapMsgHook->Lookup(dwThreadID); if(pData != NULL) { lRet = ::CallNextHookEx(pData->hMsgHook, nCode, wParam, lParam); } } return lRet; } // Implementation void DoPopupMenu(int nIndex, bool bAnimate) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - DoPopupMenu, bAnimate = %s\n"), bAnimate ? "true" : "false"); #endif T* pT = static_cast(this); // get popup menu and it's position RECT rect = {}; this->GetItemRect(nIndex, &rect); POINT pt = { rect.left, rect.bottom }; this->MapWindowPoints(NULL, &pt, 1); this->MapWindowPoints(NULL, &rect); TPMPARAMS TPMParams = {}; TPMParams.cbSize = sizeof(TPMPARAMS); TPMParams.rcExclude = rect; HMENU hMenuPopup = ::GetSubMenu(m_hMenu, nIndex); ATLASSERT(hMenuPopup != NULL); // get button ID TBBUTTON tbb = {}; this->GetButton(nIndex, &tbb); int nCmdID = tbb.idCommand; m_nPopBtn = nIndex; // remember current button's index // press button and display popup menu this->PressButton(nCmdID, TRUE); this->SetHotItem(nCmdID); pT->DoTrackPopupMenu(hMenuPopup, TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | (bAnimate ? TPM_VERPOSANIMATION : TPM_NOANIMATION), pt.x, pt.y, &TPMParams); this->PressButton(nCmdID, FALSE); if(::GetFocus() != this->m_hWnd) this->SetHotItem(-1); m_nPopBtn = -1; // restore // eat next message if click is on the same button MSG msg = {}; if(::PeekMessage(&msg, this->m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rect, msg.pt)) ::PeekMessage(&msg, this->m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); // check if another popup menu should be displayed if(m_nNextPopBtn != -1) { this->PostMessage(GetAutoPopupMessage(), m_nNextPopBtn & 0xFFFF); if(!(m_nNextPopBtn & 0xFFFF0000) && !m_bPopupItem) this->PostMessage(WM_KEYDOWN, VK_DOWN, 0); m_nNextPopBtn = -1; } else { m_bContextMenu = false; // If user didn't hit escape, give focus back if(!m_bEscapePressed) { if(m_bUseKeyboardCues && m_bShowKeyboardCues) m_bAllowKeyboardCues = false; pT->GiveFocusBack(); } else { this->SetHotItem(nCmdID); this->SetAnchorHighlight(TRUE); } } } BOOL DoTrackPopupMenu(HMENU hMenu, UINT uFlags, int x, int y, LPTPMPARAMS lpParams = NULL) { CMenuHandle menuPopup = hMenu; CWindowCreateCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::DoTrackPopupMenu.\n")); ATLASSERT(FALSE); return FALSE; } ATLASSERT(this->s_hCreateHook == NULL); this->s_pCurrentBar = static_cast(this); this->s_hCreateHook = ::SetWindowsHookEx(WH_CBT, CreateHookProc, ModuleHelper::GetModuleInstance(), GetCurrentThreadId()); ATLASSERT(this->s_hCreateHook != NULL); m_bPopupItem = false; m_bMenuActive = true; BOOL bTrackRet = menuPopup.TrackPopupMenuEx(uFlags, x, y, this->m_hWnd, lpParams); m_bMenuActive = false; ::UnhookWindowsHookEx(this->s_hCreateHook); this->s_hCreateHook = NULL; this->s_pCurrentBar = NULL; lock.Unlock(); // cleanup - convert menus back to original state #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - TrackPopupMenu - cleanup\n")); #endif ATLASSERT(this->m_stackMenuWnd.GetSize() == 0); this->UpdateWindow(); ATL::CWindow wndTL = this->GetTopLevelParent(); wndTL.UpdateWindow(); // restore the menu items to the previous state for all menus that were converted if(m_bImagesVisible) { HMENU hMenuSav = NULL; while((hMenuSav = this->m_stackMenuHandle.Pop()) != NULL) { menuPopup = hMenuSav; BOOL bRet = FALSE; // restore state and delete menu item data for(int i = 0; i < menuPopup.GetMenuItemCount(); i++) { CMenuItemInfo mii; mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID; bRet = menuPopup.GetMenuItemInfo(i, TRUE, &mii); ATLASSERT(bRet); _MenuItemData* pMI = (_MenuItemData*)mii.dwItemData; if(_IsValidMem(pMI) && pMI->IsCmdBarMenuItem()) { mii.fMask = MIIM_DATA | MIIM_TYPE | MIIM_STATE; mii.fType = pMI->fType; mii.fState = pMI->fState; mii.dwTypeData = pMI->lpstrText; mii.cch = lstrlen(pMI->lpstrText); mii.dwItemData = NULL; bRet = menuPopup.SetMenuItemInfo(i, TRUE, &mii); // this one triggers WM_MEASUREITEM menuPopup.ModifyMenu(i, MF_BYPOSITION | mii.fType | mii.fState, mii.wID, pMI->lpstrText); ATLASSERT(bRet); delete [] pMI->lpstrText; delete pMI; } } } } return bTrackRet; } int GetPreviousMenuItem(int nBtn) const { if(nBtn == -1) return -1; RECT rcClient = {}; this->GetClientRect(&rcClient); int nNextBtn; for(nNextBtn = nBtn - 1; nNextBtn != nBtn; nNextBtn--) { if(nNextBtn < 0) nNextBtn = ::GetMenuItemCount(m_hMenu) - 1; TBBUTTON tbb = {}; this->GetButton(nNextBtn, &tbb); RECT rcBtn = {}; this->GetItemRect(nNextBtn, &rcBtn); if(rcBtn.right > rcClient.right) { nNextBtn = -2; // chevron break; } if(((tbb.fsState & TBSTATE_ENABLED) != 0) && ((tbb.fsState & TBSTATE_HIDDEN) == 0)) break; } return (nNextBtn != nBtn) ? nNextBtn : -1; } int GetNextMenuItem(int nBtn) const { if(nBtn == -1) return -1; RECT rcClient = {}; this->GetClientRect(&rcClient); int nNextBtn = 0; int nCount = ::GetMenuItemCount(m_hMenu); for(nNextBtn = nBtn + 1; nNextBtn != nBtn; nNextBtn++) { if(nNextBtn >= nCount) nNextBtn = 0; TBBUTTON tbb = {}; this->GetButton(nNextBtn, &tbb); RECT rcBtn = {}; this->GetItemRect(nNextBtn, &rcBtn); if(rcBtn.right > rcClient.right) { nNextBtn = -2; // chevron break; } if(((tbb.fsState & TBSTATE_ENABLED) != 0) && ((tbb.fsState & TBSTATE_HIDDEN) == 0)) break; } return (nNextBtn != nBtn) ? nNextBtn : -1; } bool DisplayChevronMenu() { // assume we are in a rebar HWND hWndReBar = this->GetParent(); int nCount = (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L); bool bRet = false; for(int i = 0; i < nCount; i++) { REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_STYLE }; BOOL bRetBandInfo = (BOOL)::SendMessage(hWndReBar, RB_GETBANDINFO, i, (LPARAM)&rbbi); if(bRetBandInfo && (rbbi.hwndChild == this->m_hWnd)) { if((rbbi.fStyle & RBBS_USECHEVRON) != 0) { ::PostMessage(hWndReBar, RB_PUSHCHEVRON, i, 0L); this->PostMessage(WM_KEYDOWN, VK_DOWN, 0L); bRet = true; } break; } } return bRet; } void GetSystemSettings() { // refresh our font NONCLIENTMETRICS info = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; BOOL bRet = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); ATLASSERT(bRet); if(bRet) { LOGFONT logfont = {}; if(m_fontMenu.m_hFont != NULL) m_fontMenu.GetLogFont(logfont); if((logfont.lfHeight != info.lfMenuFont.lfHeight) || (logfont.lfWidth != info.lfMenuFont.lfWidth) || (logfont.lfEscapement != info.lfMenuFont.lfEscapement) || (logfont.lfOrientation != info.lfMenuFont.lfOrientation) || (logfont.lfWeight != info.lfMenuFont.lfWeight) || (logfont.lfItalic != info.lfMenuFont.lfItalic) || (logfont.lfUnderline != info.lfMenuFont.lfUnderline) || (logfont.lfStrikeOut != info.lfMenuFont.lfStrikeOut) || (logfont.lfCharSet != info.lfMenuFont.lfCharSet) || (logfont.lfOutPrecision != info.lfMenuFont.lfOutPrecision) || (logfont.lfClipPrecision != info.lfMenuFont.lfClipPrecision) || (logfont.lfQuality != info.lfMenuFont.lfQuality) || (logfont.lfPitchAndFamily != info.lfMenuFont.lfPitchAndFamily) || (lstrcmp(logfont.lfFaceName, info.lfMenuFont.lfFaceName) != 0)) { HFONT hFontMenu = ::CreateFontIndirect(&info.lfMenuFont); ATLASSERT(hFontMenu != NULL); if(hFontMenu != NULL) { if(m_fontMenu.m_hFont != NULL) m_fontMenu.DeleteObject(); m_fontMenu.Attach(hFontMenu); this->SetFont(m_fontMenu); this->AddStrings(_T("NS\0")); // for proper item height this->AutoSize(); } } } // check if we need extra spacing for menu item text CWindowDC dc(this->m_hWnd); HFONT hFontOld = dc.SelectFont(m_fontMenu); RECT rcText = {}; dc.DrawText(_T("\t"), -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); if((rcText.right - rcText.left) < 4) { ::SetRectEmpty(&rcText); dc.DrawText(_T("x"), -1, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_CALCRECT); m_cxExtraSpacing = rcText.right - rcText.left; } else { m_cxExtraSpacing = 0; } dc.SelectFont(hFontOld); // get Windows version #ifndef _versionhelpers_H_INCLUDED_ OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; ::GetVersionEx(&ovi); #endif // !_versionhelpers_H_INCLUDED_ // query keyboard cues mode (Windows 2000 or later) #ifdef _versionhelpers_H_INCLUDED_ if(::IsWindowsVersionOrGreater(5, 0, 0)) #else // !_versionhelpers_H_INCLUDED_ if (ovi.dwMajorVersion >= 5) #endif // _versionhelpers_H_INCLUDED_ { BOOL bRetVal = TRUE; bRet = ::SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &bRetVal, 0); m_bUseKeyboardCues = (bRet && !bRetVal); m_bAllowKeyboardCues = true; ShowKeyboardCues(!m_bUseKeyboardCues); } // query flat menu mode (Windows XP or later) #ifdef _versionhelpers_H_INCLUDED_ if(::IsWindowsXPOrGreater()) #else // !_versionhelpers_H_INCLUDED_ if (((ovi.dwMajorVersion == 5) && (ovi.dwMinorVersion >= 1)) || (ovi.dwMajorVersion > 5)) #endif // _versionhelpers_H_INCLUDED_ { BOOL bRetVal = FALSE; bRet = ::SystemParametersInfo(SPI_GETFLATMENU, 0, &bRetVal, 0); m_bFlatMenus = (bRet && bRetVal); } #if _WTL_CMDBAR_VISTA_MENUS // check if we should use Vista menus bool bVistaMenus = (((m_dwExtendedStyle & CBR_EX_NOVISTAMENUS) == 0) && RunTimeHelper::IsVista() && RunTimeHelper::IsThemeAvailable()); if(!bVistaMenus && m_bVistaMenus && (m_hMenu != NULL) && (m_arrCommand.GetSize() > 0)) { T* pT = static_cast(this); pT->_RemoveVistaBitmapsFromMenu(); } m_bVistaMenus = bVistaMenus; #endif // _WTL_CMDBAR_VISTA_MENUS #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("CmdBar - GetSystemSettings:\n m_bFlatMenus = %s\n m_bUseKeyboardCues = %s m_bVistaMenus = %s\n"), m_bFlatMenus ? "true" : "false", m_bUseKeyboardCues ? "true" : "false", m_bVistaMenus ? "true" : "false"); #endif } // Implementation - alternate focus mode support void TakeFocus() { if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && (m_hWndFocus == NULL)) m_hWndFocus = ::GetFocus(); this->SetFocus(); } void GiveFocusBack() { if(m_bParentActive) { if((m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && ::IsWindow(m_hWndFocus)) ::SetFocus(m_hWndFocus); else if(!(m_dwExtendedStyle & CBR_EX_ALTFOCUSMODE) && m_wndParent.IsWindow()) m_wndParent.SetFocus(); } m_hWndFocus = NULL; this->SetAnchorHighlight(FALSE); if(m_bUseKeyboardCues && m_bShowKeyboardCues) this->ShowKeyboardCues(false); m_bSkipPostDown = false; } void ShowKeyboardCues(bool bShow) { m_bShowKeyboardCues = bShow; this->SetDrawTextFlags(DT_HIDEPREFIX, m_bShowKeyboardCues ? 0 : DT_HIDEPREFIX); this->Invalidate(); this->UpdateWindow(); } // Implementation - internal message helpers static UINT GetAutoPopupMessage() { static UINT uAutoPopupMessage = 0; if(uAutoPopupMessage == 0) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::GetAutoPopupMessage.\n")); ATLASSERT(FALSE); return 0; } if(uAutoPopupMessage == 0) uAutoPopupMessage = ::RegisterWindowMessage(_T("WTL_CmdBar_InternalAutoPopupMsg")); lock.Unlock(); } ATLASSERT(uAutoPopupMessage != 0); return uAutoPopupMessage; } static UINT GetGetBarMessage() { static UINT uGetBarMessage = 0; if(uGetBarMessage == 0) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CCommandBarCtrlImpl::GetGetBarMessage.\n")); ATLASSERT(FALSE); return 0; } if(uGetBarMessage == 0) uGetBarMessage = ::RegisterWindowMessage(_T("WTL_CmdBar_InternalGetBarMsg")); lock.Unlock(); } ATLASSERT(uGetBarMessage != 0); return uGetBarMessage; } // Implementation bool CreateInternalImageList(int cImages) { UINT uFlags = (m_bAlphaImages ? ILC_COLOR32 : ILC_COLOR24) | ILC_MASK; m_hImageList = ::ImageList_Create(m_szBitmap.cx, m_szBitmap.cy, uFlags, cImages, 1); ATLASSERT(m_hImageList != NULL); return (m_hImageList != NULL); } // Implementation - support for Vista menus #if _WTL_CMDBAR_VISTA_MENUS void _AddVistaBitmapsFromImageList(int nStartIndex, int nCount) { // Create display compatible memory DC CClientDC dc(NULL); CDC dcMem; dcMem.CreateCompatibleDC(dc); HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); T* pT = static_cast(this); // Create bitmaps for all menu items for(int i = 0; i < nCount; i++) { HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nStartIndex + i, dc, dcMem); dcMem.SelectBitmap(hBitmapSave); m_arrVistaBitmap.Add(hBitmap); } } void _AddVistaBitmapFromImageList(int nIndex) { // Create display compatible memory DC CClientDC dc(NULL); CDC dcMem; dcMem.CreateCompatibleDC(dc); HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); // Create bitmap for menu item T* pT = static_cast(this); HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nIndex, dc, dcMem); // Select saved bitmap back and add bitmap to the array dcMem.SelectBitmap(hBitmapSave); m_arrVistaBitmap.Add(hBitmap); } void _ReplaceVistaBitmapFromImageList(int nIndex) { // Delete existing bitmap if(m_arrVistaBitmap[nIndex] != NULL) ::DeleteObject(m_arrVistaBitmap[nIndex]); // Create display compatible memory DC CClientDC dc(NULL); CDC dcMem; dcMem.CreateCompatibleDC(dc); HBITMAP hBitmapSave = dcMem.GetCurrentBitmap(); // Create bitmap for menu item T* pT = static_cast(this); HBITMAP hBitmap = pT->_CreateVistaBitmapHelper(nIndex, dc, dcMem); // Select saved bitmap back and replace bitmap in the array dcMem.SelectBitmap(hBitmapSave); m_arrVistaBitmap.SetAtIndex(nIndex, hBitmap); } HBITMAP _CreateVistaBitmapHelper(int nIndex, HDC hDCSource, HDC hDCTarget) { // Create 32-bit bitmap BITMAPINFO bi = {}; bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bi.bmiHeader.biWidth = m_szBitmap.cx; bi.bmiHeader.biHeight = m_szBitmap.cy; bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 32; bi.bmiHeader.biCompression = BI_RGB; bi.bmiHeader.biSizeImage = 0; bi.bmiHeader.biXPelsPerMeter = 0; bi.bmiHeader.biYPelsPerMeter = 0; bi.bmiHeader.biClrUsed = 0; bi.bmiHeader.biClrImportant = 0; HBITMAP hBitmap = ::CreateDIBSection(hDCSource, &bi, DIB_RGB_COLORS, NULL, NULL, 0); ATLASSERT(hBitmap != NULL); // Select bitmap into target DC and draw from image list to it if(hBitmap != NULL) { ::SelectObject(hDCTarget, hBitmap); IMAGELISTDRAWPARAMS ildp = {}; ildp.cbSize = sizeof(IMAGELISTDRAWPARAMS); ildp.himl = m_hImageList; ildp.i = nIndex; ildp.hdcDst = hDCTarget; ildp.x = 0; ildp.y = 0; ildp.cx = 0; ildp.cy = 0; ildp.xBitmap = 0; ildp.yBitmap = 0; ildp.fStyle = ILD_TRANSPARENT; ildp.fState = ILS_ALPHA; ildp.Frame = 255; ::ImageList_DrawIndirect(&ildp); } return hBitmap; } void _RemoveVistaBitmapsFromMenu() { CMenuHandle menu = m_hMenu; for(int i = 0; i < m_arrCommand.GetSize(); i++) { CMenuItemInfo mii; mii.fMask = MIIM_BITMAP; mii.hbmpItem = NULL; menu.SetMenuItemInfo(m_arrCommand[i], FALSE, &mii); } } #endif // _WTL_CMDBAR_VISTA_MENUS // Implementation helper static bool _IsValidMem(void* pMem) { bool bRet = false; if(pMem != NULL) { MEMORY_BASIC_INFORMATION mbi = {}; ::VirtualQuery(pMem, &mbi, sizeof(MEMORY_BASIC_INFORMATION)); bRet = (mbi.BaseAddress != NULL) && ((mbi.Protect & (PAGE_READONLY | PAGE_READWRITE)) != 0); } return bRet; } }; class CCommandBarCtrl : public CCommandBarCtrlImpl { public: DECLARE_WND_SUPERCLASS(_T("WTL_CommandBar"), GetWndClassName()) }; /////////////////////////////////////////////////////////////////////////////// // CMDICommandBarCtrl - ATL implementation of Command Bars for MDI apps template class ATL_NO_VTABLE CMDICommandBarCtrlImpl : public CCommandBarCtrlImpl< T, TBase, TWinTraits> { public: // Data members ATL::CContainedWindow m_wndMDIClient; bool m_bChildMaximized; HWND m_hWndChildMaximized; HICON m_hIconChildMaximized; int m_nBtnPressed; int m_nBtnWasPressed; int m_cxyOffset; // offset between nonclient elements int m_cxIconWidth; // small icon width int m_cyIconHeight; // small icon height int m_cxBtnWidth; // nonclient button width int m_cyBtnHeight; // nonclient button height int m_cxLeft; // left nonclient area width int m_cxRight; // right nonclient area width HTHEME m_hTheme; // Constructor/destructor CMDICommandBarCtrlImpl() : m_wndMDIClient(this, 2), m_bChildMaximized(false), m_hWndChildMaximized(NULL), m_hIconChildMaximized(NULL), m_nBtnPressed(-1), m_nBtnWasPressed(-1), m_cxyOffset(2), m_cxIconWidth(16), m_cyIconHeight(16), m_cxBtnWidth(16), m_cyBtnHeight(14), m_cxLeft(20), m_cxRight(55), m_hTheme(NULL) { } ~CMDICommandBarCtrlImpl() { if(m_wndMDIClient.IsWindow()) /*scary!*/ m_wndMDIClient.UnsubclassWindow(); } // Operations BOOL SetMDIClient(HWND hWndMDIClient) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(::IsWindow(hWndMDIClient)); if(!::IsWindow(hWndMDIClient)) return FALSE; #ifdef _DEBUG // BLOCK: Test if the passed window is MDICLIENT { LPCTSTR lpszMDIClientClass = _T("MDICLIENT"); const int nNameLen = 9 + 1; // "MDICLIENT" + NULL TCHAR szClassName[nNameLen] = {}; ::GetClassName(hWndMDIClient, szClassName, nNameLen); ATLASSERT(lstrcmpi(szClassName, lpszMDIClientClass) == 0); } #endif // _DEBUG if(m_wndMDIClient.IsWindow()) /*scary!*/ m_wndMDIClient.UnsubclassWindow(); return m_wndMDIClient.SubclassWindow(hWndMDIClient); } // Message maps typedef CCommandBarCtrlImpl< T, TBase, TWinTraits > _baseClass; BEGIN_MSG_MAP(CMDICommandBarCtrlImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_NCCALCSIZE, OnNcCalcSize) MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) MESSAGE_HANDLER(WM_NCHITTEST, OnNcHitTest) MESSAGE_HANDLER(WM_NCLBUTTONDOWN, OnNcLButtonDown) MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) MESSAGE_HANDLER(WM_NCLBUTTONDBLCLK, OnNcLButtonDblClk) MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) CHAIN_MSG_MAP(_baseClass) ALT_MSG_MAP(1) // Parent window messages MESSAGE_HANDLER(WM_ACTIVATE, OnParentActivate) CHAIN_MSG_MAP_ALT(_baseClass, 1) ALT_MSG_MAP(2) // MDI client window messages MESSAGE_HANDLER(WM_MDISETMENU, OnMDISetMenu) // no chaining needed since this was moved from the base class here ALT_MSG_MAP(3) // Message hook messages MESSAGE_RANGE_HANDLER(0, 0xFFFF, OnAllHookMessages) CHAIN_MSG_MAP_ALT(_baseClass, 3) END_MSG_MAP() // Additional MDI message handlers LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { LRESULT lRet = _baseClass::OnCreate(uMsg, wParam, lParam, bHandled); if(lRet == (LRESULT)-1) return lRet; T* pT = static_cast(this); pT->_OpenThemeData(); return lRet; } LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { LRESULT lRet = _baseClass::OnDestroy(uMsg, wParam, lParam, bHandled); T* pT = static_cast(this); pT->_CloseThemeData(); return lRet; } LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->_CloseThemeData(); pT->_OpenThemeData(); return 0; } LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); T* pT = static_cast(this); pT->_AdjustBtnSize(GET_Y_LPARAM(lParam)); return lRet; } LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); if(m_bChildMaximized && (BOOL)wParam) { LPNCCALCSIZE_PARAMS lpParams = (LPNCCALCSIZE_PARAMS)lParam; if(this->m_bLayoutRTL) { lpParams->rgrc[0].left += m_cxRight; lpParams->rgrc[0].right -= m_cxLeft; } else { lpParams->rgrc[0].left += m_cxLeft; lpParams->rgrc[0].right -= m_cxRight; } } return lRet; } LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); if(!m_bChildMaximized) return lRet; ATLASSERT((m_hWndChildMaximized != NULL) && (m_hIconChildMaximized != NULL)); // get DC and window rectangle CWindowDC dc(this->m_hWnd); RECT rect = {}; this->GetWindowRect(&rect); int cxWidth = rect.right - rect.left; int cyHeight = rect.bottom - rect.top; // paint left side nonclient background and draw icon ::SetRect(&rect, 0, 0, m_cxLeft, cyHeight); if(m_hTheme != NULL) { ::DrawThemeParentBackground(this->m_hWnd, dc, &rect); } else { if((this->m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) dc.FillRect(&rect, COLOR_3DFACE); else dc.FillRect(&rect, COLOR_MENU); } RECT rcIcon = {}; T* pT = static_cast(this); pT->_CalcIconRect(cxWidth, cyHeight, rcIcon); dc.DrawIconEx(rcIcon.left, rcIcon.top, m_hIconChildMaximized, m_cxIconWidth, m_cyIconHeight); // paint right side nonclient background ::SetRect(&rect, cxWidth - m_cxRight, 0, cxWidth, cyHeight); if(m_hTheme != NULL) { // this is to account for the left non-client area POINT ptOrg = {}; dc.GetViewportOrg(&ptOrg); dc.SetViewportOrg(ptOrg.x + m_cxLeft, ptOrg.y); ::OffsetRect(&rect, -m_cxLeft, 0); ::DrawThemeParentBackground(this->m_hWnd, dc, &rect); // restore dc.SetViewportOrg(ptOrg); ::OffsetRect(&rect, m_cxLeft, 0); } else { if((this->m_dwExtendedStyle & CBR_EX_TRANSPARENT) != 0) dc.FillRect(&rect, COLOR_3DFACE); else dc.FillRect(&rect, COLOR_MENU); } // draw buttons RECT arrRect[3] = {}; pT->_CalcBtnRects(cxWidth, cyHeight, arrRect); pT->_DrawMDIButton(dc, arrRect, -1); // draw all buttons return lRet; } LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); if(m_bChildMaximized) { RECT rect = {}; this->GetWindowRect(&rect); POINT pt = { GET_X_LPARAM(lParam) - rect.left, GET_Y_LPARAM(lParam) - rect.top }; if(this->m_bLayoutRTL) { if((pt.x < m_cxRight) || (pt.x > ((rect.right - rect.left) - m_cxLeft))) lRet = HTBORDER; } else { if((pt.x < m_cxLeft) || (pt.x > ((rect.right - rect.left) - m_cxRight))) lRet = HTBORDER; } } return lRet; } LRESULT OnNcLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(!m_bChildMaximized) { bHandled = FALSE; return 1; } ATLASSERT(_DebugCheckChild()); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; RECT rect = {}; this->GetWindowRect(&rect); pt.x -= rect.left; pt.y -= rect.top; RECT rcIcon = {}; T* pT = static_cast(this); pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, this->m_bLayoutRTL); RECT arrRect[3] = {}; pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, this->m_bLayoutRTL); if(::PtInRect(&rcIcon, pt)) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: icon\n")); #endif CMenuHandle menu = ::GetSystemMenu(m_hWndChildMaximized, FALSE); UINT uRet = (UINT)menu.TrackPopupMenu(TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD | TPM_VERPOSANIMATION, this->m_bLayoutRTL ? rect.right : rect.left, rect.bottom, m_hWndChildMaximized); // eat next message if click is on the same button ::OffsetRect(&rcIcon, rect.left, rect.top); MSG msg = {}; if(::PeekMessage(&msg, this->m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rcIcon, msg.pt)) ::PeekMessage(&msg, this->m_hWnd, WM_NCLBUTTONDOWN, WM_NCLBUTTONDOWN, PM_REMOVE); if(uRet != 0) ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, uRet, 0L); } else if(::PtInRect(&arrRect[0], pt)) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: close button\n")); #endif m_nBtnWasPressed = m_nBtnPressed = 0; } else if(::PtInRect(&arrRect[1], pt)) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: restore button\n")); #endif m_nBtnWasPressed = m_nBtnPressed = 1; } else if(::PtInRect(&arrRect[2], pt)) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonDown: minimize button\n")); #endif m_nBtnWasPressed = m_nBtnPressed = 2; } else { bHandled = FALSE; } // draw the button state if it was pressed if(m_nBtnPressed != -1) { this->SetCapture(); CWindowDC dc(this->m_hWnd); pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); pT->_DrawMDIButton(dc, arrRect, m_nBtnPressed); } return 0; } LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(!m_bChildMaximized || (::GetCapture() != this->m_hWnd) || (m_nBtnWasPressed == -1)) { bHandled = FALSE; return 1; } POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; this->ClientToScreen(&pt); RECT rect = {}; this->GetWindowRect(&rect); pt.x -= rect.left; pt.y -= rect.top; RECT arrRect[3] = {}; T* pT = static_cast(this); pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, this->m_bLayoutRTL); int nOldBtnPressed = m_nBtnPressed; m_nBtnPressed = ::PtInRect(&arrRect[m_nBtnWasPressed], pt) ? m_nBtnWasPressed : -1; if(nOldBtnPressed != m_nBtnPressed) { CWindowDC dc(this->m_hWnd); pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); pT->_DrawMDIButton(dc, arrRect, (m_nBtnPressed != -1) ? m_nBtnPressed : nOldBtnPressed); } return 0; } LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(!m_bChildMaximized || (::GetCapture() != this->m_hWnd) || (m_nBtnWasPressed == -1)) { bHandled = FALSE; return 1; } ATLASSERT(_DebugCheckChild()); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; this->ClientToScreen(&pt); RECT rect = {}; this->GetWindowRect(&rect); pt.x -= rect.left; pt.y -= rect.top; int nBtn = m_nBtnWasPressed; ReleaseCapture(); RECT arrRect[3] = {}; T* pT = static_cast(this); pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, this->m_bLayoutRTL); if(::PtInRect(&arrRect[nBtn], pt)) { switch(nBtn) { case 0: // close #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: close button\n")); #endif ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_CLOSE, 0L); break; case 1: // restore #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: restore button\n")); #endif ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_RESTORE, 0L); break; case 2: // minimize #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - LButtonUp: minimize button\n")); #endif ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, SC_MINIMIZE, 0L); break; default: break; } } return 0; } LRESULT OnNcLButtonDblClk(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(!m_bChildMaximized || (m_nBtnWasPressed != -1)) { bHandled = FALSE; return 1; } ATLASSERT(_DebugCheckChild()); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; RECT rect = {}; this->GetWindowRect(&rect); pt.x -= rect.left; pt.y -= rect.top; RECT rcIcon = {}; T* pT = static_cast(this); pT->_CalcIconRect(rect.right - rect.left, rect.bottom - rect.top, rcIcon, this->m_bLayoutRTL); RECT arrRect[3] = {}; pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect, this->m_bLayoutRTL); if(::PtInRect(&rcIcon, pt)) { CMenuHandle menu = ::GetSystemMenu(m_hWndChildMaximized, FALSE); UINT uDefID = menu.GetMenuDefaultItem(); if(uDefID == (UINT)-1) uDefID = SC_CLOSE; ::SendMessage(m_hWndChildMaximized, WM_SYSCOMMAND, uDefID, 0L); } return 0; } LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_bChildMaximized) { if(m_nBtnPressed != -1) { ATLASSERT(m_nBtnPressed == m_nBtnWasPressed); // must be m_nBtnPressed = -1; RECT rect = {}; this->GetWindowRect(&rect); RECT arrRect[3] = {}; T* pT = static_cast(this); pT->_CalcBtnRects(rect.right - rect.left, rect.bottom - rect.top, arrRect); CWindowDC dc(this->m_hWnd); pT->_DrawMDIButton(dc, arrRect, m_nBtnWasPressed); } m_nBtnWasPressed = -1; } else { bHandled = FALSE; } return 0; } // Parent window message handlers LRESULT OnParentActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { this->m_bParentActive = (LOWORD(wParam) != WA_INACTIVE); this->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); bHandled = FALSE; return 1; } // MDI client window message handlers LRESULT OnMDISetMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { m_wndMDIClient.DefWindowProc(uMsg, NULL, lParam); HMENU hOldMenu = this->GetMenu(); BOOL bRet = this->AttachMenu((HMENU)wParam); (void)bRet; // avoid level 4 warning ATLASSERT(bRet); T* pT = static_cast(this); pT->UpdateRebarBandIdealSize(); return (LRESULT)hOldMenu; } // All messages from the message hook LRESULT OnAllHookMessages(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); pT->_ProcessAllHookMessages(uMsg, wParam, lParam); bHandled = FALSE; return 1; } // Overrideables // override this to provide different ideal size void UpdateRebarBandIdealSize() { // assuming we are in a rebar, change ideal size to our size // we hope that if we are not in a rebar, nCount will be 0 ATL::CWindow wndParent = this->GetParent(); int nCount = (int)wndParent.SendMessage(RB_GETBANDCOUNT, 0, 0L); for(int i = 0; i < nCount; i++) { REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE }; wndParent.SendMessage(RB_GETBANDINFO, i, (LPARAM)&rbi); if(rbi.hwndChild == this->m_hWnd) { rbi.fMask = RBBIM_IDEALSIZE; rbi.cxIdeal = m_bChildMaximized ? m_cxLeft + m_cxRight : 0; int nBtnCount = this->GetButtonCount(); if(nBtnCount > 0) { RECT rect = {}; this->GetItemRect(nBtnCount - 1, &rect); rbi.cxIdeal += rect.right; } wndParent.SendMessage(RB_SETBANDINFO, i, (LPARAM)&rbi); break; } } } // all hook messages - check for the maximized MDI child window change void _ProcessAllHookMessages(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/) { if((uMsg == WM_MDIGETACTIVE) || (uMsg == WM_MDISETMENU)) return; BOOL bMaximized = FALSE; HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); bool bMaxOld = m_bChildMaximized; m_bChildMaximized = ((hWndChild != NULL) && bMaximized); HICON hIconOld = m_hIconChildMaximized; if(m_bChildMaximized) { if(m_hWndChildMaximized != hWndChild) { ATL::CWindow wnd = m_hWndChildMaximized = hWndChild; m_hIconChildMaximized = wnd.GetIcon(FALSE); if(m_hIconChildMaximized == NULL) { m_hIconChildMaximized = wnd.GetIcon(TRUE); if(m_hIconChildMaximized == NULL) // no icon set with WM_SETICON, get the class one m_hIconChildMaximized = (HICON)::GetClassLongPtr(wnd, GCLP_HICONSM); } } } else { m_hWndChildMaximized = NULL; m_hIconChildMaximized = NULL; } if(bMaxOld != m_bChildMaximized) { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - All messages hook change: m_bChildMaximized = %s\n"), m_bChildMaximized ? "true" : "false"); #endif // assuming we are in a rebar, change our size to accomodate new state // we hope that if we are not in a rebar, nCount will be 0 ATL::CWindow wndParent = this->GetParent(); int nCount = (int)wndParent.SendMessage(RB_GETBANDCOUNT, 0, 0L); int cxDiff = (m_bChildMaximized ? 1 : -1) * (m_cxLeft + m_cxRight); for(int i = 0; i < nCount; i++) { REBARBANDINFO rbi = { RunTimeHelper::SizeOf_REBARBANDINFO(), RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_STYLE }; wndParent.SendMessage(RB_GETBANDINFO, i, (LPARAM)&rbi); if(rbi.hwndChild == this->m_hWnd) { if((rbi.fStyle & RBBS_USECHEVRON) != 0) { rbi.fMask = RBBIM_CHILDSIZE | RBBIM_IDEALSIZE; rbi.cxMinChild += cxDiff; rbi.cxIdeal += cxDiff; wndParent.SendMessage(RB_SETBANDINFO, i, (LPARAM)&rbi); } break; } } } if((bMaxOld != m_bChildMaximized) || (hIconOld != m_hIconChildMaximized)) { // force size change and redraw everything RECT rect = {}; this->GetWindowRect(&rect); ::MapWindowPoints(NULL, this->GetParent(), (LPPOINT)&rect, 2); this->SetRedraw(FALSE); this->SetWindowPos(NULL, 0, 0, 1, 1, SWP_NOZORDER | SWP_NOMOVE); this->SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); this->SetRedraw(TRUE); this->RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); } } // Implementation void GetSystemSettings() { #ifdef _CMDBAR_EXTRA_TRACE ATLTRACE2(atlTraceUI, 0, _T("MDI CmdBar - GetSystemSettings\n")); #endif _baseClass::GetSystemSettings(); NONCLIENTMETRICS info = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; BOOL bRet = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0); ATLASSERT(bRet); if(bRet) { m_cxIconWidth = ::GetSystemMetrics(SM_CXSMICON); m_cyIconHeight = ::GetSystemMetrics(SM_CYSMICON); m_cxLeft = m_cxIconWidth; if(m_hTheme != NULL) { m_cxBtnWidth = info.iCaptionWidth - 2 * m_cxyOffset; m_cyBtnHeight = info.iCaptionHeight - 2 * m_cxyOffset; m_cxRight = 3 * m_cxBtnWidth; } else { m_cxBtnWidth = info.iCaptionWidth - m_cxyOffset; m_cyBtnHeight = info.iCaptionHeight - 2 * m_cxyOffset; m_cxRight = 3 * m_cxBtnWidth + m_cxyOffset; } } RECT rect = {}; this->GetClientRect(&rect); T* pT = static_cast(this); pT->_AdjustBtnSize(rect.bottom); } void _AdjustBtnSize(int cyHeight) { if((cyHeight > 1) && (m_cyBtnHeight > cyHeight)) { if(m_hTheme != NULL) { m_cyBtnHeight = cyHeight; m_cxBtnWidth = cyHeight; m_cxRight = 3 * m_cxBtnWidth; } else { m_cyBtnHeight = cyHeight; m_cxBtnWidth = cyHeight + m_cxyOffset; m_cxRight = 3 * m_cxBtnWidth + m_cxyOffset; } } } void _CalcIconRect(int cxWidth, int cyHeight, RECT& rect, bool bInvertX = false) const { int xStart = (m_cxLeft - m_cxIconWidth) / 2; if(xStart < 0) xStart = 0; int yStart = (cyHeight - m_cyIconHeight) / 2; if(yStart < 0) yStart = 0; if(bInvertX) ::SetRect(&rect, cxWidth - (xStart + m_cxBtnWidth), yStart, cxWidth - xStart, yStart + m_cyBtnHeight); else ::SetRect(&rect, xStart, yStart, xStart + m_cxBtnWidth, yStart + m_cyBtnHeight); } void _CalcBtnRects(int cxWidth, int cyHeight, RECT arrRect[3], bool bInvertX = false) const { int yStart = (cyHeight - m_cyBtnHeight) / 2; if(yStart < 0) yStart = 0; RECT rcBtn = { cxWidth - m_cxBtnWidth, yStart, cxWidth, yStart + m_cyBtnHeight }; int nDirection = -1; if(bInvertX) { ::SetRect(&rcBtn, 0, yStart, m_cxBtnWidth, yStart + m_cyBtnHeight); nDirection = 1; } arrRect[0] = rcBtn; if(m_hTheme != NULL) ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); else ::OffsetRect(&rcBtn, nDirection * (m_cxBtnWidth + m_cxyOffset), 0); arrRect[1] = rcBtn; ::OffsetRect(&rcBtn, nDirection * m_cxBtnWidth, 0); arrRect[2] = rcBtn; } void _DrawMDIButton(CWindowDC& dc, LPRECT pRects, int nBtn) { if(m_hTheme != NULL) { #ifndef __VSSYM32_H__ const int WP_MDICLOSEBUTTON = 20; const int CBS_NORMAL = 1; const int CBS_PUSHED = 3; const int CBS_DISABLED = 4; const int WP_MDIRESTOREBUTTON = 22; const int RBS_NORMAL = 1; const int RBS_PUSHED = 3; const int RBS_DISABLED = 4; const int WP_MDIMINBUTTON = 16; const int MINBS_NORMAL = 1; const int MINBS_PUSHED = 3; const int MINBS_DISABLED = 4; #endif // __VSSYM32_H__ if((nBtn == -1) || (nBtn == 0)) ::DrawThemeBackground(m_hTheme, dc, WP_MDICLOSEBUTTON, this->m_bParentActive ? ((m_nBtnPressed == 0) ? CBS_PUSHED : CBS_NORMAL) : CBS_DISABLED, &pRects[0], NULL); if((nBtn == -1) || (nBtn == 1)) ::DrawThemeBackground(m_hTheme, dc, WP_MDIRESTOREBUTTON, this->m_bParentActive ? ((m_nBtnPressed == 1) ? RBS_PUSHED : RBS_NORMAL) : RBS_DISABLED, &pRects[1], NULL); if((nBtn == -1) || (nBtn == 2)) ::DrawThemeBackground(m_hTheme, dc, WP_MDIMINBUTTON, this->m_bParentActive ? ((m_nBtnPressed == 2) ? MINBS_PUSHED : MINBS_NORMAL) : MINBS_DISABLED, &pRects[2], NULL); } else { if((nBtn == -1) || (nBtn == 0)) dc.DrawFrameControl(&pRects[0], DFC_CAPTION, DFCS_CAPTIONCLOSE | ((m_nBtnPressed == 0) ? DFCS_PUSHED : 0)); if((nBtn == -1) || (nBtn == 1)) dc.DrawFrameControl(&pRects[1], DFC_CAPTION, DFCS_CAPTIONRESTORE | ((m_nBtnPressed == 1) ? DFCS_PUSHED : 0)); if((nBtn == -1) || (nBtn == 2)) dc.DrawFrameControl(&pRects[2], DFC_CAPTION, DFCS_CAPTIONMIN | ((m_nBtnPressed == 2) ? DFCS_PUSHED : 0)); } } void _OpenThemeData() { if(RunTimeHelper::IsThemeAvailable()) m_hTheme = ::OpenThemeData(this->m_hWnd, L"Window"); } void _CloseThemeData() { if(m_hTheme != NULL) { ::CloseThemeData(m_hTheme); m_hTheme = NULL; } } bool _DebugCheckChild() { #ifdef _DEBUG BOOL bMaximized = FALSE; HWND hWndChild = (HWND)::SendMessage(m_wndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); return (bMaximized && (hWndChild == m_hWndChildMaximized)); #else // !_DEBUG return true; #endif // !_DEBUG } }; class CMDICommandBarCtrl : public CMDICommandBarCtrlImpl { public: DECLARE_WND_SUPERCLASS(_T("WTL_MDICommandBar"), GetWndClassName()) }; } // namespace WTL #endif // __ATLCTRLW_H__ ================================================ FILE: third_party/WTL/Include/atlctrlx.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLCTRLX_H__ #define __ATLCTRLX_H__ #pragma once #ifndef __ATLAPP_H__ #error atlctrlx.h requires atlapp.h to be included first #endif #ifndef __ATLCTRLS_H__ #error atlctrlx.h requires atlctrls.h to be included first #endif /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CBitmapButtonImpl // CBitmapButton // CCheckListViewCtrlImpl // CCheckListViewCtrl // CHyperLinkImpl // CHyperLink // CWaitCursor // CCustomWaitCursor // CMultiPaneStatusBarCtrlImpl // CMultiPaneStatusBarCtrl // CPaneContainerImpl // CPaneContainer // CSortListViewImpl // CSortListViewCtrlImpl // CSortListViewCtrl // CTabViewImpl // CTabView namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CBitmapButton - bitmap button implementation // bitmap button extended styles #define BMPBTN_HOVER 0x00000001 #define BMPBTN_AUTO3D_SINGLE 0x00000002 #define BMPBTN_AUTO3D_DOUBLE 0x00000004 #define BMPBTN_AUTOSIZE 0x00000008 #define BMPBTN_SHAREIMAGELISTS 0x00000010 #define BMPBTN_AUTOFIRE 0x00000020 #define BMPBTN_CHECK 0x00000040 #define BMPBTN_AUTOCHECK 0x00000080 // Note: BMPBTN_CHECK/BMPBTN_AUTOCHECK disables BN_DOUBLECLICKED, // BMPBTN_AUTOFIRE doesn't work with BMPBTN_CHECK/BMPBTN_AUTOCHECK template class ATL_NO_VTABLE CBitmapButtonImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > { public: DECLARE_WND_SUPERCLASS2(NULL, T, TBase::GetWndClassName()) enum { _nImageNormal = 0, _nImagePushed, _nImageFocusOrHover, _nImageDisabled, _nImageCount = 4, }; enum { ID_TIMER_FIRST = 1000, ID_TIMER_REPEAT = 1001 }; // Bitmap button specific extended styles DWORD m_dwExtendedStyle; CImageList m_ImageList; int m_nImage[_nImageCount]; CToolTipCtrl m_tip; LPTSTR m_lpstrToolTipText; // Internal states unsigned m_fMouseOver:1; unsigned m_fFocus:1; unsigned m_fPressed:1; unsigned m_fChecked:1; // Constructor/Destructor CBitmapButtonImpl(DWORD dwExtendedStyle = BMPBTN_AUTOSIZE, HIMAGELIST hImageList = NULL) : m_dwExtendedStyle(dwExtendedStyle), m_ImageList(hImageList), m_lpstrToolTipText(NULL), m_fMouseOver(0), m_fFocus(0), m_fPressed(0), m_fChecked(0) { m_nImage[_nImageNormal] = -1; m_nImage[_nImagePushed] = -1; m_nImage[_nImageFocusOrHover] = -1; m_nImage[_nImageDisabled] = -1; #ifdef _DEBUG if(((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) && IsCheckMode()) ATLTRACE2(atlTraceUI, 0, _T("CBitmapButtonImpl - Check mode and BMPBTN_AUTOFIRE cannot be used together, BMPBTN_AUTOFIRE will be ignored.\n")); #endif // _DEBUG } ~CBitmapButtonImpl() { if((m_dwExtendedStyle & BMPBTN_SHAREIMAGELISTS) == 0) m_ImageList.Destroy(); delete [] m_lpstrToolTipText; } // overridden to provide proper initialization BOOL SubclassWindow(HWND hWnd) { BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); if(bRet != FALSE) { T* pT = static_cast(this); pT->Init(); } return bRet; } // Attributes DWORD GetBitmapButtonExtendedStyle() const { return m_dwExtendedStyle; } DWORD SetBitmapButtonExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) { DWORD dwPrevStyle = m_dwExtendedStyle; if(dwMask == 0) m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); #ifdef _DEBUG if(((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) && IsCheckMode()) ATLTRACE2(atlTraceUI, 0, _T("CBitmapButtonImpl - Check mode and BMPBTN_AUTOFIRE cannot be used together, BMPBTN_AUTOFIRE will be ignored.\n")); #endif // _DEBUG return dwPrevStyle; } HIMAGELIST GetImageList() const { return m_ImageList; } HIMAGELIST SetImageList(HIMAGELIST hImageList) { HIMAGELIST hImageListPrev = m_ImageList; m_ImageList = hImageList; if(((m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0) && ::IsWindow(this->m_hWnd)) SizeToImage(); return hImageListPrev; } int GetToolTipTextLength() const { return (m_lpstrToolTipText == NULL) ? -1 : lstrlen(m_lpstrToolTipText); } bool GetToolTipText(LPTSTR lpstrText, int nLength) const { ATLASSERT(lpstrText != NULL); if(m_lpstrToolTipText == NULL) return false; errno_t nRet = ATL::Checked::tcsncpy_s(lpstrText, nLength, m_lpstrToolTipText, _TRUNCATE); return ((nRet == 0) || (nRet == STRUNCATE)); } bool SetToolTipText(LPCTSTR lpstrText) { if(m_lpstrToolTipText != NULL) { delete [] m_lpstrToolTipText; m_lpstrToolTipText = NULL; } if(lpstrText == NULL) { if(m_tip.IsWindow()) m_tip.Activate(FALSE); return true; } int cchLen = lstrlen(lpstrText) + 1; ATLTRY(m_lpstrToolTipText = new TCHAR[cchLen]); if(m_lpstrToolTipText == NULL) return false; ATL::Checked::tcscpy_s(m_lpstrToolTipText, cchLen, lpstrText); if(m_tip.IsWindow()) { m_tip.Activate(TRUE); m_tip.AddTool(this->m_hWnd, m_lpstrToolTipText); } return true; } bool GetCheck() const { return (m_fChecked == 1); } void SetCheck(bool bCheck, bool bUpdate = true) { m_fChecked = bCheck ? 1 : 0; if(bUpdate) { this->Invalidate(); this->UpdateWindow(); } } // Operations void SetImages(int nNormal, int nPushed = -1, int nFocusOrHover = -1, int nDisabled = -1) { if(nNormal != -1) m_nImage[_nImageNormal] = nNormal; if(nPushed != -1) m_nImage[_nImagePushed] = nPushed; if(nFocusOrHover != -1) m_nImage[_nImageFocusOrHover] = nFocusOrHover; if(nDisabled != -1) m_nImage[_nImageDisabled] = nDisabled; } BOOL SizeToImage() { ATLASSERT(::IsWindow(this->m_hWnd) && (m_ImageList.m_hImageList != NULL)); int cx = 0; int cy = 0; if(!m_ImageList.GetIconSize(cx, cy)) return FALSE; return this->ResizeClient(cx, cy); } // Overrideables void DoPaint(CDCHandle dc) { ATLASSERT(m_ImageList.m_hImageList != NULL); // image list must be set ATLASSERT(m_nImage[0] != -1); // main bitmap must be set // set bitmap according to the current button state bool bHover = IsHoverMode(); bool bPressed = (m_fPressed == 1) || (IsCheckMode() && (m_fChecked == 1)); int nImage = -1; if(!this->IsWindowEnabled()) nImage = m_nImage[_nImageDisabled]; else if(bPressed) nImage = m_nImage[_nImagePushed]; else if((!bHover && (m_fFocus == 1)) || (bHover && (m_fMouseOver == 1))) nImage = m_nImage[_nImageFocusOrHover]; // if none is set, use default one if(nImage == -1) nImage = m_nImage[_nImageNormal]; // draw the button image bool bAuto3D = (m_dwExtendedStyle & (BMPBTN_AUTO3D_SINGLE | BMPBTN_AUTO3D_DOUBLE)) != 0; int xyPos = (bPressed && bAuto3D && (m_nImage[_nImagePushed] == -1)) ? 1 : 0; m_ImageList.Draw(dc, nImage, xyPos, xyPos, ILD_NORMAL); // draw 3D border if required if(bAuto3D) { RECT rect = {}; this->GetClientRect(&rect); if(bPressed) dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_SUNKENOUTER : EDGE_SUNKEN, BF_RECT); else if(!bHover || (m_fMouseOver == 1)) dc.DrawEdge(&rect, ((m_dwExtendedStyle & BMPBTN_AUTO3D_SINGLE) != 0) ? BDR_RAISEDINNER : EDGE_RAISED, BF_RECT); if(!bHover && (m_fFocus == 1)) { ::InflateRect(&rect, -2 * ::GetSystemMetrics(SM_CXEDGE), -2 * ::GetSystemMetrics(SM_CYEDGE)); dc.DrawFocusRect(&rect); } } } // Message map and handlers BEGIN_MSG_MAP(CBitmapButtonImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk) MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) MESSAGE_HANDLER(WM_ENABLE, OnEnable) MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) MESSAGE_HANDLER(WM_KEYUP, OnKeyUp) MESSAGE_HANDLER(WM_TIMER, OnTimer) MESSAGE_HANDLER(WM_UPDATEUISTATE, OnUpdateUiState) END_MSG_MAP() LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { T* pT = static_cast(this); pT->Init(); bHandled = FALSE; return 1; } LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_tip.IsWindow()) { m_tip.DestroyWindow(); m_tip.m_hWnd = NULL; } bHandled = FALSE; return 1; } LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { MSG msg = { this->m_hWnd, uMsg, wParam, lParam }; if(m_tip.IsWindow()) m_tip.RelayEvent(&msg); bHandled = FALSE; return 1; } LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return 1; // no background needed } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); if(wParam != NULL) { pT->DoPaint((HDC)wParam); } else { CPaintDC dc(this->m_hWnd); pT->DoPaint(dc.m_hDC); } return 0; } LRESULT OnFocus(UINT uMsg, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { m_fFocus = (uMsg == WM_SETFOCUS) ? 1 : 0; this->Invalidate(); this->UpdateWindow(); bHandled = FALSE; return 1; } LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = 0; if(IsHoverMode()) this->SetCapture(); else lRet = this->DefWindowProc(uMsg, wParam, lParam); if(::GetCapture() == this->m_hWnd) { m_fPressed = 1; this->Invalidate(); this->UpdateWindow(); } if(((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0) && !IsCheckMode()) { int nElapse = 250; int nDelay = 0; if(::SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &nDelay, 0)) nElapse += nDelay * 250; // all milli-seconds this->SetTimer(ID_TIMER_FIRST, nElapse); } return lRet; } LRESULT OnLButtonDblClk(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = 0; if(!IsHoverMode() && !IsCheckMode()) lRet = this->DefWindowProc(uMsg, wParam, lParam); if(::GetCapture() != this->m_hWnd) this->SetCapture(); if(m_fPressed == 0) { m_fPressed = 1; this->Invalidate(); this->UpdateWindow(); } return lRet; } LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { if(((m_dwExtendedStyle & BMPBTN_AUTOCHECK) != 0) && (m_fPressed == 1)) SetCheck(!GetCheck(), false); LRESULT lRet = 0; if(!IsHoverMode() && !IsCheckMode()) lRet = this->DefWindowProc(uMsg, wParam, lParam); if(::GetCapture() == this->m_hWnd) { if((IsHoverMode() || IsCheckMode()) && (m_fPressed == 1)) this->GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(this->GetDlgCtrlID(), BN_CLICKED), (LPARAM)this->m_hWnd); ::ReleaseCapture(); } return lRet; } LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_fPressed == 1) { m_fPressed = 0; this->Invalidate(); this->UpdateWindow(); } bHandled = FALSE; return 1; } LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { this->Invalidate(); this->UpdateWindow(); bHandled = FALSE; return 1; } LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(::GetCapture() == this->m_hWnd) { POINT ptCursor = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; this->ClientToScreen(&ptCursor); RECT rect = {}; this->GetWindowRect(&rect); unsigned int uPressed = ::PtInRect(&rect, ptCursor) ? 1 : 0; if(m_fPressed != uPressed) { m_fPressed = uPressed; this->Invalidate(); this->UpdateWindow(); } } else if(IsHoverMode() && m_fMouseOver == 0) { m_fMouseOver = 1; this->Invalidate(); this->UpdateWindow(); StartTrackMouseLeave(); } bHandled = FALSE; return 1; } LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(m_fMouseOver == 1) { m_fMouseOver = 0; this->Invalidate(); this->UpdateWindow(); } return 0; } LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if((wParam == VK_SPACE) && IsHoverMode()) return 0; // ignore if in hover mode if((wParam == VK_SPACE) && (m_fPressed == 0)) { m_fPressed = 1; this->Invalidate(); this->UpdateWindow(); } bHandled = FALSE; return 1; } LRESULT OnKeyUp(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if((wParam == VK_SPACE) && IsHoverMode()) return 0; // ignore if in hover mode if((wParam == VK_SPACE) && (m_fPressed == 1)) { m_fPressed = 0; if((m_dwExtendedStyle & BMPBTN_AUTOCHECK) != 0) SetCheck(!GetCheck(), false); this->Invalidate(); this->UpdateWindow(); } bHandled = FALSE; return 1; } LRESULT OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { ATLASSERT((m_dwExtendedStyle & BMPBTN_AUTOFIRE) != 0); switch(wParam) // timer ID { case ID_TIMER_FIRST: this->KillTimer(ID_TIMER_FIRST); if(m_fPressed == 1) { this->GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(this->GetDlgCtrlID(), BN_CLICKED), (LPARAM)this->m_hWnd); int nElapse = 250; int nRepeat = 40; if(::SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &nRepeat, 0)) nElapse = 10000 / (10 * nRepeat + 25); // milli-seconds, approximated this->SetTimer(ID_TIMER_REPEAT, nElapse); } break; case ID_TIMER_REPEAT: if(m_fPressed == 1) this->GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(this->GetDlgCtrlID(), BN_CLICKED), (LPARAM)this->m_hWnd); else if(::GetCapture() != this->m_hWnd) this->KillTimer(ID_TIMER_REPEAT); break; default: // not our timer break; } return 0; } LRESULT OnUpdateUiState(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // If the control is subclassed or superclassed, this message can cause // repainting without WM_PAINT. We don't use this state, so just do nothing. return 0; } // Implementation void Init() { // We need this style to prevent Windows from painting the button this->ModifyStyle(0, BS_OWNERDRAW); // create a tool tip m_tip.Create(this->m_hWnd); ATLASSERT(m_tip.IsWindow()); if(m_tip.IsWindow() && (m_lpstrToolTipText != NULL)) { m_tip.Activate(TRUE); m_tip.AddTool(this->m_hWnd, m_lpstrToolTipText); } if((m_ImageList.m_hImageList != NULL) && ((m_dwExtendedStyle & BMPBTN_AUTOSIZE) != 0)) SizeToImage(); } BOOL StartTrackMouseLeave() { TRACKMOUSEEVENT tme = {}; tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; tme.hwndTrack = this->m_hWnd; return ::TrackMouseEvent(&tme); } bool IsHoverMode() const { return ((m_dwExtendedStyle & BMPBTN_HOVER) != 0); } bool IsCheckMode() const { return ((m_dwExtendedStyle & (BMPBTN_CHECK | BMPBTN_AUTOCHECK)) != 0); } }; class CBitmapButton : public CBitmapButtonImpl { public: DECLARE_WND_SUPERCLASS(_T("WTL_BitmapButton"), GetWndClassName()) CBitmapButton(DWORD dwExtendedStyle = BMPBTN_AUTOSIZE, HIMAGELIST hImageList = NULL) : CBitmapButtonImpl(dwExtendedStyle, hImageList) { } }; /////////////////////////////////////////////////////////////////////////////// // CCheckListCtrlView - list view control with check boxes template class CCheckListViewCtrlImplTraits { public: static DWORD GetWndStyle(DWORD dwStyle) { return (dwStyle == 0) ? t_dwStyle : dwStyle; } static DWORD GetWndExStyle(DWORD dwExStyle) { return (dwExStyle == 0) ? t_dwExStyle : dwExStyle; } static DWORD GetExtendedLVStyle() { return t_dwExListViewStyle; } }; typedef CCheckListViewCtrlImplTraits CCheckListViewCtrlTraits; template class ATL_NO_VTABLE CCheckListViewCtrlImpl : public ATL::CWindowImpl { public: DECLARE_WND_SUPERCLASS2(NULL, T, TBase::GetWndClassName()) // Attributes static DWORD GetExtendedLVStyle() { return TWinTraits::GetExtendedLVStyle(); } // Operations BOOL SubclassWindow(HWND hWnd) { BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); if(bRet != FALSE) { T* pT = static_cast(this); pT->Init(); } return bRet; } void CheckSelectedItems(int nCurrItem) { // first check if this item is selected LVITEM lvi = {}; lvi.iItem = nCurrItem; lvi.iSubItem = 0; lvi.mask = LVIF_STATE; lvi.stateMask = LVIS_SELECTED; this->GetItem(&lvi); // if item is not selected, don't do anything if(!(lvi.state & LVIS_SELECTED)) return; // new check state will be reverse of the current state, BOOL bCheck = !this->GetCheckState(nCurrItem); int nItem = -1; int nOldItem = -1; while((nItem = this->GetNextItem(nOldItem, LVNI_SELECTED)) != -1) { if(nItem != nCurrItem) this->SetCheckState(nItem, bCheck); nOldItem = nItem; } } // Implementation void Init() { T* pT = static_cast(this); (void)pT; // avoid level 4 warning ATLASSERT((pT->GetExtendedLVStyle() & LVS_EX_CHECKBOXES) != 0); this->SetExtendedListViewStyle(pT->GetExtendedLVStyle()); } // Message map and handlers BEGIN_MSG_MAP(CCheckListViewCtrlImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDown) MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) END_MSG_MAP() LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { // first let list view control initialize everything LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); if(lRet == 0) { T* pT = static_cast(this); pT->Init(); } return lRet; } LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { POINT ptMsg = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; LVHITTESTINFO lvh = {}; lvh.pt = ptMsg; if((this->HitTest(&lvh) != -1) && (lvh.flags == LVHT_ONITEMSTATEICON) && (::GetKeyState(VK_CONTROL) >= 0)) { T* pT = static_cast(this); pT->CheckSelectedItems(lvh.iItem); } bHandled = FALSE; return 1; } LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(wParam == VK_SPACE) { int nCurrItem = this->GetNextItem(-1, LVNI_FOCUSED); if((nCurrItem != -1) && (::GetKeyState(VK_CONTROL) >= 0)) { T* pT = static_cast(this); pT->CheckSelectedItems(nCurrItem); } } bHandled = FALSE; return 1; } }; class CCheckListViewCtrl : public CCheckListViewCtrlImpl { public: DECLARE_WND_SUPERCLASS(_T("WTL_CheckListView"), GetWndClassName()) }; /////////////////////////////////////////////////////////////////////////////// // CHyperLink - hyper link control implementation #define HLINK_UNDERLINED 0x00000000 #define HLINK_NOTUNDERLINED 0x00000001 #define HLINK_UNDERLINEHOVER 0x00000002 #define HLINK_COMMANDBUTTON 0x00000004 #define HLINK_NOTIFYBUTTON 0x0000000C #define HLINK_USETAGS 0x00000010 #define HLINK_USETAGSBOLD 0x00000030 #define HLINK_NOTOOLTIP 0x00000040 #define HLINK_AUTOCREATELINKFONT 0x00000080 #define HLINK_SINGLELINE 0x00000100 // Notes: // - HLINK_USETAGS and HLINK_USETAGSBOLD are always left-aligned // - When HLINK_USETAGSBOLD is used, the underlined styles will be ignored template class ATL_NO_VTABLE CHyperLinkImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > { public: LPTSTR m_lpstrLabel; LPTSTR m_lpstrHyperLink; HCURSOR m_hCursor; HFONT m_hFontLink; HFONT m_hFontNormal; RECT m_rcLink; CToolTipCtrl m_tip; COLORREF m_clrLink; COLORREF m_clrVisited; DWORD m_dwExtendedStyle; // Hyper Link specific extended styles bool m_bPaintLabel:1; bool m_bVisited:1; bool m_bHover:1; bool m_bInternalLinkFont:1; bool m_bInternalNormalFont:1; // Constructor/Destructor CHyperLinkImpl(DWORD dwExtendedStyle = HLINK_UNDERLINED) : m_lpstrLabel(NULL), m_lpstrHyperLink(NULL), m_hCursor(NULL), m_hFontLink(NULL), m_hFontNormal(NULL), m_clrLink(RGB(0, 0, 255)), m_clrVisited(RGB(128, 0, 128)), m_dwExtendedStyle(dwExtendedStyle), m_bPaintLabel(true), m_bVisited(false), m_bHover(false), m_bInternalLinkFont(false), m_bInternalNormalFont(false) { ::SetRectEmpty(&m_rcLink); } ~CHyperLinkImpl() { delete [] m_lpstrLabel; delete [] m_lpstrHyperLink; } // Attributes DWORD GetHyperLinkExtendedStyle() const { return m_dwExtendedStyle; } DWORD SetHyperLinkExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) { DWORD dwPrevStyle = m_dwExtendedStyle; if(dwMask == 0) m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); return dwPrevStyle; } bool GetLabel(LPTSTR lpstrBuffer, int nLength) const { if(m_lpstrLabel == NULL) return false; ATLASSERT(lpstrBuffer != NULL); if(nLength <= lstrlen(m_lpstrLabel)) return false; ATL::Checked::tcscpy_s(lpstrBuffer, nLength, m_lpstrLabel); return true; } bool SetLabel(LPCTSTR lpstrLabel) { delete [] m_lpstrLabel; m_lpstrLabel = NULL; int cchLen = lstrlen(lpstrLabel) + 1; ATLTRY(m_lpstrLabel = new TCHAR[cchLen]); if(m_lpstrLabel == NULL) return false; ATL::Checked::tcscpy_s(m_lpstrLabel, cchLen, lpstrLabel); T* pT = static_cast(this); pT->CalcLabelRect(); if(this->m_hWnd != NULL) this->SetWindowText(lpstrLabel); // Set this for accessibility return true; } bool GetHyperLink(LPTSTR lpstrBuffer, int nLength) const { if(m_lpstrHyperLink == NULL) return false; ATLASSERT(lpstrBuffer != NULL); if(nLength <= lstrlen(m_lpstrHyperLink)) return false; ATL::Checked::tcscpy_s(lpstrBuffer, nLength, m_lpstrHyperLink); return true; } bool SetHyperLink(LPCTSTR lpstrLink) { delete [] m_lpstrHyperLink; m_lpstrHyperLink = NULL; int cchLen = lstrlen(lpstrLink) + 1; ATLTRY(m_lpstrHyperLink = new TCHAR[cchLen]); if(m_lpstrHyperLink == NULL) return false; ATL::Checked::tcscpy_s(m_lpstrHyperLink, cchLen, lpstrLink); if(m_lpstrLabel == NULL) { T* pT = static_cast(this); pT->CalcLabelRect(); } if(m_tip.IsWindow()) { m_tip.Activate(TRUE); m_tip.AddTool(this->m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); } return true; } HFONT GetLinkFont() const { return m_hFontLink; } void SetLinkFont(HFONT hFont) { if(m_bInternalLinkFont) { ::DeleteObject(m_hFontLink); m_bInternalLinkFont = false; } m_hFontLink = hFont; T* pT = static_cast(this); pT->CalcLabelRect(); } int GetIdealHeight() const { ATLASSERT(::IsWindow(this->m_hWnd)); if((m_lpstrLabel == NULL) && (m_lpstrHyperLink == NULL)) return -1; if(!m_bPaintLabel) return -1; UINT uFormat = IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; CClientDC dc(this->m_hWnd); RECT rect = {}; this->GetClientRect(&rect); HFONT hFontOld = dc.SelectFont(m_hFontNormal); RECT rcText = rect; dc.DrawText(_T("NS"), -1, &rcText, DT_LEFT | uFormat | DT_CALCRECT); dc.SelectFont(m_hFontLink); RECT rcLink = rect; dc.DrawText(_T("NS"), -1, &rcLink, DT_LEFT | uFormat | DT_CALCRECT); dc.SelectFont(hFontOld); return __max(rcText.bottom - rcText.top, rcLink.bottom - rcLink.top); } bool GetIdealSize(SIZE& size) const { int cx = 0, cy = 0; bool bRet = GetIdealSize(cx, cy); if(bRet) { size.cx = cx; size.cy = cy; } return bRet; } bool GetIdealSize(int& cx, int& cy) const { ATLASSERT(::IsWindow(this->m_hWnd)); if((m_lpstrLabel == NULL) && (m_lpstrHyperLink == NULL)) return false; if(!m_bPaintLabel) return false; CClientDC dc(this->m_hWnd); RECT rcClient = {}; this->GetClientRect(&rcClient); RECT rcAll = rcClient; if(IsUsingTags()) { // find tags and label parts LPTSTR lpstrLeft = NULL; int cchLeft = 0; LPTSTR lpstrLink = NULL; int cchLink = 0; LPTSTR lpstrRight = NULL; int cchRight = 0; const T* pT = static_cast(this); pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); // get label part rects UINT uFormat = IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; HFONT hFontOld = dc.SelectFont(m_hFontNormal); RECT rcLeft = rcClient; dc.DrawText(lpstrLeft, cchLeft, &rcLeft, DT_LEFT | uFormat | DT_CALCRECT); dc.SelectFont(m_hFontLink); RECT rcLink = { rcLeft.right, rcLeft.top, rcClient.right, rcClient.bottom }; dc.DrawText(lpstrLink, cchLink, &rcLink, DT_LEFT | uFormat | DT_CALCRECT); dc.SelectFont(m_hFontNormal); RECT rcRight = { rcLink.right, rcLink.top, rcClient.right, rcClient.bottom }; dc.DrawText(lpstrRight, cchRight, &rcRight, DT_LEFT | uFormat | DT_CALCRECT); dc.SelectFont(hFontOld); int cyMax = __max(rcLeft.bottom, __max(rcLink.bottom, rcRight.bottom)); ::SetRect(&rcAll, rcLeft.left, rcLeft.top, rcRight.right, cyMax); } else { HFONT hOldFont = NULL; if(m_hFontLink != NULL) hOldFont = dc.SelectFont(m_hFontLink); LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; DWORD dwStyle = this->GetStyle(); UINT uFormat = DT_LEFT; if (dwStyle & SS_CENTER) uFormat = DT_CENTER; else if (dwStyle & SS_RIGHT) uFormat = DT_RIGHT; uFormat |= IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; dc.DrawText(lpstrText, -1, &rcAll, uFormat | DT_CALCRECT); if(m_hFontLink != NULL) dc.SelectFont(hOldFont); if (dwStyle & SS_CENTER) { int dx = (rcClient.right - rcAll.right) / 2; ::OffsetRect(&rcAll, dx, 0); } else if (dwStyle & SS_RIGHT) { int dx = rcClient.right - rcAll.right; ::OffsetRect(&rcAll, dx, 0); } } cx = rcAll.right - rcAll.left; cy = rcAll.bottom - rcAll.top; return true; } // for command buttons only bool GetToolTipText(LPTSTR lpstrBuffer, int nLength) const { ATLASSERT(IsCommandButton()); return GetHyperLink(lpstrBuffer, nLength); } bool SetToolTipText(LPCTSTR lpstrToolTipText) { ATLASSERT(IsCommandButton()); return SetHyperLink(lpstrToolTipText); } // Operations BOOL SubclassWindow(HWND hWnd) { ATLASSERT(this->m_hWnd == NULL); ATLASSERT(::IsWindow(hWnd)); if(m_hFontNormal == NULL) m_hFontNormal = (HFONT)::SendMessage(hWnd, WM_GETFONT, 0, 0L); BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); if(bRet != FALSE) { T* pT = static_cast(this); pT->Init(); } return bRet; } bool Navigate() { ATLASSERT(::IsWindow(this->m_hWnd)); bool bRet = true; if(IsNotifyButton()) { NMHDR nmhdr = { this->m_hWnd, (UINT_PTR)this->GetDlgCtrlID(), NM_CLICK }; this->GetParent().SendMessage(WM_NOTIFY, this->GetDlgCtrlID(), (LPARAM)&nmhdr); } else if(IsCommandButton()) { this->GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(this->GetDlgCtrlID(), BN_CLICKED), (LPARAM)this->m_hWnd); } else { ATLASSERT(m_lpstrHyperLink != NULL); DWORD_PTR dwRet = (DWORD_PTR)::ShellExecute(0, _T("open"), m_lpstrHyperLink, 0, 0, SW_SHOWNORMAL); bRet = (dwRet > 32); ATLASSERT(bRet); if(bRet) { m_bVisited = true; this->Invalidate(); } } return bRet; } void CreateLinkFontFromNormal() { if(m_bInternalLinkFont) { ::DeleteObject(m_hFontLink); m_bInternalLinkFont = false; } CFontHandle font = (m_hFontNormal != NULL) ? m_hFontNormal : (HFONT)::GetStockObject(SYSTEM_FONT); LOGFONT lf = {}; font.GetLogFont(&lf); if(IsUsingTagsBold()) lf.lfWeight = FW_BOLD; else if(!IsNotUnderlined()) lf.lfUnderline = TRUE; m_hFontLink = ::CreateFontIndirect(&lf); m_bInternalLinkFont = true; ATLASSERT(m_hFontLink != NULL); } // Message map and handlers BEGIN_MSG_MAP(CHyperLinkImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) MESSAGE_HANDLER(WM_SETFOCUS, OnFocus) MESSAGE_HANDLER(WM_KILLFOCUS, OnFocus) MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) MESSAGE_HANDLER(WM_CHAR, OnChar) MESSAGE_HANDLER(WM_GETDLGCODE, OnGetDlgCode) MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) MESSAGE_HANDLER(WM_ENABLE, OnEnable) MESSAGE_HANDLER(WM_GETFONT, OnGetFont) MESSAGE_HANDLER(WM_SETFONT, OnSetFont) MESSAGE_HANDLER(WM_UPDATEUISTATE, OnUpdateUiState) MESSAGE_HANDLER(WM_SIZE, OnSize) END_MSG_MAP() LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->Init(); return 0; } LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_tip.IsWindow()) { m_tip.DestroyWindow(); m_tip.m_hWnd = NULL; } if(m_bInternalLinkFont) { ::DeleteObject(m_hFontLink); m_hFontLink = NULL; m_bInternalLinkFont = false; } if(m_bInternalNormalFont) { ::DeleteObject(m_hFontNormal); m_hFontNormal = NULL; m_bInternalNormalFont = false; } bHandled = FALSE; return 1; } LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { MSG msg = { this->m_hWnd, uMsg, wParam, lParam }; if(m_tip.IsWindow() && IsUsingToolTip()) m_tip.RelayEvent(&msg); bHandled = FALSE; return 1; } LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return 1; // no background painting needed (we do it all during WM_PAINT) } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(!m_bPaintLabel) { bHandled = FALSE; return 1; } T* pT = static_cast(this); if(wParam != NULL) { pT->DoEraseBackground((HDC)wParam); pT->DoPaint((HDC)wParam); } else { CPaintDC dc(this->m_hWnd); pT->DoEraseBackground(dc.m_hDC); pT->DoPaint(dc.m_hDC); } return 0; } LRESULT OnFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_bPaintLabel) this->Invalidate(); else bHandled = FALSE; return 0; } LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if(((m_lpstrHyperLink != NULL) || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) { ::SetCursor(m_hCursor); if(IsUnderlineHover()) { if(!m_bHover) { m_bHover = true; this->InvalidateRect(&m_rcLink); this->UpdateWindow(); StartTrackMouseLeave(); } } } else { if(IsUnderlineHover()) { if(m_bHover) { m_bHover = false; this->InvalidateRect(&m_rcLink); this->UpdateWindow(); } } bHandled = FALSE; } return 0; } LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(IsUnderlineHover() && m_bHover) { m_bHover = false; this->InvalidateRect(&m_rcLink); this->UpdateWindow(); } return 0; } LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if(::PtInRect(&m_rcLink, pt)) { this->SetFocus(); this->SetCapture(); } return 0; } LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { if(GetCapture() == this->m_hWnd) { ReleaseCapture(); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if(::PtInRect(&m_rcLink, pt)) { T* pT = static_cast(this); pT->Navigate(); } } return 0; } LRESULT OnChar(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if((wParam == VK_RETURN) || (wParam == VK_SPACE)) { T* pT = static_cast(this); pT->Navigate(); } return 0; } LRESULT OnGetDlgCode(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return DLGC_WANTCHARS; } LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { POINT pt = {}; GetCursorPos(&pt); this->ScreenToClient(&pt); if(((m_lpstrHyperLink != NULL) || IsCommandButton()) && ::PtInRect(&m_rcLink, pt)) { return TRUE; } bHandled = FALSE; return FALSE; } LRESULT OnEnable(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { this->Invalidate(); this->UpdateWindow(); return 0; } LRESULT OnGetFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return (LRESULT)m_hFontNormal; } LRESULT OnSetFont(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { if(m_bInternalNormalFont) { ::DeleteObject(m_hFontNormal); m_bInternalNormalFont = false; } bool bCreateLinkFont = m_bInternalLinkFont; m_hFontNormal = (HFONT)wParam; if(bCreateLinkFont || IsAutoCreateLinkFont()) CreateLinkFontFromNormal(); T* pT = static_cast(this); pT->CalcLabelRect(); if((BOOL)lParam) { this->Invalidate(); this->UpdateWindow(); } return 0; } LRESULT OnUpdateUiState(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // If the control is subclassed or superclassed, this message can cause // repainting without WM_PAINT. We don't use this state, so just do nothing. return 0; } LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->CalcLabelRect(); pT->Invalidate(); return 0; } // Implementation void Init() { ATLASSERT(::IsWindow(this->m_hWnd)); // Check if we should paint a label const int cchBuff = 8; TCHAR szBuffer[cchBuff] = {}; if(::GetClassName(this->m_hWnd, szBuffer, cchBuff)) { if(lstrcmpi(szBuffer, _T("static")) == 0) { this->ModifyStyle(0, SS_NOTIFY); // we need this DWORD dwStyle = this->GetStyle() & 0x000000FF; if((dwStyle == SS_ICON) || (dwStyle == SS_BLACKRECT) || (dwStyle == SS_GRAYRECT) || (dwStyle == SS_WHITERECT) || (dwStyle == SS_BLACKFRAME) || (dwStyle == SS_GRAYFRAME) || (dwStyle == SS_WHITEFRAME) || (dwStyle == SS_OWNERDRAW) || (dwStyle == SS_BITMAP) || (dwStyle == SS_ENHMETAFILE)) m_bPaintLabel = false; } } // create or load a cursor m_hCursor = ::LoadCursor(NULL, IDC_HAND); ATLASSERT(m_hCursor != NULL); // set fonts if(m_bPaintLabel) { if(m_hFontNormal == NULL) { m_hFontNormal = AtlCreateControlFont(); m_bInternalNormalFont = true; } if(m_hFontLink == NULL) CreateLinkFontFromNormal(); } // create a tool tip m_tip.Create(this->m_hWnd); ATLASSERT(m_tip.IsWindow()); // set label (defaults to window text) if(m_lpstrLabel == NULL) { int nLen = this->GetWindowTextLength(); if(nLen > 0) { ATLTRY(m_lpstrLabel = new TCHAR[nLen + 1]); if(m_lpstrLabel != NULL) ATLVERIFY(this->GetWindowText(m_lpstrLabel, nLen + 1) > 0); } } T* pT = static_cast(this); pT->CalcLabelRect(); // set hyperlink (defaults to label), or just activate tool tip if already set if((m_lpstrHyperLink == NULL) && !IsCommandButton()) { if(m_lpstrLabel != NULL) SetHyperLink(m_lpstrLabel); } else { m_tip.Activate(TRUE); m_tip.AddTool(this->m_hWnd, m_lpstrHyperLink, &m_rcLink, 1); } // set link colors if(m_bPaintLabel) { ATL::CRegKey rk; LONG lRet = rk.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Internet Explorer\\Settings")); if(lRet == ERROR_SUCCESS) { const int cchValue = 12; TCHAR szValue[cchValue] = {}; ULONG ulCount = cchValue; lRet = rk.QueryStringValue(_T("Anchor Color"), szValue, &ulCount); if(lRet == ERROR_SUCCESS) { COLORREF clr = pT->_ParseColorString(szValue); ATLASSERT(clr != CLR_INVALID); if(clr != CLR_INVALID) m_clrLink = clr; } ulCount = cchValue; lRet = rk.QueryStringValue(_T("Anchor Color Visited"), szValue, &ulCount); if(lRet == ERROR_SUCCESS) { COLORREF clr = pT->_ParseColorString(szValue); ATLASSERT(clr != CLR_INVALID); if(clr != CLR_INVALID) m_clrVisited = clr; } } } } static COLORREF _ParseColorString(LPTSTR lpstr) { int c[3] = { -1, -1, -1 }; LPTSTR p = NULL; for(int i = 0; i < 2; i++) { for(p = lpstr; *p != _T('\0'); p = ::CharNext(p)) { if(*p == _T(',')) { *p = _T('\0'); c[i] = _ttoi(lpstr); lpstr = &p[1]; break; } } if(c[i] == -1) return CLR_INVALID; } if(*lpstr == _T('\0')) return CLR_INVALID; c[2] = _ttoi(lpstr); return RGB(c[0], c[1], c[2]); } bool CalcLabelRect() { if(!::IsWindow(this->m_hWnd)) return false; if((m_lpstrLabel == NULL) && (m_lpstrHyperLink == NULL)) return false; CClientDC dc(this->m_hWnd); RECT rcClient = {}; this->GetClientRect(&rcClient); m_rcLink = rcClient; if(!m_bPaintLabel) return true; if(IsUsingTags()) { // find tags and label parts LPTSTR lpstrLeft = NULL; int cchLeft = 0; LPTSTR lpstrLink = NULL; int cchLink = 0; LPTSTR lpstrRight = NULL; int cchRight = 0; T* pT = static_cast(this); pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); ATLASSERT(lpstrLink != NULL); ATLASSERT(cchLink > 0); // get label part rects HFONT hFontOld = dc.SelectFont(m_hFontNormal); UINT uFormat = IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; RECT rcLeft = rcClient; if(lpstrLeft != NULL) dc.DrawText(lpstrLeft, cchLeft, &rcLeft, DT_LEFT | uFormat | DT_CALCRECT); dc.SelectFont(m_hFontLink); RECT rcLink = rcClient; if(lpstrLeft != NULL) rcLink.left = rcLeft.right; dc.DrawText(lpstrLink, cchLink, &rcLink, DT_LEFT | uFormat | DT_CALCRECT); dc.SelectFont(hFontOld); m_rcLink = rcLink; } else { HFONT hOldFont = NULL; if(m_hFontLink != NULL) hOldFont = dc.SelectFont(m_hFontLink); LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; DWORD dwStyle = this->GetStyle(); UINT uFormat = DT_LEFT; if (dwStyle & SS_CENTER) uFormat = DT_CENTER; else if (dwStyle & SS_RIGHT) uFormat = DT_RIGHT; uFormat |= IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; dc.DrawText(lpstrText, -1, &m_rcLink, uFormat | DT_CALCRECT); if(m_hFontLink != NULL) dc.SelectFont(hOldFont); if (dwStyle & SS_CENTER) { int dx = (rcClient.right - m_rcLink.right) / 2; ::OffsetRect(&m_rcLink, dx, 0); } else if (dwStyle & SS_RIGHT) { int dx = rcClient.right - m_rcLink.right; ::OffsetRect(&m_rcLink, dx, 0); } } return true; } void CalcLabelParts(LPTSTR& lpstrLeft, int& cchLeft, LPTSTR& lpstrLink, int& cchLink, LPTSTR& lpstrRight, int& cchRight) const { lpstrLeft = NULL; cchLeft = 0; lpstrLink = NULL; cchLink = 0; lpstrRight = NULL; cchRight = 0; LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; int cchText = lstrlen(lpstrText); bool bOutsideLink = true; for(int i = 0; i < cchText; i++) { if(lpstrText[i] != _T('<')) continue; if(bOutsideLink) { if(::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, &lpstrText[i], 3, _T(""), 3) == CSTR_EQUAL) { if(i > 0) { lpstrLeft = lpstrText; cchLeft = i; } lpstrLink = &lpstrText[i + 3]; bOutsideLink = false; } } else { if(::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, &lpstrText[i], 4, _T(""), 4) == CSTR_EQUAL) { cchLink = i - 3 - cchLeft; if(lpstrText[i + 4] != 0) { lpstrRight = &lpstrText[i + 4]; cchRight = cchText - (i + 4); break; } } } } } void DoEraseBackground(CDCHandle dc) { HBRUSH hBrush = (HBRUSH)this->GetParent().SendMessage(WM_CTLCOLORSTATIC, (WPARAM)dc.m_hDC, (LPARAM)this->m_hWnd); if(hBrush != NULL) { RECT rect = {}; this->GetClientRect(&rect); dc.FillRect(&rect, hBrush); } } void DoPaint(CDCHandle dc) { if(IsUsingTags()) { // find tags and label parts LPTSTR lpstrLeft = NULL; int cchLeft = 0; LPTSTR lpstrLink = NULL; int cchLink = 0; LPTSTR lpstrRight = NULL; int cchRight = 0; T* pT = static_cast(this); pT->CalcLabelParts(lpstrLeft, cchLeft, lpstrLink, cchLink, lpstrRight, cchRight); // get label part rects RECT rcClient = {}; this->GetClientRect(&rcClient); dc.SetBkMode(TRANSPARENT); HFONT hFontOld = dc.SelectFont(m_hFontNormal); UINT uFormat = IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; if(lpstrLeft != NULL) dc.DrawText(lpstrLeft, cchLeft, &rcClient, DT_LEFT | uFormat); COLORREF clrOld = dc.SetTextColor(this->IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); if((m_hFontLink != NULL) && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) dc.SelectFont(m_hFontLink); else dc.SelectFont(m_hFontNormal); dc.DrawText(lpstrLink, cchLink, &m_rcLink, DT_LEFT | uFormat); dc.SetTextColor(clrOld); dc.SelectFont(m_hFontNormal); if(lpstrRight != NULL) { RECT rcRight = { m_rcLink.right, m_rcLink.top, rcClient.right, rcClient.bottom }; dc.DrawText(lpstrRight, cchRight, &rcRight, DT_LEFT | uFormat); } if(GetFocus() == this->m_hWnd) dc.DrawFocusRect(&m_rcLink); dc.SelectFont(hFontOld); } else { dc.SetBkMode(TRANSPARENT); COLORREF clrOld = dc.SetTextColor(this->IsWindowEnabled() ? (m_bVisited ? m_clrVisited : m_clrLink) : (::GetSysColor(COLOR_GRAYTEXT))); HFONT hFontOld = NULL; if((m_hFontLink != NULL) && (!IsUnderlineHover() || (IsUnderlineHover() && m_bHover))) hFontOld = dc.SelectFont(m_hFontLink); else hFontOld = dc.SelectFont(m_hFontNormal); LPTSTR lpstrText = (m_lpstrLabel != NULL) ? m_lpstrLabel : m_lpstrHyperLink; DWORD dwStyle = this->GetStyle(); UINT uFormat = DT_LEFT; if (dwStyle & SS_CENTER) uFormat = DT_CENTER; else if (dwStyle & SS_RIGHT) uFormat = DT_RIGHT; uFormat |= IsSingleLine() ? DT_SINGLELINE : DT_WORDBREAK; dc.DrawText(lpstrText, -1, &m_rcLink, uFormat); if(GetFocus() == this->m_hWnd) dc.DrawFocusRect(&m_rcLink); dc.SetTextColor(clrOld); dc.SelectFont(hFontOld); } } BOOL StartTrackMouseLeave() { TRACKMOUSEEVENT tme = {}; tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; tme.hwndTrack = this->m_hWnd; return ::TrackMouseEvent(&tme); } // Implementation helpers bool IsUnderlined() const { return ((m_dwExtendedStyle & (HLINK_NOTUNDERLINED | HLINK_UNDERLINEHOVER)) == 0); } bool IsNotUnderlined() const { return ((m_dwExtendedStyle & HLINK_NOTUNDERLINED) != 0); } bool IsUnderlineHover() const { return ((m_dwExtendedStyle & HLINK_UNDERLINEHOVER) != 0); } bool IsCommandButton() const { return ((m_dwExtendedStyle & HLINK_COMMANDBUTTON) != 0); } bool IsNotifyButton() const { return ((m_dwExtendedStyle & HLINK_NOTIFYBUTTON) == HLINK_NOTIFYBUTTON); } bool IsUsingTags() const { return ((m_dwExtendedStyle & HLINK_USETAGS) != 0); } bool IsUsingTagsBold() const { return ((m_dwExtendedStyle & HLINK_USETAGSBOLD) == HLINK_USETAGSBOLD); } bool IsUsingToolTip() const { return ((m_dwExtendedStyle & HLINK_NOTOOLTIP) == 0); } bool IsAutoCreateLinkFont() const { return ((m_dwExtendedStyle & HLINK_AUTOCREATELINKFONT) == HLINK_AUTOCREATELINKFONT); } bool IsSingleLine() const { return ((m_dwExtendedStyle & HLINK_SINGLELINE) == HLINK_SINGLELINE); } }; class CHyperLink : public CHyperLinkImpl { public: DECLARE_WND_CLASS(_T("WTL_HyperLink")) }; /////////////////////////////////////////////////////////////////////////////// // CWaitCursor - displays a wait cursor class CWaitCursor { public: // Data HCURSOR m_hWaitCursor; HCURSOR m_hOldCursor; bool m_bInUse; // Constructor/destructor CWaitCursor(bool bSet = true, LPCTSTR lpstrCursor = IDC_WAIT, bool bSys = true) : m_hOldCursor(NULL), m_bInUse(false) { HINSTANCE hInstance = bSys ? NULL : ModuleHelper::GetResourceInstance(); m_hWaitCursor = ::LoadCursor(hInstance, lpstrCursor); ATLASSERT(m_hWaitCursor != NULL); if(bSet) Set(); } ~CWaitCursor() { Restore(); } // Methods bool Set() { if(m_bInUse) return false; m_hOldCursor = ::SetCursor(m_hWaitCursor); m_bInUse = true; return true; } bool Restore() { if(!m_bInUse) return false; ::SetCursor(m_hOldCursor); m_bInUse = false; return true; } }; /////////////////////////////////////////////////////////////////////////////// // CCustomWaitCursor - for custom and animated cursors class CCustomWaitCursor : public CWaitCursor { public: // Constructor/destructor CCustomWaitCursor(ATL::_U_STRINGorID cursor, bool bSet = true, HINSTANCE hInstance = NULL) : CWaitCursor(false, IDC_WAIT, true) { if(hInstance == NULL) hInstance = ModuleHelper::GetResourceInstance(); m_hWaitCursor = (HCURSOR)::LoadImage(hInstance, cursor.m_lpstr, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE); if(bSet) Set(); } ~CCustomWaitCursor() { Restore(); ::DestroyCursor(m_hWaitCursor); } }; /////////////////////////////////////////////////////////////////////////////// // CMultiPaneStatusBarCtrl - Status Bar with multiple panes template class ATL_NO_VTABLE CMultiPaneStatusBarCtrlImpl : public ATL::CWindowImpl< T, TBase > { public: DECLARE_WND_SUPERCLASS2(NULL, T, TBase::GetWndClassName()) // Data enum { m_cxPaneMargin = 3 }; int m_nPanes; int* m_pPane; // Constructor/destructor CMultiPaneStatusBarCtrlImpl() : m_nPanes(0), m_pPane(NULL) { } ~CMultiPaneStatusBarCtrlImpl() { delete [] m_pPane; } // Methods HWND Create(HWND hWndParent, LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) { return ATL::CWindowImpl< T, TBase >::Create(hWndParent, this->rcDefault, lpstrText, dwStyle, 0, nID); } HWND Create(HWND hWndParent, UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) { const int cchMax = 128; // max text length is 127 for status bars (+1 for null) TCHAR szText[cchMax] = {}; ::LoadString(ModuleHelper::GetResourceInstance(), nTextID, szText, cchMax); return Create(hWndParent, szText, dwStyle, nID); } BOOL SetPanes(int* pPanes, int nPanes, bool bSetText = true) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPanes > 0); m_nPanes = nPanes; delete [] m_pPane; m_pPane = NULL; ATLTRY(m_pPane = new int[nPanes]); ATLASSERT(m_pPane != NULL); if(m_pPane == NULL) return FALSE; ATL::CTempBuffer buff; int* pPanesPos = buff.Allocate(nPanes); ATLASSERT(pPanesPos != NULL); if(pPanesPos == NULL) return FALSE; ATL::Checked::memcpy_s(m_pPane, nPanes * sizeof(int), pPanes, nPanes * sizeof(int)); // get status bar DC and set font CClientDC dc(this->m_hWnd); HFONT hOldFont = dc.SelectFont(this->GetFont()); // get status bar borders int arrBorders[3] = {}; this->GetBorders(arrBorders); const int cchBuff = 128; TCHAR szBuff[cchBuff] = {}; int cxLeft = arrBorders[0]; // calculate right edge of each part for(int i = 0; i < nPanes; i++) { if(pPanes[i] == ID_DEFAULT_PANE) { // make very large, will be resized later pPanesPos[i] = INT_MAX / 2; } else { ::LoadString(ModuleHelper::GetResourceInstance(), pPanes[i], szBuff, cchBuff); SIZE size = {}; dc.GetTextExtent(szBuff, lstrlen(szBuff), &size); T* pT = static_cast(this); (void)pT; // avoid level 4 warning pPanesPos[i] = cxLeft + size.cx + arrBorders[2] + 2 * pT->m_cxPaneMargin; } cxLeft = pPanesPos[i]; } BOOL bRet = this->SetParts(nPanes, pPanesPos); if(bRet && bSetText) { for(int i = 0; i < nPanes; i++) { if(pPanes[i] != ID_DEFAULT_PANE) { ::LoadString(ModuleHelper::GetResourceInstance(), pPanes[i], szBuff, cchBuff); SetPaneText(m_pPane[i], szBuff); } } } dc.SelectFont(hOldFont); return bRet; } bool GetPaneTextLength(int nPaneID, int* pcchLength = NULL, int* pnType = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return false; int nLength = this->GetTextLength(nIndex, pnType); if(pcchLength != NULL) *pcchLength = nLength; return true; } BOOL GetPaneText(int nPaneID, LPTSTR lpstrText, int* pcchLength = NULL, int* pnType = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; int nLength = this->GetText(nIndex, lpstrText, pnType); if(pcchLength != NULL) *pcchLength = nLength; return TRUE; } #ifdef __ATLSTR_H__ BOOL GetPaneText(int nPaneID, ATL::CString& strText, int* pcchLength = NULL, int* pnType = NULL) const { ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; int nLength = this->GetText(nIndex, strText, pnType); if(pcchLength != NULL) *pcchLength = nLength; return TRUE; } #endif // __ATLSTR_H__ BOOL SetPaneText(int nPaneID, LPCTSTR lpstrText, int nType = 0) { ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; return this->SetText(nIndex, lpstrText, nType); } BOOL GetPaneRect(int nPaneID, LPRECT lpRect) const { ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; return this->GetRect(nIndex, lpRect); } BOOL SetPaneWidth(int nPaneID, int cxWidth) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(nPaneID != ID_DEFAULT_PANE); // Can't resize this one int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; // get pane positions ATL::CTempBuffer buff; int* pPanesPos = buff.Allocate(m_nPanes); if(pPanesPos == NULL) return FALSE; this->GetParts(m_nPanes, pPanesPos); // calculate offset int cxPaneWidth = pPanesPos[nIndex] - ((nIndex == 0) ? 0 : pPanesPos[nIndex - 1]); int cxOff = cxWidth - cxPaneWidth; // find variable width pane int nDef = m_nPanes; for(int i = 0; i < m_nPanes; i++) { if(m_pPane[i] == ID_DEFAULT_PANE) { nDef = i; break; } } // resize if(nIndex < nDef) // before default pane { for(int i = nIndex; i < nDef; i++) pPanesPos[i] += cxOff; } else // after default one { for(int i = nDef; i < nIndex; i++) pPanesPos[i] -= cxOff; } // set pane postions return this->SetParts(m_nPanes, pPanesPos); } BOOL GetPaneTipText(int nPaneID, LPTSTR lpstrText, int nSize) const { ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; this->GetTipText(nIndex, lpstrText, nSize); return TRUE; } BOOL SetPaneTipText(int nPaneID, LPCTSTR lpstrText) { ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; this->SetTipText(nIndex, lpstrText); return TRUE; } BOOL GetPaneIcon(int nPaneID, HICON& hIcon) const { ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; hIcon = this->GetIcon(nIndex); return TRUE; } BOOL SetPaneIcon(int nPaneID, HICON hIcon) { ATLASSERT(::IsWindow(this->m_hWnd)); int nIndex = GetPaneIndexFromID(nPaneID); if(nIndex == -1) return FALSE; return this->SetIcon(nIndex, hIcon); } // Message map and handlers BEGIN_MSG_MAP(CMultiPaneStatusBarCtrlImpl< T >) MESSAGE_HANDLER(WM_SIZE, OnSize) END_MSG_MAP() LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); if((wParam != SIZE_MINIMIZED) && (m_nPanes > 0)) { T* pT = static_cast(this); pT->UpdatePanesLayout(); } return lRet; } // Implementation BOOL UpdatePanesLayout() { // get pane positions ATL::CTempBuffer buff; int* pPanesPos = buff.Allocate(m_nPanes); ATLASSERT(pPanesPos != NULL); if(pPanesPos == NULL) return FALSE; int nRet = this->GetParts(m_nPanes, pPanesPos); ATLASSERT(nRet == m_nPanes); if(nRet != m_nPanes) return FALSE; // calculate offset RECT rcClient = {}; this->GetClientRect(&rcClient); int cxOff = rcClient.right - pPanesPos[m_nPanes - 1]; // Move panes left if size grip box is present if((this->GetStyle() & SBARS_SIZEGRIP) != 0) cxOff -= ::GetSystemMetrics(SM_CXVSCROLL) + ::GetSystemMetrics(SM_CXEDGE); // find variable width pane int i; for(i = 0; i < m_nPanes; i++) { if(m_pPane[i] == ID_DEFAULT_PANE) break; } // resize all panes from the variable one to the right if((i < m_nPanes) && (pPanesPos[i] + cxOff) > ((i == 0) ? 0 : pPanesPos[i - 1])) { for(; i < m_nPanes; i++) pPanesPos[i] += cxOff; } // set pane postions return this->SetParts(m_nPanes, pPanesPos); } int GetPaneIndexFromID(int nPaneID) const { for(int i = 0; i < m_nPanes; i++) { if(m_pPane[i] == nPaneID) return i; } return -1; // not found } }; class CMultiPaneStatusBarCtrl : public CMultiPaneStatusBarCtrlImpl { public: DECLARE_WND_SUPERCLASS(_T("WTL_MultiPaneStatusBar"), GetWndClassName()) }; /////////////////////////////////////////////////////////////////////////////// // CPaneContainer - provides header with title and close button for panes // pane container extended styles #define PANECNT_NOCLOSEBUTTON 0x00000001 #define PANECNT_VERTICAL 0x00000002 #define PANECNT_FLATBORDER 0x00000004 #define PANECNT_NOBORDER 0x00000008 #define PANECNT_DIVIDER 0x00000010 #define PANECNT_GRADIENT 0x00000020 template class ATL_NO_VTABLE CPaneContainerImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CCustomDraw< T > { public: DECLARE_WND_CLASS_EX2(NULL, T, 0, -1) // Constants enum { m_cxyBorder = 2, m_cxyTextOffset = 4, m_cxyBtnOffset = 1, m_cchTitle = 80, m_cxImageTB = 13, m_cyImageTB = 11, m_cxyBtnAddTB = 7, m_cxToolBar = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder + m_cxyBtnOffset, m_xBtnImageLeft = 6, m_yBtnImageTop = 5, m_xBtnImageRight = 12, m_yBtnImageBottom = 11, m_nCloseBtnID = ID_PANE_CLOSE }; // Data members CToolBarCtrl m_tb; ATL::CWindow m_wndClient; int m_cxyHeader; TCHAR m_szTitle[m_cchTitle]; DWORD m_dwExtendedStyle; // Pane container specific extended styles HFONT m_hFont; bool m_bInternalFont; // Constructor CPaneContainerImpl() : m_cxyHeader(0), m_dwExtendedStyle(0), m_hFont(NULL), m_bInternalFont(false) { m_szTitle[0] = 0; } // Attributes DWORD GetPaneContainerExtendedStyle() const { return m_dwExtendedStyle; } DWORD SetPaneContainerExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) { DWORD dwPrevStyle = m_dwExtendedStyle; if(dwMask == 0) m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); if(this->m_hWnd != NULL) { T* pT = static_cast(this); bool bUpdate = false; if(((dwPrevStyle & PANECNT_NOCLOSEBUTTON) != 0) && ((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0)) // add close button { pT->CreateCloseButton(); bUpdate = true; } else if(((dwPrevStyle & PANECNT_NOCLOSEBUTTON) == 0) && ((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) != 0)) // remove close button { pT->DestroyCloseButton(); bUpdate = true; } if((dwPrevStyle & PANECNT_VERTICAL) != (m_dwExtendedStyle & PANECNT_VERTICAL)) // change orientation { pT->CalcSize(); bUpdate = true; } if((dwPrevStyle & (PANECNT_FLATBORDER | PANECNT_NOBORDER)) != (m_dwExtendedStyle & (PANECNT_FLATBORDER | PANECNT_NOBORDER))) // change border { bUpdate = true; } if((dwPrevStyle & PANECNT_GRADIENT) != (m_dwExtendedStyle & PANECNT_GRADIENT)) // change background { bUpdate = true; } if(bUpdate) pT->UpdateLayout(); } return dwPrevStyle; } HWND GetClient() const { return m_wndClient; } HWND SetClient(HWND hWndClient) { HWND hWndOldClient = m_wndClient; m_wndClient = hWndClient; if(this->m_hWnd != NULL) { T* pT = static_cast(this); pT->UpdateLayout(); } return hWndOldClient; } BOOL GetTitle(LPTSTR lpstrTitle, int cchLength) const { ATLASSERT(lpstrTitle != NULL); errno_t nRet = ATL::Checked::tcsncpy_s(lpstrTitle, cchLength, m_szTitle, _TRUNCATE); return ((nRet == 0) || (nRet == STRUNCATE)); } BOOL SetTitle(LPCTSTR lpstrTitle) { ATLASSERT(lpstrTitle != NULL); errno_t nRet = ATL::Checked::tcsncpy_s(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); bool bRet = ((nRet == 0) || (nRet == STRUNCATE)); if(bRet && (this->m_hWnd != NULL)) { T* pT = static_cast(this); pT->UpdateLayout(); } return bRet; } int GetTitleLength() const { return lstrlen(m_szTitle); } // Methods HWND Create(HWND hWndParent, LPCTSTR lpstrTitle = NULL, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) { if(lpstrTitle != NULL) ATL::Checked::tcsncpy_s(m_szTitle, m_cchTitle, lpstrTitle, _TRUNCATE); return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, this->rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); } HWND Create(HWND hWndParent, UINT uTitleID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, DWORD dwExStyle = 0, UINT nID = 0, LPVOID lpCreateParam = NULL) { if(uTitleID != 0U) ::LoadString(ModuleHelper::GetResourceInstance(), uTitleID, m_szTitle, m_cchTitle); return ATL::CWindowImpl< T, TBase, TWinTraits >::Create(hWndParent, this->rcDefault, NULL, dwStyle, dwExStyle, nID, lpCreateParam); } BOOL SubclassWindow(HWND hWnd) { BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); if(bRet != FALSE) { T* pT = static_cast(this); pT->Init(); RECT rect = {}; this->GetClientRect(&rect); pT->UpdateLayout(rect.right, rect.bottom); } return bRet; } BOOL EnableCloseButton(BOOL bEnable) { ATLASSERT(::IsWindow(this->m_hWnd)); T* pT = static_cast(this); (void)pT; // avoid level 4 warning return (m_tb.m_hWnd != NULL) ? m_tb.EnableButton(pT->m_nCloseBtnID, bEnable) : FALSE; } void UpdateLayout() { RECT rcClient = {}; this->GetClientRect(&rcClient); T* pT = static_cast(this); pT->UpdateLayout(rcClient.right, rcClient.bottom); } // Message map and handlers BEGIN_MSG_MAP(CPaneContainerImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_GETFONT, OnGetFont) MESSAGE_HANDLER(WM_SETFONT, OnSetFont) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) MESSAGE_HANDLER(WM_NOTIFY, OnNotify) MESSAGE_HANDLER(WM_COMMAND, OnCommand) FORWARD_NOTIFICATIONS() END_MSG_MAP() LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->Init(); return 0; } LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(m_bInternalFont) { ::DeleteObject(m_hFont); m_hFont = NULL; m_bInternalFont = false; } return 0; } LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->UpdateLayout(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); return 0; } LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(m_wndClient.m_hWnd != NULL) m_wndClient.SetFocus(); return 0; } LRESULT OnGetFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return (LRESULT)m_hFont; } LRESULT OnSetFont(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { if(m_bInternalFont) { ::DeleteObject(m_hFont); m_bInternalFont = false; } m_hFont = (HFONT)wParam; T* pT = static_cast(this); pT->CalcSize(); if((BOOL)lParam != FALSE) pT->UpdateLayout(); return 0; } LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->DrawPaneTitleBackground((HDC)wParam); return 1; } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); if(wParam != NULL) { pT->DrawPaneTitle((HDC)wParam); if(m_wndClient.m_hWnd == NULL) // no client window pT->DrawPane((HDC)wParam); } else { CPaintDC dc(this->m_hWnd); pT->DrawPaneTitle(dc.m_hDC); if(m_wndClient.m_hWnd == NULL) // no client window pT->DrawPane(dc.m_hDC); } return 0; } LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(m_tb.m_hWnd == NULL) { bHandled = FALSE; return 1; } T* pT = static_cast(this); (void)pT; // avoid level 4 warning LPNMHDR lpnmh = (LPNMHDR)lParam; LRESULT lRet = 0; // pass toolbar custom draw notifications to the base class if((lpnmh->code == NM_CUSTOMDRAW) && (lpnmh->hwndFrom == m_tb.m_hWnd)) lRet = CCustomDraw< T >::OnCustomDraw(0, lpnmh, bHandled); // tooltip notifications come with the tooltip window handle and button ID, // pass them to the parent if we don't handle them else if((lpnmh->code == TTN_GETDISPINFO) && (lpnmh->idFrom == pT->m_nCloseBtnID)) bHandled = pT->GetToolTipText(lpnmh); // only let notifications not from the toolbar go to the parent else if((lpnmh->hwndFrom != m_tb.m_hWnd) && (lpnmh->idFrom != pT->m_nCloseBtnID)) bHandled = FALSE; return lRet; } LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // if command comes from the close button, substitute HWND of the pane container instead if((m_tb.m_hWnd != NULL) && ((HWND)lParam == m_tb.m_hWnd)) return this->GetParent().SendMessage(WM_COMMAND, wParam, (LPARAM)this->m_hWnd); bHandled = FALSE; return 1; } // Custom draw overrides DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_NOTIFYITEMDRAW; // we need per-item notifications } DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/) { return CDRF_NOTIFYPOSTPAINT; } DWORD OnItemPostPaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw) { CDCHandle dc = lpNMCustomDraw->hdc; RECT& rc = lpNMCustomDraw->rc; RECT rcImage = { m_xBtnImageLeft, m_yBtnImageTop, m_xBtnImageRight + 1, m_yBtnImageBottom + 1 }; ::OffsetRect(&rcImage, rc.left, rc.top); T* pT = static_cast(this); if((lpNMCustomDraw->uItemState & CDIS_DISABLED) != 0) { RECT rcShadow = rcImage; ::OffsetRect(&rcShadow, 1, 1); CPen pen1; pen1.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DHILIGHT)); pT->DrawButtonImage(dc, rcShadow, pen1); CPen pen2; pen2.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_3DSHADOW)); pT->DrawButtonImage(dc, rcImage, pen2); } else { if((lpNMCustomDraw->uItemState & CDIS_SELECTED) != 0) ::OffsetRect(&rcImage, 1, 1); CPen pen; pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNTEXT)); pT->DrawButtonImage(dc, rcImage, pen); } return CDRF_DODEFAULT; // continue with the default item painting } // Implementation - overrideable methods void Init() { if(m_hFont == NULL) { // The same as AtlCreateControlFont() for horizontal pane LOGFONT lf = {}; ATLVERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0) != FALSE); if(IsVertical()) lf.lfEscapement = 900; // 90 degrees m_hFont = ::CreateFontIndirect(&lf); m_bInternalFont = true; } T* pT = static_cast(this); pT->CalcSize(); if((m_dwExtendedStyle & PANECNT_NOCLOSEBUTTON) == 0) pT->CreateCloseButton(); } void UpdateLayout(int cxWidth, int cyHeight) { ATLASSERT(::IsWindow(this->m_hWnd)); RECT rect = {}; if(IsVertical()) { ::SetRect(&rect, 0, 0, m_cxyHeader, cyHeight); if(m_tb.m_hWnd != NULL) m_tb.SetWindowPos(NULL, m_cxyBorder, m_cxyBorder + m_cxyBtnOffset, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); if(m_wndClient.m_hWnd != NULL) m_wndClient.SetWindowPos(NULL, m_cxyHeader, 0, cxWidth - m_cxyHeader, cyHeight, SWP_NOZORDER); else rect.right = cxWidth; } else { ::SetRect(&rect, 0, 0, cxWidth, m_cxyHeader); if(m_tb.m_hWnd != NULL) m_tb.SetWindowPos(NULL, rect.right - m_cxToolBar, m_cxyBorder + m_cxyBtnOffset, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); if(m_wndClient.m_hWnd != NULL) m_wndClient.SetWindowPos(NULL, 0, m_cxyHeader, cxWidth, cyHeight - m_cxyHeader, SWP_NOZORDER); else rect.bottom = cyHeight; } this->InvalidateRect(&rect); } void CreateCloseButton() { ATLASSERT(m_tb.m_hWnd == NULL); // create toolbar for the "x" button m_tb.Create(this->m_hWnd, this->rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_NOMOVEY | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT, 0); ATLASSERT(m_tb.IsWindow()); if(m_tb.m_hWnd != NULL) { T* pT = static_cast(this); (void)pT; // avoid level 4 warning m_tb.SetButtonStructSize(); TBBUTTON tbbtn = {}; tbbtn.idCommand = pT->m_nCloseBtnID; tbbtn.fsState = TBSTATE_ENABLED; tbbtn.fsStyle = BTNS_BUTTON; m_tb.AddButtons(1, &tbbtn); m_tb.SetBitmapSize(m_cxImageTB, m_cyImageTB); m_tb.SetButtonSize(m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB); if(IsVertical()) m_tb.SetWindowPos(NULL, m_cxyBorder + m_cxyBtnOffset, m_cxyBorder + m_cxyBtnOffset, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB + 1, SWP_NOZORDER | SWP_NOACTIVATE); else m_tb.SetWindowPos(NULL, 0, 0, m_cxImageTB + m_cxyBtnAddTB, m_cyImageTB + m_cxyBtnAddTB + 1, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); } } void DestroyCloseButton() { if(m_tb.m_hWnd != NULL) m_tb.DestroyWindow(); } void CalcSize() { T* pT = static_cast(this); CFontHandle font = pT->GetTitleFont(); if(font.IsNull()) font = (HFONT)::GetStockObject(SYSTEM_FONT); LOGFONT lf = {}; font.GetLogFont(lf); if(IsVertical()) { m_cxyHeader = m_cxImageTB + m_cxyBtnAddTB + m_cxyBorder + 1; } else { int cyFont = abs(lf.lfHeight) + m_cxyBorder + 2 * m_cxyTextOffset; int cyBtn = m_cyImageTB + m_cxyBtnAddTB + m_cxyBorder + 2 * m_cxyBtnOffset + 1; m_cxyHeader = __max(cyFont, cyBtn); } } HFONT GetTitleFont() const { return m_hFont; } BOOL GetToolTipText(LPNMHDR /*lpnmh*/) { return FALSE; } void DrawPaneTitle(CDCHandle dc) { RECT rect = {}; this->GetClientRect(&rect); UINT uBorder = BF_LEFT | BF_TOP | BF_ADJUST; if(IsVertical()) { rect.right = rect.left + m_cxyHeader; uBorder |= BF_BOTTOM; } else { rect.bottom = rect.top + m_cxyHeader; uBorder |= BF_RIGHT; } if((m_dwExtendedStyle & PANECNT_NOBORDER) == 0) { if((m_dwExtendedStyle & PANECNT_FLATBORDER) != 0) uBorder |= BF_FLAT; dc.DrawEdge(&rect, EDGE_ETCHED, uBorder); } if((m_dwExtendedStyle & PANECNT_DIVIDER) != 0) { uBorder = BF_FLAT | BF_ADJUST | (IsVertical() ? BF_RIGHT : BF_BOTTOM); dc.DrawEdge(&rect, BDR_SUNKENOUTER, uBorder); } // draw title text dc.SetTextColor(::GetSysColor(COLOR_WINDOWTEXT)); dc.SetBkMode(TRANSPARENT); T* pT = static_cast(this); HFONT hFontOld = dc.SelectFont(pT->GetTitleFont()); if(IsVertical()) { rect.top += m_cxyTextOffset; rect.bottom -= m_cxyTextOffset; if(m_tb.m_hWnd != NULL) rect.top += m_cxToolBar;; RECT rcCalc = { rect.left, rect.bottom, rect.right, rect.top }; int cxFont = dc.DrawText(m_szTitle, -1, &rcCalc, DT_TOP | DT_SINGLELINE | DT_END_ELLIPSIS | DT_CALCRECT); RECT rcText = {}; rcText.left = (rect.right - rect.left - cxFont) / 2; rcText.right = rcText.left + (rect.bottom - rect.top); rcText.top = rect.bottom; rcText.bottom = rect.top; dc.DrawText(m_szTitle, -1, &rcText, DT_TOP | DT_SINGLELINE | DT_END_ELLIPSIS); } else { rect.left += m_cxyTextOffset; rect.right -= m_cxyTextOffset; if(m_tb.m_hWnd != NULL) rect.right -= m_cxToolBar;; dc.DrawText(m_szTitle, -1, &rect, DT_LEFT | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS); } dc.SelectFont(hFontOld); } void DrawPaneTitleBackground(CDCHandle dc) { RECT rect = {}; this->GetClientRect(&rect); if(IsVertical()) rect.right = m_cxyHeader; else rect.bottom = m_cxyHeader; if((m_dwExtendedStyle & PANECNT_GRADIENT) != 0) dc.GradientFillRect(rect, ::GetSysColor(COLOR_WINDOW), ::GetSysColor(COLOR_3DFACE), IsVertical()); else dc.FillRect(&rect, COLOR_3DFACE); } // called only if pane is empty void DrawPane(CDCHandle dc) { RECT rect = {}; this->GetClientRect(&rect); if(IsVertical()) rect.left += m_cxyHeader; else rect.top += m_cxyHeader; if((this->GetExStyle() & WS_EX_CLIENTEDGE) == 0) dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); dc.FillRect(&rect, COLOR_APPWORKSPACE); } // drawing helper - draws "x" button image void DrawButtonImage(CDCHandle dc, RECT& rcImage, HPEN hPen) { HPEN hPenOld = dc.SelectPen(hPen); dc.MoveTo(rcImage.left, rcImage.top); dc.LineTo(rcImage.right, rcImage.bottom); dc.MoveTo(rcImage.left + 1, rcImage.top); dc.LineTo(rcImage.right + 1, rcImage.bottom); dc.MoveTo(rcImage.left, rcImage.bottom - 1); dc.LineTo(rcImage.right, rcImage.top - 1); dc.MoveTo(rcImage.left + 1, rcImage.bottom - 1); dc.LineTo(rcImage.right + 1, rcImage.top - 1); dc.SelectPen(hPenOld); } bool IsVertical() const { return ((m_dwExtendedStyle & PANECNT_VERTICAL) != 0); } }; class CPaneContainer : public CPaneContainerImpl { public: DECLARE_WND_CLASS_EX(_T("WTL_PaneContainer"), 0, -1) }; /////////////////////////////////////////////////////////////////////////////// // CSortListViewCtrl - implements sorting for a listview control // sort listview extended styles #define SORTLV_USESHELLBITMAPS 0x00000001 // Notification sent to parent when sort column is changed by user clicking header. #define SLVN_SORTCHANGED LVN_LAST // A LPNMSORTLISTVIEW is sent with the SLVN_SORTCHANGED notification typedef struct tagNMSORTLISTVIEW { NMHDR hdr; int iNewSortColumn; int iOldSortColumn; } NMSORTLISTVIEW, *LPNMSORTLISTVIEW; // Column sort types. Can be set on a per-column basis with the SetColumnSortType method. enum { LVCOLSORT_NONE, LVCOLSORT_TEXT, // default LVCOLSORT_TEXTNOCASE, LVCOLSORT_LONG, LVCOLSORT_DOUBLE, LVCOLSORT_DECIMAL, LVCOLSORT_DATETIME, LVCOLSORT_DATE, LVCOLSORT_TIME, LVCOLSORT_CUSTOM, LVCOLSORT_LAST = LVCOLSORT_CUSTOM }; template class CSortListViewImpl { public: enum { m_cchCmpTextMax = 32, // overrideable m_cxSortImage = 16, m_cySortImage = 15, m_cxSortArrow = 11, m_cySortArrow = 6, m_iSortUp = 0, // index of sort bitmaps m_iSortDown = 1, m_nShellSortUpID = 133 }; // passed to LVCompare functions as lParam1 and lParam2 struct LVCompareParam { int iItem; DWORD_PTR dwItemData; union { long lValue; double dblValue; DECIMAL decValue; LPCTSTR pszValue; }; }; // passed to LVCompare functions as the lParamSort parameter struct LVSortInfo { T* pT; int iSortCol; bool bDescending; }; bool m_bSortDescending; bool m_bCommCtrl6; int m_iSortColumn; CBitmap m_bmSort[2]; int m_fmtOldSortCol; HBITMAP m_hbmOldSortCol; DWORD m_dwSortLVExtendedStyle; ATL::CSimpleArray m_arrColSortType; bool m_bUseWaitCursor; CSortListViewImpl() : m_bSortDescending(false), m_bCommCtrl6(false), m_iSortColumn(-1), m_fmtOldSortCol(0), m_hbmOldSortCol(NULL), m_dwSortLVExtendedStyle(SORTLV_USESHELLBITMAPS), m_bUseWaitCursor(true) { DWORD dwMajor = 0; DWORD dwMinor = 0; HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); m_bCommCtrl6 = SUCCEEDED(hRet) && (dwMajor >= 6); } // Attributes void SetSortColumn(int iCol) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); CHeaderCtrl header = pT->GetHeader(); ATLASSERT(header.m_hWnd != NULL); ATLASSERT((iCol >= -1) && (iCol < m_arrColSortType.GetSize())); int iOldSortCol = m_iSortColumn; m_iSortColumn = iCol; if(m_bCommCtrl6) { const int nMask = HDF_SORTUP | HDF_SORTDOWN; HDITEM hditem = { HDI_FORMAT }; if((iOldSortCol != iCol) && (iOldSortCol >= 0) && header.GetItem(iOldSortCol, &hditem)) { hditem.fmt &= ~nMask; header.SetItem(iOldSortCol, &hditem); } if((iCol >= 0) && header.GetItem(iCol, &hditem)) { hditem.fmt &= ~nMask; hditem.fmt |= m_bSortDescending ? HDF_SORTDOWN : HDF_SORTUP; header.SetItem(iCol, &hditem); } return; } if(m_bmSort[m_iSortUp].IsNull()) pT->CreateSortBitmaps(); // restore previous sort column's bitmap, if any, and format HDITEM hditem = { HDI_BITMAP | HDI_FORMAT }; if((iOldSortCol != iCol) && (iOldSortCol >= 0)) { hditem.hbm = m_hbmOldSortCol; hditem.fmt = m_fmtOldSortCol; header.SetItem(iOldSortCol, &hditem); } // save new sort column's bitmap and format, and add our sort bitmap if((iCol >= 0) && header.GetItem(iCol, &hditem)) { if(iOldSortCol != iCol) { m_fmtOldSortCol = hditem.fmt; m_hbmOldSortCol = hditem.hbm; } hditem.fmt &= ~HDF_IMAGE; hditem.fmt |= HDF_BITMAP | HDF_BITMAP_ON_RIGHT; int i = m_bSortDescending ? m_iSortDown : m_iSortUp; hditem.hbm = m_bmSort[i]; header.SetItem(iCol, &hditem); } } int GetSortColumn() const { return m_iSortColumn; } void SetColumnSortType(int iCol, WORD wType) { ATLASSERT((iCol >= 0) && (iCol < m_arrColSortType.GetSize())); ATLASSERT((wType >= LVCOLSORT_NONE) && (wType <= LVCOLSORT_LAST)); m_arrColSortType[iCol] = wType; } WORD GetColumnSortType(int iCol) const { ATLASSERT((iCol >= 0) && (iCol < m_arrColSortType.GetSize())); return m_arrColSortType[iCol]; } int GetColumnCount() const { const T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); CHeaderCtrl header = pT->GetHeader(); return header.m_hWnd != NULL ? header.GetItemCount() : 0; } bool IsSortDescending() const { return m_bSortDescending; } DWORD GetSortListViewExtendedStyle() const { return m_dwSortLVExtendedStyle; } DWORD SetSortListViewExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) { DWORD dwPrevStyle = m_dwSortLVExtendedStyle; if(dwMask == 0) m_dwSortLVExtendedStyle = dwExtendedStyle; else m_dwSortLVExtendedStyle = (m_dwSortLVExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); return dwPrevStyle; } // Operations bool DoSortItems(int iCol, bool bDescending = false) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); ATLASSERT((iCol >= 0) && (iCol < m_arrColSortType.GetSize())); WORD wType = m_arrColSortType[iCol]; if(wType == LVCOLSORT_NONE) return false; int nCount = pT->GetItemCount(); if(nCount < 2) { m_bSortDescending = bDescending; SetSortColumn(iCol); return true; } CWaitCursor waitCursor(false); if(m_bUseWaitCursor) waitCursor.Set(); LVCompareParam* pParam = NULL; ATLTRY(pParam = new LVCompareParam[nCount]); PFNLVCOMPARE pFunc = NULL; TCHAR pszTemp[pT->m_cchCmpTextMax] = {}; bool bStrValue = false; switch(wType) { case LVCOLSORT_TEXT: pFunc = (PFNLVCOMPARE)pT->LVCompareText; case LVCOLSORT_TEXTNOCASE: if(pFunc == NULL) pFunc = (PFNLVCOMPARE)pT->LVCompareTextNoCase; case LVCOLSORT_CUSTOM: { if(pFunc == NULL) pFunc = (PFNLVCOMPARE)pT->LVCompareCustom; for(int i = 0; i < nCount; i++) { pParam[i].iItem = i; pParam[i].dwItemData = pT->GetItemData(i); pParam[i].pszValue = new TCHAR[pT->m_cchCmpTextMax]; pT->GetItemText(i, iCol, (LPTSTR)pParam[i].pszValue, pT->m_cchCmpTextMax); pT->SetItemData(i, (DWORD_PTR)&pParam[i]); } bStrValue = true; } break; case LVCOLSORT_LONG: { pFunc = (PFNLVCOMPARE)pT->LVCompareLong; for(int i = 0; i < nCount; i++) { pParam[i].iItem = i; pParam[i].dwItemData = pT->GetItemData(i); pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); pParam[i].lValue = pT->StrToLong(pszTemp); pT->SetItemData(i, (DWORD_PTR)&pParam[i]); } } break; case LVCOLSORT_DOUBLE: { pFunc = (PFNLVCOMPARE)pT->LVCompareDouble; for(int i = 0; i < nCount; i++) { pParam[i].iItem = i; pParam[i].dwItemData = pT->GetItemData(i); pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); pParam[i].dblValue = pT->StrToDouble(pszTemp); pT->SetItemData(i, (DWORD_PTR)&pParam[i]); } } break; case LVCOLSORT_DECIMAL: { pFunc = (PFNLVCOMPARE)pT->LVCompareDecimal; for(int i = 0; i < nCount; i++) { pParam[i].iItem = i; pParam[i].dwItemData = pT->GetItemData(i); pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); pT->StrToDecimal(pszTemp, &pParam[i].decValue); pT->SetItemData(i, (DWORD_PTR)&pParam[i]); } } break; case LVCOLSORT_DATETIME: case LVCOLSORT_DATE: case LVCOLSORT_TIME: { pFunc = (PFNLVCOMPARE)pT->LVCompareDouble; DWORD dwFlags = LOCALE_NOUSEROVERRIDE; if(wType == LVCOLSORT_DATE) dwFlags |= VAR_DATEVALUEONLY; else if(wType == LVCOLSORT_TIME) dwFlags |= VAR_TIMEVALUEONLY; for(int i = 0; i < nCount; i++) { pParam[i].iItem = i; pParam[i].dwItemData = pT->GetItemData(i); pT->GetItemText(i, iCol, pszTemp, pT->m_cchCmpTextMax); pParam[i].dblValue = pT->DateStrToDouble(pszTemp, dwFlags); pT->SetItemData(i, (DWORD_PTR)&pParam[i]); } } break; default: ATLTRACE2(atlTraceUI, 0, _T("Unknown value for sort type in CSortListViewImpl::DoSortItems()\n")); break; } // switch(wType) ATLASSERT(pFunc != NULL); LVSortInfo lvsi = { pT, iCol, bDescending }; bool bRet = ((BOOL)pT->DefWindowProc(LVM_SORTITEMS, (WPARAM)&lvsi, (LPARAM)pFunc) != FALSE); for(int i = 0; i < nCount; i++) { DWORD_PTR dwItemData = pT->GetItemData(i); LVCompareParam* p = (LVCompareParam*)dwItemData; ATLASSERT(p != NULL); if(bStrValue) delete [] (TCHAR*)p->pszValue; pT->SetItemData(i, p->dwItemData); } delete [] pParam; if(bRet) { m_bSortDescending = bDescending; SetSortColumn(iCol); } if(m_bUseWaitCursor) waitCursor.Restore(); return bRet; } void CreateSortBitmaps() { if((m_dwSortLVExtendedStyle & SORTLV_USESHELLBITMAPS) != 0) { bool bFree = false; LPCTSTR pszModule = _T("shell32.dll"); HINSTANCE hShell = ::GetModuleHandle(pszModule); if (hShell == NULL) { hShell = ::LoadLibrary(pszModule); bFree = true; } if (hShell != NULL) { bool bSuccess = true; for(int i = m_iSortUp; i <= m_iSortDown; i++) { if(!m_bmSort[i].IsNull()) m_bmSort[i].DeleteObject(); m_bmSort[i] = (HBITMAP)::LoadImage(hShell, MAKEINTRESOURCE(m_nShellSortUpID + i), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); if(m_bmSort[i].IsNull()) { bSuccess = false; break; } } if(bFree) ::FreeLibrary(hShell); if(bSuccess) return; } } T* pT = static_cast(this); for(int i = m_iSortUp; i <= m_iSortDown; i++) { if(!m_bmSort[i].IsNull()) m_bmSort[i].DeleteObject(); CDC dcMem; CClientDC dc(::GetDesktopWindow()); dcMem.CreateCompatibleDC(dc.m_hDC); m_bmSort[i].CreateCompatibleBitmap(dc.m_hDC, m_cxSortImage, m_cySortImage); HBITMAP hbmOld = dcMem.SelectBitmap(m_bmSort[i]); RECT rc = { 0, 0, m_cxSortImage, m_cySortImage }; pT->DrawSortBitmap(dcMem.m_hDC, i, &rc); dcMem.SelectBitmap(hbmOld); dcMem.DeleteDC(); } } void NotifyParentSortChanged(int iNewSortCol, int iOldSortCol) { T* pT = static_cast(this); int nID = pT->GetDlgCtrlID(); NMSORTLISTVIEW nm = { { pT->m_hWnd, (UINT_PTR)nID, SLVN_SORTCHANGED }, iNewSortCol, iOldSortCol }; ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nID, (LPARAM)&nm); } // Overrideables int CompareItemsCustom(LVCompareParam* /*pItem1*/, LVCompareParam* /*pItem2*/, int /*iSortCol*/) { // pItem1 and pItem2 contain valid iItem, dwItemData, and pszValue members. // If item1 > item2 return 1, if item1 < item2 return -1, else return 0. return 0; } void DrawSortBitmap(CDCHandle dc, int iBitmap, LPRECT prc) { dc.FillRect(prc, ::GetSysColorBrush(COLOR_BTNFACE)); HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW)); CPen pen; pen.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNSHADOW)); HPEN hpenOld = dc.SelectPen(pen); POINT ptOrg = { (m_cxSortImage - m_cxSortArrow) / 2, (m_cySortImage - m_cySortArrow) / 2 }; if(iBitmap == m_iSortUp) { POINT pts[3] = { { ptOrg.x + m_cxSortArrow / 2, ptOrg.y }, { ptOrg.x, ptOrg.y + m_cySortArrow - 1 }, { ptOrg.x + m_cxSortArrow - 1, ptOrg.y + m_cySortArrow - 1 } }; dc.Polygon(pts, 3); } else { POINT pts[3] = { { ptOrg.x, ptOrg.y }, { ptOrg.x + m_cxSortArrow / 2, ptOrg.y + m_cySortArrow - 1 }, { ptOrg.x + m_cxSortArrow - 1, ptOrg.y } }; dc.Polygon(pts, 3); } dc.SelectBrush(hbrOld); dc.SelectPen(hpenOld); } double DateStrToDouble(LPCTSTR lpstr, DWORD dwFlags) { ATLASSERT(lpstr != NULL); if((lpstr == NULL) || (lpstr[0] == _T('\0'))) return 0; USES_CONVERSION; HRESULT hRet = E_FAIL; DATE dRet = 0; if (FAILED(hRet = ::VarDateFromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, dwFlags, &dRet))) { ATLTRACE2(atlTraceUI, 0, _T("VarDateFromStr failed with result of 0x%8.8X\n"), hRet); dRet = 0; } return dRet; } long StrToLong(LPCTSTR lpstr) { ATLASSERT(lpstr != NULL); if((lpstr == NULL) || (lpstr[0] == _T('\0'))) return 0; USES_CONVERSION; HRESULT hRet = E_FAIL; long lRet = 0; if (FAILED(hRet = ::VarI4FromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, &lRet))) { ATLTRACE2(atlTraceUI, 0, _T("VarI4FromStr failed with result of 0x%8.8X\n"), hRet); lRet = 0; } return lRet; } double StrToDouble(LPCTSTR lpstr) { ATLASSERT(lpstr != NULL); if((lpstr == NULL) || (lpstr[0] == _T('\0'))) return 0; USES_CONVERSION; HRESULT hRet = E_FAIL; double dblRet = 0; if (FAILED(hRet = ::VarR8FromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, &dblRet))) { ATLTRACE2(atlTraceUI, 0, _T("VarR8FromStr failed with result of 0x%8.8X\n"), hRet); dblRet = 0; } return dblRet; } bool StrToDecimal(LPCTSTR lpstr, DECIMAL* pDecimal) { ATLASSERT(lpstr != NULL); ATLASSERT(pDecimal != NULL); if((lpstr == NULL) || (pDecimal == NULL)) return false; USES_CONVERSION; HRESULT hRet = E_FAIL; if (FAILED(hRet = ::VarDecFromStr((LPOLESTR)T2COLE(lpstr), LANG_USER_DEFAULT, LOCALE_NOUSEROVERRIDE, pDecimal))) { ATLTRACE2(atlTraceUI, 0, _T("VarDecFromStr failed with result of 0x%8.8X\n"), hRet); pDecimal->Lo64 = 0; pDecimal->Hi32 = 0; pDecimal->signscale = 0; return false; } return true; } // Overrideable PFNLVCOMPARE functions static int CALLBACK LVCompareText(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; LVSortInfo* pInfo = (LVSortInfo*)lParamSort; int nRet = lstrcmp(pParam1->pszValue, pParam2->pszValue); return pInfo->bDescending ? -nRet : nRet; } static int CALLBACK LVCompareTextNoCase(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; LVSortInfo* pInfo = (LVSortInfo*)lParamSort; int nRet = lstrcmpi(pParam1->pszValue, pParam2->pszValue); return pInfo->bDescending ? -nRet : nRet; } static int CALLBACK LVCompareLong(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; LVSortInfo* pInfo = (LVSortInfo*)lParamSort; int nRet = 0; if(pParam1->lValue > pParam2->lValue) nRet = 1; else if(pParam1->lValue < pParam2->lValue) nRet = -1; return pInfo->bDescending ? -nRet : nRet; } static int CALLBACK LVCompareDouble(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; LVSortInfo* pInfo = (LVSortInfo*)lParamSort; int nRet = 0; if(pParam1->dblValue > pParam2->dblValue) nRet = 1; else if(pParam1->dblValue < pParam2->dblValue) nRet = -1; return pInfo->bDescending ? -nRet : nRet; } static int CALLBACK LVCompareCustom(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; LVSortInfo* pInfo = (LVSortInfo*)lParamSort; int nRet = pInfo->pT->CompareItemsCustom(pParam1, pParam2, pInfo->iSortCol); return pInfo->bDescending ? -nRet : nRet; } static int CALLBACK LVCompareDecimal(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { ATLASSERT((lParam1 != NULL) && (lParam2 != NULL) && (lParamSort != NULL)); LVCompareParam* pParam1 = (LVCompareParam*)lParam1; LVCompareParam* pParam2 = (LVCompareParam*)lParam2; LVSortInfo* pInfo = (LVSortInfo*)lParamSort; int nRet = (int)::VarDecCmp(&pParam1->decValue, &pParam2->decValue); nRet--; return pInfo->bDescending ? -nRet : nRet; } BEGIN_MSG_MAP(CSortListViewImpl) MESSAGE_HANDLER(LVM_INSERTCOLUMN, OnInsertColumn) MESSAGE_HANDLER(LVM_DELETECOLUMN, OnDeleteColumn) NOTIFY_CODE_HANDLER(HDN_ITEMCLICKA, OnHeaderItemClick) NOTIFY_CODE_HANDLER(HDN_ITEMCLICKW, OnHeaderItemClick) MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) END_MSG_MAP() LRESULT OnInsertColumn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { T* pT = static_cast(this); LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); if(lRet == -1) return -1; WORD wType = 0; m_arrColSortType.Add(wType); int nCount = m_arrColSortType.GetSize(); ATLASSERT(nCount == GetColumnCount()); for(int i = nCount - 1; i > lRet; i--) m_arrColSortType[i] = m_arrColSortType[i - 1]; m_arrColSortType[(int)lRet] = LVCOLSORT_TEXT; if(lRet <= m_iSortColumn) m_iSortColumn++; return lRet; } LRESULT OnDeleteColumn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { T* pT = static_cast(this); LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); if(lRet == 0) return 0; int iCol = (int)wParam; if(m_iSortColumn == iCol) m_iSortColumn = -1; else if(m_iSortColumn > iCol) m_iSortColumn--; m_arrColSortType.RemoveAt(iCol); return lRet; } LRESULT OnHeaderItemClick(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { LPNMHEADER p = (LPNMHEADER)pnmh; if(p->iButton == 0) { int iOld = m_iSortColumn; bool bDescending = (m_iSortColumn == p->iItem) ? !m_bSortDescending : false; if(DoSortItems(p->iItem, bDescending)) NotifyParentSortChanged(p->iItem, iOld); } bHandled = FALSE; return 0; } LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(wParam == SPI_SETNONCLIENTMETRICS) GetSystemSettings(); bHandled = FALSE; return 0; } void GetSystemSettings() { if(!m_bCommCtrl6 && !m_bmSort[m_iSortUp].IsNull()) { T* pT = static_cast(this); pT->CreateSortBitmaps(); if(m_iSortColumn != -1) SetSortColumn(m_iSortColumn); } } }; typedef ATL::CWinTraits CSortListViewCtrlTraits; template class ATL_NO_VTABLE CSortListViewCtrlImpl: public ATL::CWindowImpl, public CSortListViewImpl { public: DECLARE_WND_SUPERCLASS2(NULL, T, TBase::GetWndClassName()) bool SortItems(int iCol, bool bDescending = false) { return this->DoSortItems(iCol, bDescending); } BEGIN_MSG_MAP(CSortListViewCtrlImpl) MESSAGE_HANDLER(LVM_INSERTCOLUMN, CSortListViewImpl::OnInsertColumn) MESSAGE_HANDLER(LVM_DELETECOLUMN, CSortListViewImpl::OnDeleteColumn) NOTIFY_CODE_HANDLER(HDN_ITEMCLICKA, CSortListViewImpl::OnHeaderItemClick) NOTIFY_CODE_HANDLER(HDN_ITEMCLICKW, CSortListViewImpl::OnHeaderItemClick) MESSAGE_HANDLER(WM_SETTINGCHANGE, CSortListViewImpl::OnSettingChange) END_MSG_MAP() }; class CSortListViewCtrl : public CSortListViewCtrlImpl { public: DECLARE_WND_SUPERCLASS(_T("WTL_SortListViewCtrl"), GetWndClassName()) }; /////////////////////////////////////////////////////////////////////////////// // CTabView - implements tab view window // TabView Notifications #define TBVN_PAGEACTIVATED (0U-741) #define TBVN_CONTEXTMENU (0U-742) #define TBVN_TABCLOSEBTN (0U-743) // return 0 to close page, 1 to keep open // internal #define TBVN_CLOSEBTNMOUSELEAVE (0U-744) // Notification data for TBVN_CONTEXTMENU struct TBVCONTEXTMENUINFO { NMHDR hdr; POINT pt; }; typedef TBVCONTEXTMENUINFO* LPTBVCONTEXTMENUINFO; // Helper class for tab item hover close button class CTabViewCloseBtn : public ATL::CWindowImpl { public: DECLARE_WND_CLASS_EX(_T("WTL_TabView_CloseBtn"), 0, -1) enum { _xyBtnImageLeftTop = 3, _xyBtnImageRightBottom = 9 }; bool m_bHover; bool m_bPressed; CToolTipCtrl m_tip; CTabViewCloseBtn() : m_bHover(false), m_bPressed(false) { } // Message map and handlers BEGIN_MSG_MAP(CTabViewCloseBtn) MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage) MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave) MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) FORWARD_NOTIFICATIONS() END_MSG_MAP() LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { MSG msg = { m_hWnd, uMsg, wParam, lParam }; if(m_tip.IsWindow() != FALSE) m_tip.RelayEvent(&msg); bHandled = FALSE; return 1; } LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { SetCapture(); m_bHover = false; m_bPressed = true; Invalidate(FALSE); UpdateWindow(); return 0; } LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { if(::GetCapture() == m_hWnd) { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; ClientToScreen(&pt); RECT rect = {}; GetWindowRect(&rect); bool bPressed = (::PtInRect(&rect, pt) != FALSE); if(m_bPressed != bPressed) { m_bPressed = bPressed; Invalidate(FALSE); UpdateWindow(); } } else { if(!m_bHover) { m_bHover = true; Invalidate(FALSE); UpdateWindow(); } TRACKMOUSEEVENT tme = { sizeof(TRACKMOUSEEVENT), TME_LEAVE, m_hWnd }; ::TrackMouseEvent(&tme); } return 0; } LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(m_bHover) { m_bHover = false; Invalidate(FALSE); UpdateWindow(); } NMHDR nmhdr = { m_hWnd, (UINT_PTR)GetDlgCtrlID(), TBVN_CLOSEBTNMOUSELEAVE }; GetParent().SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr); return 0; } LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(::GetCapture() == m_hWnd) { bool bAction = m_bPressed; ReleaseCapture(); if(bAction) GetParent().SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); } return 0; } LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(m_bPressed) { m_bPressed = false; Invalidate(FALSE); UpdateWindow(); } return 0; } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(wParam != NULL) { DoPaint((HDC)wParam); } else { CPaintDC dc(this->m_hWnd); DoPaint(dc.m_hDC); } return 0; } // painting helper void DoPaint(CDCHandle dc) { RECT rect = {}; GetClientRect(&rect); RECT rcImage = { _xyBtnImageLeftTop, _xyBtnImageLeftTop, _xyBtnImageRightBottom + 1, _xyBtnImageRightBottom + 1 }; ::OffsetRect(&rcImage, rect.left, rect.top); if(m_bPressed) ::OffsetRect(&rcImage, 1, 0); // draw button frame and background CPen penFrame; penFrame.CreatePen(PS_SOLID, 0, ::GetSysColor((m_bHover || m_bPressed) ? COLOR_BTNTEXT : COLOR_BTNSHADOW)); HPEN hPenOld = dc.SelectPen(penFrame); CBrush brush; brush.CreateSysColorBrush(m_bPressed ? COLOR_BTNSHADOW : COLOR_WINDOW); HBRUSH hBrushOld = dc.SelectBrush(brush); dc.Rectangle(&rect); // draw button "X" CPen penX; penX.CreatePen(PS_SOLID, 0, ::GetSysColor(COLOR_BTNTEXT)); dc.SelectPen(penX); dc.MoveTo(rcImage.left, rcImage.top); dc.LineTo(rcImage.right, rcImage.bottom); dc.MoveTo(rcImage.left + 1, rcImage.top); dc.LineTo(rcImage.right + 1, rcImage.bottom); dc.MoveTo(rcImage.left, rcImage.bottom - 1); dc.LineTo(rcImage.right, rcImage.top - 1); dc.MoveTo(rcImage.left + 1, rcImage.bottom - 1); dc.LineTo(rcImage.right + 1, rcImage.top - 1); dc.SelectPen(hPenOld); dc.SelectBrush(hBrushOld); } }; template class ATL_NO_VTABLE CTabViewImpl : public ATL::CWindowImpl< T, TBase, TWinTraits > { public: DECLARE_WND_CLASS_EX2(NULL, T, 0, COLOR_APPWORKSPACE) // Declarations and enums struct TABVIEWPAGE { HWND hWnd; LPTSTR lpstrTitle; LPVOID pData; }; struct TCITEMEXTRA { TCITEMHEADER tciheader; TABVIEWPAGE tvpage; operator LPTCITEM() { return (LPTCITEM)this; } }; enum { m_nTabID = 1313, m_cxMoveMark = 6, m_cyMoveMark = 3, m_nMenuItemsMax = (ID_WINDOW_TABLAST - ID_WINDOW_TABFIRST + 1) }; enum { _nAutoScrollTimerID = 4321 }; enum AutoScroll { _AUTOSCROLL_NONE = 0, _AUTOSCROLL_LEFT = -1, _AUTOSCROLL_RIGHT = 1 }; enum CloseBtn { _cxCloseBtn = 14, _cyCloseBtn = 13, _cxCloseBtnMargin = 4, _cxCloseBtnMarginSel = 1, _nCloseBtnID = ID_PANE_CLOSE }; // Data members ATL::CContainedWindowT m_tab; int m_cyTabHeight; int m_nActivePage; int m_nInsertItem; POINT m_ptStartDrag; CMenuHandle m_menu; int m_cchTabTextLength; int m_nMenuItemsCount; ATL::CWindow m_wndTitleBar; LPTSTR m_lpstrTitleBarBase; int m_cchTitleBarLength; CImageList m_ilDrag; AutoScroll m_AutoScroll; CUpDownCtrl m_ud; CTabViewCloseBtn m_btnClose; int m_nCloseItem; bool m_bDestroyPageOnRemove:1; bool m_bDestroyImageList:1; bool m_bActivePageMenuItem:1; bool m_bActiveAsDefaultMenuItem:1; bool m_bEmptyMenuItem:1; bool m_bWindowsMenuItem:1; bool m_bNoTabDrag:1; bool m_bNoTabDragAutoScroll:1; bool m_bTabCloseButton:1; // internal bool m_bTabCapture:1; bool m_bTabDrag:1; bool m_bInternalFont:1; // Constructor/destructor CTabViewImpl() : m_tab(this, 1), m_cyTabHeight(0), m_nActivePage(-1), m_nInsertItem(-1), m_cchTabTextLength(30), m_nMenuItemsCount(10), m_lpstrTitleBarBase(NULL), m_cchTitleBarLength(100), m_AutoScroll(_AUTOSCROLL_NONE), m_nCloseItem(-1), m_bDestroyPageOnRemove(true), m_bDestroyImageList(true), m_bActivePageMenuItem(true), m_bActiveAsDefaultMenuItem(false), m_bEmptyMenuItem(false), m_bWindowsMenuItem(false), m_bNoTabDrag(false), m_bNoTabDragAutoScroll(false), m_bTabCloseButton(true), m_bTabCapture(false), m_bTabDrag(false), m_bInternalFont(false) { m_ptStartDrag.x = 0; m_ptStartDrag.y = 0; } ~CTabViewImpl() { delete [] m_lpstrTitleBarBase; } // Message filter function - to be called from PreTranslateMessage of the main window BOOL PreTranslateMessage(MSG* pMsg) { if(this->IsWindow() == FALSE) return FALSE; BOOL bRet = FALSE; // Check for TabView built-in accelerators (Ctrl+Tab/Ctrl+Shift+Tab - next/previous page) int nCount = GetPageCount(); if(nCount > 0) { bool bControl = (::GetKeyState(VK_CONTROL) < 0); if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_TAB) && bControl) { if(nCount > 1) { int nPage = m_nActivePage; bool bShift = (::GetKeyState(VK_SHIFT) < 0); if(bShift) nPage = (nPage > 0) ? (nPage - 1) : (nCount - 1); else nPage = ((nPage >= 0) && (nPage < (nCount - 1))) ? (nPage + 1) : 0; SetActivePage(nPage); T* pT = static_cast(this); pT->OnPageActivated(m_nActivePage); } bRet = TRUE; } } // If we are doing drag-drop, check for Escape key that cancels it if(bRet == FALSE) { if(m_bTabCapture && (pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_ESCAPE)) { ::ReleaseCapture(); bRet = TRUE; } } // Pass the message to the active page if(bRet == FALSE) { if(m_nActivePage != -1) bRet = (BOOL)::SendMessage(GetPageHWND(m_nActivePage), WM_FORWARDMSG, 0, (LPARAM)pMsg); } return bRet; } // Attributes int GetPageCount() const { ATLASSERT(::IsWindow(this->m_hWnd)); return m_tab.GetItemCount(); } int GetActivePage() const { return m_nActivePage; } void SetActivePage(int nPage) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); T* pT = static_cast(this); this->SetRedraw(FALSE); if(m_nActivePage != -1) ::ShowWindow(GetPageHWND(m_nActivePage), SW_HIDE); m_nActivePage = nPage; m_tab.SetCurSel(m_nActivePage); ::ShowWindow(GetPageHWND(m_nActivePage), SW_SHOW); pT->UpdateLayout(); this->SetRedraw(TRUE); this->RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); HWND hWndFocus = ::GetFocus(); ATL::CWindow wndTop = this->GetTopLevelWindow(); if((hWndFocus == wndTop.m_hWnd) || ((wndTop.IsChild(hWndFocus) != FALSE) && (hWndFocus != m_tab.m_hWnd))) ::SetFocus(GetPageHWND(m_nActivePage)); pT->UpdateTitleBar(); pT->UpdateMenu(); } HIMAGELIST GetImageList() const { ATLASSERT(::IsWindow(this->m_hWnd)); return m_tab.GetImageList(); } HIMAGELIST SetImageList(HIMAGELIST hImageList) { ATLASSERT(::IsWindow(this->m_hWnd)); return m_tab.SetImageList(hImageList); } void SetWindowMenu(HMENU hMenu) { ATLASSERT(::IsWindow(this->m_hWnd)); m_menu = hMenu; T* pT = static_cast(this); pT->UpdateMenu(); } void SetTitleBarWindow(HWND hWnd) { ATLASSERT(::IsWindow(this->m_hWnd)); delete [] m_lpstrTitleBarBase; m_lpstrTitleBarBase = NULL; m_wndTitleBar = hWnd; if(hWnd == NULL) return; int cchLen = m_wndTitleBar.GetWindowTextLength() + 1; ATLTRY(m_lpstrTitleBarBase = new TCHAR[cchLen]); if(m_lpstrTitleBarBase != NULL) { m_wndTitleBar.GetWindowText(m_lpstrTitleBarBase, cchLen); T* pT = static_cast(this); pT->UpdateTitleBar(); } } // Page attributes HWND GetPageHWND(int nPage) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_PARAM; m_tab.GetItem(nPage, tcix); return tcix.tvpage.hWnd; } LPCTSTR GetPageTitle(int nPage) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_PARAM; if(m_tab.GetItem(nPage, tcix) == FALSE) return NULL; return tcix.tvpage.lpstrTitle; } bool SetPageTitle(int nPage, LPCTSTR lpstrTitle) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); T* pT = static_cast(this); int cchBuff = lstrlen(lpstrTitle) + 1; LPTSTR lpstrBuff = NULL; ATLTRY(lpstrBuff = new TCHAR[cchBuff]); if(lpstrBuff == NULL) return false; ATL::Checked::tcscpy_s(lpstrBuff, cchBuff, lpstrTitle); TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_PARAM; if(m_tab.GetItem(nPage, tcix) == FALSE) return false; ATL::CTempBuffer buff; LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); if(lpstrTabText == NULL) return false; delete [] tcix.tvpage.lpstrTitle; pT->ShortenTitle(lpstrTitle, lpstrTabText, m_cchTabTextLength + 1); tcix.tciheader.mask = TCIF_TEXT | TCIF_PARAM; tcix.tciheader.pszText = lpstrTabText; tcix.tvpage.lpstrTitle = lpstrBuff; if(m_tab.SetItem(nPage, tcix) == FALSE) return false; pT->UpdateTitleBar(); pT->UpdateMenu(); return true; } LPVOID GetPageData(int nPage) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_PARAM; m_tab.GetItem(nPage, tcix); return tcix.tvpage.pData; } LPVOID SetPageData(int nPage, LPVOID pData) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_PARAM; m_tab.GetItem(nPage, tcix); LPVOID pDataOld = tcix.tvpage.pData; tcix.tvpage.pData = pData; m_tab.SetItem(nPage, tcix); return pDataOld; } int GetPageImage(int nPage) const { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_IMAGE; m_tab.GetItem(nPage, tcix); return tcix.tciheader.iImage; } int SetPageImage(int nPage, int nImage) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_IMAGE; m_tab.GetItem(nPage, tcix); int nImageOld = tcix.tciheader.iImage; tcix.tciheader.iImage = nImage; m_tab.SetItem(nPage, tcix); return nImageOld; } // Operations bool AddPage(HWND hWndView, LPCTSTR lpstrTitle, int nImage = -1, LPVOID pData = NULL) { return InsertPage(GetPageCount(), hWndView, lpstrTitle, nImage, pData); } bool InsertPage(int nPage, HWND hWndView, LPCTSTR lpstrTitle, int nImage = -1, LPVOID pData = NULL) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT((nPage == GetPageCount()) || IsValidPageIndex(nPage)); T* pT = static_cast(this); int cchBuff = lstrlen(lpstrTitle) + 1; LPTSTR lpstrBuff = NULL; ATLTRY(lpstrBuff = new TCHAR[cchBuff]); if(lpstrBuff == NULL) return false; ATL::Checked::tcscpy_s(lpstrBuff, cchBuff, lpstrTitle); ATL::CTempBuffer buff; LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); if(lpstrTabText == NULL) return false; pT->ShortenTitle(lpstrTitle, lpstrTabText, m_cchTabTextLength + 1); this->SetRedraw(FALSE); TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; tcix.tciheader.pszText = lpstrTabText; tcix.tciheader.iImage = nImage; tcix.tvpage.hWnd = hWndView; tcix.tvpage.lpstrTitle = lpstrBuff; tcix.tvpage.pData = pData; int nItem = m_tab.InsertItem(nPage, tcix); if(nItem == -1) { delete [] lpstrBuff; this->SetRedraw(TRUE); return false; } // adjust active page index, if inserted before it if(nPage <= m_nActivePage) m_nActivePage++; SetActivePage(nItem); pT->OnPageActivated(m_nActivePage); if(GetPageCount() == 1) pT->ShowTabControl(true); pT->UpdateLayout(); this->SetRedraw(TRUE); this->RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); return true; } void RemovePage(int nPage) { ATLASSERT(::IsWindow(this->m_hWnd)); ATLASSERT(IsValidPageIndex(nPage)); T* pT = static_cast(this); this->SetRedraw(FALSE); if(GetPageCount() == 1) pT->ShowTabControl(false); if(m_bDestroyPageOnRemove) ::DestroyWindow(GetPageHWND(nPage)); else ::ShowWindow(GetPageHWND(nPage), SW_HIDE); LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(nPage); delete [] lpstrTitle; ATLVERIFY(m_tab.DeleteItem(nPage) != FALSE); if(m_nActivePage == nPage) { m_nActivePage = -1; if(nPage > 0) { SetActivePage(nPage - 1); } else if(GetPageCount() > 0) { SetActivePage(nPage); } else { this->SetRedraw(TRUE); this->Invalidate(); this->UpdateWindow(); pT->UpdateTitleBar(); pT->UpdateMenu(); } } else { nPage = (nPage < m_nActivePage) ? (m_nActivePage - 1) : m_nActivePage; m_nActivePage = -1; SetActivePage(nPage); } pT->OnPageActivated(m_nActivePage); } void RemoveAllPages() { ATLASSERT(::IsWindow(this->m_hWnd)); if(GetPageCount() == 0) return; T* pT = static_cast(this); this->SetRedraw(FALSE); pT->ShowTabControl(false); for(int i = 0; i < GetPageCount(); i++) { if(m_bDestroyPageOnRemove) ::DestroyWindow(GetPageHWND(i)); else ::ShowWindow(GetPageHWND(i), SW_HIDE); LPTSTR lpstrTitle = (LPTSTR)GetPageTitle(i); delete [] lpstrTitle; } m_tab.DeleteAllItems(); m_nActivePage = -1; pT->OnPageActivated(m_nActivePage); this->SetRedraw(TRUE); this->Invalidate(); this->UpdateWindow(); pT->UpdateTitleBar(); pT->UpdateMenu(); } int PageIndexFromHwnd(HWND hWnd) const { int nIndex = -1; for(int i = 0; i < GetPageCount(); i++) { if(GetPageHWND(i) == hWnd) { nIndex = i; break; } } return nIndex; } void BuildWindowMenu(HMENU hMenu, int nMenuItemsCount = 10, bool bEmptyMenuItem = true, bool bWindowsMenuItem = true, bool bActivePageMenuItem = true, bool bActiveAsDefaultMenuItem = false) { ATLASSERT(::IsWindow(this->m_hWnd)); CMenuHandle menu = hMenu; T* pT = static_cast(this); (void)pT; // avoid level 4 warning int nFirstPos = 0; // Find first menu item in our range for(nFirstPos = 0; nFirstPos < menu.GetMenuItemCount(); nFirstPos++) { UINT nID = menu.GetMenuItemID(nFirstPos); if(((nID >= ID_WINDOW_TABFIRST) && (nID <= ID_WINDOW_TABLAST)) || (nID == ID_WINDOW_SHOWTABLIST)) break; } // Remove all menu items for tab pages BOOL bRet = TRUE; while(bRet != FALSE) bRet = menu.DeleteMenu(nFirstPos, MF_BYPOSITION); // Add separator if it's not already there int nPageCount = GetPageCount(); if((bWindowsMenuItem || (nPageCount > 0)) && (nFirstPos > 0)) { CMenuItemInfo mii; mii.fMask = MIIM_TYPE; menu.GetMenuItemInfo(nFirstPos - 1, TRUE, &mii); if((mii.fType & MFT_SEPARATOR) == 0) { menu.AppendMenu(MF_SEPARATOR); nFirstPos++; } } // Add menu items for all pages if(nPageCount > 0) { // Append menu items for all pages const int cchPrefix = 3; // 2 digits + space nMenuItemsCount = __min(__min(nPageCount, nMenuItemsCount), (int)m_nMenuItemsMax); ATLASSERT(nMenuItemsCount < 100); // 2 digits only if(nMenuItemsCount >= 100) nMenuItemsCount = 99; for(int i = 0; i < nMenuItemsCount; i++) { LPCTSTR lpstrTitle = GetPageTitle(i); int nLen = lstrlen(lpstrTitle); ATL::CTempBuffer buff; LPTSTR lpstrText = buff.Allocate(cchPrefix + nLen + 1); ATLASSERT(lpstrText != NULL); if(lpstrText != NULL) { LPCTSTR lpstrFormat = (i < 9) ? _T("&%i %s") : _T("%i %s"); _stprintf_s(lpstrText, cchPrefix + nLen + 1, lpstrFormat, i + 1, lpstrTitle); menu.AppendMenu(MF_STRING, ID_WINDOW_TABFIRST + i, lpstrText); } } // Mark active page if(bActivePageMenuItem && (m_nActivePage != -1)) { if(bActiveAsDefaultMenuItem) { menu.SetMenuDefaultItem((UINT)-1, TRUE); menu.SetMenuDefaultItem(nFirstPos + m_nActivePage, TRUE); } else { menu.CheckMenuRadioItem(nFirstPos, nFirstPos + nMenuItemsCount, nFirstPos + m_nActivePage, MF_BYPOSITION); } } } else { if(bEmptyMenuItem) { menu.AppendMenu(MF_BYPOSITION | MF_STRING, ID_WINDOW_TABFIRST, pT->GetEmptyListText()); menu.EnableMenuItem(ID_WINDOW_TABFIRST, MF_GRAYED); } // Remove separator if nothing else is there if(!bEmptyMenuItem && !bWindowsMenuItem && (nFirstPos > 0)) { CMenuItemInfo mii; mii.fMask = MIIM_TYPE; menu.GetMenuItemInfo(nFirstPos - 1, TRUE, &mii); if((mii.fType & MFT_SEPARATOR) != 0) menu.DeleteMenu(nFirstPos - 1, MF_BYPOSITION); } } // Add "Windows..." menu item if(bWindowsMenuItem) menu.AppendMenu(MF_BYPOSITION | MF_STRING, ID_WINDOW_SHOWTABLIST, pT->GetWindowsMenuItemText()); } BOOL SubclassWindow(HWND hWnd) { BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); if(bRet != FALSE) { T* pT = static_cast(this); pT->CreateTabControl(); pT->UpdateLayout(); } return bRet; } // Message map and handlers BEGIN_MSG_MAP(CTabViewImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_GETFONT, OnGetFont) MESSAGE_HANDLER(WM_SETFONT, OnSetFont) MESSAGE_HANDLER(WM_TIMER, OnTimer) MESSAGE_HANDLER(WM_CONTEXTMENU, OnTabContextMenu) NOTIFY_HANDLER(m_nTabID, TCN_SELCHANGE, OnTabChanged) NOTIFY_ID_HANDLER(m_nTabID, OnTabNotification) NOTIFY_CODE_HANDLER(TTN_GETDISPINFO, OnTabGetDispInfo) FORWARD_NOTIFICATIONS() ALT_MSG_MAP(1) // tab control MESSAGE_HANDLER(WM_LBUTTONDOWN, OnTabLButtonDown) MESSAGE_HANDLER(WM_LBUTTONUP, OnTabLButtonUp) MESSAGE_HANDLER(WM_CAPTURECHANGED, OnTabCaptureChanged) MESSAGE_HANDLER(WM_MOUSEMOVE, OnTabMouseMove) MESSAGE_HANDLER(WM_MOUSELEAVE, OnTabMouseLeave) NOTIFY_HANDLER(T::_nCloseBtnID, TBVN_CLOSEBTNMOUSELEAVE, OnTabCloseBtnMouseLeave) COMMAND_HANDLER(T::_nCloseBtnID, BN_CLICKED, OnTabCloseBtnClicked) END_MSG_MAP() LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->CreateTabControl(); return 0; } LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { RemoveAllPages(); if(m_bDestroyImageList) { CImageList il = m_tab.SetImageList(NULL); if(il.m_hImageList != NULL) il.Destroy(); } if(m_bInternalFont) { HFONT hFont = m_tab.GetFont(); m_tab.SetFont(NULL, FALSE); ::DeleteObject(hFont); m_bInternalFont = false; } m_ud.m_hWnd = NULL; return 0; } LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->UpdateLayout(); return 0; } LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(m_nActivePage != -1) ::SetFocus(GetPageHWND(m_nActivePage)); return 0; } LRESULT OnGetFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return m_tab.SendMessage(WM_GETFONT); } LRESULT OnSetFont(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { if(m_bInternalFont) { HFONT hFont = m_tab.GetFont(); m_tab.SetFont(NULL, FALSE); ::DeleteObject(hFont); m_bInternalFont = false; } m_tab.SendMessage(WM_SETFONT, wParam, lParam); T* pT = static_cast(this); m_cyTabHeight = pT->CalcTabHeight(); if((BOOL)lParam != FALSE) pT->UpdateLayout(); return 0; } LRESULT OnTimer(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(wParam == _nAutoScrollTimerID) { T* pT = static_cast(this); pT->DoAutoScroll(); } else { bHandled = FALSE; } return 0; } LRESULT OnTabContextMenu(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; int nPage = m_nActivePage; bool bAction = false; if((HWND)wParam == m_tab.m_hWnd) { if((pt.x == -1) && (pt.y == -1)) // keyboard { RECT rect = {}; m_tab.GetItemRect(m_nActivePage, &rect); pt.x = rect.left; pt.y = rect.bottom; m_tab.ClientToScreen(&pt); bAction = true; } else if(::WindowFromPoint(pt) == m_tab.m_hWnd) { TCHITTESTINFO hti = {}; hti.pt = pt; this->ScreenToClient(&hti.pt); nPage = m_tab.HitTest(&hti); bAction = true; } } if(bAction) { T* pT = static_cast(this); pT->OnContextMenu(nPage, pt); } else { bHandled = FALSE; } return 0; } LRESULT OnTabChanged(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) { if(m_bTabCloseButton && (m_btnClose.m_hWnd != NULL)) { T* pT = static_cast(this); RECT rcClose = {}; pT->CalcCloseButtonRect(m_nCloseItem, rcClose); m_btnClose.SetWindowPos(NULL, &rcClose, SWP_NOZORDER | SWP_NOACTIVATE); } SetActivePage(m_tab.GetCurSel()); T* pT = static_cast(this); pT->OnPageActivated(m_nActivePage); return 0; } LRESULT OnTabNotification(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) { // nothing to do - this just blocks all tab control // notifications from being propagated further return 0; } LRESULT OnTabGetDispInfo(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { LPNMTTDISPINFO pTTDI = (LPNMTTDISPINFO)pnmh; if(pTTDI->hdr.hwndFrom == m_tab.GetTooltips()) { T* pT = static_cast(this); pT->UpdateTooltipText(pTTDI); } else { bHandled = FALSE; } return 0; } // Tab control message handlers LRESULT OnTabLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(!m_bNoTabDrag && (m_tab.GetItemCount() > 1)) { m_bTabCapture = true; m_tab.SetCapture(); m_ptStartDrag.x = GET_X_LPARAM(lParam); m_ptStartDrag.y = GET_Y_LPARAM(lParam); } bHandled = FALSE; return 0; } LRESULT OnTabLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(m_bTabCapture) { if(m_bTabDrag) { T* pT = static_cast(this); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; int nItem = pT->DragHitTest(pt); if(nItem != -1) MovePage(m_nActivePage, nItem); } ::ReleaseCapture(); } bHandled = FALSE; return 0; } LRESULT OnTabCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_bTabCapture) { m_bTabCapture = false; if(m_bTabDrag) { m_bTabDrag = false; T* pT = static_cast(this); if(!m_bNoTabDragAutoScroll) pT->StartStopAutoScroll(-1); pT->DrawMoveMark(-1); m_ilDrag.DragLeave(GetDesktopWindow()); m_ilDrag.EndDrag(); m_ilDrag.Destroy(); m_ilDrag.m_hImageList = NULL; } } bHandled = FALSE; return 0; } LRESULT OnTabMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; if(m_bTabCapture) { POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if(!m_bTabDrag) { if((abs(m_ptStartDrag.x - GET_X_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CXDRAG)) || (abs(m_ptStartDrag.y - GET_Y_LPARAM(lParam)) >= ::GetSystemMetrics(SM_CYDRAG))) { T* pT = static_cast(this); pT->GenerateDragImage(m_nActivePage); int cxCursor = ::GetSystemMetrics(SM_CXCURSOR); int cyCursor = ::GetSystemMetrics(SM_CYCURSOR); m_ilDrag.BeginDrag(0, -(cxCursor / 2), -(cyCursor / 2)); POINT ptEnter = m_ptStartDrag; m_tab.ClientToScreen(&ptEnter); m_ilDrag.DragEnter(GetDesktopWindow(), ptEnter); m_bTabDrag = true; } } if(m_bTabDrag) { T* pT = static_cast(this); int nItem = pT->DragHitTest(pt); pT->SetMoveCursor(nItem != -1); if(m_nInsertItem != nItem) pT->DrawMoveMark(nItem); if(!m_bNoTabDragAutoScroll) pT->StartStopAutoScroll(pt.x); m_ilDrag.DragShowNolock((nItem != -1) ? TRUE : FALSE); m_tab.ClientToScreen(&pt); m_ilDrag.DragMove(pt); bHandled = TRUE; } } else if(m_bTabCloseButton) { TCHITTESTINFO thti = {}; thti.pt.x = GET_X_LPARAM(lParam); thti.pt.y = GET_Y_LPARAM(lParam); int nItem = m_tab.HitTest(&thti); if(nItem >= 0) { ATLTRACE(_T("+++++ item = %i\n"), nItem); T* pT = static_cast(this); if(m_btnClose.m_hWnd == NULL) { pT->CreateCloseButton(nItem); m_nCloseItem = nItem; } else if(m_nCloseItem != nItem) { RECT rcClose = {}; pT->CalcCloseButtonRect(nItem, rcClose); m_btnClose.SetWindowPos(NULL, &rcClose, SWP_NOZORDER | SWP_NOACTIVATE); m_nCloseItem = nItem; } TRACKMOUSEEVENT tme = { sizeof(TRACKMOUSEEVENT), TME_LEAVE, m_tab.m_hWnd }; ::TrackMouseEvent(&tme); } } return 0; } LRESULT OnTabMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { bHandled = FALSE; if(m_btnClose.m_hWnd != NULL) { POINT pt = {}; ::GetCursorPos(&pt); RECT rect = {}; m_btnClose.GetWindowRect(&rect); if(::PtInRect(&rect, pt) == FALSE) { m_nCloseItem = -1; T* pT = static_cast(this); pT->DestroyCloseButton(); } else { bHandled = TRUE; } } return 0; } LRESULT OnTabCloseBtnMouseLeave(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) { TCHITTESTINFO thti = {}; ::GetCursorPos(&thti.pt); m_tab.ScreenToClient(&thti.pt); int nItem = m_tab.HitTest(&thti); if(nItem == -1) m_tab.SendMessage(WM_MOUSELEAVE); return 0; } LRESULT OnTabCloseBtnClicked(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->OnTabCloseBtn(m_nCloseItem); return 0; } // Implementation helpers bool IsValidPageIndex(int nPage) const { return ((nPage >= 0) && (nPage < GetPageCount())); } bool MovePage(int nMovePage, int nInsertBeforePage) { ATLASSERT(IsValidPageIndex(nMovePage)); ATLASSERT(IsValidPageIndex(nInsertBeforePage)); if(!IsValidPageIndex(nMovePage) || !IsValidPageIndex(nInsertBeforePage)) return false; if(nMovePage == nInsertBeforePage) return true; // nothing to do ATL::CTempBuffer buff; LPTSTR lpstrTabText = buff.Allocate(m_cchTabTextLength + 1); if(lpstrTabText == NULL) return false; TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; tcix.tciheader.pszText = lpstrTabText; tcix.tciheader.cchTextMax = m_cchTabTextLength + 1; BOOL bRet = m_tab.GetItem(nMovePage, tcix); ATLASSERT(bRet != FALSE); if(bRet == FALSE) return false; int nInsertItem = (nInsertBeforePage > nMovePage) ? nInsertBeforePage + 1 : nInsertBeforePage; int nNewItem = m_tab.InsertItem(nInsertItem, tcix); ATLASSERT(nNewItem == nInsertItem); if(nNewItem != nInsertItem) { ATLVERIFY(m_tab.DeleteItem(nNewItem)); return false; } if(nMovePage > nInsertBeforePage) ATLVERIFY(m_tab.DeleteItem(nMovePage + 1) != FALSE); else if(nMovePage < nInsertBeforePage) ATLVERIFY(m_tab.DeleteItem(nMovePage) != FALSE); SetActivePage(nInsertBeforePage); T* pT = static_cast(this); pT->OnPageActivated(m_nActivePage); return true; } // Implementation overrideables bool CreateTabControl() { m_tab.Create(this->m_hWnd, this->rcDefault, NULL, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_TOOLTIPS, 0, m_nTabID); ATLASSERT(m_tab.m_hWnd != NULL); if(m_tab.m_hWnd == NULL) return false; m_tab.SetFont(AtlCreateControlFont()); m_bInternalFont = true; m_tab.SetItemExtra(sizeof(TABVIEWPAGE)); T* pT = static_cast(this); m_cyTabHeight = pT->CalcTabHeight(); return true; } int CalcTabHeight() { int nCount = m_tab.GetItemCount(); TCHAR szText[] = _T("NS"); TCITEMEXTRA tcix = {}; tcix.tciheader.mask = TCIF_TEXT; tcix.tciheader.pszText = szText; int nIndex = m_tab.InsertItem(nCount, tcix); RECT rect = { 0, 0, 1000, 1000 }; m_tab.AdjustRect(FALSE, &rect); RECT rcWnd = { 0, 0, 1000, rect.top }; ::AdjustWindowRectEx(&rcWnd, m_tab.GetStyle(), FALSE, m_tab.GetExStyle()); int nHeight = rcWnd.bottom - rcWnd.top; m_tab.DeleteItem(nIndex); return nHeight; } void ShowTabControl(bool bShow) { m_tab.ShowWindow(bShow ? SW_SHOWNOACTIVATE : SW_HIDE); T* pT = static_cast(this); pT->UpdateLayout(); } void UpdateLayout() { RECT rect = {}; this->GetClientRect(&rect); int cyOffset = 0; if(m_tab.IsWindow() && ((m_tab.GetStyle() & WS_VISIBLE) != 0)) { m_tab.SetWindowPos(NULL, 0, 0, rect.right - rect.left, m_cyTabHeight, SWP_NOZORDER); cyOffset = m_cyTabHeight; } if(m_nActivePage != -1) ::SetWindowPos(GetPageHWND(m_nActivePage), NULL, 0, cyOffset, rect.right - rect.left, rect.bottom - rect.top - cyOffset, SWP_NOZORDER); } void UpdateMenu() { if(m_menu.m_hMenu != NULL) BuildWindowMenu(m_menu, m_nMenuItemsCount, m_bEmptyMenuItem, m_bWindowsMenuItem, m_bActivePageMenuItem, m_bActiveAsDefaultMenuItem); } void UpdateTitleBar() { if(!m_wndTitleBar.IsWindow() || (m_lpstrTitleBarBase == NULL)) return; // nothing to do if(m_nActivePage != -1) { T* pT = static_cast(this); LPCTSTR lpstrTitle = pT->GetPageTitle(m_nActivePage); LPCTSTR lpstrDivider = pT->GetTitleDividerText(); int cchBuffer = m_cchTitleBarLength + lstrlen(lpstrDivider) + lstrlen(m_lpstrTitleBarBase) + 1; ATL::CTempBuffer buff; LPTSTR lpstrPageTitle = buff.Allocate(cchBuffer); ATLASSERT(lpstrPageTitle != NULL); if(lpstrPageTitle != NULL) { pT->ShortenTitle(lpstrTitle, lpstrPageTitle, m_cchTitleBarLength + 1); ATL::Checked::tcscat_s(lpstrPageTitle, cchBuffer, lpstrDivider); ATL::Checked::tcscat_s(lpstrPageTitle, cchBuffer, m_lpstrTitleBarBase); } else { lpstrPageTitle = m_lpstrTitleBarBase; } m_wndTitleBar.SetWindowText(lpstrPageTitle); } else { m_wndTitleBar.SetWindowText(m_lpstrTitleBarBase); } } void DrawMoveMark(int nItem) { T* pT = static_cast(this); if(m_nInsertItem != -1) { RECT rect = {}; pT->GetMoveMarkRect(rect); m_tab.InvalidateRect(&rect); } m_nInsertItem = nItem; if(m_nInsertItem != -1) { CClientDC dc(m_tab.m_hWnd); RECT rect = {}; pT->GetMoveMarkRect(rect); CPen pen; pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_WINDOWTEXT)); CBrush brush; brush.CreateSolidBrush(::GetSysColor(COLOR_WINDOWTEXT)); HPEN hPenOld = dc.SelectPen(pen); HBRUSH hBrushOld = dc.SelectBrush(brush); int x = rect.left; int y = rect.top; POINT ptsTop[3] = { { x, y }, { x + m_cxMoveMark, y }, { x + (m_cxMoveMark / 2), y + m_cyMoveMark } }; dc.Polygon(ptsTop, 3); y = rect.bottom - 1; POINT ptsBottom[3] = { { x, y }, { x + m_cxMoveMark, y }, { x + (m_cxMoveMark / 2), y - m_cyMoveMark } }; dc.Polygon(ptsBottom, 3); dc.SelectPen(hPenOld); dc.SelectBrush(hBrushOld); } } void GetMoveMarkRect(RECT& rect) const { m_tab.GetClientRect(&rect); RECT rcItem = {}; m_tab.GetItemRect(m_nInsertItem, &rcItem); if(m_nInsertItem <= m_nActivePage) { rect.left = rcItem.left - m_cxMoveMark / 2 - 1; rect.right = rcItem.left + m_cxMoveMark / 2; } else { rect.left = rcItem.right - m_cxMoveMark / 2 - 1; rect.right = rcItem.right + m_cxMoveMark / 2; } } void SetMoveCursor(bool bCanMove) { ::SetCursor(::LoadCursor(NULL, bCanMove ? IDC_ARROW : IDC_NO)); } void GenerateDragImage(int nItem) { ATLASSERT(IsValidPageIndex(nItem)); RECT rcItem = {}; m_tab.GetItemRect(nItem, &rcItem); ::InflateRect(&rcItem, 2, 2); // make bigger to cover selected item ATLASSERT(m_ilDrag.m_hImageList == NULL); m_ilDrag.Create(rcItem.right - rcItem.left, rcItem.bottom - rcItem.top, ILC_COLORDDB | ILC_MASK, 1, 1); CClientDC dc(this->m_hWnd); CDC dcMem; dcMem.CreateCompatibleDC(dc); ATLASSERT(dcMem.m_hDC != NULL); dcMem.SetViewportOrg(-rcItem.left, -rcItem.top); CBitmap bmp; bmp.CreateCompatibleBitmap(dc, rcItem.right - rcItem.left, rcItem.bottom - rcItem.top); ATLASSERT(bmp.m_hBitmap != NULL); HBITMAP hBmpOld = dcMem.SelectBitmap(bmp); m_tab.SendMessage(WM_PRINTCLIENT, (WPARAM)dcMem.m_hDC); dcMem.SelectBitmap(hBmpOld); ATLVERIFY(m_ilDrag.Add(bmp.m_hBitmap, RGB(255, 0, 255)) != -1); } void ShortenTitle(LPCTSTR lpstrTitle, LPTSTR lpstrShortTitle, int cchShortTitle) { if(lstrlen(lpstrTitle) >= cchShortTitle) { LPCTSTR lpstrEllipsis = _T("..."); int cchEllipsis = lstrlen(lpstrEllipsis); ATL::Checked::tcsncpy_s(lpstrShortTitle, cchShortTitle, lpstrTitle, cchShortTitle - cchEllipsis - 1); ATL::Checked::tcscat_s(lpstrShortTitle, cchShortTitle, lpstrEllipsis); } else { ATL::Checked::tcscpy_s(lpstrShortTitle, cchShortTitle, lpstrTitle); } } void UpdateTooltipText(LPNMTTDISPINFO pTTDI) { ATLASSERT(pTTDI != NULL); pTTDI->lpszText = (LPTSTR)GetPageTitle((int)pTTDI->hdr.idFrom); } int DragHitTest(POINT pt) const { RECT rect = {}; this->GetClientRect(&rect); if(::PtInRect(&rect, pt) == FALSE) return -1; m_tab.GetClientRect(&rect); TCHITTESTINFO hti = {}; hti.pt.x = pt.x; hti.pt.y = rect.bottom / 2; // use middle to ignore int nItem = m_tab.HitTest(&hti); if(nItem == -1) { int nLast = m_tab.GetItemCount() - 1; RECT rcItem = {}; m_tab.GetItemRect(nLast, &rcItem); if(pt.x >= rcItem.right) nItem = nLast; } return nItem; } void StartStopAutoScroll(int x) { AutoScroll scroll = _AUTOSCROLL_NONE; if(x != -1) { RECT rect = {}; m_tab.GetClientRect(&rect); int dx = ::GetSystemMetrics(SM_CXVSCROLL); if((x >= 0) && (x < dx)) { RECT rcItem = {}; m_tab.GetItemRect(0, &rcItem); if(rcItem.left < rect.left) scroll = _AUTOSCROLL_LEFT; } else if((x >= (rect.right - dx)) && (x < rect.right)) { RECT rcItem = {}; m_tab.GetItemRect(m_tab.GetItemCount() - 1, &rcItem); if(rcItem.right > rect.right) scroll = _AUTOSCROLL_RIGHT; } } if(scroll != _AUTOSCROLL_NONE) { if(m_ud.m_hWnd == NULL) m_ud = m_tab.GetWindow(GW_CHILD); if(m_AutoScroll != scroll) { m_AutoScroll = scroll; this->SetTimer(_nAutoScrollTimerID, 300); } } else { this->KillTimer(_nAutoScrollTimerID); m_AutoScroll = _AUTOSCROLL_NONE; } } void DoAutoScroll() { ATLASSERT(m_AutoScroll != _AUTOSCROLL_NONE); int nMin = -1, nMax = -1; m_ud.GetRange(nMin, nMax); int nPos = m_ud.GetPos(); int nNewPos = -1; if((m_AutoScroll == _AUTOSCROLL_LEFT) && (nPos > nMin)) nNewPos = nPos - 1; else if((m_AutoScroll == _AUTOSCROLL_RIGHT) && (nPos < nMax)) nNewPos = nPos + 1; if(nNewPos != -1) { m_tab.SendMessage(WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, nNewPos)); m_tab.SendMessage(WM_HSCROLL, MAKEWPARAM(SB_ENDSCROLL, 0)); POINT pt = {}; ::GetCursorPos(&pt); m_tab.ScreenToClient(&pt); m_tab.SendMessage(WM_MOUSEMOVE, NULL, MAKELPARAM(pt.x, pt.y)); } } // Text for menu items and title bar - override to provide different strings static LPCTSTR GetEmptyListText() { return _T("(Empty)"); } static LPCTSTR GetWindowsMenuItemText() { return _T("&Windows..."); } static LPCTSTR GetTitleDividerText() { return _T(" - "); } // Notifications - override to provide different behavior void OnPageActivated(int nPage) { NMHDR nmhdr = {}; nmhdr.hwndFrom = this->m_hWnd; nmhdr.idFrom = nPage; nmhdr.code = TBVN_PAGEACTIVATED; this->GetParent().SendMessage(WM_NOTIFY, this->GetDlgCtrlID(), (LPARAM)&nmhdr); } void OnContextMenu(int nPage, POINT pt) { TBVCONTEXTMENUINFO cmi = {}; cmi.hdr.hwndFrom = this->m_hWnd; cmi.hdr.idFrom = nPage; cmi.hdr.code = TBVN_CONTEXTMENU; cmi.pt = pt; this->GetParent().SendMessage(WM_NOTIFY, this->GetDlgCtrlID(), (LPARAM)&cmi); } void OnTabCloseBtn(int nPage) { NMHDR nmhdr = {}; nmhdr.hwndFrom = this->m_hWnd; nmhdr.idFrom = nPage; nmhdr.code = TBVN_TABCLOSEBTN; LRESULT lRet = this->GetParent().SendMessage(WM_NOTIFY, this->GetDlgCtrlID(), (LPARAM)&nmhdr); if(lRet == 0) // default - close page { T* pT = static_cast(this); pT->RemovePage(m_nCloseItem); m_nCloseItem = -1; pT->DestroyCloseButton(); } else { m_tab.SendMessage(WM_MOUSELEAVE); } } // Close button overrideables void CreateCloseButton(int nItem) { ATLASSERT(m_btnClose.m_hWnd == NULL); m_btnClose.m_bPressed = false; T* pT = static_cast(this); RECT rcClose = {}; pT->CalcCloseButtonRect(nItem, rcClose); m_btnClose.Create(m_tab.m_hWnd, rcClose, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, T::_nCloseBtnID); ATLASSERT(m_btnClose.IsWindow()); if(m_btnClose.m_hWnd != NULL) { // create a tool tip ATLASSERT(m_btnClose.m_tip.m_hWnd == NULL); m_btnClose.m_tip.Create(m_btnClose.m_hWnd); ATLASSERT(m_btnClose.m_tip.IsWindow()); if(m_btnClose.m_tip.IsWindow()) { m_btnClose.m_tip.Activate(TRUE); RECT rect = {}; m_btnClose.GetClientRect(&rect); m_btnClose.m_tip.AddTool(m_btnClose.m_hWnd, LPSTR_TEXTCALLBACK, &rect, T::_nCloseBtnID); } } } void DestroyCloseButton() { ATLASSERT(m_btnClose.m_hWnd != NULL); if(m_btnClose.m_hWnd != NULL) { if(m_btnClose.m_tip.IsWindow()) { m_btnClose.m_tip.DestroyWindow(); m_btnClose.m_tip.m_hWnd = NULL; } m_btnClose.DestroyWindow(); } } void CalcCloseButtonRect(int nItem, RECT& rcClose) { RECT rcItem = {}; m_tab.GetItemRect(nItem, &rcItem); int cy = (rcItem.bottom - rcItem.top - _cyCloseBtn) / 2; int cx = (nItem == m_tab.GetCurSel()) ? _cxCloseBtnMarginSel : _cxCloseBtnMargin; ::SetRect(&rcClose, rcItem.right - cx - _cxCloseBtn, rcItem.top + cy, rcItem.right - cx, rcItem.top + cy + _cyCloseBtn); } }; class CTabView : public CTabViewImpl { public: DECLARE_WND_CLASS_EX(_T("WTL_TabView"), 0, COLOR_APPWORKSPACE) }; } // namespace WTL #endif // __ATLCTRLX_H__ ================================================ FILE: third_party/WTL/Include/atlddx.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLDDX_H__ #define __ATLDDX_H__ #pragma once #ifndef __ATLAPP_H__ #error atlddx.h requires atlapp.h to be included first #endif #include /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CWinDataExchange namespace WTL { // Constants #define DDX_LOAD FALSE #define DDX_SAVE TRUE // DDX map macros #define BEGIN_DDX_MAP(thisClass) \ BOOL DoDataExchange(BOOL bSaveAndValidate = FALSE, UINT nCtlID = (UINT)-1) \ { \ (bSaveAndValidate); \ (nCtlID); #define DDX_TEXT(nID, var) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate)) \ return FALSE; \ } #define DDX_TEXT_LEN(nID, var, len) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Text(nID, var, sizeof(var), bSaveAndValidate, TRUE, len)) \ return FALSE; \ } #define DDX_INT(nID, var) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Int(nID, var, TRUE, bSaveAndValidate)) \ return FALSE; \ } #define DDX_INT_RANGE(nID, var, min, max) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Int(nID, var, TRUE, bSaveAndValidate, TRUE, min, max)) \ return FALSE; \ } #define DDX_UINT(nID, var) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Int(nID, var, FALSE, bSaveAndValidate)) \ return FALSE; \ } #define DDX_UINT_RANGE(nID, var, min, max) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Int(nID, var, FALSE, bSaveAndValidate, TRUE, min, max)) \ return FALSE; \ } #define DDX_FLOAT(nID, var) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Float(nID, var, bSaveAndValidate)) \ return FALSE; \ } #define DDX_FLOAT_RANGE(nID, var, min, max) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max)) \ return FALSE; \ } #define DDX_FLOAT_P(nID, var, precision) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Float(nID, var, bSaveAndValidate, FALSE, 0, 0, precision)) \ return FALSE; \ } #define DDX_FLOAT_P_RANGE(nID, var, min, max, precision) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ { \ if(!DDX_Float(nID, var, bSaveAndValidate, TRUE, min, max, precision)) \ return FALSE; \ } #define DDX_CONTROL(nID, obj) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Control(nID, obj, bSaveAndValidate); #define DDX_CONTROL_HANDLE(nID, obj) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Control_Handle(nID, obj, bSaveAndValidate); #define DDX_CHECK(nID, var) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Check(nID, var, bSaveAndValidate); #define DDX_RADIO(nID, var) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Radio(nID, var, bSaveAndValidate); #define END_DDX_MAP() \ return TRUE; \ } // DDX support for Tab, Combo, ListBox and ListView selection index // Note: Specialized versions require atlctrls.h to be included first #define DDX_INDEX(CtrlClass, nID, var) \ if((nCtlID == (UINT)-1) || (nCtlID == nID)) \ DDX_Index(nID, var, bSaveAndValidate); #ifdef __ATLCTRLS_H__ #define DDX_TAB_INDEX(nID, var) DDX_INDEX(WTL::CTabCtrl, nID, var) #define DDX_COMBO_INDEX(nID, var) DDX_INDEX(WTL::CComboBox, nID, var) #define DDX_LISTBOX_INDEX(nID, var) DDX_INDEX(WTL::CListBox, nID, var) #define DDX_LISTVIEW_INDEX(nID, var) DDX_INDEX(WTL::CListViewCtrl, nID, var) #endif // __ATLCTRLS_H__ /////////////////////////////////////////////////////////////////////////////// // CWinDataExchange - provides support for DDX template class CWinDataExchange { public: // Data exchange method - override in your derived class BOOL DoDataExchange(BOOL /*bSaveAndValidate*/ = FALSE, UINT /*nCtlID*/ = (UINT)-1) { // this one should never be called, override it in // your derived class by implementing DDX map ATLASSERT(FALSE); return FALSE; } // Helpers for validation error reporting enum _XDataType { ddxDataNull = 0, ddxDataText = 1, ddxDataInt = 2, ddxDataFloat = 3, ddxDataDouble = 4 }; struct _XTextData { int nLength; int nMaxLength; }; struct _XIntData { long nVal; long nMin; long nMax; }; struct _XFloatData { double nVal; double nMin; double nMax; }; struct _XData { _XDataType nDataType; union { _XTextData textData; _XIntData intData; _XFloatData floatData; }; }; // Text exchange BOOL DDX_Text(UINT nID, LPTSTR lpstrText, int cbSize, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) { T* pT = static_cast(this); BOOL bSuccess = TRUE; if(bSave) { HWND hWndCtrl = pT->GetDlgItem(nID); int nRetLen = ::GetWindowText(hWndCtrl, lpstrText, cbSize / sizeof(TCHAR)); if(nRetLen < ::GetWindowTextLength(hWndCtrl)) bSuccess = FALSE; } else { ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength)); bSuccess = pT->SetDlgItemText(nID, lpstrText); } if(!bSuccess) { pT->OnDataExchangeError(nID, bSave); } else if(bSave && bValidate) // validation { ATLASSERT(nLength > 0); if(lstrlen(lpstrText) > nLength) { _XData data = { ddxDataText }; data.textData.nLength = lstrlen(lpstrText); data.textData.nMaxLength = nLength; pT->OnDataValidateError(nID, bSave, data); bSuccess = FALSE; } } return bSuccess; } BOOL DDX_Text(UINT nID, BSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) { T* pT = static_cast(this); BOOL bSuccess = TRUE; if(bSave) { bSuccess = pT->GetDlgItemText(nID, bstrText); } else { USES_CONVERSION; LPTSTR lpstrText = OLE2T(bstrText); ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength)); bSuccess = pT->SetDlgItemText(nID, lpstrText); } if(!bSuccess) { pT->OnDataExchangeError(nID, bSave); } else if(bSave && bValidate) // validation { ATLASSERT(nLength > 0); if((int)::SysStringLen(bstrText) > nLength) { _XData data = { ddxDataText }; data.textData.nLength = (int)::SysStringLen(bstrText); data.textData.nMaxLength = nLength; pT->OnDataValidateError(nID, bSave, data); bSuccess = FALSE; } } return bSuccess; } BOOL DDX_Text(UINT nID, ATL::CComBSTR& bstrText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) { T* pT = static_cast(this); BOOL bSuccess = TRUE; if(bSave) { bSuccess = pT->GetDlgItemText(nID, (BSTR&)bstrText); } else { USES_CONVERSION; LPTSTR lpstrText = OLE2T(bstrText); ATLASSERT(!bValidate || (lstrlen(lpstrText) <= nLength)); bSuccess = pT->SetDlgItemText(nID, lpstrText); } if(!bSuccess) { pT->OnDataExchangeError(nID, bSave); } else if(bSave && bValidate) // validation { ATLASSERT(nLength > 0); if((int)bstrText.Length() > nLength) { _XData data = { ddxDataText }; data.textData.nLength = (int)bstrText.Length(); data.textData.nMaxLength = nLength; pT->OnDataValidateError(nID, bSave, data); bSuccess = FALSE; } } return bSuccess; } #ifdef __ATLSTR_H__ BOOL DDX_Text(UINT nID, ATL::CString& strText, int /*cbSize*/, BOOL bSave, BOOL bValidate = FALSE, int nLength = 0) { T* pT = static_cast(this); BOOL bSuccess = TRUE; if(bSave) { HWND hWndCtrl = pT->GetDlgItem(nID); int nLen = ::GetWindowTextLength(hWndCtrl); int nRetLen = -1; LPTSTR lpstr = strText.GetBufferSetLength(nLen); if(lpstr != NULL) { nRetLen = ::GetWindowText(hWndCtrl, lpstr, nLen + 1); strText.ReleaseBuffer(); } if(nRetLen < nLen) bSuccess = FALSE; } else { bSuccess = pT->SetDlgItemText(nID, strText); } if(!bSuccess) { pT->OnDataExchangeError(nID, bSave); } else if(bSave && bValidate) // validation { ATLASSERT(nLength > 0); if(strText.GetLength() > nLength) { _XData data = { ddxDataText }; data.textData.nLength = strText.GetLength(); data.textData.nMaxLength = nLength; pT->OnDataValidateError(nID, bSave, data); bSuccess = FALSE; } } return bSuccess; } #endif // __ATLSTR_H__ // Numeric exchange template BOOL DDX_Int(UINT nID, Type& nVal, BOOL bSigned, BOOL bSave, BOOL bValidate = FALSE, Type nMin = 0, Type nMax = 0) { T* pT = static_cast(this); BOOL bSuccess = TRUE; if(bSave) { nVal = (Type)pT->GetDlgItemInt(nID, &bSuccess, bSigned); } else { ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax))); bSuccess = pT->SetDlgItemInt(nID, nVal, bSigned); } if(!bSuccess) { pT->OnDataExchangeError(nID, bSave); } else if(bSave && bValidate) // validation { ATLASSERT(nMin != nMax); if((nVal < nMin) || (nVal > nMax)) { _XData data = { ddxDataInt }; data.intData.nVal = (long)nVal; data.intData.nMin = (long)nMin; data.intData.nMax = (long)nMax; pT->OnDataValidateError(nID, bSave, data); bSuccess = FALSE; } } return bSuccess; } // Float exchange static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d) { ATLASSERT(lpszText != NULL); while ((*lpszText == _T(' ')) || (*lpszText == _T('\t'))) lpszText++; TCHAR chFirst = lpszText[0]; d = _tcstod(lpszText, (LPTSTR*)&lpszText); if ((d == 0.0) && (chFirst != _T('0'))) return FALSE; // could not convert while ((*lpszText == _T(' ')) || (*lpszText == _T('\t'))) lpszText++; if (*lpszText != _T('\0')) return FALSE; // not terminated properly return TRUE; } BOOL DDX_Float(UINT nID, float& nVal, BOOL bSave, BOOL bValidate = FALSE, float nMin = 0.F, float nMax = 0.F, int nPrecision = FLT_DIG) { T* pT = static_cast(this); BOOL bSuccess = TRUE; const int cchBuff = 32; TCHAR szBuff[cchBuff] = {}; if(bSave) { pT->GetDlgItemText(nID, szBuff, cchBuff); double d = 0; if(_AtlSimpleFloatParse(szBuff, d)) nVal = (float)d; else bSuccess = FALSE; } else { ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax))); _stprintf_s(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); bSuccess = pT->SetDlgItemText(nID, szBuff); } if(!bSuccess) { pT->OnDataExchangeError(nID, bSave); } else if(bSave && bValidate) // validation { ATLASSERT(nMin != nMax); if((nVal < nMin) || (nVal > nMax)) { _XData data = { ddxDataFloat }; data.floatData.nVal = (double)nVal; data.floatData.nMin = (double)nMin; data.floatData.nMax = (double)nMax; pT->OnDataValidateError(nID, bSave, data); bSuccess = FALSE; } } return bSuccess; } BOOL DDX_Float(UINT nID, double& nVal, BOOL bSave, BOOL bValidate = FALSE, double nMin = 0., double nMax = 0., int nPrecision = DBL_DIG) { T* pT = static_cast(this); BOOL bSuccess = TRUE; const int cchBuff = 32; TCHAR szBuff[cchBuff] = {}; if(bSave) { pT->GetDlgItemText(nID, szBuff, cchBuff); double d = 0; if(_AtlSimpleFloatParse(szBuff, d)) nVal = d; else bSuccess = FALSE; } else { ATLASSERT(!bValidate || ((nVal >= nMin) && (nVal <= nMax))); _stprintf_s(szBuff, cchBuff, _T("%.*g"), nPrecision, nVal); bSuccess = pT->SetDlgItemText(nID, szBuff); } if(!bSuccess) { pT->OnDataExchangeError(nID, bSave); } else if(bSave && bValidate) // validation { ATLASSERT(nMin != nMax); if((nVal < nMin) || (nVal > nMax)) { _XData data = { ddxDataFloat }; data.floatData.nVal = nVal; data.floatData.nMin = nMin; data.floatData.nMax = nMax; pT->OnDataValidateError(nID, bSave, data); bSuccess = FALSE; } } return bSuccess; } // Full control subclassing (for CWindowImpl derived controls) template void DDX_Control(UINT nID, TControl& ctrl, BOOL bSave) { if(!bSave && (ctrl.m_hWnd == NULL)) { T* pT = static_cast(this); ctrl.SubclassWindow(pT->GetDlgItem(nID)); } } // Simple control attaching (for HWND wrapper controls) template void DDX_Control_Handle(UINT nID, TControl& ctrl, BOOL bSave) { if(!bSave && (ctrl.m_hWnd == NULL)) { T* pT = static_cast(this); ctrl = pT->GetDlgItem(nID); } } // Control state void DDX_Check(UINT nID, int& nValue, BOOL bSave) { T* pT = static_cast(this); HWND hWndCtrl = pT->GetDlgItem(nID); if(bSave) { nValue = (int)::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L); ATLASSERT((nValue >= 0) && (nValue <= 2)); } else { if((nValue < 0) || (nValue > 2)) { ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - dialog data checkbox value (%d) out of range.\n"), nValue); nValue = 0; // default to off } ::SendMessage(hWndCtrl, BM_SETCHECK, nValue, 0L); } } // variant that supports bool (checked/not-checked, no intermediate state) void DDX_Check(UINT nID, bool& bCheck, BOOL bSave) { int nValue = bCheck ? 1 : 0; DDX_Check(nID, nValue, bSave); if(bSave) { if(nValue == 2) ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - checkbox state (%d) out of supported range.\n"), nValue); bCheck = (nValue == 1); } } void DDX_Radio(UINT nID, int& nValue, BOOL bSave) { T* pT = static_cast(this); HWND hWndCtrl = pT->GetDlgItem(nID); ATLASSERT(hWndCtrl != NULL); // must be first in a group of auto radio buttons ATLASSERT(::GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP); ATLASSERT(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON); if(bSave) nValue = -1; // value if none found // walk all children in group int nButton = 0; do { if(::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON) { // control in group is a radio button if(bSave) { if(::SendMessage(hWndCtrl, BM_GETCHECK, 0, 0L) != 0) { ATLASSERT(nValue == -1); // only set once nValue = nButton; } } else { // select button ::SendMessage(hWndCtrl, BM_SETCHECK, (nButton == nValue), 0L); } nButton++; } else { ATLTRACE2(atlTraceUI, 0, _T("ATL: Warning - skipping non-radio button in group.\n")); } hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT); } while ((hWndCtrl != NULL) && !(GetWindowLong(hWndCtrl, GWL_STYLE) & WS_GROUP)); } // DDX support for Tab, Combo, ListBox and ListView selection index template INT _getSel(TCtrl& tCtrl) { return tCtrl.GetCurSel(); } template void _setSel(TCtrl& tCtrl, INT iSel) { if(iSel < 0) tCtrl.SetCurSel(-1); else tCtrl.SetCurSel(iSel); } #ifdef __ATLCTRLS_H__ // ListViewCtrl specialization template <> INT _getSel(WTL::CListViewCtrl& tCtrl) { return tCtrl.GetSelectedIndex(); } template <> void _setSel(WTL::CListViewCtrl& tCtrl, INT iSel) { if(iSel < 0) tCtrl.SelectItem(-1); else tCtrl.SelectItem(iSel); } #endif // __ATLCTRLS_H__ template void DDX_Index(UINT nID, INT& nVal, BOOL bSave) { T* pT = static_cast(this); TCtrl ctrl(pT->GetDlgItem(nID)); if(bSave) nVal = _getSel(ctrl); else _setSel(ctrl, nVal); } // Overrideables void OnDataExchangeError(UINT nCtrlID, BOOL /*bSave*/) { // Override to display an error message ::MessageBeep((UINT)-1); T* pT = static_cast(this); ::SetFocus(pT->GetDlgItem(nCtrlID)); } void OnDataValidateError(UINT nCtrlID, BOOL /*bSave*/, _XData& /*data*/) { // Override to display an error message ::MessageBeep((UINT)-1); T* pT = static_cast(this); ::SetFocus(pT->GetDlgItem(nCtrlID)); } }; } // namespace WTL #endif // __ATLDDX_H__ ================================================ FILE: third_party/WTL/Include/atldlgs.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLDLGS_H__ #define __ATLDLGS_H__ #pragma once #ifndef __ATLAPP_H__ #error atldlgs.h requires atlapp.h to be included first #endif #ifndef __ATLWIN_H__ #error atldlgs.h requires atlwin.h to be included first #endif #include #if (_WIN32_WINNT >= 0x0600) #include #endif // (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CFileDialogImpl // CFileDialog // CSimpleFileDialog // CMultiFileDialogImpl // CMultiFileDialog // CShellFileDialogImpl // CShellFileOpenDialogImpl // CShellFileOpenDialog // CShellFileSaveDialogImpl // CShellFileSaveDialog // CFolderDialogImpl // CFolderDialog // CFontDialogImpl // CFontDialog // CRichEditFontDialogImpl // CRichEditFontDialog // CColorDialogImpl // CColorDialog // CPrintDialogImpl // CPrintDialog // CPrintDialogExImpl // CPrintDialogEx // CPageSetupDialogImpl // CPageSetupDialog // CFindReplaceDialogImpl // CFindReplaceDialog // // CDialogBaseUnits // CMemDlgTemplate // CIndirectDialogImpl // // CPropertySheetWindow // CPropertySheetImpl // CPropertySheet // CPropertyPageWindow // CPropertyPageImpl // CPropertyPage // CAxPropertyPageImpl // CAxPropertyPage // // CWizard97SheetWindow // CWizard97SheetImpl // CWizard97Sheet // CWizard97PageWindow // CWizard97PageImpl // CWizard97ExteriorPageImpl // CWizard97InteriorPageImpl // // CAeroWizardFrameWindow // CAeroWizardFrameImpl // CAeroWizardFrame // CAeroWizardPageWindow // CAeroWizardPageImpl // CAeroWizardPage // CAeroWizardAxPageImpl // CAeroWizardAxPage // // CTaskDialogConfig // CTaskDialogImpl // CTaskDialog // // Global functions: // AtlTaskDialog() namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CFileDialogImpl - used for File Open or File Save As template class ATL_NO_VTABLE CFileDialogImpl : public ATL::CDialogImplBase { public: OPENFILENAME m_ofn; BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save TCHAR m_szFileTitle[_MAX_FNAME]; // contains file title after return TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return CFileDialogImpl(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, HWND hWndParent = NULL) : m_bOpenFileDialog(bOpenFileDialog) { memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL m_ofn.lStructSize = sizeof(m_ofn); m_ofn.lpstrFile = m_szFileName; m_ofn.nMaxFile = _MAX_PATH; m_ofn.lpstrDefExt = lpszDefExt; m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle; m_ofn.nMaxFileTitle = _MAX_FNAME; m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLEHOOK | OFN_ENABLESIZING; m_ofn.lpstrFilter = lpszFilter; m_ofn.hInstance = ModuleHelper::GetResourceInstance(); m_ofn.lpfnHook = (LPOFNHOOKPROC)T::StartDialogProc; m_ofn.hwndOwner = hWndParent; m_szFileName[0] = _T('\0'); m_szFileTitle[0] = _T('\0'); // setup initial file name if(lpszFileName != NULL) ATL::Checked::tcsncpy_s(m_szFileName, _countof(m_szFileName), lpszFileName, _TRUNCATE); } INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { ATLASSERT((m_ofn.Flags & OFN_ENABLEHOOK) != 0); ATLASSERT(m_ofn.lpfnHook != NULL); // can still be a user hook ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); if(m_ofn.hwndOwner == NULL) // set only if not specified before m_ofn.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRetTh = m_thunk.Init(NULL, NULL); if(bRetTh == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return -1; } ModuleHelper::AddCreateWndData(&m_thunk.cd, (ATL::CDialogImplBase*)this); BOOL bRet = (m_bOpenFileDialog != FALSE) ? ::GetOpenFileName(&m_ofn) : ::GetSaveFileName(&m_ofn); m_hWnd = NULL; return (bRet != FALSE) ? IDOK : IDCANCEL; } // Attributes ATL::CWindow GetFileDialogWindow() const { ATLASSERT(::IsWindow(m_hWnd)); return ATL::CWindow(GetParent()); } int GetFilePath(LPTSTR lpstrFilePath, int nLength) const { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); return (int)GetFileDialogWindow().SendMessage(CDM_GETFILEPATH, nLength, (LPARAM)lpstrFilePath); } int GetFolderIDList(LPVOID lpBuff, int nLength) const { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); return (int)GetFileDialogWindow().SendMessage(CDM_GETFOLDERIDLIST, nLength, (LPARAM)lpBuff); } int GetFolderPath(LPTSTR lpstrFolderPath, int nLength) const { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); return (int)GetFileDialogWindow().SendMessage(CDM_GETFOLDERPATH, nLength, (LPARAM)lpstrFolderPath); } int GetSpec(LPTSTR lpstrSpec, int nLength) const { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); return (int)GetFileDialogWindow().SendMessage(CDM_GETSPEC, nLength, (LPARAM)lpstrSpec); } void SetControlText(int nCtrlID, LPCTSTR lpstrText) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); GetFileDialogWindow().SendMessage(CDM_SETCONTROLTEXT, nCtrlID, (LPARAM)lpstrText); } void SetDefExt(LPCTSTR lpstrExt) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); GetFileDialogWindow().SendMessage(CDM_SETDEFEXT, 0, (LPARAM)lpstrExt); } BOOL GetReadOnlyPref() const // return TRUE if readonly checked { return ((m_ofn.Flags & OFN_READONLY) != 0) ? TRUE : FALSE; } // Operations void HideControl(int nCtrlID) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); GetFileDialogWindow().SendMessage(CDM_HIDECONTROL, nCtrlID); } // Special override for common dialogs BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) { ATLASSERT(::IsWindow(m_hWnd)); GetFileDialogWindow().SendMessage(WM_COMMAND, MAKEWPARAM(IDCANCEL, 0)); return TRUE; } // Message map and handlers BEGIN_MSG_MAP(CFileDialogImpl) NOTIFY_CODE_HANDLER(CDN_FILEOK, _OnFileOK) NOTIFY_CODE_HANDLER(CDN_FOLDERCHANGE, _OnFolderChange) NOTIFY_CODE_HANDLER(CDN_HELP, _OnHelp) NOTIFY_CODE_HANDLER(CDN_INITDONE, _OnInitDone) NOTIFY_CODE_HANDLER(CDN_SELCHANGE, _OnSelChange) NOTIFY_CODE_HANDLER(CDN_SHAREVIOLATION, _OnShareViolation) NOTIFY_CODE_HANDLER(CDN_TYPECHANGE, _OnTypeChange) NOTIFY_CODE_HANDLER(CDN_INCLUDEITEM, _OnIncludeItem) END_MSG_MAP() LRESULT _OnFileOK(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { ATLASSERT(::IsWindow(m_hWnd)); T* pT = static_cast(this); return !pT->OnFileOK((LPOFNOTIFY)pnmh); } LRESULT _OnFolderChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { ATLASSERT(::IsWindow(m_hWnd)); T* pT = static_cast(this); pT->OnFolderChange((LPOFNOTIFY)pnmh); return 0; } LRESULT _OnHelp(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { ATLASSERT(::IsWindow(m_hWnd)); T* pT = static_cast(this); pT->OnHelp((LPOFNOTIFY)pnmh); return 0; } LRESULT _OnInitDone(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { ATLASSERT(::IsWindow(m_hWnd)); T* pT = static_cast(this); pT->OnInitDone((LPOFNOTIFY)pnmh); return 0; } LRESULT _OnSelChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { ATLASSERT(::IsWindow(m_hWnd)); T* pT = static_cast(this); pT->OnSelChange((LPOFNOTIFY)pnmh); return 0; } LRESULT _OnShareViolation(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { ATLASSERT(::IsWindow(m_hWnd)); T* pT = static_cast(this); return pT->OnShareViolation((LPOFNOTIFY)pnmh); } LRESULT _OnTypeChange(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { ATLASSERT(::IsWindow(m_hWnd)); T* pT = static_cast(this); pT->OnTypeChange((LPOFNOTIFY)pnmh); return 0; } LRESULT _OnIncludeItem(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/) { ATLASSERT(::IsWindow(m_hWnd)); T* pT = static_cast(this); return pT->OnIncludeItem((LPOFNOTIFYEX)pnmh); } // Overrideables BOOL OnFileOK(LPOFNOTIFY /*lpon*/) { return TRUE; } void OnFolderChange(LPOFNOTIFY /*lpon*/) { } void OnHelp(LPOFNOTIFY /*lpon*/) { } void OnInitDone(LPOFNOTIFY /*lpon*/) { } void OnSelChange(LPOFNOTIFY /*lpon*/) { } int OnShareViolation(LPOFNOTIFY /*lpon*/) { return 0; } void OnTypeChange(LPOFNOTIFY /*lpon*/) { } BOOL OnIncludeItem(LPOFNOTIFYEX /*lponex*/) { return TRUE; // include item } }; class CFileDialog : public CFileDialogImpl { public: CFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, HWND hWndParent = NULL) : CFileDialogImpl(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) { } // override base class map and references to handlers DECLARE_EMPTY_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CSimpleFileDialog - simple class for non-customized Open/SaveAs dialogs class CSimpleFileDialog { public: OPENFILENAME m_ofn; BOOL m_bOpenFileDialog; // TRUE for file open, FALSE for file save TCHAR m_szFileTitle[_MAX_FNAME]; // contains file title after return TCHAR m_szFileName[_MAX_PATH]; // contains full path name after return CSimpleFileDialog(BOOL bOpenFileDialog, // TRUE for FileOpen, FALSE for FileSaveAs LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, HWND hWndParent = NULL) : m_bOpenFileDialog(bOpenFileDialog) { memset(&m_ofn, 0, sizeof(m_ofn)); // initialize structure to 0/NULL m_ofn.lStructSize = sizeof(m_ofn); m_ofn.lpstrFile = m_szFileName; m_ofn.nMaxFile = _MAX_PATH; m_ofn.lpstrDefExt = lpszDefExt; m_ofn.lpstrFileTitle = (LPTSTR)m_szFileTitle; m_ofn.nMaxFileTitle = _MAX_FNAME; m_ofn.Flags = dwFlags | OFN_EXPLORER | OFN_ENABLESIZING; m_ofn.lpstrFilter = lpszFilter; m_ofn.hInstance = ModuleHelper::GetResourceInstance(); m_ofn.hwndOwner = hWndParent; m_szFileName[0] = _T('\0'); m_szFileTitle[0] = _T('\0'); // setup initial file name if(lpszFileName != NULL) ATL::Checked::tcsncpy_s(m_szFileName, _countof(m_szFileName), lpszFileName, _TRUNCATE); } INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { ATLASSERT((m_ofn.Flags & OFN_EXPLORER) != 0); if(m_ofn.hwndOwner == NULL) // set only if not specified before m_ofn.hwndOwner = hWndParent; BOOL bRet = (m_bOpenFileDialog != FALSE) ? ::GetOpenFileName(&m_ofn) : ::GetSaveFileName(&m_ofn); return (bRet != FALSE) ? IDOK : IDCANCEL; } }; /////////////////////////////////////////////////////////////////////////////// // Multi File Dialog - Multi-select File Open dialog // The class dynamically resizes the buffer as the file selection changes // (as described in Knowledge Base article 131462). It also expands selected // shortcut files to take into account the full path of the target file. // Note that this doesn't work on Win9x for the old style dialogs, as well as // on NT for non-Unicode builds. #ifndef _WTL_FIXED_OFN_BUFFER_LENGTH #define _WTL_FIXED_OFN_BUFFER_LENGTH 0x10000 #endif template class ATL_NO_VTABLE CMultiFileDialogImpl : public CFileDialogImpl< T > { public: mutable LPCTSTR m_pNextFile; #ifndef _UNICODE bool m_bIsNT; #endif CMultiFileDialogImpl( LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY, LPCTSTR lpszFilter = NULL, HWND hWndParent = NULL) : CFileDialogImpl(TRUE, lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent), m_pNextFile(NULL) { this->m_ofn.Flags |= OFN_ALLOWMULTISELECT; // Force multiple selection mode #ifndef _UNICODE #ifdef _versionhelpers_H_INCLUDED_ OSVERSIONINFOEX ovi = { sizeof(OSVERSIONINFOEX) }; ovi.dwPlatformId = VER_PLATFORM_WIN32_NT; DWORDLONG const dwlConditionMask = ::VerSetConditionMask(0, VER_PLATFORMID, VER_EQUAL); m_bIsNT = (::VerifyVersionInfo(&ovi, VER_PLATFORMID, dwlConditionMask) != FALSE); #else // !_versionhelpers_H_INCLUDED_ OSVERSIONINFO ovi = { sizeof(OSVERSIONINFO) }; ::GetVersionEx(&ovi); m_bIsNT = (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT); #endif // _versionhelpers_H_INCLUDED_ if (m_bIsNT) { // On NT platforms, GetOpenFileNameA thunks to GetOpenFileNameW and there // is absolutely nothing we can do except to start off with a large buffer. ATLVERIFY(ResizeFilenameBuffer(_WTL_FIXED_OFN_BUFFER_LENGTH)); } #endif } ~CMultiFileDialogImpl() { if (this->m_ofn.lpstrFile != this->m_szFileName) // Free the buffer if we allocated it delete[] this->m_ofn.lpstrFile; } // Operations // Get the directory that the files were chosen from. // The function returns the number of characters copied, not including the terminating zero. // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. // If the function fails, the return value is zero. int GetDirectory(LPTSTR pBuffer, int nBufLen) const { if (this->m_ofn.lpstrFile == NULL) return 0; LPCTSTR pStr = this->m_ofn.lpstrFile; int nLength = lstrlen(pStr); if (pStr[nLength + 1] == 0) { // The OFN buffer contains a single item so extract its path. LPCTSTR pSep = _tcsrchr(pStr, _T('\\')); if (pSep != NULL) nLength = (int)(DWORD_PTR)(pSep - pStr); } int nRet = 0; if (pBuffer == NULL) // If the buffer is NULL, return the required length { nRet = nLength + 1; } else if (nBufLen > nLength) { ATL::Checked::tcsncpy_s(pBuffer, nBufLen, pStr, nLength); nRet = nLength; } return nRet; } #ifdef __ATLSTR_H__ bool GetDirectory(ATL::CString& strDir) const { bool bRet = false; int nLength = GetDirectory(NULL, 0); if (nLength > 0) { bRet = (GetDirectory(strDir.GetBuffer(nLength), nLength) > 0); strDir.ReleaseBuffer(nLength - 1); } return bRet; } #endif // __ATLSTR_H__ // Get the first filename as a pointer into the buffer. LPCTSTR GetFirstFileName() const { if (this->m_ofn.lpstrFile == NULL) return NULL; m_pNextFile = NULL; // Reset internal buffer pointer LPCTSTR pStr = this->m_ofn.lpstrFile; int nLength = lstrlen(pStr); if (pStr[nLength + 1] != 0) { // Multiple items were selected. The first string is the directory, // so skip forwards to the second string. pStr += nLength + 1; // Set up m_pNext so it points to the second item (or null). m_pNextFile = pStr; GetNextFileName(); } else { // A single item was selected. Skip forward past the path. LPCTSTR pSep = _tcsrchr(pStr, _T('\\')); if (pSep != NULL) pStr = pSep + 1; } return pStr; } // Get the next filename as a pointer into the buffer. LPCTSTR GetNextFileName() const { if (m_pNextFile == NULL) return NULL; LPCTSTR pStr = m_pNextFile; // Set "m_pNextFile" to point to the next file name, or null if we // have reached the last file in the list. int nLength = lstrlen(pStr); m_pNextFile = (pStr[nLength + 1] != 0) ? &pStr[nLength + 1] : NULL; return pStr; } // Get the first filename as a full path. // The function returns the number of characters copied, not including the terminating zero. // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. // If the function fails, the return value is zero. int GetFirstPathName(LPTSTR pBuffer, int nBufLen) const { LPCTSTR pStr = GetFirstFileName(); int nLengthDir = GetDirectory(NULL, 0); if((pStr == NULL) || (nLengthDir == 0)) return 0; // Figure out the required length. int nLengthTotal = nLengthDir + lstrlen(pStr); int nRet = 0; if(pBuffer == NULL) // If the buffer is NULL, return the required length { nRet = nLengthTotal + 1; } else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path { GetDirectory(pBuffer, nBufLen); ATL::Checked::tcscat_s(pBuffer, nBufLen, _T("\\")); ATL::Checked::tcscat_s(pBuffer, nBufLen, pStr); nRet = nLengthTotal; } return nRet; } #ifdef __ATLSTR_H__ bool GetFirstPathName(ATL::CString& strPath) const { bool bRet = false; int nLength = GetFirstPathName(NULL, 0); if (nLength > 0) { bRet = (GetFirstPathName(strPath.GetBuffer(nLength), nLength) > 0); strPath.ReleaseBuffer(nLength - 1); } return bRet; } #endif // __ATLSTR_H__ // Get the next filename as a full path. // The function returns the number of characters copied, not including the terminating zero. // If the buffer is NULL, the function returns the required size, in characters, including the terminating zero. // If the function fails, the return value is zero. // The internal position marker is moved forward only if the function succeeds and the buffer was large enough. int GetNextPathName(LPTSTR pBuffer, int nBufLen) const { if (m_pNextFile == NULL) return 0; int nRet = 0; LPCTSTR pStr = m_pNextFile; // Does the filename contain a backslash? if (_tcsrchr(pStr, _T('\\')) != NULL) { // Yes, so we'll assume it's a full path. int nLength = lstrlen(pStr); if (pBuffer == NULL) // If the buffer is NULL, return the required length { nRet = nLength + 1; } else if (nBufLen > nLength) // The buffer is big enough, so go ahead and copy the filename { ATL::Checked::tcscpy_s(pBuffer, nBufLen, GetNextFileName()); nRet = nBufLen; } } else { // The filename is relative, so construct the full path. int nLengthDir = GetDirectory(NULL, 0); if (nLengthDir > 0) { // Calculate the required space. int nLengthTotal = nLengthDir + lstrlen(pStr); if(pBuffer == NULL) // If the buffer is NULL, return the required length { nRet = nLengthTotal + 1; } else if (nBufLen > nLengthTotal) // If the buffer is big enough, go ahead and construct the path { GetDirectory(pBuffer, nBufLen); ATL::Checked::tcscat_s(pBuffer, nBufLen, _T("\\")); ATL::Checked::tcscat_s(pBuffer, nBufLen, GetNextFileName()); nRet = nLengthTotal; } } } return nRet; } #ifdef __ATLSTR_H__ bool GetNextPathName(ATL::CString& strPath) const { bool bRet = false; int nLength = GetNextPathName(NULL, 0); if (nLength > 0) { bRet = (GetNextPathName(strPath.GetBuffer(nLength), nLength) > 0); strPath.ReleaseBuffer(nLength - 1); } return bRet; } #endif // __ATLSTR_H__ // Implementation bool ResizeFilenameBuffer(DWORD dwLength) { if (dwLength > this->m_ofn.nMaxFile) { // Free the old buffer. if (this->m_ofn.lpstrFile != this->m_szFileName) { delete[] this->m_ofn.lpstrFile; this->m_ofn.lpstrFile = NULL; this->m_ofn.nMaxFile = 0; } // Allocate the new buffer. LPTSTR lpstrBuff = NULL; ATLTRY(lpstrBuff = new TCHAR[dwLength]); if (lpstrBuff != NULL) { this->m_ofn.lpstrFile = lpstrBuff; this->m_ofn.lpstrFile[0] = 0; this->m_ofn.nMaxFile = dwLength; } } return (this->m_ofn.lpstrFile != NULL); } void OnSelChange(LPOFNOTIFY /*lpon*/) { #ifndef _UNICODE // There is no point resizing the buffer in ANSI builds running on NT. if (m_bIsNT) return; #endif // Get the buffer length required to hold the spec. int nLength = this->GetSpec(NULL, 0); if (nLength <= 1) return; // no files are selected, presumably // Add room for the directory, and an extra terminating zero. nLength += this->GetFolderPath(NULL, 0) + 1; if (!ResizeFilenameBuffer(nLength)) { ATLASSERT(FALSE); return; } // If we are not following links then our work is done. if ((this->m_ofn.Flags & OFN_NODEREFERENCELINKS) != 0) return; // Get the file spec, which is the text in the edit control. if (this->GetSpec(this->m_ofn.lpstrFile, this->m_ofn.nMaxFile) <= 0) return; // Get the ID-list of the current folder. int nBytes = this->GetFolderIDList(NULL, 0); #ifdef STRICT_TYPED_ITEMIDS ATL::CTempBuffer idlist; #else ATL::CTempBuffer idlist; #endif idlist.AllocateBytes(nBytes); if ((nBytes <= 0) || (this->GetFolderIDList(idlist, nBytes) <= 0)) return; // First bind to the desktop folder, then to the current folder. ATL::CComPtr pDesktop, pFolder; if (FAILED(::SHGetDesktopFolder(&pDesktop))) return; if (FAILED(pDesktop->BindToObject(idlist, NULL, IID_IShellFolder, (void**)&pFolder))) return; // Work through the file spec, looking for quoted filenames. If we find a shortcut file, then // we need to add enough extra buffer space to hold its target path. DWORD nExtraChars = 0; bool bInsideQuotes = false; LPCTSTR pAnchor = this->m_ofn.lpstrFile; LPCTSTR pChar = this->m_ofn.lpstrFile; for ( ; *pChar; ++pChar) { // Look for quotation marks. if (*pChar == _T('\"')) { // We are either entering or leaving a passage of quoted text. bInsideQuotes = !bInsideQuotes; // Is it an opening or closing quote? if (bInsideQuotes) { // We found an opening quote, so set "pAnchor" to the following character. pAnchor = pChar + 1; } else // closing quote { // Each quoted entity should be shorter than MAX_PATH. if (pChar - pAnchor >= MAX_PATH) return; // Get the ID-list and attributes of the file. USES_CONVERSION; int nFileNameLength = (int)(DWORD_PTR)(pChar - pAnchor); TCHAR szFileName[MAX_PATH] = {}; ATL::Checked::tcsncpy_s(szFileName, MAX_PATH, pAnchor, nFileNameLength); #ifdef STRICT_TYPED_ITEMIDS PIDLIST_RELATIVE pidl = NULL; #else LPITEMIDLIST pidl = NULL; #endif DWORD dwAttrib = SFGAO_LINK; if (SUCCEEDED(pFolder->ParseDisplayName(NULL, NULL, T2W(szFileName), NULL, &pidl, &dwAttrib))) { // Is it a shortcut file? if (dwAttrib & SFGAO_LINK) { // Bind to its IShellLink interface. ATL::CComPtr pLink; if (SUCCEEDED(pFolder->BindToObject(pidl, NULL, IID_IShellLink, (void**)&pLink))) { // Get the shortcut's target path. TCHAR szPath[MAX_PATH] = {}; if (SUCCEEDED(pLink->GetPath(szPath, MAX_PATH, NULL, 0))) { // If the target path is longer than the shortcut name, then add on the number // of extra characters that are required. int nNewLength = lstrlen(szPath); if (nNewLength > nFileNameLength) nExtraChars += nNewLength - nFileNameLength; } } } // Free the ID-list returned by ParseDisplayName. ::CoTaskMemFree(pidl); } } } } // If we need more space for shortcut targets, then reallocate. if (nExtraChars > 0) ATLVERIFY(ResizeFilenameBuffer(this->m_ofn.nMaxFile + nExtraChars)); } }; class CMultiFileDialog : public CMultiFileDialogImpl { public: CMultiFileDialog( LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY, LPCTSTR lpszFilter = NULL, HWND hWndParent = NULL) : CMultiFileDialogImpl(lpszDefExt, lpszFileName, dwFlags, lpszFilter, hWndParent) { } BEGIN_MSG_MAP(CMultiFileDialog) CHAIN_MSG_MAP(CMultiFileDialogImpl) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // Shell File Dialog - new Shell File Open and Save dialogs in Vista // Note: Use GetPtr() to access dialog interface methods. // Example: // CShellFileOpenDialog dlg; // dlg.GetPtr()->SetTitle(L"MyFileOpenDialog"); #if (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // CShellFileDialogImpl - base class for CShellFileOpenDialogImpl and CShellFileSaveDialogImpl template class ATL_NO_VTABLE CShellFileDialogImpl : public IFileDialogEvents { public: // Operations INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { INT_PTR nRet = -1; T* pT = static_cast(this); if(pT->m_spFileDlg == NULL) { ATLASSERT(FALSE); return nRet; } DWORD dwCookie = 0; pT->_Advise(dwCookie); HRESULT hRet = pT->m_spFileDlg->Show(hWndParent); if(SUCCEEDED(hRet)) nRet = IDOK; else if(hRet == HRESULT_FROM_WIN32(ERROR_CANCELLED)) nRet = IDCANCEL; else ATLASSERT(FALSE); // error pT->_Unadvise(dwCookie); return nRet; } bool IsNull() const { const T* pT = static_cast(this); return (pT->m_spFileDlg == NULL); } // Operations - get file path after dialog returns HRESULT GetFilePath(LPWSTR lpstrFilePath, int cchLength) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg != NULL); ATL::CComPtr spItem; HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); if(SUCCEEDED(hRet)) hRet = GetFileNameFromShellItem(spItem, SIGDN_FILESYSPATH, lpstrFilePath, cchLength); return hRet; } HRESULT GetFileTitle(LPWSTR lpstrFileTitle, int cchLength) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg != NULL); ATL::CComPtr spItem; HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); if(SUCCEEDED(hRet)) hRet = GetFileNameFromShellItem(spItem, SIGDN_NORMALDISPLAY, lpstrFileTitle, cchLength); return hRet; } #ifdef __ATLSTR_H__ HRESULT GetFilePath(ATL::CString& strFilePath) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg != NULL); ATL::CComPtr spItem; HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); if(SUCCEEDED(hRet)) hRet = GetFileNameFromShellItem(spItem, SIGDN_FILESYSPATH, strFilePath); return hRet; } HRESULT GetFileTitle(ATL::CString& strFileTitle) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg != NULL); ATL::CComPtr spItem; HRESULT hRet = pT->m_spFileDlg->GetResult(&spItem); if(SUCCEEDED(hRet)) hRet = GetFileNameFromShellItem(spItem, SIGDN_NORMALDISPLAY, strFileTitle); return hRet; } #endif // __ATLSTR_H__ // Helpers for IShellItem static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, LPWSTR lpstr, int cchLength) { ATLASSERT(pShellItem != NULL); LPWSTR lpstrName = NULL; HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName); if(SUCCEEDED(hRet)) { if(lstrlenW(lpstrName) < cchLength) { ATL::Checked::wcscpy_s(lpstr, cchLength, lpstrName); } else { ATLASSERT(FALSE); hRet = DISP_E_BUFFERTOOSMALL; } ::CoTaskMemFree(lpstrName); } return hRet; } #ifdef __ATLSTR_H__ static HRESULT GetFileNameFromShellItem(IShellItem* pShellItem, SIGDN type, ATL::CString& str) { ATLASSERT(pShellItem != NULL); LPWSTR lpstrName = NULL; HRESULT hRet = pShellItem->GetDisplayName(type, &lpstrName); if(SUCCEEDED(hRet)) { str = lpstrName; ::CoTaskMemFree(lpstrName); } return hRet; } #endif // __ATLSTR_H__ // Implementation void _Advise(DWORD& dwCookie) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg != NULL); HRESULT hRet = pT->m_spFileDlg->Advise((IFileDialogEvents*)this, &dwCookie); ATLVERIFY(SUCCEEDED(hRet)); } void _Unadvise(DWORD dwCookie) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg != NULL); HRESULT hRet = pT->m_spFileDlg->Unadvise(dwCookie); ATLVERIFY(SUCCEEDED(hRet)); } void _Init(LPCWSTR lpszFileName, DWORD dwOptions, LPCWSTR lpszDefExt, const COMDLG_FILTERSPEC* arrFilterSpec, UINT uFilterSpecCount) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg != NULL); HRESULT hRet = E_FAIL; if(lpszFileName != NULL) { hRet = pT->m_spFileDlg->SetFileName(lpszFileName); ATLASSERT(SUCCEEDED(hRet)); } hRet = pT->m_spFileDlg->SetOptions(dwOptions); ATLASSERT(SUCCEEDED(hRet)); if(lpszDefExt != NULL) { hRet = pT->m_spFileDlg->SetDefaultExtension(lpszDefExt); ATLASSERT(SUCCEEDED(hRet)); } if((arrFilterSpec != NULL) && (uFilterSpecCount != 0U)) { hRet = pT->m_spFileDlg->SetFileTypes(uFilterSpecCount, arrFilterSpec); ATLASSERT(SUCCEEDED(hRet)); } } // Implementation - IUnknown interface STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) { if(ppvObject == NULL) return E_POINTER; T* pT = static_cast(this); if(IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IFileDialogEvents)) { *ppvObject = (IFileDialogEvents*)pT; // AddRef() not needed return S_OK; } return E_NOINTERFACE; } virtual ULONG STDMETHODCALLTYPE AddRef() { return 1; } virtual ULONG STDMETHODCALLTYPE Release() { return 1; } // Implementation - IFileDialogEvents interface virtual HRESULT STDMETHODCALLTYPE OnFileOk(IFileDialog* pfd) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); (void)pfd; // avoid level 4 warning return pT->OnFileOk(); } virtual HRESULT STDMETHODCALLTYPE OnFolderChanging(IFileDialog* pfd, IShellItem* psiFolder) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); (void)pfd; // avoid level 4 warning return pT->OnFolderChanging(psiFolder); } virtual HRESULT STDMETHODCALLTYPE OnFolderChange(IFileDialog* pfd) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); (void)pfd; // avoid level 4 warning return pT->OnFolderChange(); } virtual HRESULT STDMETHODCALLTYPE OnSelectionChange(IFileDialog* pfd) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); (void)pfd; // avoid level 4 warning return pT->OnSelectionChange(); } virtual HRESULT STDMETHODCALLTYPE OnShareViolation(IFileDialog* pfd, IShellItem* psi, FDE_SHAREVIOLATION_RESPONSE* pResponse) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); (void)pfd; // avoid level 4 warning return pT->OnShareViolation(psi, pResponse); } virtual HRESULT STDMETHODCALLTYPE OnTypeChange(IFileDialog* pfd) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); (void)pfd; // avoid level 4 warning return pT->OnTypeChange(); } virtual HRESULT STDMETHODCALLTYPE OnOverwrite(IFileDialog* pfd, IShellItem* psi, FDE_OVERWRITE_RESPONSE* pResponse) { T* pT = static_cast(this); ATLASSERT(pT->m_spFileDlg.IsEqualObject(pfd)); (void)pfd; // avoid level 4 warning return pT->OnOverwrite(psi, pResponse); } // Overrideables - Event handlers HRESULT OnFileOk() { return E_NOTIMPL; } HRESULT OnFolderChanging(IShellItem* /*psiFolder*/) { return E_NOTIMPL; } HRESULT OnFolderChange() { return E_NOTIMPL; } HRESULT OnSelectionChange() { return E_NOTIMPL; } HRESULT OnShareViolation(IShellItem* /*psi*/, FDE_SHAREVIOLATION_RESPONSE* /*pResponse*/) { return E_NOTIMPL; } HRESULT OnTypeChange() { return E_NOTIMPL; } HRESULT OnOverwrite(IShellItem* /*psi*/, FDE_OVERWRITE_RESPONSE* /*pResponse*/) { return E_NOTIMPL; } }; /////////////////////////////////////////////////////////////////////////////// // CShellFileOpenDialogImpl - implements new Shell File Open dialog template class ATL_NO_VTABLE CShellFileOpenDialogImpl : public CShellFileDialogImpl< T > { public: ATL::CComPtr m_spFileDlg; CShellFileOpenDialogImpl(LPCWSTR lpszFileName = NULL, DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST, LPCWSTR lpszDefExt = NULL, const COMDLG_FILTERSPEC* arrFilterSpec = NULL, UINT uFilterSpecCount = 0U) { HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileOpenDialog); if(SUCCEEDED(hRet)) this->_Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); } virtual ~CShellFileOpenDialogImpl() { } IFileOpenDialog* GetPtr() { return m_spFileDlg; } }; /////////////////////////////////////////////////////////////////////////////// // CShellFileOpenDialog - new Shell File Open dialog without events class CShellFileOpenDialog : public CShellFileOpenDialogImpl { public: CShellFileOpenDialog(LPCWSTR lpszFileName = NULL, DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_FILEMUSTEXIST, LPCWSTR lpszDefExt = NULL, const COMDLG_FILTERSPEC* arrFilterSpec = NULL, UINT uFilterSpecCount = 0U) : CShellFileOpenDialogImpl(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount) { } virtual ~CShellFileOpenDialog() { } // Implementation (remove _Advise/_Unadvise code using template magic) void _Advise(DWORD& /*dwCookie*/) { } void _Unadvise(DWORD /*dwCookie*/) { } }; /////////////////////////////////////////////////////////////////////////////// // CShellFileSaveDialogImpl - implements new Shell File Save dialog template class ATL_NO_VTABLE CShellFileSaveDialogImpl : public CShellFileDialogImpl< T > { public: ATL::CComPtr m_spFileDlg; CShellFileSaveDialogImpl(LPCWSTR lpszFileName = NULL, DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_OVERWRITEPROMPT, LPCWSTR lpszDefExt = NULL, const COMDLG_FILTERSPEC* arrFilterSpec = NULL, UINT uFilterSpecCount = 0U) { HRESULT hRet = m_spFileDlg.CoCreateInstance(CLSID_FileSaveDialog); if(SUCCEEDED(hRet)) this->_Init(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount); } virtual ~CShellFileSaveDialogImpl() { } IFileSaveDialog* GetPtr() { return m_spFileDlg; } }; /////////////////////////////////////////////////////////////////////////////// // CShellFileSaveDialog - new Shell File Save dialog without events class CShellFileSaveDialog : public CShellFileSaveDialogImpl { public: CShellFileSaveDialog(LPCWSTR lpszFileName = NULL, DWORD dwOptions = FOS_FORCEFILESYSTEM | FOS_PATHMUSTEXIST | FOS_OVERWRITEPROMPT, LPCWSTR lpszDefExt = NULL, const COMDLG_FILTERSPEC* arrFilterSpec = NULL, UINT uFilterSpecCount = 0U) : CShellFileSaveDialogImpl(lpszFileName, dwOptions, lpszDefExt, arrFilterSpec, uFilterSpecCount) { } virtual ~CShellFileSaveDialog() { } // Implementation (remove _Advise/_Unadvise code using template magic) void _Advise(DWORD& /*dwCookie*/) { } void _Unadvise(DWORD /*dwCookie*/) { } }; #endif // (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // CFolderDialogImpl - used for browsing for a folder template class ATL_NO_VTABLE CFolderDialogImpl { public: BROWSEINFO m_bi; LPCTSTR m_lpstrInitialFolder; LPCITEMIDLIST m_pidlInitialSelection; bool m_bExpandInitialSelection; TCHAR m_szFolderDisplayName[MAX_PATH]; TCHAR m_szFolderPath[MAX_PATH]; #ifdef STRICT_TYPED_ITEMIDS PIDLIST_ABSOLUTE m_pidlSelected; #else LPITEMIDLIST m_pidlSelected; #endif HWND m_hWnd; // used only in the callback function // Constructor CFolderDialogImpl(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_RETURNONLYFSDIRS) : m_lpstrInitialFolder(NULL), m_pidlInitialSelection(NULL), m_bExpandInitialSelection(false), m_pidlSelected(NULL), m_hWnd(NULL) { memset(&m_bi, 0, sizeof(m_bi)); // initialize structure to 0/NULL m_bi.hwndOwner = hWndParent; m_bi.pidlRoot = NULL; m_bi.pszDisplayName = m_szFolderDisplayName; m_bi.lpszTitle = lpstrTitle; m_bi.ulFlags = uFlags; m_bi.lpfn = BrowseCallbackProc; m_bi.lParam = (LPARAM)static_cast(this); m_szFolderPath[0] = 0; m_szFolderDisplayName[0] = 0; } ~CFolderDialogImpl() { ::CoTaskMemFree(m_pidlSelected); } // Operations INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { if(m_bi.hwndOwner == NULL) // set only if not specified before m_bi.hwndOwner = hWndParent; // Clear out any previous results m_szFolderPath[0] = 0; m_szFolderDisplayName[0] = 0; ::CoTaskMemFree(m_pidlSelected); INT_PTR nRet = IDCANCEL; m_pidlSelected = ::SHBrowseForFolder(&m_bi); if(m_pidlSelected != NULL) { nRet = IDOK; // If BIF_RETURNONLYFSDIRS is set, we try to get the filesystem path. // Otherwise, the caller must handle the ID-list directly. if((m_bi.ulFlags & BIF_RETURNONLYFSDIRS) != 0) { if(::SHGetPathFromIDList(m_pidlSelected, m_szFolderPath) == FALSE) nRet = IDCANCEL; } } return nRet; } // Methods to call before DoModal void SetInitialFolder(LPCTSTR lpstrInitialFolder, bool bExpand = true) { // lpstrInitialFolder may be a file if BIF_BROWSEINCLUDEFILES is specified m_lpstrInitialFolder = lpstrInitialFolder; m_bExpandInitialSelection = bExpand; } void SetInitialSelection(LPCITEMIDLIST pidl, bool bExpand = true) { m_pidlInitialSelection = pidl; m_bExpandInitialSelection = bExpand; } #ifdef STRICT_TYPED_ITEMIDS void SetRootFolder(PCIDLIST_ABSOLUTE pidl) #else void SetRootFolder(LPCITEMIDLIST pidl) #endif { m_bi.pidlRoot = pidl; } // Methods to call after DoModal LPITEMIDLIST GetSelectedItem(bool bDetach = false) { LPITEMIDLIST pidl = m_pidlSelected; if(bDetach) m_pidlSelected = NULL; return pidl; } LPCTSTR GetFolderPath() const { return m_szFolderPath; } LPCTSTR GetFolderDisplayName() const { return m_szFolderDisplayName; } int GetFolderImageIndex() const { return m_bi.iImage; } // Callback function and overrideables static int CALLBACK BrowseCallbackProc(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { int nRet = 0; T* pT = (T*)lpData; bool bClear = false; if(pT->m_hWnd == NULL) { pT->m_hWnd = hWnd; bClear = true; } else { ATLASSERT(pT->m_hWnd == hWnd); } switch(uMsg) { case BFFM_INITIALIZED: // Set initial selection // Note that m_pidlInitialSelection, if set, takes precedence over m_lpstrInitialFolder if(pT->m_pidlInitialSelection != NULL) pT->SetSelection(pT->m_pidlInitialSelection); else if(pT->m_lpstrInitialFolder != NULL) pT->SetSelection(pT->m_lpstrInitialFolder); // Expand initial selection if appropriate if(pT->m_bExpandInitialSelection && ((pT->m_bi.ulFlags & BIF_NEWDIALOGSTYLE) != 0)) { if(pT->m_pidlInitialSelection != NULL) pT->SetExpanded(pT->m_pidlInitialSelection); else if(pT->m_lpstrInitialFolder != NULL) pT->SetExpanded(pT->m_lpstrInitialFolder); } pT->OnInitialized(); break; case BFFM_SELCHANGED: pT->OnSelChanged((LPITEMIDLIST)lParam); break; case BFFM_VALIDATEFAILED: nRet = pT->OnValidateFailed((LPCTSTR)lParam); break; case BFFM_IUNKNOWN: pT->OnIUnknown((IUnknown*)lParam); break; default: ATLTRACE2(atlTraceUI, 0, _T("Unknown message received in CFolderDialogImpl::BrowseCallbackProc\n")); break; } if(bClear) pT->m_hWnd = NULL; return nRet; } void OnInitialized() { } void OnSelChanged(LPITEMIDLIST /*pItemIDList*/) { } int OnValidateFailed(LPCTSTR /*lpstrFolderPath*/) { return 1; // 1=continue, 0=EndDialog } void OnIUnknown(IUnknown* /*pUnknown*/) { } // Commands - valid to call only from handlers void EnableOK(BOOL bEnable) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, BFFM_ENABLEOK, 0, bEnable); } void SetSelection(LPCITEMIDLIST pItemIDList) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, BFFM_SETSELECTION, FALSE, (LPARAM)pItemIDList); } void SetSelection(LPCTSTR lpstrFolderPath) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)lpstrFolderPath); } void SetStatusText(LPCTSTR lpstrText) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)lpstrText); } void SetOKText(LPCTSTR lpstrOKText) { ATLASSERT(m_hWnd != NULL); USES_CONVERSION; LPCWSTR lpstr = T2CW(lpstrOKText); ::SendMessage(m_hWnd, BFFM_SETOKTEXT, 0, (LPARAM)lpstr); } void SetExpanded(LPCITEMIDLIST pItemIDList) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, BFFM_SETEXPANDED, FALSE, (LPARAM)pItemIDList); } void SetExpanded(LPCTSTR lpstrFolderPath) { ATLASSERT(m_hWnd != NULL); USES_CONVERSION; LPCWSTR lpstr = T2CW(lpstrFolderPath); ::SendMessage(m_hWnd, BFFM_SETEXPANDED, TRUE, (LPARAM)lpstr); } }; class CFolderDialog : public CFolderDialogImpl { public: CFolderDialog(HWND hWndParent = NULL, LPCTSTR lpstrTitle = NULL, UINT uFlags = BIF_RETURNONLYFSDIRS) : CFolderDialogImpl(hWndParent, lpstrTitle, uFlags) { } }; /////////////////////////////////////////////////////////////////////////////// // CCommonDialogImplBase - base class for common dialog classes class ATL_NO_VTABLE CCommonDialogImplBase : public ATL::CWindowImplBase { public: static UINT_PTR APIENTRY HookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if(uMsg != WM_INITDIALOG) return 0; CCommonDialogImplBase* pT = (CCommonDialogImplBase*)ModuleHelper::ExtractCreateWndData(); ATLASSERT(pT != NULL); ATLASSERT(pT->m_hWnd == NULL); ATLASSERT(::IsWindow(hWnd)); // subclass dialog's window if(!pT->SubclassWindow(hWnd)) { ATLTRACE2(atlTraceUI, 0, _T("Subclassing a common dialog failed\n")); return 0; } // check message map for WM_INITDIALOG handler LRESULT lRes = 0; if(pT->ProcessWindowMessage(pT->m_hWnd, uMsg, wParam, lParam, lRes, 0) == FALSE) return 0; return lRes; } // Special override for common dialogs BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) { ATLASSERT(::IsWindow(m_hWnd)); SendMessage(WM_COMMAND, MAKEWPARAM(IDABORT, 0)); return TRUE; } // Implementation - try to override these, to prevent errors HWND Create(HWND, ATL::_U_RECT, LPCTSTR, DWORD, DWORD, ATL::_U_MENUorID, ATOM, LPVOID) { ATLASSERT(FALSE); // should not be called return NULL; } static LRESULT CALLBACK StartWindowProc(HWND /*hWnd*/, UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/) { ATLASSERT(FALSE); // should not be called return 0; } }; /////////////////////////////////////////////////////////////////////////////// // CFontDialogImpl - font selection dialog template class ATL_NO_VTABLE CFontDialogImpl : public CCommonDialogImplBase { public: enum { _cchStyleName = 64 }; CHOOSEFONT m_cf; TCHAR m_szStyleName[_cchStyleName]; // contains style name after return LOGFONT m_lf; // default LOGFONT to store the info // Constructors CFontDialogImpl(LPLOGFONT lplfInitial = NULL, DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS, HDC hDCPrinter = NULL, HWND hWndParent = NULL) { memset(&m_cf, 0, sizeof(m_cf)); memset(&m_lf, 0, sizeof(m_lf)); memset(&m_szStyleName, 0, sizeof(m_szStyleName)); m_cf.lStructSize = sizeof(m_cf); m_cf.hwndOwner = hWndParent; m_cf.rgbColors = RGB(0, 0, 0); m_cf.lpszStyle = (LPTSTR)&m_szStyleName; m_cf.Flags = dwFlags | CF_ENABLEHOOK; m_cf.lpfnHook = (LPCFHOOKPROC)T::HookProc; if(lplfInitial != NULL) { m_cf.lpLogFont = lplfInitial; m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; m_lf = *lplfInitial; } else { m_cf.lpLogFont = &m_lf; } if(hDCPrinter != NULL) { m_cf.hDC = hDCPrinter; m_cf.Flags |= CF_PRINTERFONTS; } } // Operations INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { ATLASSERT((m_cf.Flags & CF_ENABLEHOOK) != 0); ATLASSERT(m_cf.lpfnHook != NULL); // can still be a user hook if(m_cf.hwndOwner == NULL) // set only if not specified before m_cf.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRetTh = m_thunk.Init(NULL, NULL); if(bRetTh == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return -1; } ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); BOOL bRet = ::ChooseFont(&m_cf); m_hWnd = NULL; if(bRet) // copy logical font from user's initialization buffer (if needed) ATL::Checked::memcpy_s(&m_lf, sizeof(m_lf), m_cf.lpLogFont, sizeof(m_lf)); return bRet ? IDOK : IDCANCEL; } // works only when the dialog is dislayed or after void GetCurrentFont(LPLOGFONT lplf) const { ATLASSERT(lplf != NULL); if(m_hWnd != NULL) ::SendMessage(m_hWnd, WM_CHOOSEFONT_GETLOGFONT, 0, (LPARAM)lplf); else *lplf = m_lf; } // works only when the dialog is dislayed or before void SetLogFont(LPLOGFONT lplf) { ATLASSERT(lplf != NULL); if(m_hWnd != NULL) { ::SendMessage(m_hWnd, WM_CHOOSEFONT_SETLOGFONT, 0, (LPARAM)lplf); } else { m_lf = *lplf; m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; } } void SetFlags(DWORD dwFlags) { if(m_hWnd != NULL) { CHOOSEFONT cf = { sizeof(CHOOSEFONT) }; cf.Flags = dwFlags; ::SendMessage(m_hWnd, WM_CHOOSEFONT_SETFLAGS, 0, (LPARAM)&cf); } else { m_cf.Flags = dwFlags; } } // Helpers for parsing information after successful return LPCTSTR GetFaceName() const // return the face name of the font { return (LPCTSTR)m_cf.lpLogFont->lfFaceName; } LPCTSTR GetStyleName() const // return the style name of the font { return m_cf.lpszStyle; } int GetSize() const // return the pt size of the font { return m_cf.iPointSize; } COLORREF GetColor() const // return the color of the font { return m_cf.rgbColors; } int GetWeight() const // return the chosen font weight { return (int)m_cf.lpLogFont->lfWeight; } BOOL IsStrikeOut() const // return TRUE if strikeout { return (m_cf.lpLogFont->lfStrikeOut) ? TRUE : FALSE; } BOOL IsUnderline() const // return TRUE if underline { return (m_cf.lpLogFont->lfUnderline) ? TRUE : FALSE; } BOOL IsBold() const // return TRUE if bold font { return (m_cf.lpLogFont->lfWeight == FW_BOLD) ? TRUE : FALSE; } BOOL IsItalic() const // return TRUE if italic font { return m_cf.lpLogFont->lfItalic ? TRUE : FALSE; } }; class CFontDialog : public CFontDialogImpl { public: CFontDialog(LPLOGFONT lplfInitial = NULL, DWORD dwFlags = CF_EFFECTS | CF_SCREENFONTS, HDC hDCPrinter = NULL, HWND hWndParent = NULL) : CFontDialogImpl(lplfInitial, dwFlags, hDCPrinter, hWndParent) { } DECLARE_EMPTY_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CRichEditFontDialogImpl - font selection for the Rich Edit ctrl #ifdef _RICHEDIT_ template class ATL_NO_VTABLE CRichEditFontDialogImpl : public CFontDialogImpl< T > { public: CRichEditFontDialogImpl(const CHARFORMAT& charformat, DWORD dwFlags = CF_SCREENFONTS, HDC hDCPrinter = NULL, HWND hWndParent = NULL) : CFontDialogImpl< T >(NULL, dwFlags, hDCPrinter, hWndParent) { this->m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; this->m_cf.Flags |= FillInLogFont(charformat); this->m_cf.lpLogFont = &this->m_lf; if((charformat.dwMask & CFM_COLOR) != 0) this->m_cf.rgbColors = charformat.crTextColor; } void GetCharFormat(CHARFORMAT& cf) const { USES_CONVERSION; cf.dwEffects = 0; cf.dwMask = 0; if((this->m_cf.Flags & CF_NOSTYLESEL) == 0) { cf.dwMask |= CFM_BOLD | CFM_ITALIC; cf.dwEffects |= this->IsBold() ? CFE_BOLD : 0; cf.dwEffects |= this->IsItalic() ? CFE_ITALIC : 0; } if((this->m_cf.Flags & CF_NOSIZESEL) == 0) { cf.dwMask |= CFM_SIZE; // GetSize() returns in tenths of points so mulitply by 2 to get twips cf.yHeight = this->GetSize() * 2; } if((this->m_cf.Flags & CF_NOFACESEL) == 0) { cf.dwMask |= CFM_FACE; cf.bPitchAndFamily = this->m_cf.lpLogFont->lfPitchAndFamily; ATL::Checked::tcscpy_s(cf.szFaceName, _countof(cf.szFaceName), this->GetFaceName()); } if((this->m_cf.Flags & CF_EFFECTS) != 0) { cf.dwMask |= CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR; cf.dwEffects |= this->IsUnderline() ? CFE_UNDERLINE : 0; cf.dwEffects |= this->IsStrikeOut() ? CFE_STRIKEOUT : 0; cf.crTextColor = this->GetColor(); } if((this->m_cf.Flags & CF_NOSCRIPTSEL) == 0) { cf.bCharSet = this->m_cf.lpLogFont->lfCharSet; cf.dwMask |= CFM_CHARSET; } cf.yOffset = 0; } DWORD FillInLogFont(const CHARFORMAT& cf) { USES_CONVERSION; DWORD dwFlags = 0; if((cf.dwMask & CFM_SIZE) != 0) { HDC hDC = ::CreateDC(_T("DISPLAY"), NULL, NULL, NULL); LONG yPerInch = ::GetDeviceCaps(hDC, LOGPIXELSY); this->m_lf.lfHeight = -(int)((cf.yHeight * yPerInch) / 1440); } else this->m_lf.lfHeight = 0; this->m_lf.lfWidth = 0; this->m_lf.lfEscapement = 0; this->m_lf.lfOrientation = 0; if((cf.dwMask & (CFM_ITALIC | CFM_BOLD)) == (CFM_ITALIC | CFM_BOLD)) { this->m_lf.lfWeight = ((cf.dwEffects & CFE_BOLD) != 0) ? FW_BOLD : FW_NORMAL; this->m_lf.lfItalic = (BYTE)(((cf.dwEffects & CFE_ITALIC) != 0) ? TRUE : FALSE); } else { dwFlags |= CF_NOSTYLESEL; this->m_lf.lfWeight = FW_DONTCARE; this->m_lf.lfItalic = FALSE; } if((cf.dwMask & (CFM_UNDERLINE | CFM_STRIKEOUT | CFM_COLOR)) == (CFM_UNDERLINE|CFM_STRIKEOUT|CFM_COLOR)) { dwFlags |= CF_EFFECTS; this->m_lf.lfUnderline = (BYTE)(((cf.dwEffects & CFE_UNDERLINE) != 0) ? TRUE : FALSE); this->m_lf.lfStrikeOut = (BYTE)(((cf.dwEffects & CFE_STRIKEOUT) != 0) ? TRUE : FALSE); } else { this->m_lf.lfUnderline = (BYTE)FALSE; this->m_lf.lfStrikeOut = (BYTE)FALSE; } if((cf.dwMask & CFM_CHARSET) != 0) this->m_lf.lfCharSet = cf.bCharSet; else dwFlags |= CF_NOSCRIPTSEL; this->m_lf.lfOutPrecision = OUT_DEFAULT_PRECIS; this->m_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; this->m_lf.lfQuality = DEFAULT_QUALITY; if((cf.dwMask & CFM_FACE) != 0) { this->m_lf.lfPitchAndFamily = cf.bPitchAndFamily; ATL::Checked::tcscpy_s(this->m_lf.lfFaceName, _countof(this->m_lf.lfFaceName), cf.szFaceName); } else { this->m_lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; this->m_lf.lfFaceName[0] = (TCHAR)0; } return dwFlags; } }; class CRichEditFontDialog : public CRichEditFontDialogImpl { public: CRichEditFontDialog(const CHARFORMAT& charformat, DWORD dwFlags = CF_SCREENFONTS, HDC hDCPrinter = NULL, HWND hWndParent = NULL) : CRichEditFontDialogImpl(charformat, dwFlags, hDCPrinter, hWndParent) { } DECLARE_EMPTY_MSG_MAP() }; #endif // _RICHEDIT_ /////////////////////////////////////////////////////////////////////////////// // CColorDialogImpl - color selection template class ATL_NO_VTABLE CColorDialogImpl : public CCommonDialogImplBase { public: CHOOSECOLOR m_cc; // Constructor CColorDialogImpl(COLORREF clrInit = 0, DWORD dwFlags = 0, HWND hWndParent = NULL) { memset(&m_cc, 0, sizeof(m_cc)); m_cc.lStructSize = sizeof(m_cc); m_cc.lpCustColors = GetCustomColors(); m_cc.hwndOwner = hWndParent; m_cc.Flags = dwFlags | CC_ENABLEHOOK; m_cc.lpfnHook = (LPCCHOOKPROC)T::HookProc; if(clrInit != 0) { m_cc.rgbResult = clrInit; m_cc.Flags |= CC_RGBINIT; } } // Operations INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { ATLASSERT((m_cc.Flags & CC_ENABLEHOOK) != 0); ATLASSERT(m_cc.lpfnHook != NULL); // can still be a user hook if(m_cc.hwndOwner == NULL) // set only if not specified before m_cc.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRetTh = m_thunk.Init(NULL, NULL); if(bRetTh == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return -1; } ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); BOOL bRet = ::ChooseColor(&m_cc); m_hWnd = NULL; return bRet ? IDOK : IDCANCEL; } // Set the current color while dialog is displayed void SetCurrentColor(COLORREF clr) { ATLASSERT(::IsWindow(m_hWnd)); SendMessage(_GetSetRGBMessage(), 0, (LPARAM)clr); } // Get the selected color after DoModal returns, or in OnColorOK COLORREF GetColor() const { return m_cc.rgbResult; } // Special override for the color dialog static UINT_PTR APIENTRY HookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if((uMsg != WM_INITDIALOG) && (uMsg != _GetColorOKMessage())) return 0; LPCHOOSECOLOR lpCC = (LPCHOOSECOLOR)lParam; CCommonDialogImplBase* pT = NULL; if(uMsg == WM_INITDIALOG) { pT = (CCommonDialogImplBase*)ModuleHelper::ExtractCreateWndData(); lpCC->lCustData = (LPARAM)pT; ATLASSERT(pT != NULL); ATLASSERT(pT->m_hWnd == NULL); ATLASSERT(::IsWindow(hWnd)); // subclass dialog's window if(!pT->SubclassWindow(hWnd)) { ATLTRACE2(atlTraceUI, 0, _T("Subclassing a Color common dialog failed\n")); return 0; } } else if(uMsg == _GetColorOKMessage()) { pT = (CCommonDialogImplBase*)lpCC->lCustData; ATLASSERT(pT != NULL); ATLASSERT(::IsWindow(pT->m_hWnd)); } else { ATLASSERT(FALSE); return 0; } // pass to the message map LRESULT lRes = 0; if(pT->ProcessWindowMessage(pT->m_hWnd, uMsg, wParam, lParam, lRes, 0) == FALSE) return 0; return lRes; } // Helpers static COLORREF* GetCustomColors() { static COLORREF rgbCustomColors[16] = { RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), RGB(255, 255, 255), }; return rgbCustomColors; } static UINT _GetSetRGBMessage() { static UINT uSetRGBMessage = 0; if(uSetRGBMessage == 0) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CColorDialogImpl::_GetSetRGBMessage.\n")); ATLASSERT(FALSE); return 0; } if(uSetRGBMessage == 0) uSetRGBMessage = ::RegisterWindowMessage(SETRGBSTRING); lock.Unlock(); } ATLASSERT(uSetRGBMessage != 0); return uSetRGBMessage; } static UINT _GetColorOKMessage() { static UINT uColorOKMessage = 0; if(uColorOKMessage == 0) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CColorDialogImpl::_GetColorOKMessage.\n")); ATLASSERT(FALSE); return 0; } if(uColorOKMessage == 0) uColorOKMessage = ::RegisterWindowMessage(COLOROKSTRING); lock.Unlock(); } ATLASSERT(uColorOKMessage != 0); return uColorOKMessage; } // Message map and handlers BEGIN_MSG_MAP(CColorDialogImpl) MESSAGE_HANDLER(_GetColorOKMessage(), _OnColorOK) END_MSG_MAP() LRESULT _OnColorOK(UINT, WPARAM, LPARAM, BOOL&) { T* pT = static_cast(this); return pT->OnColorOK(); } // Overrideable BOOL OnColorOK() // validate color { return FALSE; } }; class CColorDialog : public CColorDialogImpl { public: CColorDialog(COLORREF clrInit = 0, DWORD dwFlags = 0, HWND hWndParent = NULL) : CColorDialogImpl(clrInit, dwFlags, hWndParent) { } // override base class map and references to handlers DECLARE_EMPTY_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CPrintDialogImpl - used for Print... and PrintSetup... // global helper static inline HDC _AtlCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode) { if(hDevNames == NULL) return NULL; LPDEVNAMES lpDevNames = (LPDEVNAMES)::GlobalLock(hDevNames); LPDEVMODE lpDevMode = (hDevMode != NULL) ? (LPDEVMODE)::GlobalLock(hDevMode) : NULL; if(lpDevNames == NULL) return NULL; HDC hDC = ::CreateDC((LPCTSTR)lpDevNames + lpDevNames->wDriverOffset, (LPCTSTR)lpDevNames + lpDevNames->wDeviceOffset, (LPCTSTR)lpDevNames + lpDevNames->wOutputOffset, lpDevMode); ::GlobalUnlock(hDevNames); if(hDevMode != NULL) ::GlobalUnlock(hDevMode); return hDC; } #pragma warning(push) #pragma warning(disable: 4512) // assignment operator could not be generated template class ATL_NO_VTABLE CPrintDialogImpl : public CCommonDialogImplBase { public: // print dialog parameter block (note this is a reference) PRINTDLG& m_pd; // Constructors CPrintDialogImpl(BOOL bPrintSetupOnly = FALSE, // TRUE for Print Setup, FALSE for Print Dialog DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION, HWND hWndParent = NULL) : m_pd(m_pdActual) { memset(&m_pdActual, 0, sizeof(m_pdActual)); m_pd.lStructSize = sizeof(m_pdActual); m_pd.hwndOwner = hWndParent; m_pd.Flags = (dwFlags | PD_ENABLEPRINTHOOK | PD_ENABLESETUPHOOK); m_pd.lpfnPrintHook = (LPPRINTHOOKPROC)T::HookProc; m_pd.lpfnSetupHook = (LPSETUPHOOKPROC)T::HookProc; if(bPrintSetupOnly) m_pd.Flags |= PD_PRINTSETUP; else m_pd.Flags |= PD_RETURNDC; m_pd.Flags &= ~PD_RETURNIC; // do not support information context } // Operations INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { ATLASSERT((m_pd.Flags & PD_ENABLEPRINTHOOK) != 0); ATLASSERT((m_pd.Flags & PD_ENABLESETUPHOOK) != 0); ATLASSERT(m_pd.lpfnPrintHook != NULL); // can still be a user hook ATLASSERT(m_pd.lpfnSetupHook != NULL); // can still be a user hook ATLASSERT((m_pd.Flags & PD_RETURNDEFAULT) == 0); // use GetDefaults for this if(m_pd.hwndOwner == NULL) // set only if not specified before m_pd.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRetTh = m_thunk.Init(NULL, NULL); if(bRetTh == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return -1; } ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); BOOL bRet = ::PrintDlg(&m_pd); m_hWnd = NULL; return bRet ? IDOK : IDCANCEL; } // GetDefaults will not display a dialog but will get device defaults BOOL GetDefaults() { m_pd.Flags |= PD_RETURNDEFAULT; ATLASSERT(m_pd.hDevMode == NULL); // must be NULL ATLASSERT(m_pd.hDevNames == NULL); // must be NULL return ::PrintDlg(&m_pd); } // Helpers for parsing information after successful return num. copies requested int GetCopies() const { if((m_pd.Flags & PD_USEDEVMODECOPIES) != 0) { LPDEVMODE lpDevMode = GetDevMode(); return (lpDevMode != NULL) ? lpDevMode->dmCopies : -1; } return m_pd.nCopies; } BOOL PrintCollate() const // TRUE if collate checked { return ((m_pd.Flags & PD_COLLATE) != 0) ? TRUE : FALSE; } BOOL PrintSelection() const // TRUE if printing selection { return ((m_pd.Flags & PD_SELECTION) != 0) ? TRUE : FALSE; } BOOL PrintAll() const // TRUE if printing all pages { return (!PrintRange() && !PrintSelection()) ? TRUE : FALSE; } BOOL PrintRange() const // TRUE if printing page range { return ((m_pd.Flags & PD_PAGENUMS) != 0) ? TRUE : FALSE; } BOOL PrintToFile() const // TRUE if printing to a file { return ((m_pd.Flags & PD_PRINTTOFILE) != 0) ? TRUE : FALSE; } int GetFromPage() const // starting page if valid { return PrintRange() ? m_pd.nFromPage : -1; } int GetToPage() const // ending page if valid { return PrintRange() ? m_pd.nToPage : -1; } LPDEVMODE GetDevMode() const // return DEVMODE { if(m_pd.hDevMode == NULL) return NULL; return (LPDEVMODE)::GlobalLock(m_pd.hDevMode); } LPCTSTR GetDriverName() const // return driver name { if(m_pd.hDevNames == NULL) return NULL; LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); if(lpDev == NULL) return NULL; return (LPCTSTR)lpDev + lpDev->wDriverOffset; } LPCTSTR GetDeviceName() const // return device name { if(m_pd.hDevNames == NULL) return NULL; LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); if(lpDev == NULL) return NULL; return (LPCTSTR)lpDev + lpDev->wDeviceOffset; } LPCTSTR GetPortName() const // return output port name { if(m_pd.hDevNames == NULL) return NULL; LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pd.hDevNames); if(lpDev == NULL) return NULL; return (LPCTSTR)lpDev + lpDev->wOutputOffset; } HDC GetPrinterDC() const // return HDC (caller must delete) { ATLASSERT((m_pd.Flags & PD_RETURNDC) != 0); return m_pd.hDC; } // This helper creates a DC based on the DEVNAMES and DEVMODE structures. // This DC is returned, but also stored in m_pd.hDC as though it had been // returned by CommDlg. It is assumed that any previously obtained DC // has been/will be deleted by the user. This may be // used without ever invoking the print/print setup dialogs. HDC CreatePrinterDC() { m_pd.hDC = _AtlCreateDC(m_pd.hDevNames, m_pd.hDevMode); return m_pd.hDC; } // Implementation PRINTDLG m_pdActual; // the Print/Print Setup need to share this // The following handle the case of print setup... from the print dialog CPrintDialogImpl(PRINTDLG& pdInit) : m_pd(pdInit) { memset(&m_pdActual, 0, sizeof(m_pdActual)); } BEGIN_MSG_MAP(CPrintDialogImpl) #ifdef psh1 COMMAND_ID_HANDLER(psh1, OnPrintSetup) // print setup button when print is displayed #else // !psh1 COMMAND_ID_HANDLER(0x0400, OnPrintSetup) // value from dlgs.h #endif // !psh1 END_MSG_MAP() LRESULT OnPrintSetup(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& /*bHandled*/) { T dlgSetup(m_pd); ModuleHelper::AddCreateWndData(&dlgSetup.m_thunk.cd, (CCommonDialogImplBase*)&dlgSetup); return DefWindowProc(WM_COMMAND, MAKEWPARAM(wID, wNotifyCode), (LPARAM)hWndCtl); } }; class CPrintDialog : public CPrintDialogImpl { public: CPrintDialog(BOOL bPrintSetupOnly = FALSE, DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION, HWND hWndParent = NULL) : CPrintDialogImpl(bPrintSetupOnly, dwFlags, hWndParent) { } CPrintDialog(PRINTDLG& pdInit) : CPrintDialogImpl(pdInit) { } }; #pragma warning(pop) /////////////////////////////////////////////////////////////////////////////// // CPrintDialogExImpl - new print dialog for Windows 2000 } // namespace WTL #include extern "C" const __declspec(selectany) IID IID_IPrintDialogCallback = {0x5852a2c3, 0x6530, 0x11d1, {0xb6, 0xa3, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9}}; extern "C" const __declspec(selectany) IID IID_IPrintDialogServices = {0x509aaeda, 0x5639, 0x11d1, {0xb6, 0xa1, 0x0, 0x0, 0xf8, 0x75, 0x7b, 0xf9}}; namespace WTL { template class ATL_NO_VTABLE CPrintDialogExImpl : public ATL::CWindow, public ATL::CMessageMap, public IPrintDialogCallback, public ATL::IObjectWithSiteImpl< T > { public: PRINTDLGEX m_pdex; // Constructor CPrintDialogExImpl(DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION | PD_NOCURRENTPAGE, HWND hWndParent = NULL) { memset(&m_pdex, 0, sizeof(m_pdex)); m_pdex.lStructSize = sizeof(PRINTDLGEX); m_pdex.hwndOwner = hWndParent; m_pdex.Flags = dwFlags; m_pdex.nStartPage = START_PAGE_GENERAL; // callback object will be set in DoModal m_pdex.Flags &= ~PD_RETURNIC; // do not support information context } // Operations HRESULT DoModal(HWND hWndParent = ::GetActiveWindow()) { ATLASSERT(m_hWnd == NULL); ATLASSERT((m_pdex.Flags & PD_RETURNDEFAULT) == 0); // use GetDefaults for this if(m_pdex.hwndOwner == NULL) // set only if not specified before m_pdex.hwndOwner = hWndParent; T* pT = static_cast(this); m_pdex.lpCallback = (IUnknown*)(IPrintDialogCallback*)pT; HRESULT hResult = ::PrintDlgEx(&m_pdex); m_hWnd = NULL; return hResult; } BOOL EndDialog(INT_PTR /*nRetCode*/ = 0) { ATLASSERT(::IsWindow(m_hWnd)); SendMessage(WM_COMMAND, MAKEWPARAM(IDABORT, 0)); return TRUE; } // GetDefaults will not display a dialog but will get device defaults HRESULT GetDefaults() { ATLASSERT(m_pdex.hDevMode == NULL); // must be NULL ATLASSERT(m_pdex.hDevNames == NULL); // must be NULL if(m_pdex.hwndOwner == NULL) // set only if not specified before m_pdex.hwndOwner = ::GetActiveWindow(); m_pdex.Flags |= PD_RETURNDEFAULT; HRESULT hRet = ::PrintDlgEx(&m_pdex); m_pdex.Flags &= ~PD_RETURNDEFAULT; return hRet; } // Helpers for parsing information after successful return num. copies requested int GetCopies() const { if((m_pdex.Flags & PD_USEDEVMODECOPIES) != 0) { LPDEVMODE lpDevMode = GetDevMode(); return (lpDevMode != NULL) ? lpDevMode->dmCopies : -1; } return m_pdex.nCopies; } BOOL PrintCollate() const // TRUE if collate checked { return ((m_pdex.Flags & PD_COLLATE) != 0) ? TRUE : FALSE; } BOOL PrintSelection() const // TRUE if printing selection { return ((m_pdex.Flags & PD_SELECTION) != 0) ? TRUE : FALSE; } BOOL PrintAll() const // TRUE if printing all pages { return (!PrintRange() && !PrintSelection()) ? TRUE : FALSE; } BOOL PrintRange() const // TRUE if printing page range { return ((m_pdex.Flags & PD_PAGENUMS) != 0) ? TRUE : FALSE; } BOOL PrintToFile() const // TRUE if printing to a file { return ((m_pdex.Flags & PD_PRINTTOFILE) != 0) ? TRUE : FALSE; } LPDEVMODE GetDevMode() const // return DEVMODE { if(m_pdex.hDevMode == NULL) return NULL; return (LPDEVMODE)::GlobalLock(m_pdex.hDevMode); } LPCTSTR GetDriverName() const // return driver name { if(m_pdex.hDevNames == NULL) return NULL; LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); if(lpDev == NULL) return NULL; return (LPCTSTR)lpDev + lpDev->wDriverOffset; } LPCTSTR GetDeviceName() const // return device name { if(m_pdex.hDevNames == NULL) return NULL; LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); if(lpDev == NULL) return NULL; return (LPCTSTR)lpDev + lpDev->wDeviceOffset; } LPCTSTR GetPortName() const // return output port name { if(m_pdex.hDevNames == NULL) return NULL; LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_pdex.hDevNames); if(lpDev == NULL) return NULL; return (LPCTSTR)lpDev + lpDev->wOutputOffset; } HDC GetPrinterDC() const // return HDC (caller must delete) { ATLASSERT((m_pdex.Flags & PD_RETURNDC) != 0); return m_pdex.hDC; } // This helper creates a DC based on the DEVNAMES and DEVMODE structures. // This DC is returned, but also stored in m_pdex.hDC as though it had been // returned by CommDlg. It is assumed that any previously obtained DC // has been/will be deleted by the user. This may be // used without ever invoking the print/print setup dialogs. HDC CreatePrinterDC() { m_pdex.hDC = _AtlCreateDC(m_pdex.hDevNames, m_pdex.hDevMode); return m_pdex.hDC; } // Implementation - interfaces // IUnknown STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject) { if(ppvObject == NULL) return E_POINTER; T* pT = static_cast(this); if(IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IPrintDialogCallback)) { *ppvObject = (IPrintDialogCallback*)pT; // AddRef() not needed return S_OK; } else if(IsEqualGUID(riid, IID_IObjectWithSite)) { *ppvObject = (IObjectWithSite*)pT; // AddRef() not needed return S_OK; } return E_NOINTERFACE; } virtual ULONG STDMETHODCALLTYPE AddRef() { return 1; } virtual ULONG STDMETHODCALLTYPE Release() { return 1; } // IPrintDialogCallback STDMETHOD(InitDone)() { return S_FALSE; } STDMETHOD(SelectionChange)() { return S_FALSE; } STDMETHOD(HandleMessage)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* plResult) { // set up m_hWnd the first time if(m_hWnd == NULL) Attach(hWnd); // call message map HRESULT hRet = ProcessWindowMessage(hWnd, uMsg, wParam, lParam, *plResult, 0) ? S_OK : S_FALSE; if((hRet == S_OK) && (uMsg == WM_NOTIFY)) // return in DWLP_MSGRESULT ::SetWindowLongPtr(GetParent(), DWLP_MSGRESULT, (LONG_PTR)*plResult); if((uMsg == WM_INITDIALOG) && (hRet == S_OK) && ((BOOL)*plResult != FALSE)) hRet = S_FALSE; return hRet; } }; class CPrintDialogEx : public CPrintDialogExImpl { public: CPrintDialogEx( DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_NOSELECTION | PD_NOCURRENTPAGE, HWND hWndParent = NULL) : CPrintDialogExImpl(dwFlags, hWndParent) { } DECLARE_EMPTY_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CPageSetupDialogImpl - Page Setup dialog template class ATL_NO_VTABLE CPageSetupDialogImpl : public CCommonDialogImplBase { public: PAGESETUPDLG m_psd; ATL::CWndProcThunk m_thunkPaint; // Constructors CPageSetupDialogImpl(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE, HWND hWndParent = NULL) { memset(&m_psd, 0, sizeof(m_psd)); m_psd.lStructSize = sizeof(m_psd); m_psd.hwndOwner = hWndParent; m_psd.Flags = (dwFlags | PSD_ENABLEPAGESETUPHOOK | PSD_ENABLEPAGEPAINTHOOK); m_psd.lpfnPageSetupHook = (LPPAGESETUPHOOK)T::HookProc; m_thunkPaint.Init((WNDPROC)T::PaintHookProc, this); m_psd.lpfnPagePaintHook = (LPPAGEPAINTHOOK)m_thunkPaint.GetWNDPROC(); } DECLARE_EMPTY_MSG_MAP() // Attributes LPDEVMODE GetDevMode() const // return DEVMODE { if(m_psd.hDevMode == NULL) return NULL; return (LPDEVMODE)::GlobalLock(m_psd.hDevMode); } LPCTSTR GetDriverName() const // return driver name { if(m_psd.hDevNames == NULL) return NULL; LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); return (LPCTSTR)lpDev + lpDev->wDriverOffset; } LPCTSTR GetDeviceName() const // return device name { if(m_psd.hDevNames == NULL) return NULL; LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); return (LPCTSTR)lpDev + lpDev->wDeviceOffset; } LPCTSTR GetPortName() const // return output port name { if(m_psd.hDevNames == NULL) return NULL; LPDEVNAMES lpDev = (LPDEVNAMES)::GlobalLock(m_psd.hDevNames); return (LPCTSTR)lpDev + lpDev->wOutputOffset; } HDC CreatePrinterDC() { return _AtlCreateDC(m_psd.hDevNames, m_psd.hDevMode); } SIZE GetPaperSize() const { SIZE size = { m_psd.ptPaperSize.x, m_psd.ptPaperSize.y }; return size; } void GetMargins(LPRECT lpRectMargins, LPRECT lpRectMinMargins) const { if(lpRectMargins != NULL) *lpRectMargins = m_psd.rtMargin; if(lpRectMinMargins != NULL) *lpRectMinMargins = m_psd.rtMinMargin; } // Operations INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { ATLASSERT((m_psd.Flags & PSD_ENABLEPAGESETUPHOOK) != 0); ATLASSERT((m_psd.Flags & PSD_ENABLEPAGEPAINTHOOK) != 0); ATLASSERT(m_psd.lpfnPageSetupHook != NULL); // can still be a user hook ATLASSERT(m_psd.lpfnPagePaintHook != NULL); // can still be a user hook if(m_psd.hwndOwner == NULL) // set only if not specified before m_psd.hwndOwner = hWndParent; ATLASSERT(m_hWnd == NULL); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRetTh = m_thunk.Init(NULL, NULL); if(bRetTh == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return -1; } ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); BOOL bRet = ::PageSetupDlg(&m_psd); m_hWnd = NULL; return bRet ? IDOK : IDCANCEL; } // Implementation static UINT_PTR CALLBACK PaintHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { T* pT = (T*)hWnd; UINT_PTR uRet = 0; switch(uMsg) { case WM_PSD_PAGESETUPDLG: uRet = pT->PreDrawPage(LOWORD(wParam), HIWORD(wParam), (LPPAGESETUPDLG)lParam); break; case WM_PSD_FULLPAGERECT: case WM_PSD_MINMARGINRECT: case WM_PSD_MARGINRECT: case WM_PSD_GREEKTEXTRECT: case WM_PSD_ENVSTAMPRECT: case WM_PSD_YAFULLPAGERECT: uRet = pT->OnDrawPage(uMsg, (HDC)wParam, (LPRECT)lParam); break; default: ATLTRACE2(atlTraceUI, 0, _T("CPageSetupDialogImpl::PaintHookProc - unknown message received\n")); break; } return uRet; } // Overridables UINT_PTR PreDrawPage(WORD /*wPaper*/, WORD /*wFlags*/, LPPAGESETUPDLG /*pPSD*/) { // return 1 to prevent any more drawing return 0; } UINT_PTR OnDrawPage(UINT /*uMsg*/, HDC /*hDC*/, LPRECT /*lpRect*/) { return 0; // do the default } }; class CPageSetupDialog : public CPageSetupDialogImpl { public: CPageSetupDialog(DWORD dwFlags = PSD_MARGINS | PSD_INWININIINTLMEASURE, HWND hWndParent = NULL) : CPageSetupDialogImpl(dwFlags, hWndParent) { } // override PaintHookProc and references to handlers static UINT_PTR CALLBACK PaintHookProc(HWND, UINT, WPARAM, LPARAM) { return 0; } }; /////////////////////////////////////////////////////////////////////////////// // CFindReplaceDialogImpl - Find/FindReplace modeless dialogs template class ATL_NO_VTABLE CFindReplaceDialogImpl : public CCommonDialogImplBase { public: enum { _cchFindReplaceBuffer = 128 }; FINDREPLACE m_fr; TCHAR m_szFindWhat[_cchFindReplaceBuffer]; TCHAR m_szReplaceWith[_cchFindReplaceBuffer]; // Constructors CFindReplaceDialogImpl() { memset(&m_fr, 0, sizeof(m_fr)); m_szFindWhat[0] = _T('\0'); m_szReplaceWith[0] = _T('\0'); m_fr.lStructSize = sizeof(m_fr); m_fr.Flags = FR_ENABLEHOOK; m_fr.lpfnHook = (LPFRHOOKPROC)T::HookProc; m_fr.lpstrFindWhat = (LPTSTR)m_szFindWhat; m_fr.wFindWhatLen = _cchFindReplaceBuffer; m_fr.lpstrReplaceWith = (LPTSTR)m_szReplaceWith; m_fr.wReplaceWithLen = _cchFindReplaceBuffer; } // Note: You must allocate the object on the heap. // If you do not, you must override OnFinalMessage() virtual void OnFinalMessage(HWND /*hWnd*/) { delete this; } HWND Create(BOOL bFindDialogOnly, // TRUE for Find, FALSE for FindReplace LPCTSTR lpszFindWhat, LPCTSTR lpszReplaceWith = NULL, DWORD dwFlags = FR_DOWN, HWND hWndParent = NULL) { ATLASSERT((m_fr.Flags & FR_ENABLEHOOK) != 0); ATLASSERT(m_fr.lpfnHook != NULL); m_fr.Flags |= dwFlags; if(hWndParent == NULL) m_fr.hwndOwner = ::GetActiveWindow(); else m_fr.hwndOwner = hWndParent; ATLASSERT(m_fr.hwndOwner != NULL); // must have an owner for modeless dialog if(lpszFindWhat != NULL) ATL::Checked::tcsncpy_s(m_szFindWhat, _countof(m_szFindWhat), lpszFindWhat, _TRUNCATE); if(lpszReplaceWith != NULL) ATL::Checked::tcsncpy_s(m_szReplaceWith, _countof(m_szReplaceWith), lpszReplaceWith, _TRUNCATE); ATLASSERT(m_hWnd == NULL); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRet = m_thunk.Init(NULL, NULL); if(bRet == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return NULL; } ModuleHelper::AddCreateWndData(&m_thunk.cd, (CCommonDialogImplBase*)this); HWND hWnd = NULL; if(bFindDialogOnly) hWnd = ::FindText(&m_fr); else hWnd = ::ReplaceText(&m_fr); ATLASSERT(m_hWnd == hWnd); return hWnd; } static UINT GetFindReplaceMsg() { static const UINT nMsgFindReplace = ::RegisterWindowMessage(FINDMSGSTRING); return nMsgFindReplace; } // call while handling FINDMSGSTRING registered message // to retreive the object static T* PASCAL GetNotifier(LPARAM lParam) { ATLASSERT(lParam != NULL); T* pDlg = (T*)(lParam - offsetof(T, m_fr)); return pDlg; } // Operations // Helpers for parsing information after successful return LPCTSTR GetFindString() const // get find string { return (LPCTSTR)m_fr.lpstrFindWhat; } LPCTSTR GetReplaceString() const // get replacement string { return (LPCTSTR)m_fr.lpstrReplaceWith; } BOOL SearchDown() const // TRUE if search down, FALSE is up { return ((m_fr.Flags & FR_DOWN) != 0) ? TRUE : FALSE; } BOOL FindNext() const // TRUE if command is find next { return ((m_fr.Flags & FR_FINDNEXT) != 0) ? TRUE : FALSE; } BOOL MatchCase() const // TRUE if matching case { return ((m_fr.Flags & FR_MATCHCASE) != 0) ? TRUE : FALSE; } BOOL MatchWholeWord() const // TRUE if matching whole words only { return ((m_fr.Flags & FR_WHOLEWORD) != 0) ? TRUE : FALSE; } BOOL ReplaceCurrent() const // TRUE if replacing current string { return ((m_fr. Flags & FR_REPLACE) != 0) ? TRUE : FALSE; } BOOL ReplaceAll() const // TRUE if replacing all occurrences { return ((m_fr.Flags & FR_REPLACEALL) != 0) ? TRUE : FALSE; } BOOL IsTerminating() const // TRUE if terminating dialog { return ((m_fr.Flags & FR_DIALOGTERM) != 0) ? TRUE : FALSE ; } }; class CFindReplaceDialog : public CFindReplaceDialogImpl { public: DECLARE_EMPTY_MSG_MAP() }; ///////////////////////////////////////////////////////////////////////// // CDialogBaseUnits - Dialog Units helper // class CDialogBaseUnits { public: SIZE m_sizeUnits; // Constructors CDialogBaseUnits() { // The base units of the out-dated System Font LONG nDlgBaseUnits = ::GetDialogBaseUnits(); m_sizeUnits.cx = LOWORD(nDlgBaseUnits); m_sizeUnits.cy = HIWORD(nDlgBaseUnits); } CDialogBaseUnits(HWND hWnd) { if(!InitDialogBaseUnits(hWnd)) { LONG nDlgBaseUnits = ::GetDialogBaseUnits(); m_sizeUnits.cx = LOWORD(nDlgBaseUnits); m_sizeUnits.cy = HIWORD(nDlgBaseUnits); } } CDialogBaseUnits(HFONT hFont, HWND hWnd = NULL) { if(!InitDialogBaseUnits(hFont, hWnd)) { LONG nDlgBaseUnits = ::GetDialogBaseUnits(); m_sizeUnits.cx = LOWORD(nDlgBaseUnits); m_sizeUnits.cy = HIWORD(nDlgBaseUnits); } } CDialogBaseUnits(const LOGFONT& lf, HWND hWnd = NULL) { if(!InitDialogBaseUnits(lf, hWnd)) { LONG nDlgBaseUnits = ::GetDialogBaseUnits(); m_sizeUnits.cx = LOWORD(nDlgBaseUnits); m_sizeUnits.cy = HIWORD(nDlgBaseUnits); } } // Operations BOOL InitDialogBaseUnits(HWND hWnd) { ATLASSERT(::IsWindow(hWnd)); RECT rc = { 0, 0, 4, 8 }; if(!::MapDialogRect(hWnd, &rc)) return FALSE; m_sizeUnits.cx = rc.right; m_sizeUnits.cy = rc.bottom; return TRUE; } BOOL InitDialogBaseUnits(const LOGFONT& lf, HWND hWnd = NULL) { CFont font; font.CreateFontIndirect(&lf); if(font.IsNull()) return FALSE; return InitDialogBaseUnits(font, hWnd); } BOOL InitDialogBaseUnits(HFONT hFont, HWND hWnd = NULL) { ATLASSERT(hFont != NULL); CWindowDC dc = hWnd; TEXTMETRIC tmText = {}; SIZE sizeText = {}; HFONT hFontOld = dc.SelectFont(hFont); dc.GetTextMetrics(&tmText); m_sizeUnits.cy = tmText.tmHeight + tmText.tmExternalLeading; dc.GetTextExtent(_T("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"), 52, &sizeText); m_sizeUnits.cx = (sizeText.cx + 26) / 52; dc.SelectFont(hFontOld); return TRUE; } SIZE GetDialogBaseUnits() const { return m_sizeUnits; } INT MapDialogPixelsX(INT x) const { return ::MulDiv(x, 4, m_sizeUnits.cx); // Pixels X to DLU } INT MapDialogPixelsY(INT y) const { return ::MulDiv(y, 8, m_sizeUnits.cy); // Pixels Y to DLU } POINT MapDialogPixels(POINT pt) const { POINT out = { MapDialogPixelsX(pt.x), MapDialogPixelsY(pt.y) }; return out; } SIZE MapDialogPixels(SIZE input) const { SIZE out = { MapDialogPixelsX(input.cx), MapDialogPixelsY(input.cy) }; return out; } RECT MapDialogPixels(const RECT& input) const { RECT out = { MapDialogPixelsX(input.left), MapDialogPixelsY(input.top), MapDialogPixelsX(input.right), MapDialogPixelsY(input.bottom) }; return out; } INT MapDialogUnitsX(INT x) const { return ::MulDiv(x, m_sizeUnits.cx, 4); // DLU to Pixels X } INT MapDialogUnitsY(INT y) const { return ::MulDiv(y, m_sizeUnits.cy, 8); // DLU to Pixels Y } POINT MapDialogUnits(POINT pt) const { POINT out = { MapDialogUnitsX(pt.x), MapDialogUnitsY(pt.y) }; return out; } SIZE MapDialogUnits(SIZE input) const { SIZE out = { MapDialogUnitsX(input.cx), MapDialogUnitsY(input.cy) }; return out; } RECT MapDialogUnits(const RECT& input) const { RECT out = { MapDialogUnitsX(input.left), MapDialogUnitsY(input.top), MapDialogUnitsX(input.right), MapDialogUnitsY(input.bottom) }; return out; } }; /////////////////////////////////////////////////////////////////////////////// // CMemDlgTemplate - in-memory dialog template - DLGTEMPLATE or DLGTEMPLATEEX // traits suitable for dialog controls typedef ATL::CWinTraits CDlgControlWinTraits; template class CMemDlgTemplateT { public: typedef ATL::_DialogSplitHelper::DLGTEMPLATEEX DLGTEMPLATEEX; typedef ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX DLGITEMTEMPLATEEX; enum StdCtrlType { CTRL_BUTTON = 0x0080, CTRL_EDIT = 0x0081, CTRL_STATIC = 0x0082, CTRL_LISTBOX = 0x0083, CTRL_SCROLLBAR = 0x0084, CTRL_COMBOBOX = 0x0085 }; HANDLE m_hData; LPBYTE m_pData; LPBYTE m_pPtr; SIZE_T m_cAllocated; CMemDlgTemplateT() : m_hData(NULL), m_pData(NULL), m_pPtr(NULL), m_cAllocated(0) { } ~CMemDlgTemplateT() { Reset(); } bool IsValid() const { return (m_pData != NULL); } bool IsTemplateEx() const { return (IsValid() && ((DLGTEMPLATEEX*)m_pData)->signature == 0xFFFF); } LPDLGTEMPLATE GetTemplatePtr() { return reinterpret_cast(m_pData); } DLGTEMPLATEEX* GetTemplateExPtr() { return reinterpret_cast(m_pData); } void Reset() { if (IsValid()) { ::GlobalUnlock(m_pData); ATLVERIFY(::GlobalFree(m_hData) == NULL); } m_hData = NULL; m_pData = NULL; m_pPtr = NULL; m_cAllocated = 0; } void Create(bool bDlgEx, LPCTSTR lpszCaption, const RECT& rc, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) { Create(bDlgEx, lpszCaption, (short) rc.left, (short) rc.top, (short) (rc.right - rc.left), (short) (rc.bottom - rc.top), dwStyle, dwExStyle, lpstrFontName, wFontSize, wWeight, bItalic, bCharset, dwHelpID, ClassName.m_lpstr, Menu.m_lpstr); } void Create(bool bDlgEx, LPCTSTR lpszCaption, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPCTSTR lpstrFontName = NULL, WORD wFontSize = 0, WORD wWeight = 0, BYTE bItalic = 0, BYTE bCharset = 0, DWORD dwHelpID = 0, ATL::_U_STRINGorID ClassName = 0U, ATL::_U_STRINGorID Menu = 0U) { // Should have DS_SETFONT style to set the dialog font name and size if (lpstrFontName != NULL) { dwStyle |= DS_SETFONT; } else { dwStyle &= ~DS_SETFONT; } if (bDlgEx) { DLGTEMPLATEEX dlg = {1, 0xFFFF, dwHelpID, dwExStyle, dwStyle, 0, nX, nY, nWidth, nHeight}; AddData(&dlg, sizeof(dlg)); } else { DLGTEMPLATE dlg = {dwStyle, dwExStyle, 0, nX, nY, nWidth, nHeight}; AddData(&dlg, sizeof(dlg)); } if (Menu.m_lpstr == NULL) { WORD menuData = 0; AddData(&menuData, sizeof(WORD)); } else if (IS_INTRESOURCE(Menu.m_lpstr)) { WORD menuData[] = { 0xFFFF, LOWORD(Menu.m_lpstr) }; AddData(menuData, sizeof(menuData)); } else { AddString(Menu.m_lpstr); } if (ClassName.m_lpstr == NULL) { WORD classData = 0; AddData(&classData, sizeof(WORD)); } else if (IS_INTRESOURCE(ClassName.m_lpstr)) { WORD classData[] = { 0xFFFF, LOWORD(ClassName.m_lpstr) }; AddData(classData, sizeof(classData)); } else { AddString(ClassName.m_lpstr); } // Set dialog caption AddString(lpszCaption); if (lpstrFontName != NULL) { AddData(&wFontSize, sizeof(wFontSize)); if (bDlgEx) { AddData(&wWeight, sizeof(wWeight)); AddData(&bItalic, sizeof(bItalic)); AddData(&bCharset, sizeof(bCharset)); } AddString(lpstrFontName); } } void AddControl(ATL::_U_STRINGorID ClassName, WORD wId, const RECT& rc, DWORD dwStyle, DWORD dwExStyle, ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) { AddControl(ClassName.m_lpstr, wId, (short) rc.left, (short) rc.top, (short) (rc.right - rc.left), (short) (rc.bottom - rc.top), dwStyle, dwExStyle, Text.m_lpstr, pCreationData, nCreationData, dwHelpID); } void AddControl(ATL::_U_STRINGorID ClassName, WORD wId, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle, DWORD dwExStyle, ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) { ATLASSERT(IsValid()); // DWORD align data const DWORD_PTR dwDwordAlignBits = sizeof(DWORD) - 1; m_pPtr = (LPBYTE)(((DWORD_PTR)m_pPtr + dwDwordAlignBits) & (~dwDwordAlignBits)); if (IsTemplateEx()) { DLGTEMPLATEEX* dlg = (DLGTEMPLATEEX*)m_pData; dlg->cDlgItems++; DLGITEMTEMPLATEEX item = {dwHelpID, TWinTraits::GetWndExStyle(0) | dwExStyle, TWinTraits::GetWndStyle(0) | dwStyle, nX, nY, nWidth, nHeight, wId}; AddData(&item, sizeof(item)); } else { LPDLGTEMPLATE dlg = (LPDLGTEMPLATE)m_pData; dlg->cdit++; DLGITEMTEMPLATE item = {TWinTraits::GetWndStyle(0) | dwStyle, TWinTraits::GetWndExStyle(0) | dwExStyle, nX, nY, nWidth, nHeight, wId}; AddData(&item, sizeof(item)); } ATLASSERT(ClassName.m_lpstr != NULL); if (IS_INTRESOURCE(ClassName.m_lpstr)) { WORD wData[] = { 0xFFFF, LOWORD(ClassName.m_lpstr) }; AddData(wData, sizeof(wData)); } else { AddString(ClassName.m_lpstr); } if (Text.m_lpstr == NULL) { WORD classData = 0; AddData(&classData, sizeof(WORD)); } else if (IS_INTRESOURCE(Text.m_lpstr)) { WORD wData[] = { 0xFFFF, LOWORD(Text.m_lpstr) }; AddData(wData, sizeof(wData)); } else { AddString(Text.m_lpstr); } AddData(&nCreationData, sizeof(nCreationData)); if ((nCreationData != 0)) { ATLASSERT(pCreationData != NULL); AddData(pCreationData, nCreationData * sizeof(WORD)); } } void AddStdControl(StdCtrlType CtrlType, WORD wId, short nX, short nY, short nWidth, short nHeight, DWORD dwStyle, DWORD dwExStyle, ATL::_U_STRINGorID Text, const WORD* pCreationData = NULL, WORD nCreationData = 0, DWORD dwHelpID = 0) { AddControl(CtrlType, wId, nX, nY, nWidth, nHeight, dwStyle, dwExStyle, Text, pCreationData, nCreationData, dwHelpID); } void AddData(LPCVOID pData, size_t nData) { ATLASSERT(pData != NULL); const SIZE_T ALLOCATION_INCREMENT = 1024; if (m_pData == NULL) { m_cAllocated = ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; m_hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, m_cAllocated); ATLASSERT(m_hData != NULL); m_pPtr = m_pData = static_cast(::GlobalLock(m_hData)); ATLASSERT(m_pData != NULL); } else if (((m_pPtr - m_pData) + nData) > m_cAllocated) { SIZE_T ptrPos = (m_pPtr - m_pData); m_cAllocated += ((nData / ALLOCATION_INCREMENT) + 1) * ALLOCATION_INCREMENT; ::GlobalUnlock(m_pData); m_hData = ::GlobalReAlloc(m_hData, m_cAllocated, GMEM_MOVEABLE | GMEM_ZEROINIT); ATLASSERT(m_hData != NULL); m_pData = static_cast(::GlobalLock(m_hData)); ATLASSERT(m_pData != NULL); m_pPtr = m_pData + ptrPos; } ATL::Checked::memcpy_s(m_pPtr, m_cAllocated - (m_pPtr - m_pData), pData, nData); m_pPtr += nData; } void AddString(LPCTSTR lpszStr) { if (lpszStr == NULL) { WCHAR szEmpty = 0; AddData(&szEmpty, sizeof(szEmpty)); } else { USES_CONVERSION; LPCWSTR lpstr = T2CW(lpszStr); int nSize = lstrlenW(lpstr) + 1; AddData(lpstr, nSize * sizeof(WCHAR)); } } }; typedef CMemDlgTemplateT CMemDlgTemplate; /////////////////////////////////////////////////////////////////////////////// // Dialog and control macros for indirect dialogs // for DLGTEMPLATE #define BEGIN_DIALOG(x, y, width, height) \ void DoInitTemplate() \ { \ bool bExTemplate = false; \ short nX = x, nY = y, nWidth = width, nHeight = height; \ LPCTSTR szCaption = NULL; \ DWORD dwStyle = WS_POPUP | WS_BORDER | WS_SYSMENU; \ DWORD dwExStyle = 0; \ LPCTSTR szFontName = NULL; \ WORD wFontSize = 0; \ WORD wWeight = 0; \ BYTE bItalic = 0; \ BYTE bCharset = 0; \ DWORD dwHelpID = 0; \ ATL::_U_STRINGorID Menu = 0U; \ ATL::_U_STRINGorID ClassName = 0U; // for DLGTEMPLATEEX #define BEGIN_DIALOG_EX(x, y, width, height, helpID) \ void DoInitTemplate() \ { \ bool bExTemplate = true; \ short nX = x, nY = y, nWidth = width, nHeight = height; \ LPCTSTR szCaption = NULL; \ DWORD dwStyle = WS_POPUP | WS_BORDER | WS_SYSMENU; \ DWORD dwExStyle = 0; \ LPCTSTR szFontName = NULL; \ WORD wFontSize = 0; \ WORD wWeight = 0; \ BYTE bItalic = 0; \ BYTE bCharset = 0; \ DWORD dwHelpID = helpID; \ ATL::_U_STRINGorID Menu = 0U; \ ATL::_U_STRINGorID ClassName = 0U; #define END_DIALOG() \ m_Template.Create(bExTemplate, szCaption, nX, nY, nWidth, nHeight, dwStyle, dwExStyle, szFontName, wFontSize, wWeight, bItalic, bCharset, dwHelpID, ClassName, Menu); \ } #define DIALOG_CAPTION(caption) \ szCaption = caption; #define DIALOG_STYLE(style) \ dwStyle = style; #define DIALOG_EXSTYLE(exStyle) \ dwExStyle = exStyle; #define DIALOG_FONT(pointSize, typeFace) \ wFontSize = pointSize; \ szFontName = typeFace; #define DIALOG_FONT_EX(pointsize, typeface, weight, italic, charset) \ ATLASSERT(bExTemplate); \ wFontSize = pointsize; \ szFontName = typeface; \ wWeight = weight; \ bItalic = italic; \ bCharset = charset; #define DIALOG_MENU(menuName) \ Menu = menuName; #define DIALOG_CLASS(className) \ ClassName = className; #define BEGIN_CONTROLS_MAP() \ void DoInitControls() \ { #define END_CONTROLS_MAP() \ } #define CONTROL_LTEXT(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_LEFT | WS_GROUP, exStyle, text, NULL, 0); #define CONTROL_CTEXT(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_CENTER | WS_GROUP, exStyle, text, NULL, 0); #define CONTROL_RTEXT(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_RIGHT | WS_GROUP, exStyle, text, NULL, 0); #define CONTROL_PUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_DEFPUSHBUTTON(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_DEFPUSHBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_PUSHBOX(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_PUSHBOX | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_STATE3(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_3STATE | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_AUTO3STATE(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTO3STATE | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_CHECKBOX(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_CHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_AUTOCHECKBOX(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTOCHECKBOX | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_RADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_RADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_AUTORADIOBUTTON(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_AUTORADIOBUTTON | WS_TABSTOP, exStyle, text, NULL, 0); #define CONTROL_COMBOBOX(id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_COMBOBOX, (WORD)id, x, y, width, height, style | CBS_DROPDOWN | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); #define CONTROL_EDITTEXT(id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_EDIT, (WORD)id, x, y, width, height, style | ES_LEFT | WS_BORDER | WS_TABSTOP, exStyle, (LPCTSTR)NULL, NULL, 0); #define CONTROL_GROUPBOX(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_BUTTON, (WORD)id, x, y, width, height, style | BS_GROUPBOX, exStyle, text, NULL, 0); #define CONTROL_LISTBOX(id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_LISTBOX, (WORD)id, x, y, width, height, style | LBS_NOTIFY | WS_BORDER, exStyle, (LPCTSTR)NULL, NULL, 0); #define CONTROL_SCROLLBAR(id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_SCROLLBAR, (WORD)id, x, y, width, height, style | SBS_HORZ, exStyle, (LPCTSTR)NULL, NULL, 0); #define CONTROL_ICON(text, id, x, y, width, height, style, exStyle) \ m_Template.AddStdControl(m_Template.CTRL_STATIC, (WORD)id, x, y, width, height, style | SS_ICON, exStyle, text, NULL, 0); #define CONTROL_CONTROL(text, id, className, style, x, y, width, height, exStyle) \ m_Template.AddControl(className, (WORD)id, x, y, width, height, style, exStyle, text, NULL, 0); /////////////////////////////////////////////////////////////////////////////// // CIndirectDialogImpl - dialogs with template in memory template class ATL_NO_VTABLE CIndirectDialogImpl : public ATL::CDialogImpl< T, TBase > { public: enum { IDD = 0 }; // no dialog template resource TDlgTemplate m_Template; void CreateTemplate() { T* pT = static_cast(this); pT->DoInitTemplate(); pT->DoInitControls(); } INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow(), LPARAM dwInitParam = NULL) { T* pT = static_cast(this); ATLASSERT(pT->m_hWnd == NULL); if(!m_Template.IsValid()) CreateTemplate(); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRet = this->m_thunk.Init(NULL, NULL); if(bRet == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return -1; } ModuleHelper::AddCreateWndData(&this->m_thunk.cd, (ATL::CDialogImplBaseT< TBase >*)pT); #ifdef _DEBUG this->m_bModal = true; #endif // _DEBUG return ::DialogBoxIndirectParam(ModuleHelper::GetResourceInstance(), m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); } HWND Create(HWND hWndParent, LPARAM dwInitParam = NULL) { T* pT = static_cast(this); ATLASSERT(pT->m_hWnd == NULL); if(!m_Template.IsValid()) CreateTemplate(); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRet = this->m_thunk.Init(NULL, NULL); if(bRet == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return NULL; } ModuleHelper::AddCreateWndData(&this->m_thunk.cd, (ATL::CDialogImplBaseT< TBase >*)pT); #ifdef _DEBUG this->m_bModal = false; #endif // _DEBUG HWND hWnd = ::CreateDialogIndirectParam(ModuleHelper::GetResourceInstance(), (LPCDLGTEMPLATE)m_Template.GetTemplatePtr(), hWndParent, (DLGPROC)T::StartDialogProc, dwInitParam); ATLASSERT(this->m_hWnd == hWnd); return hWnd; } // for CComControl HWND Create(HWND hWndParent, RECT&, LPARAM dwInitParam = NULL) { return Create(hWndParent, dwInitParam); } void DoInitTemplate() { ATLASSERT(FALSE); // MUST be defined in derived class } void DoInitControls() { ATLASSERT(FALSE); // MUST be defined in derived class } }; /////////////////////////////////////////////////////////////////////////////// // CPropertySheetWindow - client side for a property sheet class CPropertySheetWindow : public ATL::CWindow { public: // Constructors CPropertySheetWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd) { } CPropertySheetWindow& operator =(HWND hWnd) { m_hWnd = hWnd; return *this; } // Attributes int GetPageCount() const { ATLASSERT(::IsWindow(m_hWnd)); HWND hWndTabCtrl = GetTabControl(); ATLASSERT(hWndTabCtrl != NULL); return (int)::SendMessage(hWndTabCtrl, TCM_GETITEMCOUNT, 0, 0L); } HWND GetActivePage() const { ATLASSERT(::IsWindow(m_hWnd)); return (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0L); } int GetActiveIndex() const { ATLASSERT(::IsWindow(m_hWnd)); HWND hWndTabCtrl = GetTabControl(); ATLASSERT(hWndTabCtrl != NULL); return (int)::SendMessage(hWndTabCtrl, TCM_GETCURSEL, 0, 0L); } BOOL SetActivePage(int nPageIndex) { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSEL, nPageIndex, 0L); } BOOL SetActivePage(HPROPSHEETPAGE hPage) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(hPage != NULL); return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSEL, 0, (LPARAM)hPage); } BOOL SetActivePageByID(int nPageID) { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, PSM_SETCURSELID, 0, nPageID); } void SetTitle(LPCTSTR lpszText, UINT nStyle = 0) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((nStyle & ~PSH_PROPTITLE) == 0); // only PSH_PROPTITLE is valid ATLASSERT(lpszText != NULL); ::SendMessage(m_hWnd, PSM_SETTITLE, nStyle, (LPARAM)lpszText); } HWND GetTabControl() const { ATLASSERT(::IsWindow(m_hWnd)); return (HWND)::SendMessage(m_hWnd, PSM_GETTABCONTROL, 0, 0L); } void SetFinishText(LPCTSTR lpszText) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_SETFINISHTEXT, 0, (LPARAM)lpszText); } void SetWizardButtons(DWORD dwFlags) { ATLASSERT(::IsWindow(m_hWnd)); ::PostMessage(m_hWnd, PSM_SETWIZBUTTONS, 0, dwFlags); } // Operations BOOL AddPage(HPROPSHEETPAGE hPage) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(hPage != NULL); return (BOOL)::SendMessage(m_hWnd, PSM_ADDPAGE, 0, (LPARAM)hPage); } BOOL AddPage(LPCPROPSHEETPAGE pPage) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(pPage != NULL); HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); if(hPage == NULL) return FALSE; return (BOOL)::SendMessage(m_hWnd, PSM_ADDPAGE, 0, (LPARAM)hPage); } BOOL InsertPage(int nNewPageIndex, HPROPSHEETPAGE hPage) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(hPage != NULL); return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, nNewPageIndex, (LPARAM)hPage); } BOOL InsertPage(int nNewPageIndex, LPCPROPSHEETPAGE pPage) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(pPage != NULL); HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); if(hPage == NULL) return FALSE; return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, nNewPageIndex, (LPARAM)hPage); } BOOL InsertPage(HPROPSHEETPAGE hPageInsertAfter, HPROPSHEETPAGE hPage) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(hPage != NULL); return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, (WPARAM)hPageInsertAfter, (LPARAM)hPage); } BOOL InsertPage(HPROPSHEETPAGE hPageInsertAfter, LPCPROPSHEETPAGE pPage) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(pPage != NULL); HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); if(hPage == NULL) return FALSE; return (BOOL)::SendMessage(m_hWnd, PSM_INSERTPAGE, (WPARAM)hPageInsertAfter, (LPARAM)hPage); } void RemovePage(int nPageIndex) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_REMOVEPAGE, nPageIndex, 0L); } void RemovePage(HPROPSHEETPAGE hPage) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(hPage != NULL); ::SendMessage(m_hWnd, PSM_REMOVEPAGE, 0, (LPARAM)hPage); } BOOL PressButton(int nButton) { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, PSM_PRESSBUTTON, nButton, 0L); } BOOL Apply() { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, PSM_APPLY, 0, 0L); } void CancelToClose() { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_CANCELTOCLOSE, 0, 0L); } void SetModified(HWND hWndPage, BOOL bChanged = TRUE) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(::IsWindow(hWndPage)); UINT uMsg = bChanged ? PSM_CHANGED : PSM_UNCHANGED; ::SendMessage(m_hWnd, uMsg, (WPARAM)hWndPage, 0L); } LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam) { ATLASSERT(::IsWindow(m_hWnd)); return ::SendMessage(m_hWnd, PSM_QUERYSIBLINGS, wParam, lParam); } void RebootSystem() { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_REBOOTSYSTEM, 0, 0L); } void RestartWindows() { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_RESTARTWINDOWS, 0, 0L); } BOOL IsDialogMessage(LPMSG lpMsg) { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, PSM_ISDIALOGMESSAGE, 0, (LPARAM)lpMsg); } int HwndToIndex(HWND hWnd) const { ATLASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, PSM_HWNDTOINDEX, (WPARAM)hWnd, 0L); } HWND IndexToHwnd(int nIndex) const { ATLASSERT(::IsWindow(m_hWnd)); return (HWND)::SendMessage(m_hWnd, PSM_INDEXTOHWND, nIndex, 0L); } int PageToIndex(HPROPSHEETPAGE hPage) const { ATLASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, PSM_PAGETOINDEX, 0, (LPARAM)hPage); } HPROPSHEETPAGE IndexToPage(int nIndex) const { ATLASSERT(::IsWindow(m_hWnd)); return (HPROPSHEETPAGE)::SendMessage(m_hWnd, PSM_INDEXTOPAGE, nIndex, 0L); } int IdToIndex(int nID) const { ATLASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, PSM_IDTOINDEX, 0, nID); } int IndexToId(int nIndex) const { ATLASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, PSM_INDEXTOID, nIndex, 0L); } int GetResult() const { ATLASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, PSM_GETRESULT, 0, 0L); } BOOL RecalcPageSizes() { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, PSM_RECALCPAGESIZES, 0, 0L); } void SetHeaderTitle(int nIndex, LPCTSTR lpstrHeaderTitle) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_SETHEADERTITLE, nIndex, (LPARAM)lpstrHeaderTitle); } void SetHeaderSubTitle(int nIndex, LPCTSTR lpstrHeaderSubTitle) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_SETHEADERSUBTITLE, nIndex, (LPARAM)lpstrHeaderSubTitle); } // Implementation - override to prevent usage HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) { ATLASSERT(FALSE); return NULL; } }; /////////////////////////////////////////////////////////////////////////////// // CPropertySheetImpl - implements a property sheet template class ATL_NO_VTABLE CPropertySheetImpl : public ATL::CWindowImplBaseT< TBase > { public: PROPSHEETHEADER m_psh; ATL::CSimpleArray m_arrPages; // Construction/Destruction CPropertySheetImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) { memset(&m_psh, 0, sizeof(PROPSHEETHEADER)); m_psh.dwSize = sizeof(PROPSHEETHEADER); m_psh.dwFlags = PSH_USECALLBACK; m_psh.hInstance = ModuleHelper::GetResourceInstance(); m_psh.phpage = NULL; // will be set later m_psh.nPages = 0; // will be set later m_psh.pszCaption = title.m_lpstr; m_psh.nStartPage = uStartPage; m_psh.hwndParent = hWndParent; // if NULL, will be set in DoModal/Create m_psh.pfnCallback = T::PropSheetCallback; } ~CPropertySheetImpl() { if(m_arrPages.GetSize() > 0) // sheet never created, destroy all pages { for(int i = 0; i < m_arrPages.GetSize(); i++) ::DestroyPropertySheetPage((HPROPSHEETPAGE)m_arrPages[i]); } } // Callback function and overrideables static int CALLBACK PropSheetCallback(HWND hWnd, UINT uMsg, LPARAM lParam) { (void)lParam; // avoid level 4 warning int nRet = 0; if(uMsg == PSCB_INITIALIZED) { ATLASSERT(hWnd != NULL); T* pT = (T*)ModuleHelper::ExtractCreateWndData(); // subclass the sheet window pT->SubclassWindow(hWnd); // remove page handles array pT->_CleanUpPages(); pT->OnSheetInitialized(); } return nRet; } void OnSheetInitialized() { } // Create method HWND Create(HWND hWndParent = NULL) { ATLASSERT(this->m_hWnd == NULL); m_psh.dwFlags |= PSH_MODELESS; if(m_psh.hwndParent == NULL) m_psh.hwndParent = hWndParent; m_psh.phpage = (HPROPSHEETPAGE*)m_arrPages.GetData(); m_psh.nPages = m_arrPages.GetSize(); T* pT = static_cast(this); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRet = pT->m_thunk.Init(NULL, NULL); if(bRet == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return NULL; } ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); HWND hWnd = (HWND)::PropertySheet(&m_psh); _CleanUpPages(); // ensure clean-up, required if call failed ATLASSERT(this->m_hWnd == hWnd); return hWnd; } INT_PTR DoModal(HWND hWndParent = ::GetActiveWindow()) { ATLASSERT(this->m_hWnd == NULL); m_psh.dwFlags &= ~PSH_MODELESS; if(m_psh.hwndParent == NULL) m_psh.hwndParent = hWndParent; m_psh.phpage = (HPROPSHEETPAGE*)m_arrPages.GetData(); m_psh.nPages = m_arrPages.GetSize(); T* pT = static_cast(this); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRet = pT->m_thunk.Init(NULL, NULL); if(bRet == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return -1; } ModuleHelper::AddCreateWndData(&pT->m_thunk.cd, pT); INT_PTR nRet = ::PropertySheet(&m_psh); _CleanUpPages(); // ensure clean-up, required if call failed return nRet; } // implementation helper - clean up pages array void _CleanUpPages() { m_psh.nPages = 0; m_psh.phpage = NULL; m_arrPages.RemoveAll(); } // Attributes (extended overrides of client class methods) // These now can be called before the sheet is created // Note: Calling these after the sheet is created gives unpredictable results int GetPageCount() const { if(this->m_hWnd == NULL) // not created yet return m_arrPages.GetSize(); return TBase::GetPageCount(); } int GetActiveIndex() const { if(this->m_hWnd == NULL) // not created yet return m_psh.nStartPage; return TBase::GetActiveIndex(); } HPROPSHEETPAGE GetPage(int nPageIndex) const { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created return (HPROPSHEETPAGE)m_arrPages[nPageIndex]; } int GetPageIndex(HPROPSHEETPAGE hPage) const { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created return m_arrPages.Find((HPROPSHEETPAGE&)hPage); } BOOL SetActivePage(int nPageIndex) { if(this->m_hWnd == NULL) // not created yet { ATLASSERT((nPageIndex >= 0) && (nPageIndex < m_arrPages.GetSize())); m_psh.nStartPage = nPageIndex; return TRUE; } return TBase::SetActivePage(nPageIndex); } BOOL SetActivePage(HPROPSHEETPAGE hPage) { ATLASSERT(hPage != NULL); if(this->m_hWnd == NULL) // not created yet { int nPageIndex = GetPageIndex(hPage); if(nPageIndex == -1) return FALSE; return SetActivePage(nPageIndex); } return TBase::SetActivePage(hPage); } void SetTitle(LPCTSTR lpszText, UINT nStyle = 0) { ATLASSERT((nStyle & ~PSH_PROPTITLE) == 0); // only PSH_PROPTITLE is valid ATLASSERT(lpszText != NULL); if(this->m_hWnd == NULL) { // set internal state m_psh.pszCaption = lpszText; // must exist until sheet is created m_psh.dwFlags &= ~PSH_PROPTITLE; m_psh.dwFlags |= nStyle; } else { // set external state TBase::SetTitle(lpszText, nStyle); } } void SetWizardMode() { m_psh.dwFlags |= PSH_WIZARD; } void EnableHelp() { m_psh.dwFlags |= PSH_HASHELP; } // Operations BOOL AddPage(HPROPSHEETPAGE hPage) { ATLASSERT(hPage != NULL); BOOL bRet = FALSE; if(this->m_hWnd != NULL) bRet = TBase::AddPage(hPage); else // sheet not created yet, use internal data bRet = m_arrPages.Add((HPROPSHEETPAGE&)hPage); return bRet; } BOOL AddPage(LPCPROPSHEETPAGE pPage) { ATLASSERT(pPage != NULL); HPROPSHEETPAGE hPage = ::CreatePropertySheetPage(pPage); if(hPage == NULL) return FALSE; BOOL bRet = AddPage(hPage); if(!bRet) ::DestroyPropertySheetPage(hPage); return bRet; } BOOL RemovePage(HPROPSHEETPAGE hPage) { ATLASSERT(hPage != NULL); if(this->m_hWnd == NULL) // not created yet { int nPage = GetPageIndex(hPage); if(nPage == -1) return FALSE; return RemovePage(nPage); } TBase::RemovePage(hPage); return TRUE; } BOOL RemovePage(int nPageIndex) { BOOL bRet = TRUE; if(this->m_hWnd != NULL) TBase::RemovePage(nPageIndex); else // sheet not created yet, use internal data bRet = m_arrPages.RemoveAt(nPageIndex); return bRet; } void SetHeader(LPCTSTR szbmHeader) { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psh.dwFlags &= ~PSH_WIZARD; m_psh.dwFlags |= (PSH_HEADER | PSH_WIZARD97); m_psh.pszbmHeader = szbmHeader; } void SetHeader(HBITMAP hbmHeader) { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psh.dwFlags &= ~PSH_WIZARD; m_psh.dwFlags |= (PSH_HEADER | PSH_USEHBMHEADER | PSH_WIZARD97); m_psh.hbmHeader = hbmHeader; } void SetWatermark(LPCTSTR szbmWatermark, HPALETTE hplWatermark = NULL) { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psh.dwFlags &= ~PSH_WIZARD; m_psh.dwFlags |= PSH_WATERMARK | PSH_WIZARD97; m_psh.pszbmWatermark = szbmWatermark; if(hplWatermark != NULL) { m_psh.dwFlags |= PSH_USEHPLWATERMARK; m_psh.hplWatermark = hplWatermark; } } void SetWatermark(HBITMAP hbmWatermark, HPALETTE hplWatermark = NULL) { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psh.dwFlags &= ~PSH_WIZARD; m_psh.dwFlags |= (PSH_WATERMARK | PSH_USEHBMWATERMARK | PSH_WIZARD97); m_psh.hbmWatermark = hbmWatermark; if(hplWatermark != NULL) { m_psh.dwFlags |= PSH_USEHPLWATERMARK; m_psh.hplWatermark = hplWatermark; } } void StretchWatermark(bool bStretchWatermark) { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created if(bStretchWatermark) m_psh.dwFlags |= PSH_STRETCHWATERMARK; else m_psh.dwFlags &= ~PSH_STRETCHWATERMARK; } // Message map and handlers BEGIN_MSG_MAP(CPropertySheetImpl) MESSAGE_HANDLER(WM_COMMAND, OnCommand) MESSAGE_HANDLER(WM_SYSCOMMAND, OnSysCommand) END_MSG_MAP() LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = this->DefWindowProc(uMsg, wParam, lParam); if((HIWORD(wParam) == BN_CLICKED) && ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) && ((m_psh.dwFlags & PSH_MODELESS) != 0) && (this->GetActivePage() == NULL)) this->DestroyWindow(); return lRet; } LRESULT OnSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(((m_psh.dwFlags & PSH_MODELESS) == PSH_MODELESS) && ((wParam & 0xFFF0) == SC_CLOSE)) this->SendMessage(WM_CLOSE); else bHandled = FALSE; return 0; } }; // for non-customized sheets class CPropertySheet : public CPropertySheetImpl { public: CPropertySheet(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) : CPropertySheetImpl(title, uStartPage, hWndParent) { } }; /////////////////////////////////////////////////////////////////////////////// // CPropertyPageWindow - client side for a property page class CPropertyPageWindow : public ATL::CWindow { public: // Constructors CPropertyPageWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd) { } CPropertyPageWindow& operator =(HWND hWnd) { m_hWnd = hWnd; return *this; } // Attributes CPropertySheetWindow GetPropertySheet() const { ATLASSERT(::IsWindow(m_hWnd)); return CPropertySheetWindow(GetParent()); } // Operations BOOL Apply() { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); return GetPropertySheet().Apply(); } void CancelToClose() { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); GetPropertySheet().CancelToClose(); } void SetModified(BOOL bChanged = TRUE) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); GetPropertySheet().SetModified(m_hWnd, bChanged); } LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); return GetPropertySheet().QuerySiblings(wParam, lParam); } void RebootSystem() { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); GetPropertySheet().RebootSystem(); } void RestartWindows() { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); GetPropertySheet().RestartWindows(); } void SetWizardButtons(DWORD dwFlags) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); GetPropertySheet().SetWizardButtons(dwFlags); } // Implementation - overrides to prevent usage HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) { ATLASSERT(FALSE); return NULL; } }; /////////////////////////////////////////////////////////////////////////////// // CPropertyPageImpl - implements a property page #if defined(_WTL_FORCE_OLD_PAGE_NOTIFY_HANDLERS) && defined(_WTL_NEW_PAGE_NOTIFY_HANDLERS) #error _WTL_FORCE_OLD_PAGE_NOTIFY_HANDLERS and _WTL_NEW_PAGE_NOTIFY_HANDLERS cannot be both defined #endif #if !defined(_WTL_FORCE_OLD_PAGE_NOTIFY_HANDLERS) && !defined(_WTL_NEW_PAGE_NOTIFY_HANDLERS) #define _WTL_NEW_PAGE_NOTIFY_HANDLERS #endif // NOTE: _WTL_NEW_PAGE_NOTIFY_HANDLERS is now defined by default. // It enables use of new notification handlers that // return direct values without any restrictions. // Define _WTL_FORCE_OLD_PAGE_NOTIFY_HANDLERS to use old handlers. template class ATL_NO_VTABLE CPropertyPageImpl : public ATL::CDialogImplBaseT< TBase > { public: PROPSHEETPAGE m_psp; operator PROPSHEETPAGE*() { return &m_psp; } // Construction CPropertyPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) { // initialize PROPSHEETPAGE struct memset(&m_psp, 0, sizeof(PROPSHEETPAGE)); m_psp.dwSize = sizeof(PROPSHEETPAGE); m_psp.dwFlags = PSP_USECALLBACK; m_psp.hInstance = ModuleHelper::GetResourceInstance(); T* pT = static_cast(this); m_psp.pszTemplate = MAKEINTRESOURCE(pT->IDD); m_psp.pfnDlgProc = (DLGPROC)T::StartDialogProc; m_psp.pfnCallback = T::PropPageCallback; m_psp.lParam = (LPARAM)pT; if(title.m_lpstr != NULL) SetTitle(title); } // Callback function and overrideables static UINT CALLBACK PropPageCallback(HWND hWnd, UINT uMsg, LPPROPSHEETPAGE ppsp) { (void)hWnd; // avoid level 4 warning ATLASSERT(hWnd == NULL); T* pT = (T*)ppsp->lParam; UINT uRet = 0; switch(uMsg) { case PSPCB_CREATE: { ATL::CDialogImplBaseT< TBase >* pPage = (ATL::CDialogImplBaseT< TBase >*)pT; ModuleHelper::AddCreateWndData(&pPage->m_thunk.cd, pPage); uRet = pT->OnPageCreate() ? 1 : 0; } break; case PSPCB_ADDREF: pT->OnPageAddRef(); break; case PSPCB_RELEASE: pT->OnPageRelease(); break; default: break; } return uRet; } bool OnPageCreate() { return true; // true - allow page to be created, false - prevent creation } void OnPageAddRef() { } void OnPageRelease() { } // Create method HPROPSHEETPAGE Create() { return ::CreatePropertySheetPage(&m_psp); } // Attributes void SetTitle(ATL::_U_STRINGorID title) { m_psp.pszTitle = title.m_lpstr; m_psp.dwFlags |= PSP_USETITLE; } void SetHeaderTitle(LPCTSTR lpstrHeaderTitle) { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psp.dwFlags |= PSP_USEHEADERTITLE; m_psp.pszHeaderTitle = lpstrHeaderTitle; } void SetHeaderSubTitle(LPCTSTR lpstrHeaderSubTitle) { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created m_psp.dwFlags |= PSP_USEHEADERSUBTITLE; m_psp.pszHeaderSubTitle = lpstrHeaderSubTitle; } // Operations void EnableHelp() { m_psp.dwFlags |= PSP_HASHELP; } // Message map and handlers BEGIN_MSG_MAP(CPropertyPageImpl) MESSAGE_HANDLER(WM_NOTIFY, OnNotify) END_MSG_MAP() LRESULT OnNotify(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { ATLASSERT(::IsWindow(this->m_hWnd)); NMHDR* pNMHDR = (NMHDR*)lParam; // don't handle messages not from the page/sheet itself if((pNMHDR->hwndFrom != this->m_hWnd) && (pNMHDR->hwndFrom != ::GetParent(this->m_hWnd))) { bHandled = FALSE; return 1; } T* pT = static_cast(this); LRESULT lResult = 0; switch(pNMHDR->code) { #ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS case PSN_SETACTIVE: lResult = pT->OnSetActive(); break; case PSN_KILLACTIVE: lResult = pT->OnKillActive(); break; case PSN_APPLY: lResult = pT->OnApply(); break; case PSN_RESET: pT->OnReset(); break; case PSN_QUERYCANCEL: lResult = pT->OnQueryCancel(); break; case PSN_WIZNEXT: lResult = pT->OnWizardNext(); break; case PSN_WIZBACK: lResult = pT->OnWizardBack(); break; case PSN_WIZFINISH: lResult = pT->OnWizardFinish(); break; case PSN_HELP: pT->OnHelp(); break; case PSN_GETOBJECT: if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) bHandled = FALSE; break; case PSN_TRANSLATEACCELERATOR: { LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; lResult = pT->OnTranslateAccelerator((LPMSG)lpPSHNotify->lParam); } break; case PSN_QUERYINITIALFOCUS: { LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); } break; #else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS case PSN_SETACTIVE: lResult = pT->OnSetActive() ? 0 : -1; break; case PSN_KILLACTIVE: lResult = !pT->OnKillActive(); break; case PSN_APPLY: lResult = pT->OnApply() ? PSNRET_NOERROR : PSNRET_INVALID_NOCHANGEPAGE; break; case PSN_RESET: pT->OnReset(); break; case PSN_QUERYCANCEL: lResult = !pT->OnQueryCancel(); break; case PSN_WIZNEXT: lResult = pT->OnWizardNext(); break; case PSN_WIZBACK: lResult = pT->OnWizardBack(); break; case PSN_WIZFINISH: lResult = !pT->OnWizardFinish(); break; case PSN_HELP: pT->OnHelp(); break; case PSN_GETOBJECT: if(!pT->OnGetObject((LPNMOBJECTNOTIFY)lParam)) bHandled = FALSE; break; case PSN_TRANSLATEACCELERATOR: { LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; lResult = pT->OnTranslateAccelerator((LPMSG)lpPSHNotify->lParam) ? PSNRET_MESSAGEHANDLED : PSNRET_NOERROR; } break; case PSN_QUERYINITIALFOCUS: { LPPSHNOTIFY lpPSHNotify = (LPPSHNOTIFY)lParam; lResult = (LRESULT)pT->OnQueryInitialFocus((HWND)lpPSHNotify->lParam); } break; #endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS default: bHandled = FALSE; // not handled } return lResult; } // Overridables #ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS int OnSetActive() { // 0 = allow activate // -1 = go back that was active // page ID = jump to page return 0; } BOOL OnKillActive() { // FALSE = allow deactivate // TRUE = prevent deactivation return FALSE; } int OnApply() { // PSNRET_NOERROR = apply OK // PSNRET_INVALID = apply not OK, return to this page // PSNRET_INVALID_NOCHANGEPAGE = apply not OK, don't change focus return PSNRET_NOERROR; } void OnReset() { } BOOL OnQueryCancel() { // FALSE = allow cancel // TRUE = prevent cancel return FALSE; } int OnWizardBack() { // 0 = goto previous page // -1 = prevent page change // >0 = jump to page by dlg ID return 0; } int OnWizardNext() { // 0 = goto next page // -1 = prevent page change // >0 = jump to page by dlg ID return 0; } INT_PTR OnWizardFinish() { // FALSE = allow finish // TRUE = prevent finish // HWND = prevent finish and set focus to HWND (CommCtrl 5.80 only) return FALSE; } void OnHelp() { } BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) { return FALSE; // not processed } int OnTranslateAccelerator(LPMSG /*lpMsg*/) { // PSNRET_NOERROR - message not handled // PSNRET_MESSAGEHANDLED - message handled return PSNRET_NOERROR; } HWND OnQueryInitialFocus(HWND /*hWndFocus*/) { // NULL = set focus to default control // HWND = set focus to HWND return NULL; } #else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS BOOL OnSetActive() { return TRUE; } BOOL OnKillActive() { return TRUE; } BOOL OnApply() { return TRUE; } void OnReset() { } BOOL OnQueryCancel() { return TRUE; // ok to cancel } int OnWizardBack() { // 0 = goto previous page // -1 = prevent page change // >0 = jump to page by dlg ID return 0; } int OnWizardNext() { // 0 = goto next page // -1 = prevent page change // >0 = jump to page by dlg ID return 0; } BOOL OnWizardFinish() { return TRUE; } void OnHelp() { } BOOL OnGetObject(LPNMOBJECTNOTIFY /*lpObjectNotify*/) { return FALSE; // not processed } BOOL OnTranslateAccelerator(LPMSG /*lpMsg*/) { return FALSE; // not translated } HWND OnQueryInitialFocus(HWND /*hWndFocus*/) { return NULL; // default } #endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS }; // for non-customized pages template class CPropertyPage : public CPropertyPageImpl > { public: enum { IDD = t_wDlgTemplateID }; CPropertyPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CPropertyPageImpl(title) { } DECLARE_EMPTY_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CAxPropertyPageImpl - property page that hosts ActiveX controls #ifndef _ATL_NO_HOSTING // Note: You must #include to use these classes template class ATL_NO_VTABLE CAxPropertyPageImpl : public CPropertyPageImpl< T, TBase > { public: // Data members HGLOBAL m_hInitData; HGLOBAL m_hDlgRes; HGLOBAL m_hDlgResSplit; // Constructor/destructor CAxPropertyPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CPropertyPageImpl< T, TBase >(title), m_hInitData(NULL), m_hDlgRes(NULL), m_hDlgResSplit(NULL) { T* pT = static_cast(this); (void)pT; // avoid level 4 warning // initialize ActiveX hosting and modify dialog template ATL::AtlAxWinInit(); HINSTANCE hInstance = ModuleHelper::GetResourceInstance(); LPCTSTR lpTemplateName = MAKEINTRESOURCE(pT->IDD); HRSRC hDlg = ::FindResource(hInstance, lpTemplateName, (LPTSTR)RT_DIALOG); if(hDlg != NULL) { HRSRC hDlgInit = ::FindResource(hInstance, lpTemplateName, (LPTSTR)_ATL_RT_DLGINIT); BYTE* pInitData = NULL; if(hDlgInit != NULL) { m_hInitData = ::LoadResource(hInstance, hDlgInit); pInitData = (BYTE*)::LockResource(m_hInitData); } m_hDlgRes = ::LoadResource(hInstance, hDlg); DLGTEMPLATE* pDlg = (DLGTEMPLATE*)::LockResource(m_hDlgRes); LPCDLGTEMPLATE lpDialogTemplate = ATL::_DialogSplitHelper::SplitDialogTemplate(pDlg, pInitData); if(lpDialogTemplate != pDlg) m_hDlgResSplit = GlobalHandle(lpDialogTemplate); // set up property page to use in-memory dialog template if(lpDialogTemplate != NULL) { this->m_psp.dwFlags |= PSP_DLGINDIRECT; this->m_psp.pResource = lpDialogTemplate; } else { ATLASSERT(FALSE && _T("CAxPropertyPageImpl - ActiveX initializtion failed!")); } } else { ATLASSERT(FALSE && _T("CAxPropertyPageImpl - Cannot find dialog template!")); } } ~CAxPropertyPageImpl() { if(m_hInitData != NULL) { UnlockResource(m_hInitData); FreeResource(m_hInitData); } if(m_hDlgRes != NULL) { UnlockResource(m_hDlgRes); FreeResource(m_hDlgRes); } if(m_hDlgResSplit != NULL) { ::GlobalFree(m_hDlgResSplit); } } // Methods // call this one to handle keyboard message for ActiveX controls BOOL PreTranslateMessage(LPMSG pMsg) { if (((pMsg->message < WM_KEYFIRST) || (pMsg->message > WM_KEYLAST)) && ((pMsg->message < WM_MOUSEFIRST) || (pMsg->message > WM_MOUSELAST))) return FALSE; // find a direct child of the dialog from the window that has focus HWND hWndCtl = ::GetFocus(); if (this->IsChild(hWndCtl) && (::GetParent(hWndCtl) != this->m_hWnd)) { do { hWndCtl = ::GetParent(hWndCtl); } while (::GetParent(hWndCtl) != this->m_hWnd); } // give controls a chance to translate this message return (BOOL)::SendMessage(hWndCtl, WM_FORWARDMSG, 0, (LPARAM)pMsg); } // Overridables // new default implementation for ActiveX hosting pages #ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS int OnTranslateAccelerator(LPMSG lpMsg) { T* pT = static_cast(this); return (pT->PreTranslateMessage(lpMsg) != FALSE) ? PSNRET_MESSAGEHANDLED : PSNRET_NOERROR; } #else // !_WTL_NEW_PAGE_NOTIFY_HANDLERS BOOL OnTranslateAccelerator(LPMSG lpMsg) { T* pT = static_cast(this); return pT->PreTranslateMessage(lpMsg); } #endif // !_WTL_NEW_PAGE_NOTIFY_HANDLERS int GetIDD() { return( static_cast(this)->IDD ); } virtual DLGPROC GetDialogProc() { return DialogProc; } static INT_PTR CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { CAxPropertyPageImpl< T, TBase >* pThis = (CAxPropertyPageImpl< T, TBase >*)hWnd; if (uMsg == WM_INITDIALOG) { HRESULT hr; if (FAILED(hr = pThis->CreateActiveXControls(pThis->GetIDD()))) { ATLASSERT(FALSE); return FALSE; } } return CPropertyPageImpl< T, TBase >::DialogProc(hWnd, uMsg, wParam, lParam); } // ActiveX controls creation virtual HRESULT CreateActiveXControls(UINT nID) { // Load dialog template and InitData HRSRC hDlgInit = ::FindResource(ATL::_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(nID), (LPTSTR)_ATL_RT_DLGINIT); BYTE* pInitData = NULL; HGLOBAL hData = NULL; HRESULT hr = S_OK; if (hDlgInit != NULL) { hData = ::LoadResource(ATL::_AtlBaseModule.GetResourceInstance(), hDlgInit); if (hData != NULL) pInitData = (BYTE*) ::LockResource(hData); } HRSRC hDlg = ::FindResource(ATL::_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(nID), (LPTSTR)RT_DIALOG); if (hDlg != NULL) { HGLOBAL hResource = ::LoadResource(ATL::_AtlBaseModule.GetResourceInstance(), hDlg); DLGTEMPLATE* pDlg = NULL; if (hResource != NULL) { pDlg = (DLGTEMPLATE*) ::LockResource(hResource); if (pDlg != NULL) { // Get first control on the template BOOL bDialogEx = ATL::_DialogSplitHelper::IsDialogEx(pDlg); WORD nItems = ATL::_DialogSplitHelper::DlgTemplateItemCount(pDlg); // Get first control on the dialog DLGITEMTEMPLATE* pItem = ATL::_DialogSplitHelper::FindFirstDlgItem(pDlg); HWND hWndPrev = this->GetWindow(GW_CHILD); // Create all ActiveX cotnrols in the dialog template and place them in the correct tab order (z-order) for (WORD nItem = 0; nItem < nItems; nItem++) { DWORD wID = bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->id : pItem->id; if (ATL::_DialogSplitHelper::IsActiveXControl(pItem, bDialogEx)) { BYTE* pData = NULL; DWORD dwLen = ATL::_DialogSplitHelper::FindCreateData(wID, pInitData, &pData); ATL::CComPtr spStream; if (dwLen != 0) { HGLOBAL h = GlobalAlloc(GHND, dwLen); if (h != NULL) { BYTE* pBytes = (BYTE*) GlobalLock(h); BYTE* pSource = pData; ATL::Checked::memcpy_s(pBytes, dwLen, pSource, dwLen); GlobalUnlock(h); CreateStreamOnHGlobal(h, TRUE, &spStream); } else { hr = E_OUTOFMEMORY; break; } } ATL::CComBSTR bstrLicKey; hr = ATL::_DialogSplitHelper::ParseInitData(spStream, &bstrLicKey.m_str); if (SUCCEEDED(hr)) { ATL::CAxWindow2 wnd; // Get control caption. LPWSTR pszClassName = bDialogEx ? (LPWSTR)(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem) + 1) : (LPWSTR)(pItem + 1); // Get control rect. RECT rect = {}; rect.left = bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->x : pItem->x; rect.top = bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->y : pItem->y; rect.right = rect.left + (bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cx : pItem->cx); rect.bottom = rect.top + (bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->cy : pItem->cy); // Convert from dialog units to screen units this->MapDialogRect(&rect); // Create AxWindow with a NULL caption. wnd.Create(this->m_hWnd, &rect, NULL, (bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->style : pItem->style) | WS_TABSTOP, bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->exStyle : 0, bDialogEx ? ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->id : pItem->id, NULL); if (wnd != NULL) { // Set the Help ID if (bDialogEx && ((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID != 0) wnd.SetWindowContextHelpId(((ATL::_DialogSplitHelper::DLGITEMTEMPLATEEX*)pItem)->helpID); // Try to create the ActiveX control. hr = wnd.CreateControlLic(pszClassName, spStream, NULL, bstrLicKey); if (FAILED(hr)) break; // Set the correct tab position. if (nItem == 0) hWndPrev = HWND_TOP; wnd.SetWindowPos(hWndPrev, 0,0,0,0,SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); hWndPrev = wnd; } else { hr = ATL::AtlHresultFromLastError(); } } } else { if (nItem != 0) hWndPrev = ::GetWindow(hWndPrev, GW_HWNDNEXT); } pItem = ATL::_DialogSplitHelper::FindNextDlgItem(pItem, bDialogEx); } } else hr = ATL::AtlHresultFromLastError(); } else hr = ATL::AtlHresultFromLastError(); } return hr; } // Event handling support HRESULT AdviseSinkMap(bool bAdvise) { if(!bAdvise && (this->m_hWnd == NULL)) { // window is gone, controls are already unadvised ATLTRACE2(atlTraceUI, 0, _T("CAxPropertyPageImpl::AdviseSinkMap called after the window was destroyed\n")); return S_OK; } HRESULT hRet = E_NOTIMPL; __if_exists(T::_GetSinkMapFinder) { T* pT = static_cast(this); hRet = AtlAdviseSinkMap(pT, bAdvise); } return hRet; } // Message map and handlers typedef CPropertyPageImpl< T, TBase> _baseClass; BEGIN_MSG_MAP(CAxPropertyPageImpl) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) CHAIN_MSG_MAP(_baseClass) END_MSG_MAP() LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { // initialize controls in dialog with DLGINIT resource section this->ExecuteDlgInit(static_cast(this)->IDD); AdviseSinkMap(true); bHandled = FALSE; return 1; } LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { AdviseSinkMap(false); bHandled = FALSE; return 1; } }; // for non-customized pages template class CAxPropertyPage : public CAxPropertyPageImpl > { public: enum { IDD = t_wDlgTemplateID }; CAxPropertyPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAxPropertyPageImpl(title) { } BEGIN_MSG_MAP(CAxPropertyPage) CHAIN_MSG_MAP(CAxPropertyPageImpl >) END_MSG_MAP() }; #endif // _ATL_NO_HOSTING /////////////////////////////////////////////////////////////////////////////// // Wizard97 Support // Sample wizard dialog resources: // // IDD_WIZ97_INTERIOR_BLANK DIALOG 0, 0, 317, 143 // STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION // CAPTION "Wizard97 Property Page - Interior" // FONT 8, "MS Shell Dlg" // BEGIN // END // // IDD_WIZ97_EXTERIOR_BLANK DIALOGEX 0, 0, 317, 193 // STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION // CAPTION "Wizard97 Property Page - Welcome/Complete" // FONT 8, "MS Shell Dlg", 0, 0, 0x0 // BEGIN // LTEXT "Welcome to the X Wizard",IDC_WIZ97_EXTERIOR_TITLE,115,8, // 195,24 // LTEXT "Wizard Explanation\r\n(The height of the static text should be in multiples of 8 dlus)", // IDC_STATIC,115,40,195,16 // LTEXT "h",IDC_WIZ97_BULLET1,118,64,8,8 // LTEXT "List Item 1 (the h is turned into a bullet)",IDC_STATIC, // 127,63,122,8 // LTEXT "h",IDC_WIZ97_BULLET2,118,79,8,8 // LTEXT "List Item 2. Keep 7 dlus between paragraphs",IDC_STATIC, // 127,78,33,8 // CONTROL "&Do not show this Welcome page again", // IDC_WIZ97_WELCOME_NOTAGAIN,"Button",BS_AUTOCHECKBOX | // WS_TABSTOP,115,169,138,10 // END // // GUIDELINES DESIGNINFO // BEGIN // IDD_WIZ97_INTERIOR_BLANK, DIALOG // BEGIN // LEFTMARGIN, 7 // RIGHTMARGIN, 310 // VERTGUIDE, 21 // VERTGUIDE, 31 // VERTGUIDE, 286 // VERTGUIDE, 296 // TOPMARGIN, 7 // BOTTOMMARGIN, 136 // HORZGUIDE, 8 // END // // IDD_WIZ97_EXTERIOR_BLANK, DIALOG // BEGIN // RIGHTMARGIN, 310 // VERTGUIDE, 115 // VERTGUIDE, 118 // VERTGUIDE, 127 // TOPMARGIN, 7 // BOTTOMMARGIN, 186 // HORZGUIDE, 8 // HORZGUIDE, 32 // HORZGUIDE, 40 // HORZGUIDE, 169 // END // END /////////////////////////////////////////////////////////////////////////////// // CWizard97SheetWindow - client side for a Wizard 97 style wizard sheet class CWizard97SheetWindow : public CPropertySheetWindow { public: // Constructors CWizard97SheetWindow(HWND hWnd = NULL) : CPropertySheetWindow(hWnd) { } CWizard97SheetWindow& operator =(HWND hWnd) { m_hWnd = hWnd; return *this; } // Operations HFONT GetExteriorPageTitleFont(void) { ATLASSERT(::IsWindow(m_hWnd)); return (HFONT)::SendMessage(m_hWnd, GetMessage_GetExteriorPageTitleFont(), 0, 0L); } HFONT GetBulletFont(void) { ATLASSERT(::IsWindow(m_hWnd)); return (HFONT)::SendMessage(m_hWnd, GetMessage_GetBulletFont(), 0, 0L); } // Helpers static UINT GetMessage_GetExteriorPageTitleFont() { static UINT uGetExteriorPageTitleFont = 0; if(uGetExteriorPageTitleFont == 0) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CWizard97SheetWindow::GetMessage_GetExteriorPageTitleFont().\n")); ATLASSERT(FALSE); return 0; } if(uGetExteriorPageTitleFont == 0) uGetExteriorPageTitleFont = ::RegisterWindowMessage(_T("GetExteriorPageTitleFont_531AF056-B8BE-4c4c-B786-AC608DF0DF12")); lock.Unlock(); } ATLASSERT(uGetExteriorPageTitleFont != 0); return uGetExteriorPageTitleFont; } static UINT GetMessage_GetBulletFont() { static UINT uGetBulletFont = 0; if(uGetBulletFont == 0) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CWizard97SheetWindow::GetMessage_GetBulletFont().\n")); ATLASSERT(FALSE); return 0; } if(uGetBulletFont == 0) uGetBulletFont = ::RegisterWindowMessage(_T("GetBulletFont_AD347D08-8F65-45ef-982E-6352E8218AD5")); lock.Unlock(); } ATLASSERT(uGetBulletFont != 0); return uGetBulletFont; } // Implementation - override to prevent usage HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) { ATLASSERT(FALSE); return NULL; } }; /////////////////////////////////////////////////////////////////////////////// // CWizard97SheetImpl - implements a Wizard 97 style wizard sheet template class ATL_NO_VTABLE CWizard97SheetImpl : public CPropertySheetImpl< T, TBase > { protected: // Typedefs typedef CWizard97SheetImpl< T, TBase > thisClass; typedef CPropertySheetImpl< T, TBase > baseClass; // Member variables CFont m_fontExteriorPageTitle; // Welcome and Completion page title font CFont m_fontBullet; // Bullet font (used on static text 'h' to produce a small bullet) bool m_bReceivedFirstSizeMessage; public: CWizard97SheetImpl(ATL::_U_STRINGorID title, ATL::_U_STRINGorID headerBitmap, ATL::_U_STRINGorID watermarkBitmap, UINT uStartPage = 0, HWND hWndParent = NULL) : baseClass(title, uStartPage, hWndParent), m_bReceivedFirstSizeMessage(false) { this->m_psh.dwFlags &= ~(PSH_NOCONTEXTHELP); this->m_psh.dwFlags &= ~(PSH_WIZARD | PSH_WIZARD_LITE); this->m_psh.dwFlags |= (PSH_HASHELP | PSH_WIZARDCONTEXTHELP); this->m_psh.dwFlags |= PSH_WIZARD97; baseClass::SetHeader(headerBitmap.m_lpstr); baseClass::SetWatermark(watermarkBitmap.m_lpstr); } // Overrides from base class void OnSheetInitialized() { T* pT = static_cast(this); pT->_InitializeFonts(); // We'd like to center the wizard here, but its too early. // Instead, we'll do CenterWindow upon our first WM_SIZE message } // Initialization void _InitializeFonts() { // Setup the Title and Bullet Font // (Property pages can send the "get external page title font" and "get bullet font" messages) // The derived class needs to do the actual SetFont for the dialog items) CFontHandle fontThisDialog = this->GetFont(); CClientDC dcScreen(NULL); LOGFONT titleLogFont = {}; LOGFONT bulletLogFont = {}; fontThisDialog.GetLogFont(&titleLogFont); fontThisDialog.GetLogFont(&bulletLogFont); // The Wizard 97 Spec recommends to do the Title Font // as Verdana Bold, 12pt. titleLogFont.lfCharSet = DEFAULT_CHARSET; titleLogFont.lfWeight = FW_BOLD; ATL::Checked::tcscpy_s(titleLogFont.lfFaceName, _countof(titleLogFont.lfFaceName), _T("Verdana Bold")); INT titleFontPointSize = 12; titleLogFont.lfHeight = -::MulDiv(titleFontPointSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); m_fontExteriorPageTitle.CreateFontIndirect(&titleLogFont); // The Wizard 97 Spec recommends to do Bullets by having // static text of "h" in the Marlett font. bulletLogFont.lfCharSet = DEFAULT_CHARSET; bulletLogFont.lfWeight = FW_NORMAL; ATL::Checked::tcscpy_s(bulletLogFont.lfFaceName, _countof(bulletLogFont.lfFaceName), _T("Marlett")); INT bulletFontSize = 8; bulletLogFont.lfHeight = -::MulDiv(bulletFontSize, dcScreen.GetDeviceCaps(LOGPIXELSY), 72); m_fontBullet.CreateFontIndirect(&bulletLogFont); } // Message Handling BEGIN_MSG_MAP(thisClass) MESSAGE_HANDLER(CWizard97SheetWindow::GetMessage_GetExteriorPageTitleFont(), OnGetExteriorPageTitleFont) MESSAGE_HANDLER(CWizard97SheetWindow::GetMessage_GetBulletFont(), OnGetBulletFont) MESSAGE_HANDLER(WM_SIZE, OnSize) CHAIN_MSG_MAP(baseClass) END_MSG_MAP() LRESULT OnGetExteriorPageTitleFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return (LRESULT)(HFONT)m_fontExteriorPageTitle; } LRESULT OnGetBulletFont(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return (LRESULT)(HFONT)m_fontBullet; } LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(!m_bReceivedFirstSizeMessage) { m_bReceivedFirstSizeMessage = true; this->CenterWindow(); } bHandled = FALSE; return 0; } }; // for non-customized sheets class CWizard97Sheet : public CWizard97SheetImpl { protected: // Typedefs typedef CWizard97Sheet thisClass; typedef CWizard97SheetImpl baseClass; public: CWizard97Sheet(ATL::_U_STRINGorID title, ATL::_U_STRINGorID headerBitmap, ATL::_U_STRINGorID watermarkBitmap, UINT uStartPage = 0, HWND hWndParent = NULL) : baseClass(title, headerBitmap, watermarkBitmap, uStartPage, hWndParent) { } BEGIN_MSG_MAP(thisClass) CHAIN_MSG_MAP(baseClass) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CWizard97PageWindow - client side for a Wizard 97 style wizard page #define WIZARD97_EXTERIOR_CXDLG 317 #define WIZARD97_EXTERIOR_CYDLG 193 #define WIZARD97_INTERIOR_CXDLG 317 #define WIZARD97_INTERIOR_CYDLG 143 class CWizard97PageWindow : public CPropertyPageWindow { public: // Constructors CWizard97PageWindow(HWND hWnd = NULL) : CPropertyPageWindow(hWnd) { } CWizard97PageWindow& operator =(HWND hWnd) { m_hWnd = hWnd; return *this; } // Attributes CWizard97SheetWindow GetPropertySheet() const { ATLASSERT(::IsWindow(m_hWnd)); return CWizard97SheetWindow(GetParent()); } // Operations HFONT GetExteriorPageTitleFont(void) { ATLASSERT(::IsWindow(m_hWnd)); return GetPropertySheet().GetExteriorPageTitleFont(); } HFONT GetBulletFont(void) { ATLASSERT(::IsWindow(m_hWnd)); return GetPropertySheet().GetBulletFont(); } // Implementation - overrides to prevent usage HWND Create(LPCTSTR, HWND, ATL::_U_RECT = NULL, LPCTSTR = NULL, DWORD = 0, DWORD = 0, ATL::_U_MENUorID = 0U, LPVOID = NULL) { ATLASSERT(FALSE); return NULL; } }; /////////////////////////////////////////////////////////////////////////////// // CWizard97PageImpl - implements a Wizard 97 style wizard page template class ATL_NO_VTABLE CWizard97PageImpl : public CPropertyPageImpl< T, TBase > { protected: // Typedefs typedef CWizard97PageImpl< T, TBase > thisClass; typedef CPropertyPageImpl< T, TBase > baseClass; public: CWizard97PageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) { } // Message Handling BEGIN_MSG_MAP(thisClass) CHAIN_MSG_MAP(baseClass) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CWizard97ExteriorPageImpl - implements a Wizard 97 style exterior wizard page template class ATL_NO_VTABLE CWizard97ExteriorPageImpl : public CPropertyPageImpl< T, TBase > { protected: // Typedefs typedef CWizard97ExteriorPageImpl< T, TBase > thisClass; typedef CPropertyPageImpl< T, TBase > baseClass; public: // Constructors CWizard97ExteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) { this->m_psp.dwFlags |= PSP_HASHELP; this->m_psp.dwFlags |= PSP_HIDEHEADER; } // Message Handling BEGIN_MSG_MAP(thisClass) CHAIN_MSG_MAP(baseClass) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CWizard97InteriorPageImpl - implements a Wizard 97 style interior wizard page template class ATL_NO_VTABLE CWizard97InteriorPageImpl : public CPropertyPageImpl< T, TBase > { protected: // Typedefs typedef CWizard97InteriorPageImpl< T, TBase > thisClass; typedef CPropertyPageImpl< T, TBase > baseClass; public: // Constructors CWizard97InteriorPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : baseClass(title) { this->m_psp.dwFlags |= PSP_HASHELP; this->m_psp.dwFlags &= ~PSP_HIDEHEADER; this->m_psp.dwFlags |= PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; // Be sure to have the derived class define this in the constructor. // We'll default it to something obvious in case its forgotten. baseClass::SetHeaderTitle(_T("Call SetHeaderTitle in Derived Class")); baseClass::SetHeaderSubTitle(_T("Call SetHeaderSubTitle in the constructor of the Derived Class.")); } // Message Handling BEGIN_MSG_MAP(thisClass) CHAIN_MSG_MAP(baseClass) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // Aero Wizard support #if (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // CAeroWizardFrameWindow - client side for an Aero Wizard frame window class CAeroWizardFrameWindow : public CPropertySheetWindow { public: // Constructors CAeroWizardFrameWindow(HWND hWnd = NULL) : CPropertySheetWindow(hWnd) { } CAeroWizardFrameWindow& operator =(HWND hWnd) { m_hWnd = hWnd; return *this; } // Operations - new, Aero Wizard only void SetNextText(LPCWSTR lpszText) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_SETNEXTTEXT, 0, (LPARAM)lpszText); } void ShowWizardButtons(DWORD dwButtons, DWORD dwStates) { ATLASSERT(::IsWindow(m_hWnd)); ::PostMessage(m_hWnd, PSM_SHOWWIZBUTTONS, (WPARAM)dwStates, (LPARAM)dwButtons); } void EnableWizardButtons(DWORD dwButtons, DWORD dwStates) { ATLASSERT(::IsWindow(m_hWnd)); ::PostMessage(m_hWnd, PSM_ENABLEWIZBUTTONS, (WPARAM)dwStates, (LPARAM)dwButtons); } void SetButtonText(DWORD dwButton, LPCWSTR lpszText) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PSM_SETBUTTONTEXT, (WPARAM)dwButton, (LPARAM)lpszText); } }; /////////////////////////////////////////////////////////////////////////////// // CAeroWizardFrameImpl - implements an Aero Wizard frame template class ATL_NO_VTABLE CAeroWizardFrameImpl : public CPropertySheetImpl { public: // Constructor CAeroWizardFrameImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) : CPropertySheetImpl(title, uStartPage, hWndParent) { this->m_psh.dwFlags |= PSH_WIZARD | PSH_AEROWIZARD; } // Operations void EnableResizing() { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created this->m_psh.dwFlags |= PSH_RESIZABLE; } void UseHeaderBitmap() { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created this->m_psh.dwFlags |= PSH_HEADERBITMAP; } void SetNoMargin() { ATLASSERT(this->m_hWnd == NULL); // can't do this after it's created this->m_psh.dwFlags |= PSH_NOMARGIN; } // Override to prevent use HWND Create(HWND /*hWndParent*/ = NULL) { ATLASSERT(FALSE); // not supported for Aero Wizard return NULL; } }; /////////////////////////////////////////////////////////////////////////////// // CAeroWizardFrame - for non-customized frames class CAeroWizardFrame : public CAeroWizardFrameImpl { public: CAeroWizardFrame(ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uStartPage = 0, HWND hWndParent = NULL) : CAeroWizardFrameImpl(title, uStartPage, hWndParent) { } BEGIN_MSG_MAP(CAeroWizardFrame) MESSAGE_HANDLER(WM_COMMAND, CAeroWizardFrameImpl::OnCommand) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CAeroWizardPageWindow - client side for an Aero Wizard page class CAeroWizardPageWindow : public CPropertyPageWindow { public: // Constructors CAeroWizardPageWindow(HWND hWnd = NULL) : CPropertyPageWindow(hWnd) { } CAeroWizardPageWindow& operator =(HWND hWnd) { m_hWnd = hWnd; return *this; } // Attributes CAeroWizardFrameWindow GetAeroWizardFrame() const { ATLASSERT(::IsWindow(m_hWnd)); // This is not really top-level frame window, but it processes all frame messages return CAeroWizardFrameWindow(GetParent()); } // Operations - new, Aero Wizard only void SetNextText(LPCWSTR lpszText) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); GetAeroWizardFrame().SetNextText(lpszText); } void ShowWizardButtons(DWORD dwButtons, DWORD dwStates) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); GetAeroWizardFrame().ShowWizardButtons(dwButtons, dwStates); } void EnableWizardButtons(DWORD dwButtons, DWORD dwStates) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); GetAeroWizardFrame().EnableWizardButtons(dwButtons, dwStates); } void SetButtonText(DWORD dwButton, LPCWSTR lpszText) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); GetAeroWizardFrame().SetButtonText(dwButton, lpszText); } }; /////////////////////////////////////////////////////////////////////////////// // CAeroWizardPageImpl - implements an Aero Wizard page template class ATL_NO_VTABLE CAeroWizardPageImpl : public CPropertyPageImpl { public: CAeroWizardPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CPropertyPageImpl(title) { } }; /////////////////////////////////////////////////////////////////////////////// // CAeroWizardPage - for non-customized pages template class CAeroWizardPage : public CAeroWizardPageImpl > { public: enum { IDD = t_wDlgTemplateID }; CAeroWizardPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAeroWizardPageImpl(title) { } DECLARE_EMPTY_MSG_MAP() }; #ifndef _ATL_NO_HOSTING // Note: You must #include to use these classes /////////////////////////////////////////////////////////////////////////////// // CAeroWizardAxPageImpl - Aero Wizard page that hosts ActiveX controls template class ATL_NO_VTABLE CAeroWizardAxPageImpl : public CAxPropertyPageImpl< T, TBase > { public: CAeroWizardAxPageImpl(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAxPropertyPageImpl< T, TBase >(title) { } }; /////////////////////////////////////////////////////////////////////////////// // CAeroWizardAxPage - for non-customized pages template class CAeroWizardAxPage : public CAeroWizardAxPageImpl > { public: enum { IDD = t_wDlgTemplateID }; CAeroWizardAxPage(ATL::_U_STRINGorID title = (LPCTSTR)NULL) : CAeroWizardAxPageImpl(title) { } BEGIN_MSG_MAP(CAeroWizardAxPage) CHAIN_MSG_MAP(CAeroWizardAxPageImpl >) END_MSG_MAP() }; #endif // _ATL_NO_HOSTING #endif // (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // TaskDialog support #if (_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG) /////////////////////////////////////////////////////////////////////////////// // AtlTaskDialog - support for TaskDialog() function inline int AtlTaskDialog(HWND hWndParent, ATL::_U_STRINGorID WindowTitle, ATL::_U_STRINGorID MainInstructionText, ATL::_U_STRINGorID ContentText, TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons = 0U, ATL::_U_STRINGorID Icon = (LPCTSTR)NULL) { int nRet = -1; #ifdef _WTL_TASKDIALOG_DIRECT USES_CONVERSION; HRESULT hRet = ::TaskDialog(hWndParent, ModuleHelper::GetResourceInstance(), IS_INTRESOURCE(WindowTitle.m_lpstr) ? (LPCWSTR) WindowTitle.m_lpstr : T2CW(WindowTitle.m_lpstr), IS_INTRESOURCE(MainInstructionText.m_lpstr) ? (LPCWSTR) MainInstructionText.m_lpstr : T2CW(MainInstructionText.m_lpstr), IS_INTRESOURCE(ContentText.m_lpstr) ? (LPCWSTR) ContentText.m_lpstr : T2CW(ContentText.m_lpstr), dwCommonButtons, IS_INTRESOURCE(Icon.m_lpstr) ? (LPCWSTR) Icon.m_lpstr : T2CW(Icon.m_lpstr), &nRet); ATLVERIFY(SUCCEEDED(hRet)); #else // This allows apps to run on older versions of Windows typedef HRESULT (STDAPICALLTYPE *PFN_TaskDialog)(HWND hwndParent, HINSTANCE hInstance, PCWSTR pszWindowTitle, PCWSTR pszMainInstruction, PCWSTR pszContent, TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons, PCWSTR pszIcon, int* pnButton); HMODULE m_hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); if(m_hCommCtrlDLL != NULL) { PFN_TaskDialog pfnTaskDialog = (PFN_TaskDialog)::GetProcAddress(m_hCommCtrlDLL, "TaskDialog"); if(pfnTaskDialog != NULL) { USES_CONVERSION; HRESULT hRet = pfnTaskDialog(hWndParent, ModuleHelper::GetResourceInstance(), IS_INTRESOURCE(WindowTitle.m_lpstr) ? (LPCWSTR) WindowTitle.m_lpstr : T2CW(WindowTitle.m_lpstr), IS_INTRESOURCE(MainInstructionText.m_lpstr) ? (LPCWSTR) MainInstructionText.m_lpstr : T2CW(MainInstructionText.m_lpstr), IS_INTRESOURCE(ContentText.m_lpstr) ? (LPCWSTR) ContentText.m_lpstr : T2CW(ContentText.m_lpstr), dwCommonButtons, IS_INTRESOURCE(Icon.m_lpstr) ? (LPCWSTR) Icon.m_lpstr : T2CW(Icon.m_lpstr), &nRet); ATLVERIFY(SUCCEEDED(hRet)); } ::FreeLibrary(m_hCommCtrlDLL); } #endif return nRet; } /////////////////////////////////////////////////////////////////////////////// // CTaskDialogConfig - TASKDIALOGCONFIG wrapper class CTaskDialogConfig : public TASKDIALOGCONFIG { public: // Constructor CTaskDialogConfig() { Init(); } void Init() { memset(this, 0, sizeof(TASKDIALOGCONFIG)); // initialize structure to 0/NULL this->cbSize = sizeof(TASKDIALOGCONFIG); this->hInstance = ModuleHelper::GetResourceInstance(); } // Operations - setting values // common buttons void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtonsArg) { this->dwCommonButtons = dwCommonButtonsArg; } // window title text void SetWindowTitle(UINT nID) { this->pszWindowTitle = MAKEINTRESOURCEW(nID); } void SetWindowTitle(LPCWSTR lpstrWindowTitle) { this->pszWindowTitle = lpstrWindowTitle; } // main icon void SetMainIcon(HICON hIcon) { this->dwFlags |= TDF_USE_HICON_MAIN; this->hMainIcon = hIcon; } void SetMainIcon(UINT nID) { this->dwFlags &= ~TDF_USE_HICON_MAIN; this->pszMainIcon = MAKEINTRESOURCEW(nID); } void SetMainIcon(LPCWSTR lpstrMainIcon) { this->dwFlags &= ~TDF_USE_HICON_MAIN; this->pszMainIcon = lpstrMainIcon; } // main instruction text void SetMainInstructionText(UINT nID) { this->pszMainInstruction = MAKEINTRESOURCEW(nID); } void SetMainInstructionText(LPCWSTR lpstrMainInstruction) { this->pszMainInstruction = lpstrMainInstruction; } // content text void SetContentText(UINT nID) { this->pszContent = MAKEINTRESOURCEW(nID); } void SetContentText(LPCWSTR lpstrContent) { this->pszContent = lpstrContent; } // buttons void SetButtons(const TASKDIALOG_BUTTON* pButtonsArg, UINT cButtonsArg, int nDefaultButtonArg = 0) { this->pButtons = pButtonsArg; this->cButtons = cButtonsArg; if(nDefaultButtonArg != 0) this->nDefaultButton = nDefaultButtonArg; } void SetDefaultButton(int nDefaultButtonArg) { this->nDefaultButton = nDefaultButtonArg; } // radio buttons void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtonsArg, UINT cRadioButtonsArg, int nDefaultRadioButtonArg = 0) { this->pRadioButtons = pRadioButtonsArg; this->cRadioButtons = cRadioButtonsArg; if(nDefaultRadioButtonArg != 0) this->nDefaultRadioButton = nDefaultRadioButtonArg; } void SetDefaultRadioButton(int nDefaultRadioButtonArg) { this->nDefaultRadioButton = nDefaultRadioButtonArg; } // verification text void SetVerificationText(UINT nID) { this->pszVerificationText = MAKEINTRESOURCEW(nID); } void SetVerificationText(LPCWSTR lpstrVerificationText) { this->pszVerificationText = lpstrVerificationText; } // expanded information text void SetExpandedInformationText(UINT nID) { this->pszExpandedInformation = MAKEINTRESOURCEW(nID); } void SetExpandedInformationText(LPCWSTR lpstrExpandedInformation) { this->pszExpandedInformation = lpstrExpandedInformation; } // expanded control text void SetExpandedControlText(UINT nID) { this->pszExpandedControlText = MAKEINTRESOURCEW(nID); } void SetExpandedControlText(LPCWSTR lpstrExpandedControlText) { this->pszExpandedControlText = lpstrExpandedControlText; } // collapsed control text void SetCollapsedControlText(UINT nID) { this->pszCollapsedControlText = MAKEINTRESOURCEW(nID); } void SetCollapsedControlText(LPCWSTR lpstrCollapsedControlText) { this->pszCollapsedControlText = lpstrCollapsedControlText; } // footer icon void SetFooterIcon(HICON hIcon) { this->dwFlags |= TDF_USE_HICON_FOOTER; this->hFooterIcon = hIcon; } void SetFooterIcon(UINT nID) { this->dwFlags &= ~TDF_USE_HICON_FOOTER; this->pszFooterIcon = MAKEINTRESOURCEW(nID); } void SetFooterIcon(LPCWSTR lpstrFooterIcon) { this->dwFlags &= ~TDF_USE_HICON_FOOTER; this->pszFooterIcon = lpstrFooterIcon; } // footer text void SetFooterText(UINT nID) { this->pszFooter = MAKEINTRESOURCEW(nID); } void SetFooterText(LPCWSTR lpstrFooterText) { this->pszFooter = lpstrFooterText; } // width (in DLUs) void SetWidth(UINT cxWidthArg) { this->cxWidth = cxWidthArg; } // modify flags void ModifyFlags(DWORD dwRemove, DWORD dwAdd) { this->dwFlags = (this->dwFlags & ~dwRemove) | dwAdd; } }; /////////////////////////////////////////////////////////////////////////////// // CTaskDialogImpl - implements a Task Dialog template class ATL_NO_VTABLE CTaskDialogImpl { public: CTaskDialogConfig m_tdc; HWND m_hWnd; // used only in callback functions // Constructor CTaskDialogImpl(HWND hWndParent = NULL) : m_hWnd(NULL) { m_tdc.hwndParent = hWndParent; m_tdc.pfCallback = T::TaskDialogCallback; m_tdc.lpCallbackData = (LONG_PTR)static_cast(this); } // Operations HRESULT DoModal(HWND hWndParent = ::GetActiveWindow(), int* pnButton = NULL, int* pnRadioButton = NULL, BOOL* pfVerificationFlagChecked = NULL) { if(m_tdc.hwndParent == NULL) m_tdc.hwndParent = hWndParent; #ifdef _WTL_TASKDIALOG_DIRECT return ::TaskDialogIndirect(&m_tdc, pnButton, pnRadioButton, pfVerificationFlagChecked); #else // This allows apps to run on older versions of Windows typedef HRESULT (STDAPICALLTYPE *PFN_TaskDialogIndirect)(const TASKDIALOGCONFIG* pTaskConfig, int* pnButton, int* pnRadioButton, BOOL* pfVerificationFlagChecked); HRESULT hRet = E_UNEXPECTED; HMODULE m_hCommCtrlDLL = ::LoadLibrary(_T("comctl32.dll")); if(m_hCommCtrlDLL != NULL) { PFN_TaskDialogIndirect pfnTaskDialogIndirect = (PFN_TaskDialogIndirect)::GetProcAddress(m_hCommCtrlDLL, "TaskDialogIndirect"); if(pfnTaskDialogIndirect != NULL) hRet = pfnTaskDialogIndirect(&m_tdc, pnButton, pnRadioButton, pfVerificationFlagChecked); ::FreeLibrary(m_hCommCtrlDLL); } return hRet; #endif } // Operations - setting values of TASKDIALOGCONFIG // common buttons void SetCommonButtons(TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons) { m_tdc.SetCommonButtons(dwCommonButtons); } // window title text void SetWindowTitle(UINT nID) { m_tdc.SetWindowTitle(nID); } void SetWindowTitle(LPCWSTR lpstrWindowTitle) { m_tdc.SetWindowTitle(lpstrWindowTitle); } // main icon void SetMainIcon(HICON hIcon) { m_tdc.SetMainIcon(hIcon); } void SetMainIcon(UINT nID) { m_tdc.SetMainIcon(nID); } void SetMainIcon(LPCWSTR lpstrMainIcon) { m_tdc.SetMainIcon(lpstrMainIcon); } // main instruction text void SetMainInstructionText(UINT nID) { m_tdc.SetMainInstructionText(nID); } void SetMainInstructionText(LPCWSTR lpstrMainInstruction) { m_tdc.SetMainInstructionText(lpstrMainInstruction); } // content text void SetContentText(UINT nID) { m_tdc.SetContentText(nID); } void SetContentText(LPCWSTR lpstrContent) { m_tdc.SetContentText(lpstrContent); } // buttons void SetButtons(const TASKDIALOG_BUTTON* pButtons, UINT cButtons, int nDefaultButton = 0) { m_tdc.SetButtons(pButtons, cButtons, nDefaultButton); } void SetDefaultButton(int nDefaultButton) { m_tdc.SetDefaultButton(nDefaultButton); } // radio buttons void SetRadioButtons(const TASKDIALOG_BUTTON* pRadioButtons, UINT cRadioButtons, int nDefaultRadioButton = 0) { m_tdc.SetRadioButtons(pRadioButtons, cRadioButtons, nDefaultRadioButton); } void SetDefaultRadioButton(int nDefaultRadioButton) { m_tdc.SetDefaultRadioButton(nDefaultRadioButton); } // verification text void SetVerificationText(UINT nID) { m_tdc.SetVerificationText(nID); } void SetVerificationText(LPCWSTR lpstrVerificationText) { m_tdc.SetVerificationText(lpstrVerificationText); } // expanded information text void SetExpandedInformationText(UINT nID) { m_tdc.SetExpandedInformationText(nID); } void SetExpandedInformationText(LPCWSTR lpstrExpandedInformation) { m_tdc.SetExpandedInformationText(lpstrExpandedInformation); } // expanded control text void SetExpandedControlText(UINT nID) { m_tdc.SetExpandedControlText(nID); } void SetExpandedControlText(LPCWSTR lpstrExpandedControlText) { m_tdc.SetExpandedControlText(lpstrExpandedControlText); } // collapsed control text void SetCollapsedControlText(UINT nID) { m_tdc.SetCollapsedControlText(nID); } void SetCollapsedControlText(LPCWSTR lpstrCollapsedControlText) { m_tdc.SetCollapsedControlText(lpstrCollapsedControlText); } // footer icon void SetFooterIcon(HICON hIcon) { m_tdc.SetFooterIcon(hIcon); } void SetFooterIcon(UINT nID) { m_tdc.SetFooterIcon(nID); } void SetFooterIcon(LPCWSTR lpstrFooterIcon) { m_tdc.SetFooterIcon(lpstrFooterIcon); } // footer text void SetFooterText(UINT nID) { m_tdc.SetFooterText(nID); } void SetFooterText(LPCWSTR lpstrFooterText) { m_tdc.SetFooterText(lpstrFooterText); } // width (in DLUs) void SetWidth(UINT cxWidth) { m_tdc.SetWidth(cxWidth); } // modify flags void ModifyFlags(DWORD dwRemove, DWORD dwAdd) { m_tdc.ModifyFlags(dwRemove, dwAdd); } // Implementation static HRESULT CALLBACK TaskDialogCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData) { T* pT = (T*)lpRefData; ATLASSERT((pT->m_hWnd == NULL) || (pT->m_hWnd == hWnd)); BOOL bRet = FALSE; switch(uMsg) { case TDN_DIALOG_CONSTRUCTED: pT->m_hWnd = hWnd; pT->OnDialogConstructed(); break; case TDN_CREATED: pT->OnCreated(); break; case TDN_BUTTON_CLICKED: bRet = pT->OnButtonClicked((int)wParam); break; case TDN_RADIO_BUTTON_CLICKED: pT->OnRadioButtonClicked((int)wParam); break; case TDN_HYPERLINK_CLICKED: pT->OnHyperlinkClicked((LPCWSTR)lParam); break; case TDN_EXPANDO_BUTTON_CLICKED: pT->OnExpandoButtonClicked((wParam != 0)); break; case TDN_VERIFICATION_CLICKED: pT->OnVerificationClicked((wParam != 0)); break; case TDN_HELP: pT->OnHelp(); break; case TDN_TIMER: bRet = pT->OnTimer((DWORD)wParam); break; case TDN_NAVIGATED: pT->OnNavigated(); break; case TDN_DESTROYED: pT->OnDestroyed(); pT->m_hWnd = NULL; break; default: ATLTRACE2(atlTraceUI, 0, _T("Unknown notification received in CTaskDialogImpl::TaskDialogCallback\n")); break; } return (bRet != FALSE) ? S_OK : S_FALSE; } // Overrideables - notification handlers void OnDialogConstructed() { } void OnCreated() { } BOOL OnButtonClicked(int /*nButton*/) { return FALSE; // don't prevent dialog to close } void OnRadioButtonClicked(int /*nRadioButton*/) { } void OnHyperlinkClicked(LPCWSTR /*pszHREF*/) { } void OnExpandoButtonClicked(bool /*bExpanded*/) { } void OnVerificationClicked(bool /*bChecked*/) { } void OnHelp() { } BOOL OnTimer(DWORD /*dwTickCount*/) { return FALSE; // don't reset counter } void OnNavigated() { } void OnDestroyed() { } // Commands - valid to call only from handlers void NavigatePage(TASKDIALOGCONFIG& tdc) { ATLASSERT(m_hWnd != NULL); tdc.cbSize = sizeof(TASKDIALOGCONFIG); if(tdc.hwndParent == NULL) tdc.hwndParent = m_tdc.hwndParent; tdc.pfCallback = m_tdc.pfCallback; tdc.lpCallbackData = m_tdc.lpCallbackData; (TASKDIALOGCONFIG)m_tdc = tdc; ::SendMessage(m_hWnd, TDM_NAVIGATE_PAGE, 0, (LPARAM)&tdc); } // modify TASKDIALOGCONFIG values, then call this to update task dialog void NavigatePage() { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_NAVIGATE_PAGE, 0, (LPARAM)&m_tdc); } void ClickButton(int nButton) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_CLICK_BUTTON, nButton, 0L); } void SetMarqueeProgressBar(BOOL bMarquee) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_SET_MARQUEE_PROGRESS_BAR, bMarquee, 0L); } BOOL SetProgressBarState(int nNewState) { ATLASSERT(m_hWnd != NULL); return (BOOL)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_STATE, nNewState, 0L); } DWORD SetProgressBarRange(int nMinRange, int nMaxRange) { ATLASSERT(m_hWnd != NULL); return (DWORD)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_RANGE, 0, MAKELPARAM(nMinRange, nMaxRange)); } int SetProgressBarPos(int nNewPos) { ATLASSERT(m_hWnd != NULL); return (int)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_POS, nNewPos, 0L); } BOOL SetProgressBarMarquee(BOOL bMarquee, UINT uSpeed) { ATLASSERT(m_hWnd != NULL); return (BOOL)::SendMessage(m_hWnd, TDM_SET_PROGRESS_BAR_MARQUEE, bMarquee, uSpeed); } void SetElementText(TASKDIALOG_ELEMENTS element, LPCWSTR lpstrText) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_SET_ELEMENT_TEXT, element, (LPARAM)lpstrText); } void ClickRadioButton(int nRadioButton) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_CLICK_RADIO_BUTTON, nRadioButton, 0L); } void EnableButton(int nButton, BOOL bEnable) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_ENABLE_BUTTON, nButton, bEnable); } void EnableRadioButton(int nButton, BOOL bEnable) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_ENABLE_RADIO_BUTTON, nButton, bEnable); } void ClickVerification(BOOL bCheck, BOOL bFocus) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_CLICK_VERIFICATION, bCheck, bFocus); } void UpdateElementText(TASKDIALOG_ELEMENTS element, LPCWSTR lpstrText) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_UPDATE_ELEMENT_TEXT, element, (LPARAM)lpstrText); } void SetButtonElevationRequiredState(int nButton, BOOL bElevation) { ATLASSERT(m_hWnd != NULL); ::SendMessage(m_hWnd, TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE, nButton, bElevation); } void UpdateIcon(TASKDIALOG_ICON_ELEMENTS element, HICON hIcon) { ATLASSERT(m_hWnd != NULL); #ifdef _DEBUG if(element == TDIE_ICON_MAIN) ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_MAIN) != 0); else if(element == TDIE_ICON_FOOTER) ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_FOOTER) != 0); #endif // _DEBUG ::SendMessage(m_hWnd, TDM_UPDATE_ICON, element, (LPARAM)hIcon); } void UpdateIcon(TASKDIALOG_ICON_ELEMENTS element, LPCWSTR lpstrIcon) { ATLASSERT(m_hWnd != NULL); #ifdef _DEBUG if(element == TDIE_ICON_MAIN) ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_MAIN) == 0); else if(element == TDIE_ICON_FOOTER) ATLASSERT((m_tdc.dwFlags & TDF_USE_HICON_FOOTER) == 0); #endif // _DEBUG ::SendMessage(m_hWnd, TDM_UPDATE_ICON, element, (LPARAM)lpstrIcon); } }; /////////////////////////////////////////////////////////////////////////////// // CTaskDialog - for non-customized task dialogs class CTaskDialog : public CTaskDialogImpl { public: CTaskDialog(HWND hWndParent = NULL) : CTaskDialogImpl(hWndParent) { m_tdc.pfCallback = NULL; } }; #endif // (_WIN32_WINNT >= 0x0600) || defined(_WTL_TASKDIALOG) } // namespace WTL #endif // __ATLDLGS_H__ ================================================ FILE: third_party/WTL/Include/atldwm.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLDWM_H__ #define __ATLDWM_H__ #pragma once #ifndef __ATLAPP_H__ #error atldwm.h requires atlapp.h to be included first #endif #ifndef __ATLWIN_H__ #error atldwm.h requires atlwin.h to be included first #endif #if (_WIN32_WINNT < 0x0600) #error atldwm.h requires _WIN32_WINNT >= 0x0600 #endif #ifndef _DWMAPI_H_ #include #endif #pragma comment(lib, "dwmapi.lib") // Note: To create an application that also runs on older versions of Windows, // use delay load of dwmapi.dll and ensure that no calls to the DWM API are // Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib, // and add dwmapi.dll in the Linker.Input.Delay Loaded DLLs section of the // project properties. /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CDwm // CDwmImpl // CDwmWindowT - CDwmWindow // CDwmThumbnailT // CDwmThumbnail // CDwmThumbnailHandle // CAeroControlImpl namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CDwm - wrapper for DWM handle class CDwm { public: // Data members static int m_nIsDwmSupported; // Constructor CDwm() { IsDwmSupported(); } // Dwm support helper static bool IsDwmSupported() { if(m_nIsDwmSupported == -1) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CDwm::IsDwmSupported.\n")); ATLASSERT(FALSE); return false; } if(m_nIsDwmSupported == -1) { HMODULE hDwmDLL = ::LoadLibrary(_T("dwmapi.dll")); m_nIsDwmSupported = (hDwmDLL != NULL) ? 1 : 0; if(hDwmDLL != NULL) ::FreeLibrary(hDwmDLL); } lock.Unlock(); } ATLASSERT(m_nIsDwmSupported != -1); return (m_nIsDwmSupported == 1); } // Operations BOOL DwmIsCompositionEnabled() const { if(!IsDwmSupported()) return FALSE; BOOL bRes = FALSE; return (SUCCEEDED(::DwmIsCompositionEnabled(&bRes)) && bRes) ? TRUE : FALSE; } BOOL DwmEnableComposition(UINT fEnable) { if(!IsDwmSupported()) return FALSE; return SUCCEEDED(::DwmEnableComposition(fEnable)) ? TRUE : FALSE; } BOOL DwmEnableMMCSS(BOOL fEnableMMCSS) { if(!IsDwmSupported()) return FALSE; return SUCCEEDED(::DwmEnableMMCSS(fEnableMMCSS)) ? TRUE : FALSE; } HRESULT DwmGetColorizationColor(DWORD* pcrColorization, BOOL* pfOpaqueBlend) { if(!IsDwmSupported()) return E_NOTIMPL; return ::DwmGetColorizationColor(pcrColorization, pfOpaqueBlend); } HRESULT DwmFlush() { if(!IsDwmSupported()) return E_NOTIMPL; return ::DwmFlush(); } }; __declspec(selectany) int CDwm::m_nIsDwmSupported = -1; /////////////////////////////////////////////////////////////////////////////// // CDwmImpl - DWM window support template class CDwmImpl : public TBase { public: HRESULT DwmEnableBlurBehindWindow(const DWM_BLURBEHIND* pBB) { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmEnableBlurBehindWindow(pT->m_hWnd, pBB); } HRESULT DwmExtendFrameIntoClientArea(const MARGINS* pMargins) { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmExtendFrameIntoClientArea(pT->m_hWnd, pMargins); } HRESULT DwmExtendFrameIntoEntireClientArea() { MARGINS margins = { -1 }; return DwmExtendFrameIntoClientArea(&margins); } HRESULT DwmGetCompositionTimingInfo(DWM_TIMING_INFO* pTimingInfo) { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmGetCompositionTimingInfo(pT->m_hWnd, pTimingInfo); } HRESULT DwmGetWindowAttribute(DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute) { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmGetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute); } HRESULT DwmModifyPreviousDxFrameDuration(INT cRefreshes, BOOL fRelative) { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmModifyPreviousDxFrameDuration(pT->m_hWnd, cRefreshes, fRelative); } HRESULT DwmSetDxFrameDuration(INT cRefreshes) { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmSetDxFrameDuration(pT->m_hWnd, cRefreshes); } HRESULT DwmSetPresentParameters(DWM_PRESENT_PARAMETERS* pPresentParams) { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmSetPresentParameters(pT->m_hWnd, pPresentParams); } HRESULT DwmSetWindowAttribute(DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute) { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmSetWindowAttribute(pT->m_hWnd, dwAttribute, pvAttribute, cbAttribute); } HRESULT DwmAttachMilContent() { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmAttachMilContent(pT->m_hWnd); } HRESULT DwmDetachMilContent() { if(!this->IsDwmSupported()) return E_NOTIMPL; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DwmDetachMilContent(pT->m_hWnd); } }; template class CDwmWindowT : public TBase, public CDwmImpl > { public: CDwmWindowT(HWND hWnd = NULL) : TBase(hWnd) { } CDwmWindowT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } }; typedef CDwmWindowT CDwmWindow; /////////////////////////////////////////////////////////////////////////////// // CDwmThumbnail - provides DWM thumbnail support template class CDwmThumbnailT : public TBase { public: // Data members HTHUMBNAIL m_hThumbnail; // Constructor CDwmThumbnailT(HTHUMBNAIL hThumbnail = NULL) : m_hThumbnail(hThumbnail) { } ~CDwmThumbnailT() { if(t_bManaged && (m_hThumbnail != NULL)) Unregister(); } // Operations CDwmThumbnailT& operator =(HTHUMBNAIL hThumbnail) { Attach(hThumbnail); return *this; } void Attach(HTHUMBNAIL hThumbnailNew) { if(t_bManaged && (m_hThumbnail != NULL) && (m_hThumbnail != hThumbnailNew)) Unregister(); m_hThumbnail = hThumbnailNew; } HTHUMBNAIL Detach() { HTHUMBNAIL hThumbnail = m_hThumbnail; m_hThumbnail = NULL; return hThumbnail; } HRESULT Register(HWND hwndDestination, HWND hwndSource) { ATLASSERT(::IsWindow(hwndDestination)); ATLASSERT(::IsWindow(hwndSource)); ATLASSERT(m_hThumbnail==NULL); if(!this->IsDwmSupported()) return E_NOTIMPL; return ::DwmRegisterThumbnail(hwndDestination, hwndSource, &m_hThumbnail); } HRESULT Unregister() { if(!this->IsDwmSupported()) return E_NOTIMPL; if(m_hThumbnail == NULL) return S_FALSE; HRESULT Hr = ::DwmUnregisterThumbnail(m_hThumbnail); if(SUCCEEDED(Hr)) m_hThumbnail = NULL; return Hr; } operator HTHUMBNAIL() const { return m_hThumbnail; } bool IsNull() const { return (m_hThumbnail == NULL); } HRESULT UpdateProperties(const DWM_THUMBNAIL_PROPERTIES* ptnProperties) { if(!this->IsDwmSupported()) return E_NOTIMPL; ATLASSERT(m_hThumbnail != NULL); return ::DwmUpdateThumbnailProperties(m_hThumbnail, ptnProperties); } // Attributes HRESULT QuerySourceSize(PSIZE pSize) { if(!this->IsDwmSupported()) return E_NOTIMPL; ATLASSERT(m_hThumbnail != NULL); return ::DwmQueryThumbnailSourceSize(m_hThumbnail, pSize); } }; typedef CDwmThumbnailT CDwmThumbnail; typedef CDwmThumbnailT CDwmThumbnailHandle; #ifdef __ATLTHEME_H__ /////////////////////////////////////////////////////////////////////////////// // CAeroControlImpl - Base class for controls on Glass template class CAeroControlImpl : public CThemeImpl, public CBufferedPaintImpl, public ATL::CWindowImpl { public: typedef CThemeImpl _themeClass; typedef CBufferedPaintImpl _baseClass; typedef ATL::CWindowImpl _windowClass; CAeroControlImpl() { this->m_PaintParams.dwFlags = BPPF_ERASE; } static LPCWSTR GetThemeName() { #ifdef _UNICODE return TBase::GetWndClassName(); #else ATLASSERT(!_T("Return UNICODE string of window classname / theme class")); return NULL; #endif // _UNICODE } // Message map and handlers BEGIN_MSG_MAP(CAeroControlImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) CHAIN_MSG_MAP(_themeClass) CHAIN_MSG_MAP(_baseClass) END_MSG_MAP() LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { T* pT = static_cast(this); pT->Init(); bHandled = FALSE; return 0; } LRESULT OnActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(this->IsThemingSupported()) this->Invalidate(FALSE); bHandled = FALSE; return 0; } // Operations BOOL SubclassWindow(HWND hWnd) { ATLASSERT(this->m_hWnd == NULL); ATLASSERT(::IsWindow(hWnd)); BOOL bRet = _windowClass::SubclassWindow(hWnd); if(bRet) { T* pT = static_cast(this); pT->Init(); } return bRet; } // Implementation LRESULT DefWindowProc() { const ATL::_ATL_MSG* pMsg = this->m_pCurrentMsg; LRESULT lRes = 0; if(pMsg != NULL) lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); return lRes; } LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { T* pT = static_cast(this); LRESULT lRes = 0; if(::DwmDefWindowProc(pT->m_hWnd, uMsg, wParam, lParam, &lRes) != FALSE) return lRes; return _windowClass::DefWindowProc(uMsg, wParam, lParam); } void DoBufferedPaint(HDC hDC, RECT& rcPaint) { T* pT = static_cast(this); HDC hDCPaint = NULL; RECT rcClient = {}; this->GetClientRect(&rcClient); this->m_BufferedPaint.Begin(hDC, &rcClient, this->m_dwFormat, &this->m_PaintParams, &hDCPaint); ATLASSERT(hDCPaint != NULL); pT->DoAeroPaint(hDCPaint, rcClient, rcPaint); this->m_BufferedPaint.End(); } void DoPaint(HDC /*hdc*/, RECT& /*rcClient*/) { DefWindowProc(); } // Overridables void Init() { T* pT = static_cast(this); (void)pT; // avoid level 4 warning this->SetThemeClassList(pT->GetThemeName()); if(this->m_lpstrThemeClassList != NULL) this->OpenThemeData(); } void DoAeroPaint(HDC hDC, RECT& /*rcClient*/, RECT& rcPaint) { DefWindowProc(WM_PAINT, (WPARAM) hDC, 0L); this->m_BufferedPaint.MakeOpaque(&rcPaint); } }; #endif // __ATLTHEME_H__ } // namespace WTL #endif // __ATLDWM_H__ ================================================ FILE: third_party/WTL/Include/atlfind.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLFIND_H__ #define __ATLFIND_H__ #pragma once #ifndef __ATLCTRLS_H__ #error atlfind.h requires atlctrls.h to be included first #endif #ifndef __ATLDLGS_H__ #error atlfind.h requires atldlgs.h to be included first #endif #ifndef __ATLSTR_H__ #error atlfind.h requires CString #endif /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CEditFindReplaceImplBase // CEditFindReplaceImpl // CRichEditFindReplaceImpl namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CEditFindReplaceImplBase - Base class for mixin classes that // help implement Find/Replace for CEdit or CRichEditCtrl based window classes. template class CEditFindReplaceImplBase { protected: // Typedefs typedef CEditFindReplaceImplBase thisClass; // Enumerations enum TranslationTextItem { eText_OnReplaceAllMessage = 0, eText_OnReplaceAllTitle = 1, eText_OnTextNotFoundMessage = 2, eText_OnTextNotFoundTitle = 3 }; public: // Data members TFindReplaceDialog* m_pFindReplaceDialog; ATL::CString m_sFindNext, m_sReplaceWith; BOOL m_bFindOnly, m_bFirstSearch, m_bMatchCase, m_bWholeWord, m_bFindDown; LONG m_nInitialSearchPos; HCURSOR m_hOldCursor; // Constructors CEditFindReplaceImplBase() : m_pFindReplaceDialog(NULL), m_bFindOnly(TRUE), m_bFirstSearch(TRUE), m_bMatchCase(FALSE), m_bWholeWord(FALSE), m_bFindDown(TRUE), m_nInitialSearchPos(0), m_hOldCursor(NULL) { } // Message Handlers BEGIN_MSG_MAP(thisClass) ALT_MSG_MAP(1) MESSAGE_HANDLER(TFindReplaceDialog::GetFindReplaceMsg(), OnFindReplaceCmd) COMMAND_ID_HANDLER(ID_EDIT_FIND, OnEditFind) COMMAND_ID_HANDLER(ID_EDIT_REPEAT, OnEditRepeat) COMMAND_ID_HANDLER(ID_EDIT_REPLACE, OnEditReplace) END_MSG_MAP() LRESULT OnFindReplaceCmd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { T* pT = static_cast(this); TFindReplaceDialog* pDialog = TFindReplaceDialog::GetNotifier(lParam); if(pDialog == NULL) { ATLASSERT(FALSE); ::MessageBeep(MB_ICONERROR); return 1; } ATLASSERT(pDialog == m_pFindReplaceDialog); LPFINDREPLACE findReplace = (LPFINDREPLACE)lParam; if((m_pFindReplaceDialog != NULL) && (findReplace != NULL)) { if(pDialog->FindNext()) { pT->OnFindNext(pDialog->GetFindString(), pDialog->SearchDown(), pDialog->MatchCase(), pDialog->MatchWholeWord()); } else if(pDialog->ReplaceCurrent()) { pT->OnReplaceSel(pDialog->GetFindString(), pDialog->SearchDown(), pDialog->MatchCase(), pDialog->MatchWholeWord(), pDialog->GetReplaceString()); } else if(pDialog->ReplaceAll()) { pT->OnReplaceAll(pDialog->GetFindString(), pDialog->GetReplaceString(), pDialog->MatchCase(), pDialog->MatchWholeWord()); } else if(pDialog->IsTerminating()) { // Dialog is going away (but hasn't gone away yet) // OnFinalMessage will "delete this" pT->OnTerminatingFindReplaceDialog(m_pFindReplaceDialog); m_pFindReplaceDialog = NULL; } } return 0; } LRESULT OnEditFind(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->FindReplace(TRUE); return 0; } LRESULT OnEditRepeat(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); // If the user is holding down SHIFT when hitting F3, we'll // search in reverse. Otherwise, we'll search forward. // (be sure to have an accelerator mapped to ID_EDIT_REPEAT // for both F3 and Shift+F3) m_bFindDown = !((::GetKeyState(VK_SHIFT) & 0x8000) == 0x8000); if(m_sFindNext.IsEmpty()) { pT->FindReplace(TRUE); } else { if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) pT->TextNotFound(m_sFindNext); } return 0; } LRESULT OnEditReplace(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled) { T* pT = static_cast(this); DWORD style = pT->GetStyle(); if((style & ES_READONLY) != ES_READONLY) { pT->FindReplace(FALSE); } else { // Don't allow replace when the edit control is read only bHandled = FALSE; } return 0; } // Operations (overrideable) TFindReplaceDialog* CreateFindReplaceDialog(BOOL bFindOnly, // TRUE for Find, FALSE for FindReplace LPCTSTR lpszFindWhat, LPCTSTR lpszReplaceWith = NULL, DWORD dwFlags = FR_DOWN, HWND hWndParent = NULL) { // You can override all of this in a derived class TFindReplaceDialog* findReplaceDialog = NULL; ATLTRY(findReplaceDialog = new TFindReplaceDialog()); if(findReplaceDialog == NULL) { ::MessageBeep(MB_ICONHAND); } else { HWND hWndFindReplace = findReplaceDialog->Create(bFindOnly, lpszFindWhat, lpszReplaceWith, dwFlags, hWndParent); if(hWndFindReplace == NULL) { delete findReplaceDialog; findReplaceDialog = NULL; } else { findReplaceDialog->SetActiveWindow(); findReplaceDialog->ShowWindow(SW_SHOW); } } return findReplaceDialog; } void AdjustDialogPosition(HWND hWndDialog) { ATLASSERT((hWndDialog != NULL) && ::IsWindow(hWndDialog)); T* pT = static_cast(this); LONG nStartChar = 0, nEndChar = 0; // Send EM_GETSEL so we can use both Edit and RichEdit // (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&) ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); POINT point = pT->PosFromChar(nStartChar); pT->ClientToScreen(&point); RECT rect = {}; ::GetWindowRect(hWndDialog, &rect); if(::PtInRect(&rect, point) != FALSE) { if(point.y > (rect.bottom - rect.top)) { ::OffsetRect(&rect, 0, point.y - rect.bottom - 20); } else { int nVertExt = GetSystemMetrics(SM_CYSCREEN); if((point.y + (rect.bottom - rect.top)) < nVertExt) ::OffsetRect(&rect, 0, 40 + point.y - rect.top); } ::MoveWindow(hWndDialog, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); } } DWORD GetFindReplaceDialogFlags() const { DWORD dwFlags = 0; if(m_bFindDown) dwFlags |= FR_DOWN; if(m_bMatchCase) dwFlags |= FR_MATCHCASE; if(m_bWholeWord) dwFlags |= FR_WHOLEWORD; return dwFlags; } void FindReplace(BOOL bFindOnly) { T* pT = static_cast(this); m_bFirstSearch = TRUE; if(m_pFindReplaceDialog != NULL) { if(m_bFindOnly == bFindOnly) { m_pFindReplaceDialog->SetActiveWindow(); m_pFindReplaceDialog->ShowWindow(SW_SHOW); return; } else { m_pFindReplaceDialog->SendMessage(WM_CLOSE); ATLASSERT(m_pFindReplaceDialog == NULL); } } ATLASSERT(m_pFindReplaceDialog == NULL); ATL::CString findNext; pT->GetSelText(findNext); // if selection is empty or spans multiple lines use old find text if(findNext.IsEmpty() || (findNext.FindOneOf(_T("\n\r")) != -1)) findNext = m_sFindNext; ATL::CString replaceWith = m_sReplaceWith; DWORD dwFlags = pT->GetFindReplaceDialogFlags(); m_pFindReplaceDialog = pT->CreateFindReplaceDialog(bFindOnly, findNext, replaceWith, dwFlags, pT->operator HWND()); ATLASSERT(m_pFindReplaceDialog != NULL); if(m_pFindReplaceDialog != NULL) m_bFindOnly = bFindOnly; } BOOL SameAsSelected(LPCTSTR lpszCompare, BOOL bMatchCase, BOOL /*bWholeWord*/) { T* pT = static_cast(this); // check length first size_t nLen = lstrlen(lpszCompare); LONG nStartChar = 0, nEndChar = 0; // Send EM_GETSEL so we can use both Edit and RichEdit // (CEdit::GetSel uses int&, and CRichEditCtrlT::GetSel uses LONG&) ::SendMessage(pT->m_hWnd, EM_GETSEL, (WPARAM)&nStartChar, (LPARAM)&nEndChar); if(nLen != (size_t)(nEndChar - nStartChar)) return FALSE; // length is the same, check contents ATL::CString selectedText; pT->GetSelText(selectedText); return (bMatchCase && (selectedText.Compare(lpszCompare) == 0)) || (!bMatchCase && (selectedText.CompareNoCase(lpszCompare) == 0)); } void TextNotFound(LPCTSTR lpszFind) { T* pT = static_cast(this); m_bFirstSearch = TRUE; pT->OnTextNotFound(lpszFind); } ATL::CString GetTranslationText(enum TranslationTextItem eItem) const { ATL::CString text; switch(eItem) { case eText_OnReplaceAllMessage: text = _T("Replaced %d occurances of \"%s\" with \"%s\""); break; case eText_OnReplaceAllTitle: text = _T("Replace All"); break; case eText_OnTextNotFoundMessage: text = _T("Unable to find the text \"%s\""); break; case eText_OnTextNotFoundTitle: text = _T("Text not found"); break; } return text; } // Overrideable Handlers void OnFindNext(LPCTSTR lpszFind, BOOL bFindDown, BOOL bMatchCase, BOOL bWholeWord) { T* pT = static_cast(this); m_sFindNext = lpszFind; m_bMatchCase = bMatchCase; m_bWholeWord = bWholeWord; m_bFindDown = bFindDown; if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) pT->TextNotFound(m_sFindNext); else pT->AdjustDialogPosition(m_pFindReplaceDialog->operator HWND()); } void OnReplaceSel(LPCTSTR lpszFind, BOOL bFindDown, BOOL bMatchCase, BOOL bWholeWord, LPCTSTR lpszReplace) { T* pT = static_cast(this); m_sFindNext = lpszFind; m_sReplaceWith = lpszReplace; m_bMatchCase = bMatchCase; m_bWholeWord = bWholeWord; m_bFindDown = bFindDown; if(pT->SameAsSelected(m_sFindNext, m_bMatchCase, m_bWholeWord)) pT->ReplaceSel(m_sReplaceWith); if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) pT->TextNotFound(m_sFindNext); else pT->AdjustDialogPosition(m_pFindReplaceDialog->operator HWND()); } void OnReplaceAll(LPCTSTR lpszFind, LPCTSTR lpszReplace, BOOL bMatchCase, BOOL bWholeWord) { T* pT = static_cast(this); m_sFindNext = lpszFind; m_sReplaceWith = lpszReplace; m_bMatchCase = bMatchCase; m_bWholeWord = bWholeWord; m_bFindDown = TRUE; // no selection or different than what looking for if(!pT->SameAsSelected(m_sFindNext, m_bMatchCase, m_bWholeWord)) { if(!pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)) { pT->TextNotFound(m_sFindNext); return; } } pT->OnReplaceAllCoreBegin(); int replaceCount=0; do { ++replaceCount; pT->ReplaceSel(m_sReplaceWith); } while(pT->FindTextSimple(m_sFindNext, m_bMatchCase, m_bWholeWord, m_bFindDown)); pT->OnReplaceAllCoreEnd(replaceCount); } void OnReplaceAllCoreBegin() { T* pT = static_cast(this); m_hOldCursor = ::SetCursor(::LoadCursor(NULL, IDC_WAIT)); pT->HideSelection(TRUE, FALSE); } void OnReplaceAllCoreEnd(int replaceCount) { T* pT = static_cast(this); pT->HideSelection(FALSE, FALSE); ::SetCursor(m_hOldCursor); ATL::CString message = pT->GetTranslationText(eText_OnReplaceAllMessage); if(message.GetLength() > 0) { ATL::CString formattedMessage; formattedMessage.Format(message, replaceCount, (LPCTSTR)m_sFindNext, (LPCTSTR)m_sReplaceWith); if(m_pFindReplaceDialog != NULL) { m_pFindReplaceDialog->MessageBox(formattedMessage, pT->GetTranslationText(eText_OnReplaceAllTitle), MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); } else { pT->MessageBox(formattedMessage, pT->GetTranslationText(eText_OnReplaceAllTitle), MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); } } } void OnTextNotFound(LPCTSTR lpszFind) { T* pT = static_cast(this); ATL::CString message = pT->GetTranslationText(eText_OnTextNotFoundMessage); if(message.GetLength() > 0) { ATL::CString formattedMessage; formattedMessage.Format(message, lpszFind); if(m_pFindReplaceDialog != NULL) { m_pFindReplaceDialog->MessageBox(formattedMessage, pT->GetTranslationText(eText_OnTextNotFoundTitle), MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); } else { pT->MessageBox(formattedMessage, pT->GetTranslationText(eText_OnTextNotFoundTitle), MB_OK | MB_ICONINFORMATION | MB_APPLMODAL); } } else { ::MessageBeep(MB_ICONHAND); } } void OnTerminatingFindReplaceDialog(TFindReplaceDialog*& /*findReplaceDialog*/) { } }; /////////////////////////////////////////////////////////////////////////////// // CEditFindReplaceImpl - Mixin class for implementing Find/Replace for CEdit // based window classes. // Chain to CEditFindReplaceImpl message map. Your class must also derive from CEdit. // Example: // class CMyEdit : public CWindowImpl, // public CEditFindReplaceImpl // { // public: // BEGIN_MSG_MAP(CMyEdit) // // your handlers... // CHAIN_MSG_MAP_ALT(CEditFindReplaceImpl, 1) // END_MSG_MAP() // // other stuff... // }; template class CEditFindReplaceImpl : public CEditFindReplaceImplBase { protected: typedef CEditFindReplaceImpl thisClass; typedef CEditFindReplaceImplBase baseClass; public: // Message Handlers BEGIN_MSG_MAP(thisClass) ALT_MSG_MAP(1) CHAIN_MSG_MAP_ALT(baseClass, 1) END_MSG_MAP() // Operations // Supported only for RichEdit, so this does nothing for Edit void HideSelection(BOOL /*bHide*/ = TRUE, BOOL /*bChangeStyle*/ = FALSE) { } // Operations (overrideable) BOOL FindTextSimple(LPCTSTR lpszFind, BOOL bMatchCase, BOOL bWholeWord, BOOL bFindDown = TRUE) { T* pT = static_cast(this); ATLASSERT(lpszFind != NULL); ATLASSERT(*lpszFind != _T('\0')); UINT nLen = pT->GetBufferLength(); int nStartChar = 0, nEndChar = 0; pT->GetSel(nStartChar, nEndChar); UINT nStart = nStartChar; int iDir = bFindDown ? +1 : -1; // can't find a match before the first character if((nStart == 0) && (iDir < 0)) return FALSE; LPCTSTR lpszText = pT->LockBuffer(); bool isDBCS = false; #ifdef _MBCS CPINFO info = {}; ::GetCPInfo(::GetOEMCP(), &info); isDBCS = (info.MaxCharSize > 1); #endif if(iDir < 0) { // always go back one for search backwards nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart)); } else if((nStartChar != nEndChar) && (pT->SameAsSelected(lpszFind, bMatchCase, bWholeWord))) { // easy to go backward/forward with SBCS #ifndef _UNICODE if(::IsDBCSLeadByte(lpszText[nStart])) nStart++; #endif nStart += iDir; } // handle search with nStart past end of buffer UINT nLenFind = ::lstrlen(lpszFind); if((nStart + nLenFind - 1) >= nLen) { if((iDir < 0) && (nLen >= nLenFind)) { if(isDBCS) { // walk back to previous character n times nStart = nLen; int n = nLenFind; while(n--) { nStart -= int((lpszText + nStart) - ::CharPrev(lpszText, lpszText + nStart)); } } else { // single-byte character set is easy and fast nStart = nLen - nLenFind; } ATLASSERT((nStart + nLenFind - 1) <= nLen); } else { pT->UnlockBuffer(); return FALSE; } } // start the search at nStart LPCTSTR lpsz = lpszText + nStart; typedef int (WINAPI* CompareProc)(LPCTSTR str1, LPCTSTR str2); CompareProc pfnCompare = bMatchCase ? lstrcmp : lstrcmpi; if(isDBCS) { // double-byte string search LPCTSTR lpszStop = NULL; if(iDir > 0) { // start at current and find _first_ occurrance lpszStop = lpszText + nLen - nLenFind + 1; } else { // start at top and find _last_ occurrance lpszStop = lpsz; lpsz = lpszText; } LPCTSTR lpszFound = NULL; while(lpsz <= lpszStop) { #ifndef _UNICODE if(!bMatchCase || ((*lpsz == *lpszFind) && (!::IsDBCSLeadByte(*lpsz) || (lpsz[1] == lpszFind[1])))) #else if(!bMatchCase || ((*lpsz == *lpszFind) && (lpsz[1] == lpszFind[1]))) #endif { LPTSTR lpch = (LPTSTR)(lpsz + nLenFind); TCHAR chSave = *lpch; *lpch = _T('\0'); int nResult = (*pfnCompare)(lpsz, lpszFind); *lpch = chSave; if(nResult == 0) { lpszFound = lpsz; if(iDir > 0) break; } } lpsz = ::CharNext(lpsz); } pT->UnlockBuffer(); if(lpszFound != NULL) { int n = (int)(lpszFound - lpszText); pT->SetSel(n, n + nLenFind); return TRUE; } } else { // single-byte string search UINT nCompare = 0; if(iDir < 0) nCompare = (UINT)(lpsz - lpszText) + 1; else nCompare = nLen - (UINT)(lpsz - lpszText) - nLenFind + 1; while(nCompare > 0) { ATLASSERT(lpsz >= lpszText); ATLASSERT((lpsz + nLenFind - 1) <= (lpszText + nLen - 1)); LPSTR lpch = (LPSTR)(lpsz + nLenFind); char chSave = *lpch; *lpch = '\0'; int nResult = (*pfnCompare)(lpsz, lpszFind); *lpch = chSave; if(nResult == 0) { pT->UnlockBuffer(); int n = (int)(lpsz - lpszText); pT->SetSel(n, n + nLenFind); return TRUE; } // restore character at end of search *lpch = chSave; // move on to next substring nCompare--; lpsz += iDir; } pT->UnlockBuffer(); } return FALSE; } LPCTSTR LockBuffer() const { const T* pT = static_cast(this); ATLASSERT(pT->m_hWnd != NULL); #ifndef _UNICODE // If common controls version 6 is in use (such as via theming), then EM_GETHANDLE // will always return a UNICODE string. You're really not supposed to superclass // or subclass common controls with an ANSI windows procedure. DWORD dwMajor = 0, dwMinor = 0; HRESULT hRet = ATL::AtlGetCommCtrlVersion(&dwMajor, &dwMinor); if(SUCCEEDED(hRet) && (dwMajor >= 6)) { ATLTRACE2(atlTraceUI, 0, _T("AtlFind Warning: You have compiled for MBCS/ANSI but are using common controls version 6 or later which are always Unicode.\r\n")); ATLASSERT(FALSE); } #endif // !_UNICODE HLOCAL hLocal = pT->GetHandle(); ATLASSERT(hLocal != NULL); LPCTSTR lpszText = (LPCTSTR)::LocalLock(hLocal); ATLASSERT(lpszText != NULL); return lpszText; } void UnlockBuffer() const { const T* pT = static_cast(this); ATLASSERT(pT->m_hWnd != NULL); HLOCAL hLocal = pT->GetHandle(); ATLASSERT(hLocal != NULL); ::LocalUnlock(hLocal); } UINT GetBufferLength() const { const T* pT = static_cast(this); ATLASSERT(pT->m_hWnd != NULL); UINT nLen = 0; LPCTSTR lpszText = pT->LockBuffer(); if(lpszText != NULL) nLen = ::lstrlen(lpszText); pT->UnlockBuffer(); return nLen; } LONG EndOfLine(LPCTSTR lpszText, UINT nLen, UINT nIndex) const { LPCTSTR lpsz = lpszText + nIndex; LPCTSTR lpszStop = lpszText + nLen; while((lpsz < lpszStop) && (*lpsz != _T('\r'))) ++lpsz; return LONG(lpsz - lpszText); } LONG GetSelText(ATL::CString& strText) const { const T* pT = static_cast(this); int nStartChar = 0, nEndChar = 0; pT->GetSel(nStartChar, nEndChar); ATLASSERT((UINT)nEndChar <= pT->GetBufferLength()); LPCTSTR lpszText = pT->LockBuffer(); LONG nLen = pT->EndOfLine(lpszText, nEndChar, nStartChar) - nStartChar; ATL::Checked::memcpy_s(strText.GetBuffer(nLen), nLen * sizeof(TCHAR), lpszText + nStartChar, nLen * sizeof(TCHAR)); strText.ReleaseBuffer(nLen); pT->UnlockBuffer(); return nLen; } }; /////////////////////////////////////////////////////////////////////////////// // CRichEditFindReplaceImpl - Mixin class for implementing Find/Replace for CRichEditCtrl // based window classes. // Chain to CRichEditFindReplaceImpl message map. Your class must also derive from CRichEditCtrl. // Example: // class CMyRichEdit : public CWindowImpl, // public CRichEditFindReplaceImpl // { // public: // BEGIN_MSG_MAP(CMyRichEdit) // // your handlers... // CHAIN_MSG_MAP_ALT(CRichEditFindReplaceImpl, 1) // END_MSG_MAP() // // other stuff... // }; template class CRichEditFindReplaceImpl : public CEditFindReplaceImplBase { protected: typedef CRichEditFindReplaceImpl thisClass; typedef CEditFindReplaceImplBase baseClass; public: BEGIN_MSG_MAP(thisClass) ALT_MSG_MAP(1) CHAIN_MSG_MAP_ALT(baseClass, 1) END_MSG_MAP() // Operations (overrideable) BOOL FindTextSimple(LPCTSTR lpszFind, BOOL bMatchCase, BOOL bWholeWord, BOOL bFindDown = TRUE) { T* pT = static_cast(this); ATLASSERT(lpszFind != NULL); FINDTEXTEX ft = {}; pT->GetSel(ft.chrg); if(this->m_bFirstSearch) { if(bFindDown) this->m_nInitialSearchPos = ft.chrg.cpMin; else this->m_nInitialSearchPos = ft.chrg.cpMax; this->m_bFirstSearch = FALSE; } ft.lpstrText = (LPTSTR)lpszFind; if(ft.chrg.cpMin != ft.chrg.cpMax) // i.e. there is a selection { if(bFindDown) { ft.chrg.cpMin++; } else { // won't wraparound backwards ft.chrg.cpMin = __max(ft.chrg.cpMin, 0); } } DWORD dwFlags = bMatchCase ? FR_MATCHCASE : 0; dwFlags |= bWholeWord ? FR_WHOLEWORD : 0; ft.chrg.cpMax = pT->GetTextLength() + this->m_nInitialSearchPos; if(bFindDown) { if(this->m_nInitialSearchPos >= 0) ft.chrg.cpMax = pT->GetTextLength(); dwFlags |= FR_DOWN; ATLASSERT(ft.chrg.cpMax >= ft.chrg.cpMin); } else { if(this->m_nInitialSearchPos >= 0) ft.chrg.cpMax = 0; dwFlags &= ~FR_DOWN; ATLASSERT(ft.chrg.cpMax <= ft.chrg.cpMin); } BOOL bRet = FALSE; if(pT->FindAndSelect(dwFlags, ft) != -1) { bRet = TRUE; // we found the text } else if(this->m_nInitialSearchPos > 0) { // if the original starting point was not the beginning // of the buffer and we haven't already been here if(bFindDown) { ft.chrg.cpMin = 0; ft.chrg.cpMax = this->m_nInitialSearchPos; } else { ft.chrg.cpMin = pT->GetTextLength(); ft.chrg.cpMax = this->m_nInitialSearchPos; } this->m_nInitialSearchPos = this->m_nInitialSearchPos - pT->GetTextLength(); bRet = (pT->FindAndSelect(dwFlags, ft) != -1) ? TRUE : FALSE; } return bRet; } long FindAndSelect(DWORD dwFlags, FINDTEXTEX& ft) { T* pT = static_cast(this); LONG index = pT->FindText(dwFlags, ft); if(index != -1) // i.e. we found something pT->SetSel(ft.chrgText); return index; } }; } // namespace WTL #endif // __ATLFIND_H__ ================================================ FILE: third_party/WTL/Include/atlframe.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLFRAME_H__ #define __ATLFRAME_H__ #pragma once #ifndef __ATLAPP_H__ #error atlframe.h requires atlapp.h to be included first #endif #ifndef __ATLWIN_H__ #error atlframe.h requires atlwin.h to be included first #endif /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CFrameWindowImpl // CMDIWindow // CMDIFrameWindowImpl // CMDIChildWindowImpl // COwnerDraw // CUpdateUIBase // CUpdateUI // CDynamicUpdateUI // CAutoUpdateUI // CDialogResize // CDynamicDialogLayout // CDoubleBufferImpl // CDoubleBufferWindowImpl // // Global functions: // AtlCreateSimpleToolBar() namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CFrameWndClassInfo - Manages frame window Windows class information class CFrameWndClassInfo { public: enum { cchAutoName = 5 + sizeof(void*) * 2 }; // sizeof(void*) * 2 is the number of digits %p outputs WNDCLASSEX m_wc; LPCTSTR m_lpszOrigName; WNDPROC pWndProc; LPCTSTR m_lpszCursorID; BOOL m_bSystemCursor; ATOM m_atom; TCHAR m_szAutoName[cchAutoName]; UINT m_uCommonResourceID; ATOM Register(WNDPROC* pProc) { if (m_atom == 0) { CWindowCreateCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CFrameWndClassInfo::Register.\n")); ATLASSERT(FALSE); return 0; } if(m_atom == 0) { HINSTANCE hInst = ModuleHelper::GetModuleInstance(); if (m_lpszOrigName != NULL) { ATLASSERT(pProc != NULL); LPCTSTR lpsz = m_wc.lpszClassName; WNDPROC proc = m_wc.lpfnWndProc; WNDCLASSEX wc = { sizeof(WNDCLASSEX) }; // try process local class first if(!::GetClassInfoEx(ModuleHelper::GetModuleInstance(), m_lpszOrigName, &wc)) { // try global class if(!::GetClassInfoEx(NULL, m_lpszOrigName, &wc)) { lock.Unlock(); return 0; } } m_wc = wc; pWndProc = m_wc.lpfnWndProc; m_wc.lpszClassName = lpsz; m_wc.lpfnWndProc = proc; } else { m_wc.hCursor = ::LoadCursor(m_bSystemCursor ? NULL : hInst, m_lpszCursorID); } m_wc.hInstance = hInst; m_wc.style &= ~CS_GLOBALCLASS; // we don't register global classes if (m_wc.lpszClassName == NULL) { _stprintf_s(m_szAutoName, cchAutoName, _T("ATL:%p"), &m_wc); m_wc.lpszClassName = m_szAutoName; } WNDCLASSEX wcTemp = m_wc; m_atom = (ATOM)::GetClassInfoEx(m_wc.hInstance, m_wc.lpszClassName, &wcTemp); if (m_atom == 0) { if(m_uCommonResourceID != 0) // use it if not zero { m_wc.hIcon = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); m_wc.hIconSm = (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(m_uCommonResourceID), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); } m_atom = ::RegisterClassEx(&m_wc); } } lock.Unlock(); } if (m_lpszOrigName != NULL) { ATLASSERT(pProc != NULL); ATLASSERT(pWndProc != NULL); *pProc = pWndProc; } return m_atom; } }; /////////////////////////////////////////////////////////////////////////////// // Macros for declaring frame window WNDCLASS #define DECLARE_FRAME_WND_CLASS(WndClassName, uCommonResourceID) \ static WTL::CFrameWndClassInfo& GetWndClassInfo() \ { \ static WTL::CFrameWndClassInfo wc = \ { \ { sizeof(WNDCLASSEX), 0, StartWindowProc, \ 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName, NULL }, \ NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ }; \ return wc; \ } #define DECLARE_FRAME_WND_CLASS_EX(WndClassName, uCommonResourceID, style, bkgnd) \ static WTL::CFrameWndClassInfo& GetWndClassInfo() \ { \ static WTL::CFrameWndClassInfo wc = \ { \ { sizeof(WNDCLASSEX), style, StartWindowProc, \ 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \ NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ }; \ return wc; \ } #define DECLARE_FRAME_WND_SUPERCLASS(WndClassName, OrigWndClassName, uCommonResourceID) \ static WTL::CFrameWndClassInfo& GetWndClassInfo() \ { \ static WTL::CFrameWndClassInfo wc = \ { \ { sizeof(WNDCLASSEX), 0, StartWindowProc, \ 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName, NULL }, \ OrigWndClassName, NULL, NULL, TRUE, 0, _T(""), uCommonResourceID \ }; \ return wc; \ } // These are for templated classes #define DECLARE_FRAME_WND_CLASS2(WndClassName, EnclosingClass, uCommonResourceID) \ static WTL::CFrameWndClassInfo& GetWndClassInfo() \ { \ static WTL::CFrameWndClassInfo wc = \ { \ { sizeof(WNDCLASSEX), 0, EnclosingClass::StartWindowProc, \ 0, 0, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, WndClassName, NULL }, \ NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ }; \ return wc; \ } #define DECLARE_FRAME_WND_CLASS_EX2(WndClassName, EnclosingClass, uCommonResourceID, style, bkgnd) \ static WTL::CFrameWndClassInfo& GetWndClassInfo() \ { \ static WTL::CFrameWndClassInfo wc = \ { \ { sizeof(WNDCLASSEX), style, EnclosingClass::StartWindowProc, \ 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \ NULL, NULL, IDC_ARROW, TRUE, 0, _T(""), uCommonResourceID \ }; \ return wc; \ } #define DECLARE_FRAME_WND_SUPERCLASS2(WndClassName, EnclosingClass, OrigWndClassName, uCommonResourceID) \ static WTL::CFrameWndClassInfo& GetWndClassInfo() \ { \ static WTL::CFrameWndClassInfo wc = \ { \ { sizeof(WNDCLASSEX), 0, EnclosingClass::StartWindowProc, \ 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName, NULL }, \ OrigWndClassName, NULL, NULL, TRUE, 0, _T(""), uCommonResourceID \ }; \ return wc; \ } /////////////////////////////////////////////////////////////////////////////// // CFrameWindowImpl // Client window command chaining macro (only for frame windows) #define CHAIN_CLIENT_COMMANDS() \ if((uMsg == WM_COMMAND) && (this->m_hWndClient != NULL)) \ ::SendMessage(this->m_hWndClient, uMsg, wParam, lParam); // standard toolbar styles #define ATL_SIMPLE_TOOLBAR_STYLE \ (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS) // toolbar in a rebar pane #define ATL_SIMPLE_TOOLBAR_PANE_STYLE \ (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT) // standard rebar styles #define ATL_SIMPLE_REBAR_STYLE \ (WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE) // rebar without borders #define ATL_SIMPLE_REBAR_NOBORDER_STYLE \ (WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_AUTOSIZE | CCS_NODIVIDER) // command bar support #if !defined(__ATLCTRLW_H__) #define CBRM_GETCMDBAR (WM_USER + 301) // returns command bar HWND #define CBRM_GETMENU (WM_USER + 302) // returns loaded or attached menu #define CBRM_TRACKPOPUPMENU (WM_USER + 303) // displays a popup menu struct _AtlFrameWnd_CmdBarPopupMenu { int cbSize; HMENU hMenu; UINT uFlags; int x; int y; LPTPMPARAMS lptpm; }; #define CBRPOPUPMENU _AtlFrameWnd_CmdBarPopupMenu #endif // !defined(__ATLCTRLW_H__) template class ATL_NO_VTABLE CFrameWindowImplBase : public ATL::CWindowImplBaseT< TBase, TWinTraits > { public: typedef CFrameWindowImplBase _thisClass; DECLARE_FRAME_WND_CLASS2(NULL, _thisClass, 0) struct _ChevronMenuInfo { HMENU hMenu; LPNMREBARCHEVRON lpnm; bool bCmdBar; }; // Data members HWND m_hWndToolBar; HWND m_hWndStatusBar; HWND m_hWndClient; HACCEL m_hAccel; // Constructor CFrameWindowImplBase() : m_hWndToolBar(NULL), m_hWndStatusBar(NULL), m_hWndClient(NULL), m_hAccel(NULL) { } // Methods HWND Create(HWND hWndParent, ATL::_U_RECT rect, LPCTSTR szWindowName, DWORD dwStyle, DWORD dwExStyle, ATL::_U_MENUorID MenuOrID, ATOM atom, LPVOID lpCreateParam) { ATLASSERT(this->m_hWnd == NULL); // Allocate the thunk structure here, where we can fail gracefully. BOOL bRet = this->m_thunk.Init(NULL, NULL); if(bRet == FALSE) { ::SetLastError(ERROR_OUTOFMEMORY); return NULL; } if(atom == 0) return NULL; ModuleHelper::AddCreateWndData(&this->m_thunk.cd, this); if((MenuOrID.m_hMenu == NULL) && (dwStyle & WS_CHILD)) MenuOrID.m_hMenu = (HMENU)(UINT_PTR)this; if(rect.m_lpRect == NULL) rect.m_lpRect = &TBase::rcDefault; HWND hWnd = ::CreateWindowEx(dwExStyle, MAKEINTATOM(atom), szWindowName, dwStyle, rect.m_lpRect->left, rect.m_lpRect->top, rect.m_lpRect->right - rect.m_lpRect->left, rect.m_lpRect->bottom - rect.m_lpRect->top, hWndParent, MenuOrID.m_hMenu, ModuleHelper::GetModuleInstance(), lpCreateParam); ATLASSERT((hWnd == NULL) || (this->m_hWnd == hWnd)); return hWnd; } static HWND CreateSimpleToolBarCtrl(HWND hWndParent, UINT nResourceID, BOOL bInitialSeparator = FALSE, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { HINSTANCE hInst = ModuleHelper::GetResourceInstance(); HRSRC hRsrc = ::FindResource(hInst, MAKEINTRESOURCE(nResourceID), RT_TOOLBAR); if (hRsrc == NULL) return NULL; HGLOBAL hGlobal = ::LoadResource(hInst, hRsrc); if (hGlobal == NULL) return NULL; _AtlToolBarData* pData = (_AtlToolBarData*)::LockResource(hGlobal); if (pData == NULL) return NULL; ATLASSERT(pData->wVersion == 1); WORD* pItems = pData->items(); int nItems = pData->wItemCount + (bInitialSeparator ? 1 : 0); ATL::CTempBuffer buff; TBBUTTON* pTBBtn = buff.Allocate(nItems); ATLASSERT(pTBBtn != NULL); if(pTBBtn == NULL) return NULL; const int cxSeparator = 8; // set initial separator (half width) if(bInitialSeparator) { pTBBtn[0].iBitmap = cxSeparator / 2; pTBBtn[0].idCommand = 0; pTBBtn[0].fsState = 0; pTBBtn[0].fsStyle = BTNS_SEP; pTBBtn[0].dwData = 0; pTBBtn[0].iString = 0; } int nBmp = 0; for(int i = 0, j = bInitialSeparator ? 1 : 0; i < pData->wItemCount; i++, j++) { if(pItems[i] != 0) { pTBBtn[j].iBitmap = nBmp++; pTBBtn[j].idCommand = pItems[i]; pTBBtn[j].fsState = TBSTATE_ENABLED; pTBBtn[j].fsStyle = BTNS_BUTTON; pTBBtn[j].dwData = 0; pTBBtn[j].iString = 0; } else { pTBBtn[j].iBitmap = cxSeparator; pTBBtn[j].idCommand = 0; pTBBtn[j].fsState = 0; pTBBtn[j].fsStyle = BTNS_SEP; pTBBtn[j].dwData = 0; pTBBtn[j].iString = 0; } } HWND hWnd = ::CreateWindowEx(0, TOOLBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), NULL); if(hWnd == NULL) { ATLASSERT(FALSE); return NULL; } ::SendMessage(hWnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0L); // check if font is taller than our bitmaps CFontHandle font = (HFONT)::SendMessage(hWnd, WM_GETFONT, 0, 0L); if(font.IsNull()) font = (HFONT)::GetStockObject(SYSTEM_FONT); LOGFONT lf = {}; font.GetLogFont(lf); WORD cyFontHeight = (WORD)abs(lf.lfHeight); WORD bitsPerPixel = AtlGetBitmapResourceBitsPerPixel(nResourceID); if(bitsPerPixel > 4) { COLORREF crMask = CLR_DEFAULT; if(bitsPerPixel == 32) { // 32-bit color bitmap with alpha channel (valid for Windows XP and later) crMask = CLR_NONE; } HIMAGELIST hImageList = ImageList_LoadImage(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(nResourceID), pData->wWidth, 1, crMask, IMAGE_BITMAP, LR_CREATEDIBSECTION | LR_DEFAULTSIZE); ATLASSERT(hImageList != NULL); ::SendMessage(hWnd, TB_SETIMAGELIST, 0, (LPARAM)hImageList); } else { TBADDBITMAP tbab = {}; tbab.hInst = hInst; tbab.nID = nResourceID; ::SendMessage(hWnd, TB_ADDBITMAP, nBmp, (LPARAM)&tbab); } ::SendMessage(hWnd, TB_ADDBUTTONS, nItems, (LPARAM)pTBBtn); ::SendMessage(hWnd, TB_SETBITMAPSIZE, 0, MAKELONG(pData->wWidth, __max(pData->wHeight, cyFontHeight))); const int cxyButtonMargin = 7; ::SendMessage(hWnd, TB_SETBUTTONSIZE, 0, MAKELONG(pData->wWidth + cxyButtonMargin, __max(pData->wHeight, cyFontHeight) + cxyButtonMargin)); return hWnd; } static HWND CreateSimpleReBarCtrl(HWND hWndParent, DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { // Ensure style combinations for proper rebar painting if(dwStyle & CCS_NODIVIDER && (dwStyle & WS_BORDER)) dwStyle &= ~WS_BORDER; else if(!(dwStyle & WS_BORDER) && !(dwStyle & CCS_NODIVIDER)) dwStyle |= CCS_NODIVIDER; // Create rebar window HWND hWndReBar = ::CreateWindowEx(0, REBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), NULL); if(hWndReBar == NULL) { ATLTRACE2(atlTraceUI, 0, _T("Failed to create rebar.\n")); return NULL; } // Initialize and send the REBARINFO structure REBARINFO rbi = { sizeof(REBARINFO), 0 }; if(::SendMessage(hWndReBar, RB_SETBARINFO, 0, (LPARAM)&rbi) == 0) { ATLTRACE2(atlTraceUI, 0, _T("Failed to initialize rebar.\n")); ::DestroyWindow(hWndReBar); return NULL; } return hWndReBar; } BOOL CreateSimpleReBar(DWORD dwStyle = ATL_SIMPLE_REBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { ATLASSERT(!::IsWindow(m_hWndToolBar)); m_hWndToolBar = CreateSimpleReBarCtrl(this->m_hWnd, dwStyle, nID); return (m_hWndToolBar != NULL); } static BOOL AddSimpleReBarBandCtrl(HWND hWndReBar, HWND hWndBand, int nID = 0, LPCTSTR lpstrTitle = NULL, BOOL bNewRow = FALSE, int cxWidth = 0, BOOL bFullWidthAlways = FALSE) { ATLASSERT(::IsWindow(hWndReBar)); // must be already created #ifdef _DEBUG // block - check if this is really a rebar { TCHAR lpszClassName[sizeof(REBARCLASSNAME)] = {}; ::GetClassName(hWndReBar, lpszClassName, sizeof(REBARCLASSNAME)); ATLASSERT(lstrcmp(lpszClassName, REBARCLASSNAME) == 0); } #endif // _DEBUG ATLASSERT(::IsWindow(hWndBand)); // must be already created // Get number of buttons on the toolbar int nBtnCount = (int)::SendMessage(hWndBand, TB_BUTTONCOUNT, 0, 0L); // Set band info structure REBARBANDINFO rbBand = { RunTimeHelper::SizeOf_REBARBANDINFO() }; rbBand.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE | RBBIM_ID | RBBIM_SIZE | RBBIM_IDEALSIZE; if(lpstrTitle != NULL) rbBand.fMask |= RBBIM_TEXT; rbBand.fStyle = RBBS_CHILDEDGE; if(nBtnCount > 0) // add chevron style for toolbar with buttons rbBand.fStyle |= RBBS_USECHEVRON; if(bNewRow) rbBand.fStyle |= RBBS_BREAK; rbBand.lpText = (LPTSTR)lpstrTitle; rbBand.hwndChild = hWndBand; if(nID == 0) // calc band ID nID = ATL_IDW_BAND_FIRST + (int)::SendMessage(hWndReBar, RB_GETBANDCOUNT, 0, 0L); rbBand.wID = nID; // Calculate the size of the band BOOL bRet = FALSE; RECT rcTmp = {}; if(nBtnCount > 0) { bRet = (BOOL)::SendMessage(hWndBand, TB_GETITEMRECT, nBtnCount - 1, (LPARAM)&rcTmp); ATLASSERT(bRet); rbBand.cx = (cxWidth != 0) ? cxWidth : rcTmp.right; rbBand.cyMinChild = rcTmp.bottom - rcTmp.top; if(bFullWidthAlways) { rbBand.cxMinChild = rbBand.cx; } else if(lpstrTitle == NULL) { bRet = (BOOL)::SendMessage(hWndBand, TB_GETITEMRECT, 0, (LPARAM)&rcTmp); ATLASSERT(bRet); rbBand.cxMinChild = rcTmp.right; } else { rbBand.cxMinChild = 0; } } else // no buttons, either not a toolbar or really has no buttons { bRet = ::GetWindowRect(hWndBand, &rcTmp); ATLASSERT(bRet); rbBand.cx = (cxWidth != 0) ? cxWidth : (rcTmp.right - rcTmp.left); rbBand.cxMinChild = bFullWidthAlways ? rbBand.cx : 0; rbBand.cyMinChild = rcTmp.bottom - rcTmp.top; } rbBand.cxIdeal = rbBand.cx; // Add the band LRESULT lRes = ::SendMessage(hWndReBar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); if(lRes == 0) { ATLTRACE2(atlTraceUI, 0, _T("Failed to add a band to the rebar.\n")); return FALSE; } DWORD dwExStyle = (DWORD)::SendMessage(hWndBand, TB_GETEXTENDEDSTYLE, 0, 0L); ::SendMessage(hWndBand, TB_SETEXTENDEDSTYLE, 0, dwExStyle | TBSTYLE_EX_HIDECLIPPEDBUTTONS); return TRUE; } BOOL AddSimpleReBarBand(HWND hWndBand, LPCTSTR lpstrTitle = NULL, BOOL bNewRow = FALSE, int cxWidth = 0, BOOL bFullWidthAlways = FALSE) { ATLASSERT(::IsWindow(m_hWndToolBar)); // must be an existing rebar ATLASSERT(::IsWindow(hWndBand)); // must be created return AddSimpleReBarBandCtrl(m_hWndToolBar, hWndBand, 0, lpstrTitle, bNewRow, cxWidth, bFullWidthAlways); } void SizeSimpleReBarBands() { ATLASSERT(::IsWindow(m_hWndToolBar)); // must be an existing rebar int nCount = (int)::SendMessage(m_hWndToolBar, RB_GETBANDCOUNT, 0, 0L); for(int i = 0; i < nCount; i++) { REBARBANDINFO rbBand = { RunTimeHelper::SizeOf_REBARBANDINFO() }; rbBand.fMask = RBBIM_SIZE; BOOL bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_GETBANDINFO, i, (LPARAM)&rbBand); ATLASSERT(bRet); RECT rect = {}; ::SendMessage(m_hWndToolBar, RB_GETBANDBORDERS, i, (LPARAM)&rect); rbBand.cx += rect.left + rect.right; bRet = (BOOL)::SendMessage(m_hWndToolBar, RB_SETBANDINFO, i, (LPARAM)&rbBand); ATLASSERT(bRet); } } BOOL CreateSimpleStatusBar(LPCTSTR lpstrText, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) { ATLASSERT(!::IsWindow(m_hWndStatusBar)); m_hWndStatusBar = ::CreateStatusWindow(dwStyle, lpstrText, this->m_hWnd, nID); return (m_hWndStatusBar != NULL); } BOOL CreateSimpleStatusBar(UINT nTextID = ATL_IDS_IDLEMESSAGE, DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP, UINT nID = ATL_IDW_STATUS_BAR) { const int cchMax = 128; // max text length is 127 for status bars (+1 for null) TCHAR szText[cchMax] = {}; ::LoadString(ModuleHelper::GetResourceInstance(), nTextID, szText, cchMax); return CreateSimpleStatusBar(szText, dwStyle, nID); } void UpdateLayout(BOOL bResizeBars = TRUE) { RECT rect = {}; this->GetClientRect(&rect); // position bars and offset their dimensions UpdateBarsPosition(rect, bResizeBars); // resize client window if(m_hWndClient != NULL) ::SetWindowPos(m_hWndClient, NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE); } void UpdateBarsPosition(RECT& rect, BOOL bResizeBars = TRUE) { // resize toolbar if((m_hWndToolBar != NULL) && ((DWORD)::GetWindowLong(m_hWndToolBar, GWL_STYLE) & WS_VISIBLE)) { if(bResizeBars != FALSE) { ::SendMessage(m_hWndToolBar, WM_SIZE, 0, 0); ::InvalidateRect(m_hWndToolBar, NULL, TRUE); } RECT rectTB = {}; ::GetWindowRect(m_hWndToolBar, &rectTB); rect.top += rectTB.bottom - rectTB.top; } // resize status bar if((m_hWndStatusBar != NULL) && ((DWORD)::GetWindowLong(m_hWndStatusBar, GWL_STYLE) & WS_VISIBLE)) { if(bResizeBars != FALSE) ::SendMessage(m_hWndStatusBar, WM_SIZE, 0, 0); RECT rectSB = {}; ::GetWindowRect(m_hWndStatusBar, &rectSB); rect.bottom -= rectSB.bottom - rectSB.top; } } BOOL PreTranslateMessage(MSG* pMsg) { if((m_hAccel != NULL) && ::TranslateAccelerator(this->m_hWnd, m_hAccel, pMsg)) return TRUE; return FALSE; } BEGIN_MSG_MAP(CFrameWindowImplBase) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) NOTIFY_CODE_HANDLER(TTN_GETDISPINFOA, OnToolTipTextA) NOTIFY_CODE_HANDLER(TTN_GETDISPINFOW, OnToolTipTextW) END_MSG_MAP() LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_hWndClient != NULL) // view will paint itself instead return 1; bHandled = FALSE; return 0; } LRESULT OnMenuSelect(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; if(m_hWndStatusBar == NULL) return 1; WORD wFlags = HIWORD(wParam); if((wFlags == 0xFFFF) && (lParam == NULL)) // menu closing { ::SendMessage(m_hWndStatusBar, SB_SIMPLE, FALSE, 0L); } else { const int cchBuff = 256; TCHAR szBuff[cchBuff] = {}; if(!(wFlags & MF_POPUP)) { WORD wID = LOWORD(wParam); // check for special cases if((wID >= 0xF000) && (wID < 0xF1F0)) // system menu IDs wID = (WORD)(((wID - 0xF000) >> 4) + ATL_IDS_SCFIRST); else if((wID >= ID_FILE_MRU_FIRST) && (wID <= ID_FILE_MRU_LAST)) // MRU items wID = ATL_IDS_MRU_FILE; else if((wID >= ATL_IDM_FIRST_MDICHILD) && (wID <= ATL_IDM_LAST_MDICHILD)) // MDI child windows wID = ATL_IDS_MDICHILD; int nRet = ::LoadString(ModuleHelper::GetResourceInstance(), wID, szBuff, cchBuff); for(int i = 0; i < nRet; i++) { if(szBuff[i] == _T('\n')) { szBuff[i] = 0; break; } } } ::SendMessage(m_hWndStatusBar, SB_SIMPLE, TRUE, 0L); ::SendMessage(m_hWndStatusBar, SB_SETTEXT, (255 | SBT_NOBORDERS), (LPARAM)szBuff); } return 1; } LRESULT OnSetFocus(UINT, WPARAM, LPARAM, BOOL& bHandled) { if(m_hWndClient != NULL) ::SetFocus(m_hWndClient); bHandled = FALSE; return 1; } LRESULT OnDestroy(UINT, WPARAM, LPARAM, BOOL& bHandled) { if((this->GetStyle() & (WS_CHILD | WS_POPUP)) == 0) ::PostQuitMessage(1); bHandled = FALSE; return 1; } LRESULT OnToolTipTextA(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) { LPNMTTDISPINFOA pDispInfo = (LPNMTTDISPINFOA)pnmh; if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) { const int cchBuff = 256; char szBuff[cchBuff] = {}; int nRet = ::LoadStringA(ModuleHelper::GetResourceInstance(), idCtrl, szBuff, cchBuff); for(int i = 0; i < nRet; i++) { if(szBuff[i] == '\n') { ATL::Checked::strncpy_s(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); break; } } if(nRet > 0) // string was loaded, save it pDispInfo->uFlags |= TTF_DI_SETITEM; } return 0; } LRESULT OnToolTipTextW(int idCtrl, LPNMHDR pnmh, BOOL& /*bHandled*/) { LPNMTTDISPINFOW pDispInfo = (LPNMTTDISPINFOW)pnmh; if((idCtrl != 0) && !(pDispInfo->uFlags & TTF_IDISHWND)) { const int cchBuff = 256; wchar_t szBuff[cchBuff] = {}; int nRet = ::LoadStringW(ModuleHelper::GetResourceInstance(), idCtrl, szBuff, cchBuff); for(int i = 0; i < nRet; i++) { if(szBuff[i] == L'\n') { ATL::Checked::wcsncpy_s(pDispInfo->szText, _countof(pDispInfo->szText), &szBuff[i + 1], _TRUNCATE); break; } } if(nRet > 0) // string was loaded, save it pDispInfo->uFlags |= TTF_DI_SETITEM; } return 0; } // Implementation - chevron menu support bool PrepareChevronMenu(_ChevronMenuInfo& cmi) { // get rebar and toolbar REBARBANDINFO rbbi = { RunTimeHelper::SizeOf_REBARBANDINFO() }; rbbi.fMask = RBBIM_CHILD; BOOL bRet = (BOOL)::SendMessage(cmi.lpnm->hdr.hwndFrom, RB_GETBANDINFO, cmi.lpnm->uBand, (LPARAM)&rbbi); ATLASSERT(bRet); // assume the band is a toolbar ATL::CWindow wnd = rbbi.hwndChild; int nCount = (int)wnd.SendMessage(TB_BUTTONCOUNT); if(nCount <= 0) // probably not a toolbar return false; // check if it's a command bar CMenuHandle menuCmdBar = (HMENU)wnd.SendMessage(CBRM_GETMENU); cmi.bCmdBar = (menuCmdBar.m_hMenu != NULL); // build a menu from hidden items CMenuHandle menu; bRet = menu.CreatePopupMenu(); ATLASSERT(bRet); RECT rcClient = {}; bRet = wnd.GetClientRect(&rcClient); ATLASSERT(bRet); for(int i = 0; i < nCount; i++) { TBBUTTON tbb = {}; bRet = (BOOL)wnd.SendMessage(TB_GETBUTTON, i, (LPARAM)&tbb); ATLASSERT(bRet); // skip hidden buttons if((tbb.fsState & TBSTATE_HIDDEN) != 0) continue; RECT rcButton = {}; bRet = (BOOL)wnd.SendMessage(TB_GETITEMRECT, i, (LPARAM)&rcButton); ATLASSERT(bRet); bool bEnabled = ((tbb.fsState & TBSTATE_ENABLED) != 0); if((rcButton.right > rcClient.right) || (rcButton.bottom > rcClient.bottom)) { if(tbb.fsStyle & BTNS_SEP) { if(menu.GetMenuItemCount() > 0) menu.AppendMenu(MF_SEPARATOR); } else if(cmi.bCmdBar) { const int cchBuff = 200; TCHAR szBuff[cchBuff] = {}; CMenuItemInfo mii; mii.fMask = MIIM_TYPE | MIIM_SUBMENU; mii.dwTypeData = szBuff; mii.cch = cchBuff; bRet = menuCmdBar.GetMenuItemInfo(i, TRUE, &mii); ATLASSERT(bRet); // Note: CmdBar currently supports only drop-down items ATLASSERT(::IsMenu(mii.hSubMenu)); bRet = menu.AppendMenu(MF_STRING | MF_POPUP | (bEnabled ? MF_ENABLED : MF_GRAYED), (UINT_PTR)mii.hSubMenu, mii.dwTypeData); ATLASSERT(bRet); } else { // get button's text const int cchBuff = 200; TCHAR szBuff[cchBuff] = {}; LPCTSTR lpstrText = szBuff; TBBUTTONINFO tbbi = {}; tbbi.cbSize = sizeof(TBBUTTONINFO); tbbi.dwMask = TBIF_TEXT; tbbi.pszText = szBuff; tbbi.cchText = cchBuff; if((wnd.SendMessage(TB_GETBUTTONINFO, tbb.idCommand, (LPARAM)&tbbi) == -1) || (szBuff[0] == 0)) { // no text for this button, try a resource string lpstrText = _T(""); int nRet = ::LoadString(ModuleHelper::GetResourceInstance(), tbb.idCommand, szBuff, cchBuff); for(int n = 0; n < nRet; n++) { if(szBuff[n] == _T('\n')) { lpstrText = &szBuff[n + 1]; break; } } } bRet = menu.AppendMenu(MF_STRING | (bEnabled ? MF_ENABLED : MF_GRAYED), tbb.idCommand, lpstrText); ATLASSERT(bRet); } } } if(menu.GetMenuItemCount() == 0) // no hidden buttons after all { menu.DestroyMenu(); ::MessageBeep((UINT)-1); return false; } cmi.hMenu = menu; return true; } void DisplayChevronMenu(_ChevronMenuInfo& cmi) { // convert chevron rect to screen coordinates ATL::CWindow wndFrom = cmi.lpnm->hdr.hwndFrom; POINT pt = { cmi.lpnm->rc.left, cmi.lpnm->rc.bottom }; wndFrom.MapWindowPoints(NULL, &pt, 1); RECT rc = cmi.lpnm->rc; wndFrom.MapWindowPoints(NULL, &rc); // set up flags and rect UINT uMenuFlags = TPM_LEFTBUTTON | TPM_VERTICAL | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_VERPOSANIMATION; TPMPARAMS TPMParams = {}; TPMParams.cbSize = sizeof(TPMPARAMS); TPMParams.rcExclude = rc; // check if this window has a command bar HWND hWndCmdBar = (HWND)::SendMessage(this->m_hWnd, CBRM_GETCMDBAR, 0, 0L); if(::IsWindow(hWndCmdBar)) { CBRPOPUPMENU CBRPopupMenu = { sizeof(CBRPOPUPMENU), cmi.hMenu, uMenuFlags, pt.x, pt.y, &TPMParams }; ::SendMessage(hWndCmdBar, CBRM_TRACKPOPUPMENU, 0, (LPARAM)&CBRPopupMenu); } else { CMenuHandle menu = cmi.hMenu; menu.TrackPopupMenuEx(uMenuFlags, pt.x, pt.y, this->m_hWnd, &TPMParams); } } void CleanupChevronMenu(_ChevronMenuInfo& cmi) { CMenuHandle menu = cmi.hMenu; // if menu is from a command bar, detach submenus so they are not destroyed if(cmi.bCmdBar) { for(int i = menu.GetMenuItemCount() - 1; i >=0; i--) menu.RemoveMenu(i, MF_BYPOSITION); } // destroy menu menu.DestroyMenu(); // convert chevron rect to screen coordinates ATL::CWindow wndFrom = cmi.lpnm->hdr.hwndFrom; RECT rc = cmi.lpnm->rc; wndFrom.MapWindowPoints(NULL, &rc); // eat next message if click is on the same button MSG msg = {}; if(::PeekMessage(&msg, this->m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE) && ::PtInRect(&rc, msg.pt)) ::PeekMessage(&msg, this->m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE); } }; template class ATL_NO_VTABLE CFrameWindowImpl : public CFrameWindowImplBase< TBase, TWinTraits > { public: HWND Create(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, HMENU hMenu = NULL, LPVOID lpCreateParam = NULL) { ATOM atom = T::GetWndClassInfo().Register(&this->m_pfnSuperWindowProc); dwStyle = T::GetWndStyle(dwStyle); dwExStyle = T::GetWndExStyle(dwExStyle); if(rect.m_lpRect == NULL) rect.m_lpRect = &TBase::rcDefault; return CFrameWindowImplBase< TBase, TWinTraits >::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, hMenu, atom, lpCreateParam); } HWND CreateEx(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) { const int cchName = 256; TCHAR szWindowName[cchName] = {}; ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); T* pT = static_cast(this); HWND hWnd = pT->Create(hWndParent, rect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam); if(hWnd != NULL) this->m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); return hWnd; } BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { if(nResourceID == 0) nResourceID = T::GetWndClassInfo().m_uCommonResourceID; ATLASSERT(!::IsWindow(this->m_hWndToolBar)); this->m_hWndToolBar = T::CreateSimpleToolBarCtrl(this->m_hWnd, nResourceID, TRUE, dwStyle, nID); return (this->m_hWndToolBar != NULL); } // message map and handlers typedef CFrameWindowImplBase< TBase, TWinTraits > _baseClass; BEGIN_MSG_MAP(CFrameWindowImpl) MESSAGE_HANDLER(WM_SIZE, OnSize) #ifndef _ATL_NO_REBAR_SUPPORT NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) #endif // !_ATL_NO_REBAR_SUPPORT CHAIN_MSG_MAP(_baseClass) END_MSG_MAP() LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(wParam != SIZE_MINIMIZED) { T* pT = static_cast(this); pT->UpdateLayout(); } bHandled = FALSE; return 1; } #ifndef _ATL_NO_REBAR_SUPPORT LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->UpdateLayout(FALSE); return 0; } LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { T* pT = static_cast(this); typename CFrameWindowImplBase< TBase, TWinTraits >::_ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; if(!pT->PrepareChevronMenu(cmi)) { bHandled = FALSE; return 1; } // display a popup menu with hidden items pT->DisplayChevronMenu(cmi); // cleanup pT->CleanupChevronMenu(cmi); return 0; } #endif // !_ATL_NO_REBAR_SUPPORT }; /////////////////////////////////////////////////////////////////////////////// // AtlCreateSimpleToolBar - helper for creating simple toolbars inline HWND AtlCreateSimpleToolBar(HWND hWndParent, UINT nResourceID, BOOL bInitialSeparator = FALSE, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { return CFrameWindowImplBase<>::CreateSimpleToolBarCtrl(hWndParent, nResourceID, bInitialSeparator, dwStyle, nID); } /////////////////////////////////////////////////////////////////////////////// // CMDIWindow #ifndef _WTL_MDIWINDOWMENU_TEXT #define _WTL_MDIWINDOWMENU_TEXT _T("&Window") #endif class CMDIWindow : public ATL::CWindow { public: // Data members HWND m_hWndMDIClient; HMENU m_hMenu; // Constructors CMDIWindow(HWND hWnd = NULL) : ATL::CWindow(hWnd), m_hWndMDIClient(NULL), m_hMenu(NULL) { } CMDIWindow& operator =(HWND hWnd) { m_hWnd = hWnd; return *this; } // Operations HWND MDIGetActive(BOOL* lpbMaximized = NULL) { ATLASSERT(::IsWindow(m_hWndMDIClient)); return (HWND)::SendMessage(m_hWndMDIClient, WM_MDIGETACTIVE, 0, (LPARAM)lpbMaximized); } void MDIActivate(HWND hWndChildToActivate) { ATLASSERT(::IsWindow(m_hWndMDIClient)); ATLASSERT(::IsWindow(hWndChildToActivate)); ::SendMessage(m_hWndMDIClient, WM_MDIACTIVATE, (WPARAM)hWndChildToActivate, 0); } void MDINext(HWND hWndChild, BOOL bPrevious = FALSE) { ATLASSERT(::IsWindow(m_hWndMDIClient)); ATLASSERT((hWndChild == NULL) || ::IsWindow(hWndChild)); ::SendMessage(m_hWndMDIClient, WM_MDINEXT, (WPARAM)hWndChild, (LPARAM)bPrevious); } void MDIMaximize(HWND hWndChildToMaximize) { ATLASSERT(::IsWindow(m_hWndMDIClient)); ATLASSERT(::IsWindow(hWndChildToMaximize)); ::SendMessage(m_hWndMDIClient, WM_MDIMAXIMIZE, (WPARAM)hWndChildToMaximize, 0); } void MDIRestore(HWND hWndChildToRestore) { ATLASSERT(::IsWindow(m_hWndMDIClient)); ATLASSERT(::IsWindow(hWndChildToRestore)); ::SendMessage(m_hWndMDIClient, WM_MDIRESTORE, (WPARAM)hWndChildToRestore, 0); } void MDIDestroy(HWND hWndChildToDestroy) { ATLASSERT(::IsWindow(m_hWndMDIClient)); ATLASSERT(::IsWindow(hWndChildToDestroy)); ::SendMessage(m_hWndMDIClient, WM_MDIDESTROY, (WPARAM)hWndChildToDestroy, 0); } BOOL MDICascade(UINT uFlags = 0) { ATLASSERT(::IsWindow(m_hWndMDIClient)); return (BOOL)::SendMessage(m_hWndMDIClient, WM_MDICASCADE, (WPARAM)uFlags, 0); } BOOL MDITile(UINT uFlags = MDITILE_HORIZONTAL) { ATLASSERT(::IsWindow(m_hWndMDIClient)); return (BOOL)::SendMessage(m_hWndMDIClient, WM_MDITILE, (WPARAM)uFlags, 0); } void MDIIconArrange() { ATLASSERT(::IsWindow(m_hWndMDIClient)); ::SendMessage(m_hWndMDIClient, WM_MDIICONARRANGE, 0, 0); } HMENU MDISetMenu(HMENU hMenuFrame, HMENU hMenuWindow) { ATLASSERT(::IsWindow(m_hWndMDIClient)); return (HMENU)::SendMessage(m_hWndMDIClient, WM_MDISETMENU, (WPARAM)hMenuFrame, (LPARAM)hMenuWindow); } HMENU MDIRefreshMenu() { ATLASSERT(::IsWindow(m_hWndMDIClient)); return (HMENU)::SendMessage(m_hWndMDIClient, WM_MDIREFRESHMENU, 0, 0); } // Additional operations static HMENU GetStandardWindowMenu(HMENU hMenu) { int nCount = ::GetMenuItemCount(hMenu); if(nCount == -1) return NULL; int nLen = ::GetMenuString(hMenu, nCount - 2, NULL, 0, MF_BYPOSITION); if(nLen == 0) return NULL; ATL::CTempBuffer buff; LPTSTR lpszText = buff.Allocate(nLen + 1); if(lpszText == NULL) return NULL; if(::GetMenuString(hMenu, nCount - 2, lpszText, nLen + 1, MF_BYPOSITION) != nLen) return NULL; if(lstrcmp(lpszText, _WTL_MDIWINDOWMENU_TEXT) != 0) return NULL; return ::GetSubMenu(hMenu, nCount - 2); } void SetMDIFrameMenu() { HMENU hWindowMenu = GetStandardWindowMenu(m_hMenu); MDISetMenu(m_hMenu, hWindowMenu); MDIRefreshMenu(); ::DrawMenuBar(GetMDIFrame()); } HWND GetMDIFrame() const { return ::GetParent(m_hWndMDIClient); } }; /////////////////////////////////////////////////////////////////////////////// // CMDIFrameWindowImpl // MDI child command chaining macro (only for MDI frame windows) #define CHAIN_MDI_CHILD_COMMANDS() \ if(uMsg == WM_COMMAND) \ { \ HWND hWndChild = this->MDIGetActive(); \ if(hWndChild != NULL) \ ::SendMessage(hWndChild, uMsg, wParam, lParam); \ } template class ATL_NO_VTABLE CMDIFrameWindowImpl : public CFrameWindowImplBase { public: HWND Create(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, HMENU hMenu = NULL, LPVOID lpCreateParam = NULL) { this->m_hMenu = hMenu; ATOM atom = T::GetWndClassInfo().Register(&this->m_pfnSuperWindowProc); dwStyle = T::GetWndStyle(dwStyle); dwExStyle = T::GetWndExStyle(dwExStyle); if(rect.m_lpRect == NULL) rect.m_lpRect = &TBase::rcDefault; return CFrameWindowImplBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, hMenu, atom, lpCreateParam); } HWND CreateEx(HWND hWndParent = NULL, ATL::_U_RECT rect = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) { const int cchName = 256; TCHAR szWindowName[cchName] = {}; ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); HMENU hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); T* pT = static_cast(this); HWND hWnd = pT->Create(hWndParent, rect, szWindowName, dwStyle, dwExStyle, hMenu, lpCreateParam); if(hWnd != NULL) this->m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); return hWnd; } BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { ATLASSERT(!::IsWindow(this->m_hWndToolBar)); if(nResourceID == 0) nResourceID = T::GetWndClassInfo().m_uCommonResourceID; this->m_hWndToolBar = T::CreateSimpleToolBarCtrl(this->m_hWnd, nResourceID, TRUE, dwStyle, nID); return (this->m_hWndToolBar != NULL); } virtual WNDPROC GetWindowProc() { return MDIFrameWindowProc; } static LRESULT CALLBACK MDIFrameWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { CMDIFrameWindowImpl< T, TBase, TWinTraits >* pThis = (CMDIFrameWindowImpl< T, TBase, TWinTraits >*)hWnd; // set a ptr to this message and save the old value ATL::_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam); const ATL::_ATL_MSG* pOldMsg = pThis->m_pCurrentMsg; pThis->m_pCurrentMsg = &msg; // pass to the message map to process LRESULT lRes = 0; BOOL bRet = pThis->ProcessWindowMessage(pThis->m_hWnd, uMsg, wParam, lParam, lRes, 0); // restore saved value for the current message ATLASSERT(pThis->m_pCurrentMsg == &msg); pThis->m_pCurrentMsg = pOldMsg; // do the default processing if message was not handled if(!bRet) { if(uMsg != WM_NCDESTROY) { lRes = pThis->DefWindowProc(uMsg, wParam, lParam); } else { // unsubclass, if needed LONG_PTR pfnWndProc = ::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC); lRes = pThis->DefWindowProc(uMsg, wParam, lParam); if((pThis->m_pfnSuperWindowProc != ::DefWindowProc) && (::GetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC) == pfnWndProc)) ::SetWindowLongPtr(pThis->m_hWnd, GWLP_WNDPROC, (LONG_PTR)pThis->m_pfnSuperWindowProc); // mark window as destryed pThis->m_dwState |= ATL::CWindowImplRoot< TBase >::WINSTATE_DESTROYED; } } if((pThis->m_dwState & ATL::CWindowImplRoot< TBase >::WINSTATE_DESTROYED) && (pThis->m_pCurrentMsg == NULL)) { // clear out window handle HWND hWndThis = pThis->m_hWnd; pThis->m_hWnd = NULL; pThis->m_dwState &= ~ATL::CWindowImplRoot< TBase >::WINSTATE_DESTROYED; // clean up after window is destroyed pThis->OnFinalMessage(hWndThis); } return lRes; } // Overriden to call DefWindowProc which uses DefFrameProc LRESULT DefWindowProc() { const ATL::_ATL_MSG* pMsg = this->m_pCurrentMsg; LRESULT lRes = 0; if (pMsg != NULL) lRes = DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); return lRes; } LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { return ::DefFrameProc(this->m_hWnd, this->m_hWndMDIClient, uMsg, wParam, lParam); } BOOL PreTranslateMessage(MSG* pMsg) { if(CFrameWindowImplBase::PreTranslateMessage(pMsg)) return TRUE; return ::TranslateMDISysAccel(this->m_hWndMDIClient, pMsg); } HWND CreateMDIClient(HMENU hWindowMenu = NULL, UINT nID = ATL_IDW_CLIENT, UINT nFirstChildID = ATL_IDM_FIRST_MDICHILD) { DWORD dwStyle = WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | MDIS_ALLCHILDSTYLES; DWORD dwExStyle = WS_EX_CLIENTEDGE; CLIENTCREATESTRUCT ccs = {}; ccs.hWindowMenu = hWindowMenu; ccs.idFirstChild = nFirstChildID; if((this->GetStyle() & (WS_HSCROLL | WS_VSCROLL)) != 0) { // parent MDI frame's scroll styles move to the MDICLIENT dwStyle |= (this->GetStyle() & (WS_HSCROLL | WS_VSCROLL)); // fast way to turn off the scrollbar bits (without a resize) this->ModifyStyle(WS_HSCROLL | WS_VSCROLL, 0, SWP_NOREDRAW | SWP_FRAMECHANGED); } // Create MDICLIENT window this->m_hWndClient = ::CreateWindowEx(dwExStyle, _T("MDIClient"), NULL, dwStyle, 0, 0, 1, 1, this->m_hWnd, (HMENU)LongToHandle(nID), ModuleHelper::GetModuleInstance(), (LPVOID)&ccs); if (this->m_hWndClient == NULL) { ATLTRACE2(atlTraceUI, 0, _T("MDI Frame failed to create MDICLIENT.\n")); return NULL; } // Move it to the top of z-order ::BringWindowToTop(this->m_hWndClient); // set as MDI client window this->m_hWndMDIClient = this->m_hWndClient; // update to proper size T* pT = static_cast(this); pT->UpdateLayout(); return this->m_hWndClient; } typedef CFrameWindowImplBase _baseClass; BEGIN_MSG_MAP(CMDIFrameWindowImpl) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_MDISETMENU, OnMDISetMenu) #ifndef _ATL_NO_REBAR_SUPPORT NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) #endif // !_ATL_NO_REBAR_SUPPORT CHAIN_MSG_MAP(_baseClass) END_MSG_MAP() LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(wParam != SIZE_MINIMIZED) { T* pT = static_cast(this); pT->UpdateLayout(); } // message must be handled, otherwise DefFrameProc would resize the client again return 0; } LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { // don't allow CFrameWindowImplBase to handle this one return DefWindowProc(uMsg, wParam, lParam); } LRESULT OnMDISetMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { this->SetMDIFrameMenu(); return 0; } #ifndef _ATL_NO_REBAR_SUPPORT LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->UpdateLayout(FALSE); return 0; } LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { T* pT = static_cast(this); typename CFrameWindowImplBase::_ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; if(!pT->PrepareChevronMenu(cmi)) { bHandled = FALSE; return 1; } // display a popup menu with hidden items pT->DisplayChevronMenu(cmi); // cleanup pT->CleanupChevronMenu(cmi); return 0; } #endif // !_ATL_NO_REBAR_SUPPORT }; /////////////////////////////////////////////////////////////////////////////// // CMDIChildWindowImpl template class ATL_NO_VTABLE CMDIChildWindowImpl : public CFrameWindowImplBase { public: HWND Create(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR szWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, UINT nMenuID = 0, LPVOID lpCreateParam = NULL) { ATOM atom = T::GetWndClassInfo().Register(&this->m_pfnSuperWindowProc); if(nMenuID != 0) this->m_hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(nMenuID)); dwStyle = T::GetWndStyle(dwStyle); dwExStyle = T::GetWndExStyle(dwExStyle); dwExStyle |= WS_EX_MDICHILD; // force this one this->m_pfnSuperWindowProc = ::DefMDIChildProc; this->m_hWndMDIClient = hWndParent; ATLASSERT(::IsWindow(this->m_hWndMDIClient)); if(rect.m_lpRect == NULL) rect.m_lpRect = &TBase::rcDefault; // If the currently active MDI child is maximized, we want to create this one maximized too ATL::CWindow wndParent = hWndParent; BOOL bMaximized = FALSE; wndParent.SendMessage(WM_MDIGETACTIVE, 0, (LPARAM)&bMaximized); if(bMaximized) wndParent.SetRedraw(FALSE); HWND hWnd = CFrameWindowImplBase::Create(hWndParent, rect.m_lpRect, szWindowName, dwStyle, dwExStyle, (UINT)0U, atom, lpCreateParam); if(bMaximized) { // Maximize and redraw everything if(hWnd != NULL) this->MDIMaximize(hWnd); wndParent.SetRedraw(TRUE); wndParent.RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); ::SetFocus(this->GetMDIFrame()); // focus will be set back to this window } else if((hWnd != NULL) && ::IsWindowVisible(this->m_hWnd) && !::IsChild(hWnd, ::GetFocus())) { ::SetFocus(hWnd); } return hWnd; } HWND CreateEx(HWND hWndParent, ATL::_U_RECT rect = NULL, LPCTSTR lpcstrWindowName = NULL, DWORD dwStyle = 0, DWORD dwExStyle = 0, LPVOID lpCreateParam = NULL) { const int cchName = 256; TCHAR szWindowName[cchName] = {}; if(lpcstrWindowName == NULL) { ::LoadString(ModuleHelper::GetResourceInstance(), T::GetWndClassInfo().m_uCommonResourceID, szWindowName, cchName); lpcstrWindowName = szWindowName; } T* pT = static_cast(this); HWND hWnd = pT->Create(hWndParent, rect, lpcstrWindowName, dwStyle, dwExStyle, T::GetWndClassInfo().m_uCommonResourceID, lpCreateParam); if(hWnd != NULL) this->m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), MAKEINTRESOURCE(T::GetWndClassInfo().m_uCommonResourceID)); return hWnd; } BOOL CreateSimpleToolBar(UINT nResourceID = 0, DWORD dwStyle = ATL_SIMPLE_TOOLBAR_STYLE, UINT nID = ATL_IDW_TOOLBAR) { ATLASSERT(!::IsWindow(this->m_hWndToolBar)); if(nResourceID == 0) nResourceID = T::GetWndClassInfo().m_uCommonResourceID; this->m_hWndToolBar = T::CreateSimpleToolBarCtrl(this->m_hWnd, nResourceID, TRUE, dwStyle, nID); return (this->m_hWndToolBar != NULL); } BOOL UpdateClientEdge(LPRECT lpRect = NULL) { // only adjust for active MDI child window HWND hWndChild = this->MDIGetActive(); if((hWndChild != NULL) && (hWndChild != this->m_hWnd)) return FALSE; // need to adjust the client edge style as max/restore happens DWORD dwStyle = ::GetWindowLong(this->m_hWndMDIClient, GWL_EXSTYLE); DWORD dwNewStyle = dwStyle; if((hWndChild != NULL) && ((this->GetExStyle() & WS_EX_CLIENTEDGE) == 0) && ((this->GetStyle() & WS_MAXIMIZE) != 0)) dwNewStyle &= ~(WS_EX_CLIENTEDGE); else dwNewStyle |= WS_EX_CLIENTEDGE; if(dwStyle != dwNewStyle) { // SetWindowPos will not move invalid bits ::RedrawWindow(this->m_hWndMDIClient, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); // remove/add WS_EX_CLIENTEDGE to MDI client area ::SetWindowLong(this->m_hWndMDIClient, GWL_EXSTYLE, dwNewStyle); ::SetWindowPos(this->m_hWndMDIClient, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOCOPYBITS); // return new client area if (lpRect != NULL) ::GetClientRect(this->m_hWndMDIClient, lpRect); return TRUE; } return FALSE; } typedef CFrameWindowImplBase _baseClass; BEGIN_MSG_MAP(CMDIChildWindowImpl) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_WINDOWPOSCHANGED, OnWindowPosChanged) MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) MESSAGE_HANDLER(WM_MENUSELECT, OnMenuSelect) MESSAGE_HANDLER(WM_MDIACTIVATE, OnMDIActivate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) #ifndef _ATL_NO_REBAR_SUPPORT NOTIFY_CODE_HANDLER(RBN_AUTOSIZE, OnReBarAutoSize) NOTIFY_CODE_HANDLER(RBN_CHEVRONPUSHED, OnChevronPushed) #endif // !_ATL_NO_REBAR_SUPPORT CHAIN_MSG_MAP(_baseClass) END_MSG_MAP() LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { this->DefWindowProc(uMsg, wParam, lParam); // needed for MDI children if(wParam != SIZE_MINIMIZED) { T* pT = static_cast(this); pT->UpdateLayout(); } return 0; } LRESULT OnWindowPosChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { // update MDI client edge and adjust MDI child rect LPWINDOWPOS lpWndPos = (LPWINDOWPOS)lParam; if(!(lpWndPos->flags & SWP_NOSIZE)) { RECT rectClient = {}; if(UpdateClientEdge(&rectClient) && ((this->GetStyle() & WS_MAXIMIZE) != 0)) { ::AdjustWindowRectEx(&rectClient, this->GetStyle(), FALSE, this->GetExStyle()); lpWndPos->x = rectClient.left; lpWndPos->y = rectClient.top; lpWndPos->cx = rectClient.right - rectClient.left; lpWndPos->cy = rectClient.bottom - rectClient.top; } } bHandled = FALSE; return 1; } LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRes = this->DefWindowProc(uMsg, wParam, lParam); // Activate this MDI window if needed if((lRes == MA_ACTIVATE) || (lRes == MA_ACTIVATEANDEAT)) { if(this->MDIGetActive() != this->m_hWnd) this->MDIActivate(this->m_hWnd); } return lRes; } LRESULT OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { return ::SendMessage(this->GetMDIFrame(), uMsg, wParam, lParam); } LRESULT OnMDIActivate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(((HWND)lParam == this->m_hWnd) && (this->m_hMenu != NULL)) this->SetMDIFrameMenu(); else if((HWND)lParam == NULL) ::SendMessage(this->GetMDIFrame(), WM_MDISETMENU, 0, 0); bHandled = FALSE; return 1; } LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(this->m_hMenu != NULL) { ::DestroyMenu(this->m_hMenu); this->m_hMenu = NULL; } UpdateClientEdge(); bHandled = FALSE; return 1; } #ifndef _ATL_NO_REBAR_SUPPORT LRESULT OnReBarAutoSize(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->UpdateLayout(FALSE); return 0; } LRESULT OnChevronPushed(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { T* pT = static_cast(this); typename CFrameWindowImplBase::_ChevronMenuInfo cmi = { NULL, (LPNMREBARCHEVRON)pnmh, false }; if(!pT->PrepareChevronMenu(cmi)) { bHandled = FALSE; return 1; } // display a popup menu with hidden items pT->DisplayChevronMenu(cmi); // cleanup pT->CleanupChevronMenu(cmi); return 0; } #endif // !_ATL_NO_REBAR_SUPPORT }; /////////////////////////////////////////////////////////////////////////////// // COwnerDraw - MI class for owner-draw support template class COwnerDraw { public: // Message map and handlers BEGIN_MSG_MAP(COwnerDraw< T >) MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem) MESSAGE_HANDLER(WM_COMPAREITEM, OnCompareItem) MESSAGE_HANDLER(WM_DELETEITEM, OnDeleteItem) ALT_MSG_MAP(1) MESSAGE_HANDLER(OCM_DRAWITEM, OnDrawItem) MESSAGE_HANDLER(OCM_MEASUREITEM, OnMeasureItem) MESSAGE_HANDLER(OCM_COMPAREITEM, OnCompareItem) MESSAGE_HANDLER(OCM_DELETEITEM, OnDeleteItem) END_MSG_MAP() LRESULT OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); pT->SetMsgHandled(TRUE); pT->DrawItem((LPDRAWITEMSTRUCT)lParam); bHandled = pT->IsMsgHandled(); return (LRESULT)TRUE; } LRESULT OnMeasureItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); pT->SetMsgHandled(TRUE); pT->MeasureItem((LPMEASUREITEMSTRUCT)lParam); bHandled = pT->IsMsgHandled(); return (LRESULT)TRUE; } LRESULT OnCompareItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); pT->SetMsgHandled(TRUE); bHandled = pT->IsMsgHandled(); return (LRESULT)pT->CompareItem((LPCOMPAREITEMSTRUCT)lParam); } LRESULT OnDeleteItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); pT->SetMsgHandled(TRUE); pT->DeleteItem((LPDELETEITEMSTRUCT)lParam); bHandled = pT->IsMsgHandled(); return (LRESULT)TRUE; } // Overrideables void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/) { // must be implemented ATLASSERT(FALSE); } void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) { if(lpMeasureItemStruct->CtlType != ODT_MENU) { // return default height for a system font T* pT = static_cast(this); HWND hWnd = pT->GetDlgItem(lpMeasureItemStruct->CtlID); CClientDC dc(hWnd); TEXTMETRIC tm = {}; dc.GetTextMetrics(&tm); lpMeasureItemStruct->itemHeight = tm.tmHeight; } else lpMeasureItemStruct->itemHeight = ::GetSystemMetrics(SM_CYMENU); } int CompareItem(LPCOMPAREITEMSTRUCT /*lpCompareItemStruct*/) { // all items are equal return 0; } void DeleteItem(LPDELETEITEMSTRUCT /*lpDeleteItemStruct*/) { // default - nothing } }; /////////////////////////////////////////////////////////////////////////////// // Update UI macros // these build the Update UI map inside a class definition #define BEGIN_UPDATE_UI_MAP(thisClass) \ static const CUpdateUIBase::_AtlUpdateUIMap* GetUpdateUIMap() \ { \ static const CUpdateUIBase::_AtlUpdateUIMap theMap[] = \ { #define UPDATE_ELEMENT(nID, wType) \ { nID, wType }, #define END_UPDATE_UI_MAP() \ { (WORD)-1, 0 } \ }; \ return theMap; \ } /////////////////////////////////////////////////////////////////////////////// // CUpdateUI - manages UI elements updating class CUpdateUIBase { public: // constants enum { // UI element type UPDUI_MENUPOPUP = 0x0001, UPDUI_MENUBAR = 0x0002, UPDUI_CHILDWINDOW = 0x0004, UPDUI_TOOLBAR = 0x0008, UPDUI_STATUSBAR = 0x0010, // state UPDUI_ENABLED = 0x0000, UPDUI_DISABLED = 0x0100, UPDUI_CHECKED = 0x0200, UPDUI_CHECKED2 = 0x0400, UPDUI_RADIO = 0x0800, UPDUI_DEFAULT = 0x1000, UPDUI_TEXT = 0x2000, // internal state UPDUI_CLEARDEFAULT = 0x4000, }; // element data struct _AtlUpdateUIElement { HWND m_hWnd; WORD m_wType; bool operator ==(const _AtlUpdateUIElement& e) const { return ((m_hWnd == e.m_hWnd) && (m_wType == e.m_wType)); } }; // map data struct _AtlUpdateUIMap { WORD m_nID; WORD m_wType; bool operator ==(const _AtlUpdateUIMap& e) const { return ((m_nID == e.m_nID) && (m_wType == e.m_wType)); } }; // instance data #pragma warning(push) #pragma warning(disable: 4201) // nameless unions are part of C++ struct _AtlUpdateUIData { WORD m_wState; union { void* m_lpData; LPTSTR m_lpstrText; struct { WORD m_nIDFirst; WORD m_nIDLast; }; }; bool operator ==(const _AtlUpdateUIData& e) const { return ((m_wState == e.m_wState) && (m_lpData == e.m_lpData)); } }; #pragma warning(pop) ATL::CSimpleArray<_AtlUpdateUIElement> m_UIElements; // elements data const _AtlUpdateUIMap* m_pUIMap; // static UI data _AtlUpdateUIData* m_pUIData; // instance UI data WORD m_wDirtyType; // global dirty flag bool m_bBlockAccelerators; // Constructor, destructor CUpdateUIBase() : m_pUIMap(NULL), m_pUIData(NULL), m_wDirtyType(0), m_bBlockAccelerators(false) { } ~CUpdateUIBase() { if((m_pUIMap != NULL) && (m_pUIData != NULL)) { const _AtlUpdateUIMap* pUIMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; while(pUIMap->m_nID != (WORD)-1) { if(pUIData->m_wState & UPDUI_TEXT) delete [] pUIData->m_lpstrText; pUIMap++; pUIData++; } delete [] m_pUIData; } } // Check for disabled commands bool UIGetBlockAccelerators() const { return m_bBlockAccelerators; } bool UISetBlockAccelerators(bool bBlock) { bool bOld = m_bBlockAccelerators; m_bBlockAccelerators = bBlock; return bOld; } // Add elements BOOL UIAddMenuBar(HWND hWnd) // menu bar (main menu) { if(hWnd == NULL) return FALSE; _AtlUpdateUIElement e; e.m_hWnd = hWnd; e.m_wType = UPDUI_MENUBAR; return m_UIElements.Add(e); } BOOL UIAddToolBar(HWND hWnd) // toolbar { if(hWnd == NULL) return FALSE; _AtlUpdateUIElement e; e.m_hWnd = hWnd; e.m_wType = UPDUI_TOOLBAR; return m_UIElements.Add(e); } BOOL UIAddStatusBar(HWND hWnd) // status bar { if(hWnd == NULL) return FALSE; _AtlUpdateUIElement e; e.m_hWnd = hWnd; e.m_wType = UPDUI_STATUSBAR; return m_UIElements.Add(e); } BOOL UIAddChildWindowContainer(HWND hWnd) // child window { if(hWnd == NULL) return FALSE; _AtlUpdateUIElement e; e.m_hWnd = hWnd; e.m_wType = UPDUI_CHILDWINDOW; return m_UIElements.Add(e); } // Message map for popup menu updates and accelerator blocking BEGIN_MSG_MAP(CUpdateUIBase) MESSAGE_HANDLER(WM_INITMENUPOPUP, OnInitMenuPopup) MESSAGE_HANDLER(WM_COMMAND, OnCommand) END_MSG_MAP() LRESULT OnInitMenuPopup(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { bHandled = FALSE; HMENU hMenu = (HMENU)wParam; if(hMenu == NULL) return 1; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return 1; const _AtlUpdateUIMap* pMap = m_pUIMap; while(pMap->m_nID != (WORD)-1) { if(pMap->m_wType & UPDUI_MENUPOPUP) { UIUpdateMenuBarElement(pMap->m_nID, pUIData, hMenu); if((pUIData->m_wState & UPDUI_RADIO) != 0) ::CheckMenuRadioItem(hMenu, pUIData->m_nIDFirst, pUIData->m_nIDLast, pMap->m_nID, MF_BYCOMMAND); } pMap++; pUIData++; } return 0; } LRESULT OnCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { bHandled = FALSE; if(m_bBlockAccelerators && (HIWORD(wParam) == 1)) // accelerators only { int nID = LOWORD(wParam); if((UIGetState(nID) & UPDUI_DISABLED) == UPDUI_DISABLED) { ATLTRACE2(atlTraceUI, 0, _T("CUpdateUIBase::OnCommand - blocked disabled command 0x%4.4X\n"), nID); bHandled = TRUE; // eat the command, UI item is disabled } } return 0; } // methods for setting UI element state BOOL UIEnable(int nID, BOOL bEnable, BOOL bForceUpdate = FALSE) { const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) { if(nID == (int)pMap->m_nID) { if(bEnable) { if(pUIData->m_wState & UPDUI_DISABLED) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState &= ~UPDUI_DISABLED; } } else { if(!(pUIData->m_wState & UPDUI_DISABLED)) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState |= UPDUI_DISABLED; } } if(bForceUpdate) pUIData->m_wState |= pMap->m_wType; if(pUIData->m_wState & pMap->m_wType) m_wDirtyType |= pMap->m_wType; break; // found } } return TRUE; } BOOL UISetCheck(int nID, int nCheck, BOOL bForceUpdate = FALSE) { const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) { if(nID == (int)pMap->m_nID) { switch(nCheck) { case 0: if((pUIData->m_wState & UPDUI_CHECKED) || (pUIData->m_wState & UPDUI_CHECKED2)) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState &= ~(UPDUI_CHECKED | UPDUI_CHECKED2); } break; case 1: if(!(pUIData->m_wState & UPDUI_CHECKED)) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState &= ~UPDUI_CHECKED2; pUIData->m_wState |= UPDUI_CHECKED; } break; case 2: if(!(pUIData->m_wState & UPDUI_CHECKED2)) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState &= ~UPDUI_CHECKED; pUIData->m_wState |= UPDUI_CHECKED2; } break; } if(bForceUpdate) pUIData->m_wState |= pMap->m_wType; if(pUIData->m_wState & pMap->m_wType) m_wDirtyType |= pMap->m_wType; break; // found } } return TRUE; } // variant that supports bool (checked/not-checked, no intermediate state) BOOL UISetCheck(int nID, bool bCheck, BOOL bForceUpdate = FALSE) { return UISetCheck(nID, bCheck ? 1 : 0, bForceUpdate); } BOOL UISetRadio(int nID, BOOL bRadio, BOOL bForceUpdate = FALSE) { const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) { if(nID == (int)pMap->m_nID) { if(bRadio) { if(!(pUIData->m_wState & UPDUI_RADIO)) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState |= UPDUI_RADIO; } } else { if(pUIData->m_wState & UPDUI_RADIO) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState &= ~UPDUI_RADIO; } } if(bForceUpdate) pUIData->m_wState |= pMap->m_wType; if(pUIData->m_wState & pMap->m_wType) m_wDirtyType |= pMap->m_wType; break; // found } } return TRUE; } // for menu items BOOL UISetRadioMenuItem(int nID, int nIDFirst, int nIDLast, BOOL bForceUpdate = FALSE) { const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) { if(nID == (int)pMap->m_nID) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState |= UPDUI_RADIO; pUIData->m_nIDFirst = (WORD)nIDFirst; pUIData->m_nIDLast = (WORD)nIDLast; if(bForceUpdate) pUIData->m_wState |= pMap->m_wType; if(pUIData->m_wState & pMap->m_wType) m_wDirtyType |= pMap->m_wType; } else if((pMap->m_nID >= nIDFirst) && (pMap->m_nID <= nIDLast)) { if(pUIData->m_wState & UPDUI_RADIO) { pUIData->m_wState &= ~pMap->m_wType; pUIData->m_wState &= ~UPDUI_RADIO; pUIData->m_nIDFirst = 0; pUIData->m_nIDLast = 0; } } if(pMap->m_nID == nIDLast) break; } return TRUE; } BOOL UISetText(int nID, LPCTSTR lpstrText, BOOL bForceUpdate = FALSE) { const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; if(lpstrText == NULL) lpstrText = _T(""); for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) { if(nID == (int)pMap->m_nID) { if((pUIData->m_lpstrText == NULL) || (lstrcmp(pUIData->m_lpstrText, lpstrText) != 0)) { delete [] pUIData->m_lpstrText; pUIData->m_lpstrText = NULL; int nStrLen = lstrlen(lpstrText); ATLTRY(pUIData->m_lpstrText = new TCHAR[nStrLen + 1]); if(pUIData->m_lpstrText == NULL) { ATLTRACE2(atlTraceUI, 0, _T("UISetText - memory allocation failed\n")); break; } ATL::Checked::tcscpy_s(pUIData->m_lpstrText, nStrLen + 1, lpstrText); pUIData->m_wState |= (UPDUI_TEXT | pMap->m_wType); } if(bForceUpdate) pUIData->m_wState |= (UPDUI_TEXT | pMap->m_wType); if(pUIData->m_wState & pMap->m_wType) m_wDirtyType |= pMap->m_wType; break; // found } } return TRUE; } BOOL UISetDefault(int nID, BOOL bDefault, BOOL bForceUpdate = FALSE) { const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) { if(nID == (int)pMap->m_nID) { if(bDefault) { if((pUIData->m_wState & UPDUI_DEFAULT) == 0) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState |= UPDUI_DEFAULT; } } else { if((pUIData->m_wState & UPDUI_DEFAULT) != 0) { pUIData->m_wState |= pMap->m_wType; pUIData->m_wState &= ~UPDUI_DEFAULT; pUIData->m_wState |= UPDUI_CLEARDEFAULT; } } if(bForceUpdate) pUIData->m_wState |= pMap->m_wType; if(pUIData->m_wState & pMap->m_wType) m_wDirtyType |= pMap->m_wType; break; // found } } return TRUE; } // methods for complete state set/get BOOL UISetState(int nID, DWORD dwState) { const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) { if(nID == (int)pMap->m_nID) { pUIData->m_wState = (WORD)(dwState | pMap->m_wType); m_wDirtyType |= pMap->m_wType; break; // found } } return TRUE; } DWORD UIGetState(int nID) { const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return 0; for( ; pMap->m_nID != (WORD)-1; pMap++, pUIData++) { if(nID == (int)pMap->m_nID) return pUIData->m_wState; } return 0; } // methods for updating UI BOOL UIUpdateMenuBar(BOOL bForceUpdate = FALSE, BOOL bMainMenu = FALSE) { if(!(m_wDirtyType & UPDUI_MENUBAR) && !bForceUpdate) return TRUE; const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; while(pMap->m_nID != (WORD)-1) { for(int i = 0; i < m_UIElements.GetSize(); i++) { if(m_UIElements[i].m_wType == UPDUI_MENUBAR) { HMENU hMenu = ::GetMenu(m_UIElements[i].m_hWnd); if((hMenu != NULL) && (pUIData->m_wState & UPDUI_MENUBAR) && (pMap->m_wType & UPDUI_MENUBAR)) UIUpdateMenuBarElement(pMap->m_nID, pUIData, hMenu); } if(bMainMenu) ::DrawMenuBar(m_UIElements[i].m_hWnd); } pMap++; pUIData->m_wState &= ~UPDUI_MENUBAR; if(pUIData->m_wState & UPDUI_TEXT) { delete [] pUIData->m_lpstrText; pUIData->m_lpstrText = NULL; pUIData->m_wState &= ~UPDUI_TEXT; } pUIData++; } m_wDirtyType &= ~UPDUI_MENUBAR; return TRUE; } BOOL UIUpdateToolBar(BOOL bForceUpdate = FALSE) { if(!(m_wDirtyType & UPDUI_TOOLBAR) && !bForceUpdate) return TRUE; const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; while(pMap->m_nID != (WORD)-1) { for(int i = 0; i < m_UIElements.GetSize(); i++) { if(m_UIElements[i].m_wType == UPDUI_TOOLBAR) { if((pUIData->m_wState & UPDUI_TOOLBAR) && (pMap->m_wType & UPDUI_TOOLBAR)) UIUpdateToolBarElement(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); } } pMap++; pUIData->m_wState &= ~UPDUI_TOOLBAR; pUIData++; } m_wDirtyType &= ~UPDUI_TOOLBAR; return TRUE; } BOOL UIUpdateStatusBar(BOOL bForceUpdate = FALSE) { if(!(m_wDirtyType & UPDUI_STATUSBAR) && !bForceUpdate) return TRUE; const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; while(pMap->m_nID != (WORD)-1) { for(int i = 0; i < m_UIElements.GetSize(); i++) { if(m_UIElements[i].m_wType == UPDUI_STATUSBAR) { if((pUIData->m_wState & UPDUI_STATUSBAR) && (pMap->m_wType & UPDUI_STATUSBAR)) UIUpdateStatusBarElement(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); } } pMap++; pUIData->m_wState &= ~UPDUI_STATUSBAR; if(pUIData->m_wState & UPDUI_TEXT) { delete [] pUIData->m_lpstrText; pUIData->m_lpstrText = NULL; pUIData->m_wState &= ~UPDUI_TEXT; } pUIData++; } m_wDirtyType &= ~UPDUI_STATUSBAR; return TRUE; } BOOL UIUpdateChildWindows(BOOL bForceUpdate = FALSE) { if(!(m_wDirtyType & UPDUI_CHILDWINDOW) && !bForceUpdate) return TRUE; const _AtlUpdateUIMap* pMap = m_pUIMap; _AtlUpdateUIData* pUIData = m_pUIData; if(pUIData == NULL) return FALSE; while(pMap->m_nID != (WORD)-1) { for(int i = 0; i < m_UIElements.GetSize(); i++) { if(m_UIElements[i].m_wType == UPDUI_CHILDWINDOW) { if((pUIData->m_wState & UPDUI_CHILDWINDOW) && (pMap->m_wType & UPDUI_CHILDWINDOW)) UIUpdateChildWindow(pMap->m_nID, pUIData, m_UIElements[i].m_hWnd); } } pMap++; pUIData->m_wState &= ~UPDUI_CHILDWINDOW; if(pUIData->m_wState & UPDUI_TEXT) { delete [] pUIData->m_lpstrText; pUIData->m_lpstrText = NULL; pUIData->m_wState &= ~UPDUI_TEXT; } pUIData++; } m_wDirtyType &= ~UPDUI_CHILDWINDOW; return TRUE; } // internal element specific methods static void UIUpdateMenuBarElement(int nID, _AtlUpdateUIData* pUIData, HMENU hMenu) { if((pUIData->m_wState & UPDUI_CLEARDEFAULT) != 0) { ::SetMenuDefaultItem(hMenu, (UINT)-1, 0); pUIData->m_wState &= ~UPDUI_CLEARDEFAULT; } CMenuItemInfo mii; mii.fMask = MIIM_STATE; mii.wID = nID; if((pUIData->m_wState & UPDUI_DISABLED) != 0) mii.fState |= MFS_DISABLED | MFS_GRAYED; else mii.fState |= MFS_ENABLED; if((pUIData->m_wState & UPDUI_CHECKED) != 0) mii.fState |= MFS_CHECKED; else mii.fState |= MFS_UNCHECKED; if((pUIData->m_wState & UPDUI_DEFAULT) != 0) mii.fState |= MFS_DEFAULT; if((pUIData->m_wState & UPDUI_TEXT) != 0) { CMenuItemInfo miiNow; miiNow.fMask = MIIM_TYPE; miiNow.wID = nID; if(::GetMenuItemInfo(hMenu, nID, FALSE, &miiNow)) { mii.fMask |= MIIM_TYPE; // MFT_BITMAP and MFT_SEPARATOR don't go together with MFT_STRING mii.fType |= (miiNow.fType & ~(MFT_BITMAP | MFT_SEPARATOR)) | MFT_STRING; mii.dwTypeData = pUIData->m_lpstrText; } } ::SetMenuItemInfo(hMenu, nID, FALSE, &mii); } static void UIUpdateToolBarElement(int nID, _AtlUpdateUIData* pUIData, HWND hWndToolBar) { // Note: only handles enabled/disabled, checked state, and radio (press) ::SendMessage(hWndToolBar, TB_ENABLEBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_DISABLED) ? FALSE : TRUE); ::SendMessage(hWndToolBar, TB_CHECKBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_CHECKED) ? TRUE : FALSE); ::SendMessage(hWndToolBar, TB_INDETERMINATE, nID, (LPARAM)(pUIData->m_wState & UPDUI_CHECKED2) ? TRUE : FALSE); ::SendMessage(hWndToolBar, TB_PRESSBUTTON, nID, (LPARAM)(pUIData->m_wState & UPDUI_RADIO) ? TRUE : FALSE); } static void UIUpdateStatusBarElement(int nID, _AtlUpdateUIData* pUIData, HWND hWndStatusBar) { // Note: only handles text if(pUIData->m_wState & UPDUI_TEXT) ::SendMessage(hWndStatusBar, SB_SETTEXT, nID, (LPARAM)pUIData->m_lpstrText); } static void UIUpdateChildWindow(int nID, _AtlUpdateUIData* pUIData, HWND hWnd) { HWND hChild = ::GetDlgItem(hWnd, nID); ::EnableWindow(hChild, (pUIData->m_wState & UPDUI_DISABLED) ? FALSE : TRUE); // for check and radio, assume that window is a button int nCheck = BST_UNCHECKED; if((pUIData->m_wState & UPDUI_CHECKED) || (pUIData->m_wState & UPDUI_RADIO)) nCheck = BST_CHECKED; else if(pUIData->m_wState & UPDUI_CHECKED2) nCheck = BST_INDETERMINATE; ::SendMessage(hChild, BM_SETCHECK, nCheck, 0L); if(pUIData->m_wState & UPDUI_DEFAULT) { DWORD dwRet = (DWORD)::SendMessage(hWnd, DM_GETDEFID, 0, 0L); if(HIWORD(dwRet) == DC_HASDEFID) { HWND hOldDef = ::GetDlgItem(hWnd, (int)(short)LOWORD(dwRet)); // remove BS_DEFPUSHBUTTON ::SendMessage(hOldDef, BM_SETSTYLE, BS_PUSHBUTTON, MAKELPARAM(TRUE, 0)); } ::SendMessage(hWnd, DM_SETDEFID, nID, 0L); } if(pUIData->m_wState & UPDUI_TEXT) ::SetWindowText(hChild, pUIData->m_lpstrText); } }; template class CUpdateUI : public CUpdateUIBase { public: CUpdateUI() { T* pT = static_cast(this); (void)pT; // avoid level 4 warning const _AtlUpdateUIMap* pMap = pT->GetUpdateUIMap(); m_pUIMap = pMap; ATLASSERT(m_pUIMap != NULL); int nCount = 1; for( ; pMap->m_nID != (WORD)-1; nCount++) pMap++; // check for duplicates (debug only) #ifdef _DEBUG for(int i = 0; i < nCount; i++) { for(int j = 0; j < nCount; j++) { // shouldn't have duplicates in the update UI map if(i != j) ATLASSERT(m_pUIMap[j].m_nID != m_pUIMap[i].m_nID); } } #endif // _DEBUG ATLTRY(m_pUIData = new _AtlUpdateUIData[nCount]); ATLASSERT(m_pUIData != NULL); if(m_pUIData != NULL) memset(m_pUIData, 0, sizeof(_AtlUpdateUIData) * nCount); } }; /////////////////////////////////////////////////////////////////////////////// // CDynamicUpdateUI - allows update elements to dynamically added and removed // in addition to a static update UI map template class CDynamicUpdateUI : public CUpdateUIBase { public: // Data members ATL::CSimpleArray<_AtlUpdateUIMap> m_arrUIMap; // copy of the static UI data ATL::CSimpleArray<_AtlUpdateUIData> m_arrUIData; // instance UI data // Constructor/destructor CDynamicUpdateUI() { T* pT = static_cast(this); (void)pT; // avoid level 4 warning const _AtlUpdateUIMap* pMap = pT->GetUpdateUIMap(); ATLASSERT(pMap != NULL); for(;;) { BOOL bRet = m_arrUIMap.Add(*(_AtlUpdateUIMap*)pMap); ATLASSERT(bRet); if(bRet != FALSE) { _AtlUpdateUIData data = { 0, NULL }; bRet = m_arrUIData.Add(data); ATLASSERT(bRet); } if(pMap->m_nID == (WORD)-1) break; pMap++; } ATLASSERT(m_arrUIMap.GetSize() == m_arrUIData.GetSize()); #ifdef _DEBUG // check for duplicates (debug only) for(int i = 0; i < m_arrUIMap.GetSize(); i++) { for(int j = 0; j < m_arrUIMap.GetSize(); j++) { // shouldn't have duplicates in the update UI map if(i != j) ATLASSERT(m_arrUIMap[j].m_nID != m_arrUIMap[i].m_nID); } } #endif // _DEBUG // Set internal data pointers to point to the new data arrays m_pUIMap = m_arrUIMap.m_aT; m_pUIData = m_arrUIData.m_aT; } ~CDynamicUpdateUI() { for(int i = 0; i < m_arrUIData.GetSize(); i++) { if((m_arrUIData[i].m_wState & UPDUI_TEXT) != 0) delete [] m_arrUIData[i].m_lpstrText; } // Reset internal data pointers (memory will be released by CSimpleArray d-tor) m_pUIMap = NULL; m_pUIData = NULL; } // Methods for dynamically adding and removing update elements bool UIAddUpdateElement(WORD nID, WORD wType) { // check for duplicates for(int i = 0; i < m_arrUIMap.GetSize(); i++) { // shouldn't have duplicates in the update UI map ATLASSERT(m_arrUIMap[i].m_nID != nID); if(m_arrUIMap[i].m_nID == nID) return false; } bool bRetVal = false; // Add new end element _AtlUpdateUIMap uumEnd = { (WORD)-1, 0 }; BOOL bRet = m_arrUIMap.Add(uumEnd); ATLASSERT(bRet); if(bRet != FALSE) { _AtlUpdateUIData uud = { 0, NULL }; bRet = m_arrUIData.Add(uud); ATLASSERT(bRet); // Set new data to the previous end element if(bRet != FALSE) { int nSize = m_arrUIMap.GetSize(); _AtlUpdateUIMap uum = { nID, wType }; m_arrUIMap.SetAtIndex(nSize - 2, uum); m_arrUIData.SetAtIndex(nSize - 2, uud); // Set internal data pointers again, just in case that memory moved m_pUIMap = m_arrUIMap.m_aT; m_pUIData = m_arrUIData.m_aT; bRetVal = true; } } return bRetVal; } bool UIRemoveUpdateElement(WORD nID) { bool bRetVal = false; for(int i = 0; i < m_arrUIMap.GetSize(); i++) { if(m_arrUIMap[i].m_nID == nID) { if((m_arrUIData[i].m_wState & UPDUI_TEXT) != 0) delete [] m_arrUIData[i].m_lpstrText; BOOL bRet = m_arrUIMap.RemoveAt(i); ATLASSERT(bRet); bRet = m_arrUIData.RemoveAt(i); ATLASSERT(bRet); bRetVal = true; break; } } return bRetVal; } }; /////////////////////////////////////////////////////////////////////////////// // CAutoUpdateUI : Automatic mapping of UI elements template class CAutoUpdateUI : public CDynamicUpdateUI { public: LPCTSTR UIGetText(int nID) { for(int i = 0; i < this->m_arrUIMap.GetSize(); i++) { if(this->m_arrUIMap[i].m_nID == nID) return this->m_arrUIData[i].m_lpstrText; } return NULL; } // Element template bool UIAddElement(UINT nID) { // check for existing UI map element for(int i = 0; i < this->m_arrUIMap.GetSize(); i++) { if(this->m_arrUIMap[i].m_nID == nID) { // set requested type this->m_arrUIMap[i].m_wType |= t_wType; return true; } } // Add element to UI map with requested type return this->UIAddUpdateElement((WORD)nID, t_wType); } template bool UIRemoveElement(UINT nID) { for(int i = 0; i < this->m_arrUIMap.GetSize(); i++) { if(this->m_arrUIMap[i].m_nID == nID) // matching UI map element { WORD wType = this->m_arrUIMap[i].m_wType & ~t_wType; if (wType != 0) // has other types { this->m_arrUIMap[i].m_wType = wType; // keep other types return true; } else { return this->UIRemoveUpdateElement((WORD)nID); } } } return false; } // Menu bool UIAddMenu(HMENU hMenu, bool bSetText = false) { ATLASSERT(::IsMenu(hMenu)); MENUITEMINFO mii = {sizeof(MENUITEMINFO), MIIM_TYPE | MIIM_ID | MIIM_SUBMENU}; // Complete the UI map for (INT uItem = 0; CMenuHandle(hMenu).GetMenuItemInfo(uItem, TRUE, &mii); uItem++) { if(mii.hSubMenu) { // Add submenu to UI map UIAddMenu(mii.hSubMenu, bSetText); } else if (mii.wID != 0) { // Add element to UI map UIAddElement::UPDUI_MENUPOPUP>(mii.wID); if (bSetText) { TCHAR sText[64] = {}; if (GetMenuString(hMenu, uItem, sText, 64, MF_BYPOSITION)) this->UISetText(mii.wID, sText); } } } return true; } bool UIAddMenu(UINT uID, bool bSetText = false) { CMenu menu; ATLVERIFY(menu.LoadMenu(uID)); return UIAddMenu(menu, bSetText); } // ToolBar bool UIAddToolBar(HWND hWndToolBar) { ATLASSERT(::IsWindow(hWndToolBar)); TBBUTTONINFO tbbi = { sizeof(TBBUTTONINFO), TBIF_COMMAND | TBIF_STYLE | TBIF_BYINDEX }; // Add toolbar buttons for (int uItem = 0; ::SendMessage(hWndToolBar, TB_GETBUTTONINFO, uItem, (LPARAM)&tbbi) != -1; uItem++) { if (tbbi.fsStyle ^ BTNS_SEP) UIAddElement::UPDUI_TOOLBAR>(tbbi.idCommand); } // Add embedded controls if any if (::GetWindow(hWndToolBar, GW_CHILD)) UIAddChildWindowContainer(hWndToolBar); return (CUpdateUIBase::UIAddToolBar(hWndToolBar) != FALSE); } // Container bool UIAddChildWindowContainer(HWND hWnd) { ATLASSERT(::IsWindow(hWnd)); // Add children controls if any for (ATL::CWindow wCtl = ::GetWindow(hWnd, GW_CHILD); wCtl.IsWindow(); wCtl = wCtl.GetWindow(GW_HWNDNEXT)) { int id = wCtl.GetDlgCtrlID(); if(id != 0) UIAddElement::UPDUI_CHILDWINDOW>(id); } return (CUpdateUIBase::UIAddChildWindowContainer(hWnd) != FALSE); } // StatusBar BOOL UIUpdateStatusBar(BOOL bForceUpdate = FALSE) { if(!(this->m_wDirtyType & CDynamicUpdateUI::UPDUI_STATUSBAR) && !bForceUpdate) return TRUE; for(int i = 0; i < this->m_arrUIMap.GetSize(); i++) { for(int e = 0; e < this->m_UIElements.GetSize(); e++) { if((this->m_UIElements[e].m_wType == CDynamicUpdateUI::UPDUI_STATUSBAR) && (this->m_arrUIMap[i].m_wType & CDynamicUpdateUI::UPDUI_STATUSBAR) && (this->m_arrUIData[i].m_wState & CDynamicUpdateUI::UPDUI_STATUSBAR)) { this->UIUpdateStatusBarElement(this->m_arrUIMap[i].m_nID, &this->m_arrUIData[i], this->m_UIElements[e].m_hWnd); this->m_arrUIData[i].m_wState &= ~CDynamicUpdateUI::UPDUI_STATUSBAR; if(this->m_arrUIData[i].m_wState & CDynamicUpdateUI::UPDUI_TEXT) this->m_arrUIData[i].m_wState &= ~CDynamicUpdateUI::UPDUI_TEXT; } } } this->m_wDirtyType &= ~CDynamicUpdateUI::UPDUI_STATUSBAR; return TRUE; } bool UIAddStatusBar(HWND hWndStatusBar, INT nPanes = 1) { ATLASSERT(::IsWindow(hWndStatusBar)); // Add StatusBar panes for (int iPane = 0; iPane < nPanes; iPane++) UIAddElement::UPDUI_STATUSBAR>(ID_DEFAULT_PANE + iPane); return (CUpdateUIBase::UIAddStatusBar(hWndStatusBar) != FALSE); } // UI Map used if derived class has none BEGIN_UPDATE_UI_MAP(CAutoUpdateUI) END_UPDATE_UI_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CDialogResize - provides support for resizing dialog controls // (works for any window that has child controls) // Put CDialogResize in the list of base classes for a dialog (or even plain window), // then implement DLGRESIZE map by specifying controls and groups of control // and using DLSZ_* values to specify how are they supposed to be resized. // // Notes: // - Resizeable border (WS_THICKFRAME style) should be set in the dialog template // for top level dialogs (popup or overlapped), so that users can resize the dialog. // - Some flags cannot be combined; for instance DLSZ_CENTER_X overrides DLSZ_SIZE_X, // DLSZ_SIZE_X overrides DLSZ_MOVE_X. X and Y flags can be combined. // - Order of controls is important - group controls are resized and moved based // on the position of the previous control in a group. // dialog resize map macros struct _AtlDlgResizeMap { int m_nCtlID; DWORD m_dwResizeFlags; }; #define BEGIN_DLGRESIZE_MAP(thisClass) \ static const WTL::_AtlDlgResizeMap* GetDlgResizeMap() \ { \ static const WTL::_AtlDlgResizeMap theMap[] = \ { #define END_DLGRESIZE_MAP() \ { -1, 0 }, \ }; \ return theMap; \ } #define DLGRESIZE_CONTROL(id, flags) \ { id, flags }, #define BEGIN_DLGRESIZE_GROUP() \ { -1, _DLSZ_BEGIN_GROUP }, #define END_DLGRESIZE_GROUP() \ { -1, _DLSZ_END_GROUP }, template class CDialogResize { public: // Data declarations and members enum { DLSZ_SIZE_X = 0x00000001, DLSZ_SIZE_Y = 0x00000002, DLSZ_MOVE_X = 0x00000004, DLSZ_MOVE_Y = 0x00000008, DLSZ_REPAINT = 0x00000010, DLSZ_CENTER_X = 0x00000020, DLSZ_CENTER_Y = 0x00000040, // internal use only _DLSZ_BEGIN_GROUP = 0x00001000, _DLSZ_END_GROUP = 0x00002000, _DLSZ_GRIPPER = 0x00004000 }; struct _AtlDlgResizeData { int m_nCtlID; DWORD m_dwResizeFlags; RECT m_rect; int GetGroupCount() const { return (int)LOBYTE(HIWORD(m_dwResizeFlags)); } void SetGroupCount(int nCount) { ATLASSERT((nCount > 0) && (nCount < 256)); DWORD dwCount = (DWORD)MAKELONG(0, MAKEWORD(nCount, 0)); m_dwResizeFlags &= 0xFF00FFFF; m_dwResizeFlags |= dwCount; } bool operator ==(const _AtlDlgResizeData& r) const { return ((m_nCtlID == r.m_nCtlID) && (m_dwResizeFlags == r.m_dwResizeFlags)); } }; ATL::CSimpleArray<_AtlDlgResizeData> m_arrData; SIZE m_sizeDialog; POINT m_ptMinTrackSize; bool m_bGripper; // Constructor CDialogResize() : m_bGripper(false) { m_sizeDialog.cx = 0; m_sizeDialog.cy = 0; m_ptMinTrackSize.x = -1; m_ptMinTrackSize.y = -1; } // Operations void DlgResize_Init(bool bAddGripper = true, bool bUseMinTrackSize = true, DWORD dwForceStyle = WS_CLIPCHILDREN) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); DWORD dwStyle = pT->GetStyle(); #ifdef _DEBUG // Debug only: Check if top level dialogs have a resizeable border. if(((dwStyle & WS_CHILD) == 0) && ((dwStyle & WS_THICKFRAME) == 0)) ATLTRACE2(atlTraceUI, 0, _T("DlgResize_Init - warning: top level dialog without the WS_THICKFRAME style - user cannot resize it\n")); #endif // _DEBUG // Force specified styles (default WS_CLIPCHILDREN reduces flicker) if((dwStyle & dwForceStyle) != dwForceStyle) pT->ModifyStyle(0, dwForceStyle); // Adding this style removes an empty icon that dialogs with WS_THICKFRAME have. // Setting icon to NULL is required when XP themes are active. // Note: This will not prevent adding an icon for the dialog using SetIcon() if((dwStyle & WS_CHILD) == 0) { pT->ModifyStyleEx(0, WS_EX_DLGMODALFRAME); if(pT->GetIcon(FALSE) == NULL) pT->SetIcon(NULL, FALSE); } // Cleanup in case of multiple initialization // block: first check for the gripper control, destroy it if needed { ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); if(wndGripper.IsWindow() && (m_arrData.GetSize() > 0) && (m_arrData[0].m_dwResizeFlags & _DLSZ_GRIPPER) != 0) wndGripper.DestroyWindow(); } // clear out everything else m_arrData.RemoveAll(); m_sizeDialog.cx = 0; m_sizeDialog.cy = 0; m_ptMinTrackSize.x = -1; m_ptMinTrackSize.y = -1; // Get initial dialog client size RECT rectDlg = {}; pT->GetClientRect(&rectDlg); m_sizeDialog.cx = rectDlg.right; m_sizeDialog.cy = rectDlg.bottom; // Create gripper if requested m_bGripper = false; if(bAddGripper) { // shouldn't exist already ATLASSERT(!pT->GetDlgItem(ATL_IDW_STATUS_BAR).IsWindow()); if(!pT->GetDlgItem(ATL_IDW_STATUS_BAR).IsWindow()) { ATL::CWindow wndGripper; wndGripper.Create(_T("SCROLLBAR"), pT->m_hWnd, rectDlg, NULL, WS_CHILD | WS_VISIBLE | WS_GROUP | WS_CLIPSIBLINGS | SBS_SIZEBOX | SBS_SIZEGRIP | SBS_SIZEBOXBOTTOMRIGHTALIGN, 0, ATL_IDW_STATUS_BAR); ATLASSERT(wndGripper.IsWindow()); if(wndGripper.IsWindow()) { m_bGripper = true; RECT rectCtl = {}; wndGripper.GetWindowRect(&rectCtl); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); _AtlDlgResizeData data = { ATL_IDW_STATUS_BAR, DLSZ_MOVE_X | DLSZ_MOVE_Y | DLSZ_REPAINT | _DLSZ_GRIPPER, { rectCtl.left, rectCtl.top, rectCtl.right, rectCtl.bottom } }; m_arrData.Add(data); } } } // Get min track position if requested if(bUseMinTrackSize) { if((dwStyle & WS_CHILD) != 0) { RECT rect = {}; pT->GetClientRect(&rect); m_ptMinTrackSize.x = rect.right - rect.left; m_ptMinTrackSize.y = rect.bottom - rect.top; } else { RECT rect = {}; pT->GetWindowRect(&rect); m_ptMinTrackSize.x = rect.right - rect.left; m_ptMinTrackSize.y = rect.bottom - rect.top; } } // Walk the map and initialize data const _AtlDlgResizeMap* pMap = pT->GetDlgResizeMap(); ATLASSERT(pMap != NULL); int nGroupStart = -1; for(int nCount = 1; !((pMap->m_nCtlID == -1) && (pMap->m_dwResizeFlags == 0)); nCount++, pMap++) { if(pMap->m_nCtlID == -1) { switch(pMap->m_dwResizeFlags) { case _DLSZ_BEGIN_GROUP: ATLASSERT(nGroupStart == -1); nGroupStart = m_arrData.GetSize(); break; case _DLSZ_END_GROUP: { ATLASSERT(nGroupStart != -1); int nGroupCount = m_arrData.GetSize() - nGroupStart; m_arrData[nGroupStart].SetGroupCount(nGroupCount); nGroupStart = -1; } break; default: ATLASSERT(FALSE && _T("Invalid DLGRESIZE Map Entry")); break; } } else { // this ID conflicts with the default gripper one ATLASSERT(m_bGripper ? (pMap->m_nCtlID != ATL_IDW_STATUS_BAR) : TRUE); ATL::CWindow ctl = pT->GetDlgItem(pMap->m_nCtlID); ATLASSERT(ctl.IsWindow()); RECT rectCtl = {}; ctl.GetWindowRect(&rectCtl); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); DWORD dwGroupFlag = ((nGroupStart != -1) && (m_arrData.GetSize() == nGroupStart)) ? _DLSZ_BEGIN_GROUP : 0; _AtlDlgResizeData data = { pMap->m_nCtlID, pMap->m_dwResizeFlags | dwGroupFlag, { rectCtl.left, rectCtl.top, rectCtl.right, rectCtl.bottom } }; m_arrData.Add(data); } } ATLASSERT((nGroupStart == -1) && _T("No End Group Entry in the DLGRESIZE Map")); } void DlgResize_UpdateLayout(int cxWidth, int cyHeight) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); // Restrict minimum size if requested if(((pT->GetStyle() & WS_CHILD) != 0) && (m_ptMinTrackSize.x != -1) && (m_ptMinTrackSize.y != -1)) { if(cxWidth < m_ptMinTrackSize.x) cxWidth = m_ptMinTrackSize.x; if(cyHeight < m_ptMinTrackSize.y) cyHeight = m_ptMinTrackSize.y; } BOOL bVisible = pT->IsWindowVisible(); if(bVisible) pT->SetRedraw(FALSE); for(int i = 0; i < m_arrData.GetSize(); i++) { if((m_arrData[i].m_dwResizeFlags & _DLSZ_BEGIN_GROUP) != 0) // start of a group { int nGroupCount = m_arrData[i].GetGroupCount(); ATLASSERT((nGroupCount > 0) && ((i + nGroupCount - 1) < m_arrData.GetSize())); RECT rectGroup = m_arrData[i].m_rect; int j = 1; for(j = 1; j < nGroupCount; j++) { rectGroup.left = __min(rectGroup.left, m_arrData[i + j].m_rect.left); rectGroup.top = __min(rectGroup.top, m_arrData[i + j].m_rect.top); rectGroup.right = __max(rectGroup.right, m_arrData[i + j].m_rect.right); rectGroup.bottom = __max(rectGroup.bottom, m_arrData[i + j].m_rect.bottom); } for(j = 0; j < nGroupCount; j++) { _AtlDlgResizeData* pDataPrev = NULL; if(j > 0) pDataPrev = &(m_arrData[i + j - 1]); pT->DlgResize_PositionControl(cxWidth, cyHeight, rectGroup, m_arrData[i + j], true, pDataPrev); } i += nGroupCount - 1; // increment to skip all group controls } else // one control entry { RECT rectGroup = {}; pT->DlgResize_PositionControl(cxWidth, cyHeight, rectGroup, m_arrData[i], false); } } if(bVisible) pT->SetRedraw(TRUE); pT->RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); } // Message map and handlers BEGIN_MSG_MAP(CDialogResize) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo) END_MSG_MAP() LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { T* pT = static_cast(this); if(m_bGripper) { ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); if(wParam == SIZE_MAXIMIZED) wndGripper.ShowWindow(SW_HIDE); else if(wParam == SIZE_RESTORED) wndGripper.ShowWindow(SW_SHOW); } if(wParam != SIZE_MINIMIZED) { ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DlgResize_UpdateLayout(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); } return 0; } LRESULT OnGetMinMaxInfo(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { if((m_ptMinTrackSize.x != -1) && (m_ptMinTrackSize.y != -1)) { LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam; lpMMI->ptMinTrackSize = m_ptMinTrackSize; } return 0; } // Implementation bool DlgResize_PositionControl(int cxWidth, int cyHeight, RECT& rectGroup, _AtlDlgResizeData& data, bool bGroup, _AtlDlgResizeData* pDataPrev = NULL) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); ATL::CWindow ctl; RECT rectCtl = {}; ctl = pT->GetDlgItem(data.m_nCtlID); if(!ctl.GetWindowRect(&rectCtl)) return false; ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rectCtl, 2); if(bGroup) { if((data.m_dwResizeFlags & DLSZ_CENTER_X) != 0) { int cxRight = rectGroup.right + cxWidth - m_sizeDialog.cx; int cxCtl = data.m_rect.right - data.m_rect.left; rectCtl.left = rectGroup.left + (cxRight - rectGroup.left - cxCtl) / 2; rectCtl.right = rectCtl.left + cxCtl; } else if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_MOVE_X)) != 0) { rectCtl.left = rectGroup.left + ::MulDiv(data.m_rect.left - rectGroup.left, rectGroup.right - rectGroup.left + (cxWidth - m_sizeDialog.cx), rectGroup.right - rectGroup.left); if((data.m_dwResizeFlags & DLSZ_SIZE_X) != 0) { rectCtl.right = rectGroup.left + ::MulDiv(data.m_rect.right - rectGroup.left, rectGroup.right - rectGroup.left + (cxWidth - m_sizeDialog.cx), rectGroup.right - rectGroup.left); if(pDataPrev != NULL) { ATL::CWindow ctlPrev = pT->GetDlgItem(pDataPrev->m_nCtlID); RECT rcPrev = {}; ctlPrev.GetWindowRect(&rcPrev); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcPrev, 2); int dxAdjust = (rectCtl.left - rcPrev.right) - (data.m_rect.left - pDataPrev->m_rect.right); rcPrev.right += dxAdjust; ctlPrev.SetWindowPos(NULL, &rcPrev, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); } } else { rectCtl.right = rectCtl.left + (data.m_rect.right - data.m_rect.left); } } if((data.m_dwResizeFlags & DLSZ_CENTER_Y) != 0) { int cyBottom = rectGroup.bottom + cyHeight - m_sizeDialog.cy; int cyCtl = data.m_rect.bottom - data.m_rect.top; rectCtl.top = rectGroup.top + (cyBottom - rectGroup.top - cyCtl) / 2; rectCtl.bottom = rectCtl.top + cyCtl; } else if((data.m_dwResizeFlags & (DLSZ_SIZE_Y | DLSZ_MOVE_Y)) != 0) { rectCtl.top = rectGroup.top + ::MulDiv(data.m_rect.top - rectGroup.top, rectGroup.bottom - rectGroup.top + (cyHeight - m_sizeDialog.cy), rectGroup.bottom - rectGroup.top); if((data.m_dwResizeFlags & DLSZ_SIZE_Y) != 0) { rectCtl.bottom = rectGroup.top + ::MulDiv(data.m_rect.bottom - rectGroup.top, rectGroup.bottom - rectGroup.top + (cyHeight - m_sizeDialog.cy), rectGroup.bottom - rectGroup.top); if(pDataPrev != NULL) { ATL::CWindow ctlPrev = pT->GetDlgItem(pDataPrev->m_nCtlID); RECT rcPrev = {}; ctlPrev.GetWindowRect(&rcPrev); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcPrev, 2); int dxAdjust = (rectCtl.top - rcPrev.bottom) - (data.m_rect.top - pDataPrev->m_rect.bottom); rcPrev.bottom += dxAdjust; ctlPrev.SetWindowPos(NULL, &rcPrev, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE); } } else { rectCtl.bottom = rectCtl.top + (data.m_rect.bottom - data.m_rect.top); } } } else // no group { if((data.m_dwResizeFlags & DLSZ_CENTER_X) != 0) { int cxCtl = data.m_rect.right - data.m_rect.left; rectCtl.left = (cxWidth - cxCtl) / 2; rectCtl.right = rectCtl.left + cxCtl; } else if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_MOVE_X)) != 0) { rectCtl.right = data.m_rect.right + (cxWidth - m_sizeDialog.cx); if((data.m_dwResizeFlags & DLSZ_MOVE_X) != 0) rectCtl.left = rectCtl.right - (data.m_rect.right - data.m_rect.left); } if((data.m_dwResizeFlags & DLSZ_CENTER_Y) != 0) { int cyCtl = data.m_rect.bottom - data.m_rect.top; rectCtl.top = (cyHeight - cyCtl) / 2; rectCtl.bottom = rectCtl.top + cyCtl; } else if((data.m_dwResizeFlags & (DLSZ_SIZE_Y | DLSZ_MOVE_Y)) != 0) { rectCtl.bottom = data.m_rect.bottom + (cyHeight - m_sizeDialog.cy); if((data.m_dwResizeFlags & DLSZ_MOVE_Y) != 0) rectCtl.top = rectCtl.bottom - (data.m_rect.bottom - data.m_rect.top); } } if((data.m_dwResizeFlags & DLSZ_REPAINT) != 0) ctl.Invalidate(); if((data.m_dwResizeFlags & (DLSZ_SIZE_X | DLSZ_SIZE_Y | DLSZ_MOVE_X | DLSZ_MOVE_Y | DLSZ_REPAINT | DLSZ_CENTER_X | DLSZ_CENTER_Y)) != 0) ctl.SetWindowPos(NULL, &rectCtl, SWP_NOZORDER | SWP_NOACTIVATE); return true; } }; /////////////////////////////////////////////////////////////////////////////// // CDynamicDialogLayout - support for dialog dynamic layout resource info // (AFX_DIALOG_LAYOUT) in VS2015 and higher #if (_MSC_VER >= 1900) template class CDynamicDialogLayout { public: // Data declarations struct _AtlDynamicLayoutData { HWND m_hWnd; char m_nMoveRatioX; char m_nMoveRatioY; char m_nSizeRatioX; char m_nSizeRatioY; RECT m_rcInit; }; // Data members ATL::CSimpleArray<_AtlDynamicLayoutData> m_arrLayoutData; SIZE m_szParentInit; POINT m_ptMinTrackSize; bool m_bGripper; // Constructor CDynamicDialogLayout() : m_bGripper(false) { m_szParentInit.cx = 0; m_szParentInit.cy = 0; m_ptMinTrackSize.x = -1; m_ptMinTrackSize.y = -1; } // Methods void InitDynamicLayout(bool bAddGripper = true, bool bMinTrackSize = true) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); // Cleanup in case of multiple initialization // block: first check for the gripper control, destroy it if needed { ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); if(wndGripper.IsWindow() != FALSE) wndGripper.DestroyWindow(); } // clear out everything else m_arrLayoutData.RemoveAll(); m_ptMinTrackSize.x = -1; m_ptMinTrackSize.y = -1; m_szParentInit.cx = 0; m_szParentInit.cy = 0; m_bGripper = false; CResource rcLayout; if(rcLayout.Load(_T("AFX_DIALOG_LAYOUT"), pT->IDD)) { int nCount = rcLayout.GetSize() / sizeof(WORD); if(nCount > 1) { RECT rcParent = {}; pT->GetWindowRect(&rcParent); m_szParentInit.cx = rcParent.right - rcParent.left; m_szParentInit.cy = rcParent.bottom - rcParent.top; WORD* pnData = (WORD*)rcLayout.Lock(); WORD wVersion = *pnData; // AFX_DIALOG_LAYOUT version ATLASSERT(wVersion == 0); if(wVersion == 0) { pnData++; // skip version ATL::CWindow wndChild = pT->GetWindow(GW_CHILD); for(int i = 0; (i < nCount) && (wndChild.m_hWnd != NULL); i += 4) { char nMoveRatioX = _GetDataPct(pnData[i]); char nMoveRatioY = _GetDataPct(pnData[i + 1]); char nSizeRatioX = _GetDataPct(pnData[i + 2]); char nSizeRatioY = _GetDataPct(pnData[i + 3]); bool bValid = ((nMoveRatioX != -1) && (nMoveRatioY != -1) && (nSizeRatioX != -1) && (nSizeRatioY != -1)); bool bAction = ((nMoveRatioX != 0) || (nMoveRatioY != 0) || (nSizeRatioX != 0) || (nSizeRatioY != 0)); if(bValid && bAction) { _AtlDynamicLayoutData LayoutData = { wndChild.m_hWnd, nMoveRatioX, nMoveRatioY, nSizeRatioX, nSizeRatioY }; wndChild.GetWindowRect(&LayoutData.m_rcInit); pT->ScreenToClient(&LayoutData.m_rcInit); m_arrLayoutData.Add(LayoutData); } wndChild = wndChild.GetWindow(GW_HWNDNEXT); } } rcLayout.Release(); } } if(bAddGripper) { RECT rcDialog = {}; pT->GetClientRect(&rcDialog); ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); if(wndGripper.m_hWnd != NULL) wndGripper.DestroyWindow(); wndGripper.Create(_T("SCROLLBAR"), pT->m_hWnd, rcDialog, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SBS_SIZEBOX | SBS_SIZEGRIP | SBS_SIZEBOXBOTTOMRIGHTALIGN, 0, ATL_IDW_STATUS_BAR); ATLASSERT(wndGripper.m_hWnd != NULL); if(wndGripper.m_hWnd != NULL) { m_bGripper = true; _AtlDynamicLayoutData LayoutData = { wndGripper.m_hWnd, 100, 100, 0, 0 }; wndGripper.GetWindowRect(&LayoutData.m_rcInit); pT->ScreenToClient(&LayoutData.m_rcInit); m_arrLayoutData.Add(LayoutData); } } if(bMinTrackSize) { RECT rcMinTrack = {}; if((pT->GetStyle() & WS_CHILD) != 0) pT->GetClientRect(&rcMinTrack); else pT->GetWindowRect(&rcMinTrack); m_ptMinTrackSize.x = rcMinTrack.right - rcMinTrack.left; m_ptMinTrackSize.y = rcMinTrack.bottom - rcMinTrack.top; } } void UpdateDynamicLayout() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); int nCount = m_arrLayoutData.GetSize(); if(nCount == 0) return; RECT rcParent = {}; pT->GetWindowRect(&rcParent); int nDeltaWidth = rcParent.right - rcParent.left - m_szParentInit.cx; int nDeltaHeight = rcParent.bottom - rcParent.top - m_szParentInit.cy; HDWP hDwp = ::BeginDeferWindowPos(nCount); for(int i = 0; i < nCount; i++) { _AtlDynamicLayoutData& LayoutData = m_arrLayoutData[i]; ATLASSERT(::IsWindow(LayoutData.m_hWnd) != FALSE); int nID = ::GetDlgCtrlID(LayoutData.m_hWnd); UINT nFlags = (SWP_NOMOVE | SWP_NOSIZE); RECT rcItem = LayoutData.m_rcInit; if(((nID == ATL_IDW_STATUS_BAR) || (nDeltaWidth >= 0)) && (LayoutData.m_nMoveRatioX != 0)) { rcItem.left += ::MulDiv(nDeltaWidth, LayoutData.m_nMoveRatioX, 100); rcItem.right += ::MulDiv(nDeltaWidth, LayoutData.m_nMoveRatioX, 100); nFlags &= ~SWP_NOMOVE; } if(((nID == ATL_IDW_STATUS_BAR) || (nDeltaHeight >= 0)) && (LayoutData.m_nMoveRatioY != 0)) { rcItem.top += ::MulDiv(nDeltaHeight, LayoutData.m_nMoveRatioY, 100); rcItem.bottom += ::MulDiv(nDeltaHeight, LayoutData.m_nMoveRatioY, 100); nFlags &= ~SWP_NOMOVE; } if((nDeltaWidth >= 0) && (LayoutData.m_nSizeRatioX != 0)) { rcItem.right += ::MulDiv(nDeltaWidth, LayoutData.m_nSizeRatioX, 100); nFlags &= ~SWP_NOSIZE; } if((nDeltaHeight >= 0) && (LayoutData.m_nSizeRatioY != 0)) { rcItem.bottom += ::MulDiv(nDeltaHeight, LayoutData.m_nSizeRatioY, 100); nFlags &= ~SWP_NOSIZE; } if(nFlags != (SWP_NOMOVE | SWP_NOSIZE)) ::DeferWindowPos(hDwp, LayoutData.m_hWnd, NULL, rcItem.left, rcItem.top, rcItem.right - rcItem.left, rcItem.bottom - rcItem.top, nFlags | SWP_NOZORDER | SWP_NOREPOSITION | SWP_NOACTIVATE | SWP_NOCOPYBITS); } ::EndDeferWindowPos(hDwp); } // Message map and handlers BEGIN_MSG_MAP(CDynamicDialogLayout) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo) END_MSG_MAP() LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); if(m_bGripper) { ATL::CWindow wndGripper = pT->GetDlgItem(ATL_IDW_STATUS_BAR); if(wndGripper.m_hWnd != NULL) { if(wParam == SIZE_MAXIMIZED) wndGripper.ShowWindow(SW_HIDE); else if(wParam == SIZE_RESTORED) wndGripper.ShowWindow(SW_SHOW); } } if(wParam != SIZE_MINIMIZED) pT->UpdateDynamicLayout(); return 0; } LRESULT OnGetMinMaxInfo(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { if((m_ptMinTrackSize.x != -1) && (m_ptMinTrackSize.y != -1)) { LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam; lpMMI->ptMinTrackSize = m_ptMinTrackSize; } return 0; } // Implementation char _GetDataPct(WORD wResData) { ATLASSERT((wResData >= 0) && (wResData <= 100)); char nPct = (char)LOBYTE(wResData); if((nPct < 0) || (nPct > 100)) nPct = -1; return nPct; } }; #endif // (_MSC_VER >= 1900) /////////////////////////////////////////////////////////////////////////////// // CDoubleBufferImpl - Provides double-buffer painting support to any window template class CDoubleBufferImpl { public: // Overrideables void DoPaint(CDCHandle /*dc*/) { // must be implemented in a derived class ATLASSERT(FALSE); } // Message map and handlers BEGIN_MSG_MAP(CDoubleBufferImpl) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) END_MSG_MAP() LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return 1; // no background painting needed } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); if(wParam != NULL) { RECT rect = {}; pT->GetClientRect(&rect); CMemoryDC dcMem((HDC)wParam, rect); pT->DoPaint(dcMem.m_hDC); } else { CPaintDC dc(pT->m_hWnd); CMemoryDC dcMem(dc.m_hDC, dc.m_ps.rcPaint); pT->DoPaint(dcMem.m_hDC); } return 0; } }; /////////////////////////////////////////////////////////////////////////////// // CDoubleBufferWindowImpl - Implements a double-buffer painting window template class ATL_NO_VTABLE CDoubleBufferWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CDoubleBufferImpl< T > { public: BEGIN_MSG_MAP(CDoubleBufferWindowImpl) CHAIN_MSG_MAP(CDoubleBufferImpl< T >) END_MSG_MAP() }; // command bar support #if !defined(__ATLCTRLW_H__) #undef CBRM_GETMENU #undef CBRM_TRACKPOPUPMENU #undef CBRM_GETCMDBAR #undef CBRPOPUPMENU #endif // !defined(__ATLCTRLW_H__) } // namespace WTL #endif // __ATLFRAME_H__ ================================================ FILE: third_party/WTL/Include/atlgdi.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLGDI_H__ #define __ATLGDI_H__ #pragma once #ifndef __ATLAPP_H__ #error atlgdi.h requires atlapp.h to be included first #endif // protect template members from windowsx.h macros #ifdef _INC_WINDOWSX #undef CopyRgn #undef CreateBrush #undef CreatePen #undef SelectBrush #undef SelectPen #undef SelectFont #undef SelectBitmap #endif // _INC_WINDOWSX // required libraries #pragma comment(lib, "msimg32.lib") #if !defined(_ATL_NO_OPENGL) #pragma comment(lib, "opengl32.lib") #endif /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CPenT // CBrushT // CLogFont // CFontT // CBitmapT // CPaletteT // CRgnT // CDCT // CPaintDC // CClientDC // CWindowDC // CMemoryDC // CEnhMetaFileInfo // CEnhMetaFileT // CEnhMetaFileDC namespace WTL { /////////////////////////////////////////////////////////////////////////////// // Bitmap resource helpers to extract bitmap information for a bitmap resource inline LPBITMAPINFOHEADER AtlGetBitmapResourceInfo(HMODULE hModule, ATL::_U_STRINGorID image) { HRSRC hResource = ::FindResource(hModule, image.m_lpstr, RT_BITMAP); ATLASSERT(hResource != NULL); HGLOBAL hGlobal = ::LoadResource(hModule, hResource); ATLASSERT(hGlobal != NULL); LPBITMAPINFOHEADER pBitmapInfoHeader = (LPBITMAPINFOHEADER)::LockResource(hGlobal); ATLASSERT(pBitmapInfoHeader != NULL); return pBitmapInfoHeader; } inline WORD AtlGetBitmapResourceBitsPerPixel(HMODULE hModule, ATL::_U_STRINGorID image) { LPBITMAPINFOHEADER pBitmapInfoHeader = AtlGetBitmapResourceInfo(hModule, image); ATLASSERT(pBitmapInfoHeader != NULL); return pBitmapInfoHeader->biBitCount; } inline WORD AtlGetBitmapResourceBitsPerPixel(ATL::_U_STRINGorID image) { return AtlGetBitmapResourceBitsPerPixel(ModuleHelper::GetResourceInstance(), image); } /////////////////////////////////////////////////////////////////////////////// // 32-bit (alpha channel) bitmap resource helper // Note: 32-bit (alpha channel) images work only on Windows XP with Common Controls version 6. // If you want your app to work on older version of Windows, load non-alpha images if Common // Controls version is less than 6. inline bool AtlIsAlphaBitmapResource(ATL::_U_STRINGorID image) { return (AtlGetBitmapResourceBitsPerPixel(image) == 32); } /////////////////////////////////////////////////////////////////////////////// // CPen template class CPenT { public: // Data members HPEN m_hPen; // Constructor/destructor/operators CPenT(HPEN hPen = NULL) : m_hPen(hPen) { } ~CPenT() { if(t_bManaged && (m_hPen != NULL)) DeleteObject(); } CPenT& operator =(HPEN hPen) { Attach(hPen); return *this; } void Attach(HPEN hPen) { if(t_bManaged && (m_hPen != NULL) && (m_hPen != hPen)) ::DeleteObject(m_hPen); m_hPen = hPen; } HPEN Detach() { HPEN hPen = m_hPen; m_hPen = NULL; return hPen; } operator HPEN() const { return m_hPen; } bool IsNull() const { return (m_hPen == NULL); } // Create methods HPEN CreatePen(int nPenStyle, int nWidth, COLORREF crColor) { ATLASSERT(m_hPen == NULL); m_hPen = ::CreatePen(nPenStyle, nWidth, crColor); return m_hPen; } HPEN CreatePen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL) { ATLASSERT(m_hPen == NULL); m_hPen = ::ExtCreatePen(nPenStyle, nWidth, pLogBrush, nStyleCount, lpStyle); return m_hPen; } HPEN CreatePenIndirect(LPLOGPEN lpLogPen) { ATLASSERT(m_hPen == NULL); m_hPen = ::CreatePenIndirect(lpLogPen); return m_hPen; } BOOL DeleteObject() { ATLASSERT(m_hPen != NULL); BOOL bRet = ::DeleteObject(m_hPen); if(bRet) m_hPen = NULL; return bRet; } // Attributes int GetLogPen(LOGPEN* pLogPen) const { ATLASSERT(m_hPen != NULL); return ::GetObject(m_hPen, sizeof(LOGPEN), pLogPen); } bool GetLogPen(LOGPEN& LogPen) const { ATLASSERT(m_hPen != NULL); return (::GetObject(m_hPen, sizeof(LOGPEN), &LogPen) == sizeof(LOGPEN)); } int GetExtLogPen(EXTLOGPEN* pLogPen, int nSize = sizeof(EXTLOGPEN)) const { ATLASSERT(m_hPen != NULL); return ::GetObject(m_hPen, nSize, pLogPen); } bool GetExtLogPen(EXTLOGPEN& ExtLogPen, int nSize = sizeof(EXTLOGPEN)) const { ATLASSERT(m_hPen != NULL); int nRet = ::GetObject(m_hPen, nSize, &ExtLogPen); return ((nRet > 0) && (nRet <= nSize)); } }; typedef CPenT CPenHandle; typedef CPenT CPen; /////////////////////////////////////////////////////////////////////////////// // CBrush template class CBrushT { public: // Data members HBRUSH m_hBrush; // Constructor/destructor/operators CBrushT(HBRUSH hBrush = NULL) : m_hBrush(hBrush) { } ~CBrushT() { if(t_bManaged && (m_hBrush != NULL)) DeleteObject(); } CBrushT& operator =(HBRUSH hBrush) { Attach(hBrush); return *this; } void Attach(HBRUSH hBrush) { if(t_bManaged && (m_hBrush != NULL) && (m_hBrush != hBrush)) ::DeleteObject(m_hBrush); m_hBrush = hBrush; } HBRUSH Detach() { HBRUSH hBrush = m_hBrush; m_hBrush = NULL; return hBrush; } operator HBRUSH() const { return m_hBrush; } bool IsNull() const { return (m_hBrush == NULL); } // Create methods HBRUSH CreateSolidBrush(COLORREF crColor) { ATLASSERT(m_hBrush == NULL); m_hBrush = ::CreateSolidBrush(crColor); return m_hBrush; } HBRUSH CreateHatchBrush(int nIndex, COLORREF crColor) { ATLASSERT(m_hBrush == NULL); m_hBrush = ::CreateHatchBrush(nIndex, crColor); return m_hBrush; } HBRUSH CreateBrushIndirect(const LOGBRUSH* lpLogBrush) { ATLASSERT(m_hBrush == NULL); m_hBrush = ::CreateBrushIndirect(lpLogBrush); return m_hBrush; } HBRUSH CreatePatternBrush(HBITMAP hBitmap) { ATLASSERT(m_hBrush == NULL); m_hBrush = ::CreatePatternBrush(hBitmap); return m_hBrush; } HBRUSH CreateDIBPatternBrush(HGLOBAL hPackedDIB, UINT nUsage) { ATLASSERT(hPackedDIB != NULL); const void* lpPackedDIB = GlobalLock(hPackedDIB); ATLASSERT(lpPackedDIB != NULL); m_hBrush = ::CreateDIBPatternBrushPt(lpPackedDIB, nUsage); GlobalUnlock(hPackedDIB); return m_hBrush; } HBRUSH CreateDIBPatternBrush(const void* lpPackedDIB, UINT nUsage) { ATLASSERT(m_hBrush == NULL); m_hBrush = ::CreateDIBPatternBrushPt(lpPackedDIB, nUsage); return m_hBrush; } HBRUSH CreateSysColorBrush(int nIndex) { ATLASSERT(m_hBrush == NULL); m_hBrush = ::GetSysColorBrush(nIndex); return m_hBrush; } BOOL DeleteObject() { ATLASSERT(m_hBrush != NULL); BOOL bRet = ::DeleteObject(m_hBrush); if(bRet) m_hBrush = NULL; return bRet; } // Attributes int GetLogBrush(LOGBRUSH* pLogBrush) const { ATLASSERT(m_hBrush != NULL); return ::GetObject(m_hBrush, sizeof(LOGBRUSH), pLogBrush); } bool GetLogBrush(LOGBRUSH& LogBrush) const { ATLASSERT(m_hBrush != NULL); return (::GetObject(m_hBrush, sizeof(LOGBRUSH), &LogBrush) == sizeof(LOGBRUSH)); } }; typedef CBrushT CBrushHandle; typedef CBrushT CBrush; /////////////////////////////////////////////////////////////////////////////// // CFont class CLogFont : public LOGFONT { public: CLogFont() { memset(this, 0, sizeof(LOGFONT)); } CLogFont(const LOGFONT& lf) { Copy(&lf); } CLogFont(HFONT hFont) { ATLASSERT(::GetObjectType(hFont) == OBJ_FONT); ::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*)this); } HFONT CreateFontIndirect() { return ::CreateFontIndirect(this); } void SetBold() { lfWeight = FW_BOLD; } bool IsBold() const { return (lfWeight >= FW_BOLD); } void MakeBolder(int iScale = 1) { lfWeight += FW_BOLD * iScale; } void MakeLarger(int iScale) { if(lfHeight > 0) lfHeight += iScale; else lfHeight -= iScale; } void SetHeight(LONG nPointSize, HDC hDC = NULL) { HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); // For MM_TEXT mapping mode lfHeight = -::MulDiv(nPointSize, ::GetDeviceCaps(hDC1, LOGPIXELSY), 72); if(hDC == NULL) ::ReleaseDC(NULL, hDC1); } LONG GetHeight(HDC hDC = NULL) const { HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); // For MM_TEXT mapping mode LONG nPointSize = ::MulDiv(-lfHeight, 72, ::GetDeviceCaps(hDC1, LOGPIXELSY)); if(hDC == NULL) ::ReleaseDC(NULL, hDC1); return nPointSize; } LONG GetDeciPointHeight(HDC hDC = NULL) const { HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); POINT ptOrg = { 0, 0 }; ::DPtoLP(hDC1, &ptOrg, 1); POINT pt = { 0, 0 }; pt.y = abs(lfHeight) + ptOrg.y; ::LPtoDP(hDC1, &pt, 1); LONG nDeciPoint = ::MulDiv(pt.y, 720, ::GetDeviceCaps(hDC1, LOGPIXELSY)); // 72 points/inch, 10 decipoints/point if(hDC == NULL) ::ReleaseDC(NULL, hDC1); return nDeciPoint; } void SetHeightFromDeciPoint(LONG nDeciPtHeight, HDC hDC = NULL) { HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); POINT pt = { 0, 0 }; pt.y = ::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), nDeciPtHeight, 720); // 72 points/inch, 10 decipoints/point ::DPtoLP(hDC1, &pt, 1); POINT ptOrg = { 0, 0 }; ::DPtoLP(hDC1, &ptOrg, 1); lfHeight = -abs(pt.y - ptOrg.y); if(hDC == NULL) ::ReleaseDC(NULL, hDC1); } void SetCaptionFont() { NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); Copy(&ncm.lfCaptionFont); } void SetMenuFont() { NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); Copy(&ncm.lfMenuFont); } void SetStatusFont() { NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); Copy(&ncm.lfStatusFont); } void SetMessageBoxFont() { NONCLIENTMETRICS ncm = { RunTimeHelper::SizeOf_NONCLIENTMETRICS() }; ATLVERIFY(::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)); Copy(&ncm.lfMessageFont); } void Copy(const LOGFONT* pLogFont) { ATLASSERT(pLogFont != NULL); *(LOGFONT*)this = *pLogFont; } CLogFont& operator =(const CLogFont& src) { Copy(&src); return *this; } CLogFont& operator =(const LOGFONT& src) { Copy(&src); return *this; } CLogFont& operator =(HFONT hFont) { ATLASSERT(::GetObjectType(hFont) == OBJ_FONT); ::GetObject(hFont, sizeof(LOGFONT), (LOGFONT*)this); return *this; } bool operator ==(const LOGFONT& logfont) const { return((logfont.lfHeight == lfHeight) && (logfont.lfWidth == lfWidth) && (logfont.lfEscapement == lfEscapement) && (logfont.lfOrientation == lfOrientation) && (logfont.lfWeight == lfWeight) && (logfont.lfItalic == lfItalic) && (logfont.lfUnderline == lfUnderline) && (logfont.lfStrikeOut == lfStrikeOut) && (logfont.lfCharSet == lfCharSet) && (logfont.lfOutPrecision == lfOutPrecision) && (logfont.lfClipPrecision == lfClipPrecision) && (logfont.lfQuality == lfQuality) && (logfont.lfPitchAndFamily == lfPitchAndFamily) && (lstrcmp(logfont.lfFaceName, lfFaceName) == 0)); } }; template class CFontT { public: // Data members HFONT m_hFont; // Constructor/destructor/operators CFontT(HFONT hFont = NULL) : m_hFont(hFont) { } ~CFontT() { if(t_bManaged && (m_hFont != NULL)) DeleteObject(); } CFontT& operator =(HFONT hFont) { Attach(hFont); return *this; } void Attach(HFONT hFont) { if(t_bManaged && (m_hFont != NULL) && (m_hFont != hFont)) ::DeleteObject(m_hFont); m_hFont = hFont; } HFONT Detach() { HFONT hFont = m_hFont; m_hFont = NULL; return hFont; } operator HFONT() const { return m_hFont; } bool IsNull() const { return (m_hFont == NULL); } // Create methods HFONT CreateFontIndirect(const LOGFONT* lpLogFont) { ATLASSERT(m_hFont == NULL); m_hFont = ::CreateFontIndirect(lpLogFont); return m_hFont; } HFONT CreateFontIndirectEx(CONST ENUMLOGFONTEXDV* penumlfex) { ATLASSERT(m_hFont == NULL); m_hFont = ::CreateFontIndirectEx(penumlfex); return m_hFont; } HFONT CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, LPCTSTR lpszFacename) { ATLASSERT(m_hFont == NULL); m_hFont = ::CreateFont(nHeight, nWidth, nEscapement, nOrientation, nWeight, bItalic, bUnderline, cStrikeOut, nCharSet, nOutPrecision, nClipPrecision, nQuality, nPitchAndFamily, lpszFacename); return m_hFont; } HFONT CreatePointFont(int nPointSize, LPCTSTR lpszFaceName, HDC hDC = NULL, bool bBold = false, bool bItalic = false) { LOGFONT logFont = {}; logFont.lfCharSet = DEFAULT_CHARSET; logFont.lfHeight = nPointSize; ATL::Checked::tcsncpy_s(logFont.lfFaceName, _countof(logFont.lfFaceName), lpszFaceName, _TRUNCATE); if(bBold) logFont.lfWeight = FW_BOLD; if(bItalic) logFont.lfItalic = (BYTE)TRUE; return CreatePointFontIndirect(&logFont, hDC); } HFONT CreatePointFontIndirect(const LOGFONT* lpLogFont, HDC hDC = NULL) { HDC hDC1 = (hDC != NULL) ? hDC : ::GetDC(NULL); // convert nPointSize to logical units based on hDC LOGFONT logFont = *lpLogFont; POINT pt = { 0, 0 }; pt.y = ::MulDiv(::GetDeviceCaps(hDC1, LOGPIXELSY), logFont.lfHeight, 720); // 72 points/inch, 10 decipoints/point ::DPtoLP(hDC1, &pt, 1); POINT ptOrg = { 0, 0 }; ::DPtoLP(hDC1, &ptOrg, 1); logFont.lfHeight = -abs(pt.y - ptOrg.y); if(hDC == NULL) ::ReleaseDC(NULL, hDC1); return CreateFontIndirect(&logFont); } BOOL DeleteObject() { ATLASSERT(m_hFont != NULL); BOOL bRet = ::DeleteObject(m_hFont); if(bRet) m_hFont = NULL; return bRet; } // Attributes int GetLogFont(LOGFONT* pLogFont) const { ATLASSERT(m_hFont != NULL); return ::GetObject(m_hFont, sizeof(LOGFONT), pLogFont); } bool GetLogFont(LOGFONT& LogFont) const { ATLASSERT(m_hFont != NULL); return (::GetObject(m_hFont, sizeof(LOGFONT), &LogFont) == sizeof(LOGFONT)); } }; typedef CFontT CFontHandle; typedef CFontT CFont; /////////////////////////////////////////////////////////////////////////////// // CBitmap template class CBitmapT { public: // Data members HBITMAP m_hBitmap; // Constructor/destructor/operators CBitmapT(HBITMAP hBitmap = NULL) : m_hBitmap(hBitmap) { } ~CBitmapT() { if(t_bManaged && (m_hBitmap != NULL)) DeleteObject(); } CBitmapT& operator =(HBITMAP hBitmap) { Attach(hBitmap); return *this; } void Attach(HBITMAP hBitmap) { if(t_bManaged && (m_hBitmap != NULL) && (m_hBitmap != hBitmap)) ::DeleteObject(m_hBitmap); m_hBitmap = hBitmap; } HBITMAP Detach() { HBITMAP hBitmap = m_hBitmap; m_hBitmap = NULL; return hBitmap; } operator HBITMAP() const { return m_hBitmap; } bool IsNull() const { return (m_hBitmap == NULL); } // Create and load methods HBITMAP LoadBitmap(ATL::_U_STRINGorID bitmap) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr); return m_hBitmap; } HBITMAP LoadOEMBitmap(UINT nIDBitmap) // for OBM_/OCR_/OIC_ { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::LoadBitmap(NULL, MAKEINTRESOURCE(nIDBitmap)); return m_hBitmap; } HBITMAP LoadMappedBitmap(UINT nIDBitmap, UINT nFlags = 0, LPCOLORMAP lpColorMap = NULL, int nMapSize = 0) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateMappedBitmap(ModuleHelper::GetResourceInstance(), nIDBitmap, (WORD)nFlags, lpColorMap, nMapSize); return m_hBitmap; } HBITMAP CreateBitmap(int nWidth, int nHeight, UINT nPlanes, UINT nBitsPerPixel, const void* lpBits) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateBitmap(nWidth, nHeight, nPlanes, nBitsPerPixel, lpBits); return m_hBitmap; } HBITMAP CreateBitmapIndirect(LPBITMAP lpBitmap) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateBitmapIndirect(lpBitmap); return m_hBitmap; } HBITMAP CreateCompatibleBitmap(HDC hDC, int nWidth, int nHeight) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateCompatibleBitmap(hDC, nWidth, nHeight); return m_hBitmap; } HBITMAP CreateDiscardableBitmap(HDC hDC, int nWidth, int nHeight) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateDiscardableBitmap(hDC, nWidth, nHeight); return m_hBitmap; } BOOL DeleteObject() { ATLASSERT(m_hBitmap != NULL); BOOL bRet = ::DeleteObject(m_hBitmap); if(bRet) m_hBitmap = NULL; return bRet; } // Attributes int GetBitmap(BITMAP* pBitMap) const { ATLASSERT(m_hBitmap != NULL); return ::GetObject(m_hBitmap, sizeof(BITMAP), pBitMap); } bool GetBitmap(BITMAP& bm) const { ATLASSERT(m_hBitmap != NULL); return (::GetObject(m_hBitmap, sizeof(BITMAP), &bm) == sizeof(BITMAP)); } bool GetSize(SIZE& size) const { ATLASSERT(m_hBitmap != NULL); BITMAP bm = {}; if(!GetBitmap(&bm)) return false; size.cx = bm.bmWidth; size.cy = bm.bmHeight; return true; } DWORD GetBitmapBits(DWORD dwCount, LPVOID lpBits) const { ATLASSERT(m_hBitmap != NULL); return ::GetBitmapBits(m_hBitmap, dwCount, lpBits); } DWORD SetBitmapBits(DWORD dwCount, const void* lpBits) { ATLASSERT(m_hBitmap != NULL); return ::SetBitmapBits(m_hBitmap, dwCount, lpBits); } BOOL GetBitmapDimension(LPSIZE lpSize) const { ATLASSERT(m_hBitmap != NULL); return ::GetBitmapDimensionEx(m_hBitmap, lpSize); } BOOL SetBitmapDimension(int nWidth, int nHeight, LPSIZE lpSize = NULL) { ATLASSERT(m_hBitmap != NULL); return ::SetBitmapDimensionEx(m_hBitmap, nWidth, nHeight, lpSize); } // DIB support HBITMAP CreateDIBitmap(HDC hDC, CONST BITMAPINFOHEADER* lpbmih, DWORD dwInit, CONST VOID* lpbInit, CONST BITMAPINFO* lpbmi, UINT uColorUse) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateDIBitmap(hDC, lpbmih, dwInit, lpbInit, lpbmi, uColorUse); return m_hBitmap; } HBITMAP CreateDIBSection(HDC hDC, CONST BITMAPINFO* lpbmi, UINT uColorUse, VOID** ppvBits, HANDLE hSection, DWORD dwOffset) { ATLASSERT(m_hBitmap == NULL); m_hBitmap = ::CreateDIBSection(hDC, lpbmi, uColorUse, ppvBits, hSection, dwOffset); return m_hBitmap; } int GetDIBits(HDC hDC, UINT uStartScan, UINT cScanLines, LPVOID lpvBits, LPBITMAPINFO lpbmi, UINT uColorUse) const { ATLASSERT(m_hBitmap != NULL); return ::GetDIBits(hDC, m_hBitmap, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); } int SetDIBits(HDC hDC, UINT uStartScan, UINT cScanLines, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse) { ATLASSERT(m_hBitmap != NULL); return ::SetDIBits(hDC, m_hBitmap, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); } }; typedef CBitmapT CBitmapHandle; typedef CBitmapT CBitmap; /////////////////////////////////////////////////////////////////////////////// // CPalette template class CPaletteT { public: // Data members HPALETTE m_hPalette; // Constructor/destructor/operators CPaletteT(HPALETTE hPalette = NULL) : m_hPalette(hPalette) { } ~CPaletteT() { if(t_bManaged && (m_hPalette != NULL)) DeleteObject(); } CPaletteT& operator =(HPALETTE hPalette) { Attach(hPalette); return *this; } void Attach(HPALETTE hPalette) { if(t_bManaged && (m_hPalette != NULL) && (m_hPalette != hPalette)) ::DeleteObject(m_hPalette); m_hPalette = hPalette; } HPALETTE Detach() { HPALETTE hPalette = m_hPalette; m_hPalette = NULL; return hPalette; } operator HPALETTE() const { return m_hPalette; } bool IsNull() const { return (m_hPalette == NULL); } // Create methods HPALETTE CreatePalette(LPLOGPALETTE lpLogPalette) { ATLASSERT(m_hPalette == NULL); m_hPalette = ::CreatePalette(lpLogPalette); return m_hPalette; } HPALETTE CreateHalftonePalette(HDC hDC) { ATLASSERT(m_hPalette == NULL); ATLASSERT(hDC != NULL); m_hPalette = ::CreateHalftonePalette(hDC); return m_hPalette; } BOOL DeleteObject() { ATLASSERT(m_hPalette != NULL); BOOL bRet = ::DeleteObject(m_hPalette); if(bRet) m_hPalette = NULL; return bRet; } // Attributes int GetEntryCount() const { ATLASSERT(m_hPalette != NULL); WORD nEntries = 0; ::GetObject(m_hPalette, sizeof(WORD), &nEntries); return (int)nEntries; } UINT GetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) const { ATLASSERT(m_hPalette != NULL); return ::GetPaletteEntries(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); } UINT SetPaletteEntries(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) { ATLASSERT(m_hPalette != NULL); return ::SetPaletteEntries(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); } // Operations void AnimatePalette(UINT nStartIndex, UINT nNumEntries, LPPALETTEENTRY lpPaletteColors) { ATLASSERT(m_hPalette != NULL); ::AnimatePalette(m_hPalette, nStartIndex, nNumEntries, lpPaletteColors); } BOOL ResizePalette(UINT nNumEntries) { ATLASSERT(m_hPalette != NULL); return ::ResizePalette(m_hPalette, nNumEntries); } UINT GetNearestPaletteIndex(COLORREF crColor) const { ATLASSERT(m_hPalette != NULL); return ::GetNearestPaletteIndex(m_hPalette, crColor); } }; typedef CPaletteT CPaletteHandle; typedef CPaletteT CPalette; /////////////////////////////////////////////////////////////////////////////// // CRgn template class CRgnT { public: // Data members HRGN m_hRgn; // Constructor/destructor/operators CRgnT(HRGN hRgn = NULL) : m_hRgn(hRgn) { } ~CRgnT() { if(t_bManaged && (m_hRgn != NULL)) DeleteObject(); } CRgnT& operator =(HRGN hRgn) { Attach(hRgn); return *this; } void Attach(HRGN hRgn) { if(t_bManaged && (m_hRgn != NULL) && (m_hRgn != hRgn)) ::DeleteObject(m_hRgn); m_hRgn = hRgn; } HRGN Detach() { HRGN hRgn = m_hRgn; m_hRgn = NULL; return hRgn; } operator HRGN() const { return m_hRgn; } bool IsNull() const { return (m_hRgn == NULL); } // Create methods HRGN CreateRectRgn(int x1, int y1, int x2, int y2) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::CreateRectRgn(x1, y1, x2, y2); return m_hRgn; } HRGN CreateRectRgnIndirect(LPCRECT lpRect) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::CreateRectRgnIndirect(lpRect); return m_hRgn; } HRGN CreateEllipticRgn(int x1, int y1, int x2, int y2) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::CreateEllipticRgn(x1, y1, x2, y2); return m_hRgn; } HRGN CreateEllipticRgnIndirect(LPCRECT lpRect) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::CreateEllipticRgnIndirect(lpRect); return m_hRgn; } HRGN CreatePolygonRgn(const POINT* lpPoints, int nCount, int nMode) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::CreatePolygonRgn(lpPoints, nCount, nMode); return m_hRgn; } HRGN CreatePolyPolygonRgn(const POINT* lpPoints, const INT* lpPolyCounts, int nCount, int nPolyFillMode) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::CreatePolyPolygonRgn(lpPoints, lpPolyCounts, nCount, nPolyFillMode); return m_hRgn; } HRGN CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::CreateRoundRectRgn(x1, y1, x2, y2, x3, y3); return m_hRgn; } HRGN CreateFromPath(HDC hDC) { ATLASSERT(m_hRgn == NULL); ATLASSERT(hDC != NULL); m_hRgn = ::PathToRegion(hDC); return m_hRgn; } HRGN CreateFromData(const XFORM* lpXForm, int nCount, const RGNDATA* pRgnData) { ATLASSERT(m_hRgn == NULL); m_hRgn = ::ExtCreateRegion(lpXForm, nCount, pRgnData); return m_hRgn; } BOOL DeleteObject() { ATLASSERT(m_hRgn != NULL); BOOL bRet = ::DeleteObject(m_hRgn); if(bRet) m_hRgn = NULL; return bRet; } // Operations void SetRectRgn(int x1, int y1, int x2, int y2) { ATLASSERT(m_hRgn != NULL); ::SetRectRgn(m_hRgn, x1, y1, x2, y2); } void SetRectRgn(LPCRECT lpRect) { ATLASSERT(m_hRgn != NULL); ::SetRectRgn(m_hRgn, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } int CombineRgn(HRGN hRgnSrc1, HRGN hRgnSrc2, int nCombineMode) { ATLASSERT(m_hRgn != NULL); return ::CombineRgn(m_hRgn, hRgnSrc1, hRgnSrc2, nCombineMode); } int CombineRgn(HRGN hRgnSrc, int nCombineMode) { ATLASSERT(m_hRgn != NULL); return ::CombineRgn(m_hRgn, m_hRgn, hRgnSrc, nCombineMode); } int CopyRgn(HRGN hRgnSrc) { ATLASSERT(m_hRgn != NULL); return ::CombineRgn(m_hRgn, hRgnSrc, NULL, RGN_COPY); } BOOL EqualRgn(HRGN hRgn) const { ATLASSERT(m_hRgn != NULL); return ::EqualRgn(m_hRgn, hRgn); } int OffsetRgn(int x, int y) { ATLASSERT(m_hRgn != NULL); return ::OffsetRgn(m_hRgn, x, y); } int OffsetRgn(POINT point) { ATLASSERT(m_hRgn != NULL); return ::OffsetRgn(m_hRgn, point.x, point.y); } int GetRgnBox(LPRECT lpRect) const { ATLASSERT(m_hRgn != NULL); return ::GetRgnBox(m_hRgn, lpRect); } BOOL PtInRegion(int x, int y) const { ATLASSERT(m_hRgn != NULL); return ::PtInRegion(m_hRgn, x, y); } BOOL PtInRegion(POINT point) const { ATLASSERT(m_hRgn != NULL); return ::PtInRegion(m_hRgn, point.x, point.y); } BOOL RectInRegion(LPCRECT lpRect) const { ATLASSERT(m_hRgn != NULL); return ::RectInRegion(m_hRgn, lpRect); } int GetRegionData(LPRGNDATA lpRgnData, int nDataSize) const { ATLASSERT(m_hRgn != NULL); return (int)::GetRegionData(m_hRgn, nDataSize, lpRgnData); } }; typedef CRgnT CRgnHandle; typedef CRgnT CRgn; /////////////////////////////////////////////////////////////////////////////// // CDC - The device context class template class CDCT; typedef CDCT CDCHandle; typedef CDCT CDC; template class CDCT { public: // Data members HDC m_hDC; // Constructor/destructor/operators CDCT(HDC hDC = NULL) : m_hDC(hDC) { } ~CDCT() { if(t_bManaged && (m_hDC != NULL)) ::DeleteDC(Detach()); } CDCT& operator =(HDC hDC) { Attach(hDC); return *this; } void Attach(HDC hDC) { if(t_bManaged && (m_hDC != NULL) && (m_hDC != hDC)) ::DeleteDC(m_hDC); m_hDC = hDC; } HDC Detach() { HDC hDC = m_hDC; m_hDC = NULL; return hDC; } operator HDC() const { return m_hDC; } bool IsNull() const { return (m_hDC == NULL); } // Operations HWND WindowFromDC() const { ATLASSERT(m_hDC != NULL); return ::WindowFromDC(m_hDC); } CPenHandle GetCurrentPen() const { ATLASSERT(m_hDC != NULL); return CPenHandle((HPEN)::GetCurrentObject(m_hDC, OBJ_PEN)); } CBrushHandle GetCurrentBrush() const { ATLASSERT(m_hDC != NULL); return CBrushHandle((HBRUSH)::GetCurrentObject(m_hDC, OBJ_BRUSH)); } CPaletteHandle GetCurrentPalette() const { ATLASSERT(m_hDC != NULL); return CPaletteHandle((HPALETTE)::GetCurrentObject(m_hDC, OBJ_PAL)); } CFontHandle GetCurrentFont() const { ATLASSERT(m_hDC != NULL); return CFontHandle((HFONT)::GetCurrentObject(m_hDC, OBJ_FONT)); } CBitmapHandle GetCurrentBitmap() const { ATLASSERT(m_hDC != NULL); return CBitmapHandle((HBITMAP)::GetCurrentObject(m_hDC, OBJ_BITMAP)); } HDC CreateDC(LPCTSTR lpszDriverName, LPCTSTR lpszDeviceName, LPCTSTR lpszOutput, const DEVMODE* lpInitData) { ATLASSERT(m_hDC == NULL); m_hDC = ::CreateDC(lpszDriverName, lpszDeviceName, lpszOutput, lpInitData); return m_hDC; } HDC CreateCompatibleDC(HDC hDC = NULL) { ATLASSERT(m_hDC == NULL); m_hDC = ::CreateCompatibleDC(hDC); return m_hDC; } BOOL DeleteDC() { if(m_hDC == NULL) return FALSE; BOOL bRet = ::DeleteDC(m_hDC); if(bRet) m_hDC = NULL; return bRet; } // Device-Context Functions int SaveDC() { ATLASSERT(m_hDC != NULL); return ::SaveDC(m_hDC); } BOOL RestoreDC(int nSavedDC) { ATLASSERT(m_hDC != NULL); return ::RestoreDC(m_hDC, nSavedDC); } int GetDeviceCaps(int nIndex) const { ATLASSERT(m_hDC != NULL); return ::GetDeviceCaps(m_hDC, nIndex); } UINT SetBoundsRect(LPCRECT lpRectBounds, UINT flags) { ATLASSERT(m_hDC != NULL); return ::SetBoundsRect(m_hDC, lpRectBounds, flags); } UINT GetBoundsRect(LPRECT lpRectBounds, UINT flags) const { ATLASSERT(m_hDC != NULL); return ::GetBoundsRect(m_hDC, lpRectBounds, flags); } BOOL ResetDC(const DEVMODE* lpDevMode) { ATLASSERT(m_hDC != NULL); return ::ResetDC(m_hDC, lpDevMode) != NULL; } // Drawing-Tool Functions BOOL GetBrushOrg(LPPOINT lpPoint) const { ATLASSERT(m_hDC != NULL); return ::GetBrushOrgEx(m_hDC, lpPoint); } BOOL SetBrushOrg(int x, int y, LPPOINT lpPoint = NULL) { ATLASSERT(m_hDC != NULL); return ::SetBrushOrgEx(m_hDC, x, y, lpPoint); } BOOL SetBrushOrg(POINT point, LPPOINT lpPointRet = NULL) { ATLASSERT(m_hDC != NULL); return ::SetBrushOrgEx(m_hDC, point.x, point.y, lpPointRet); } int EnumObjects(int nObjectType, int (CALLBACK* lpfn)(LPVOID, LPARAM), LPARAM lpData) { ATLASSERT(m_hDC != NULL); #ifdef STRICT return ::EnumObjects(m_hDC, nObjectType, (GOBJENUMPROC)lpfn, lpData); #else return ::EnumObjects(m_hDC, nObjectType, (GOBJENUMPROC)lpfn, (LPVOID)lpData); #endif } // Type-safe selection helpers HPEN SelectPen(HPEN hPen) { ATLASSERT(m_hDC != NULL); ATLASSERT((hPen == NULL) || (::GetObjectType(hPen) == OBJ_PEN) || (::GetObjectType(hPen) == OBJ_EXTPEN)); return (HPEN)::SelectObject(m_hDC, hPen); } HBRUSH SelectBrush(HBRUSH hBrush) { ATLASSERT(m_hDC != NULL); ATLASSERT((hBrush == NULL) || (::GetObjectType(hBrush) == OBJ_BRUSH)); return (HBRUSH)::SelectObject(m_hDC, hBrush); } HFONT SelectFont(HFONT hFont) { ATLASSERT(m_hDC != NULL); ATLASSERT((hFont == NULL) || (::GetObjectType(hFont) == OBJ_FONT)); return (HFONT)::SelectObject(m_hDC, hFont); } HBITMAP SelectBitmap(HBITMAP hBitmap) { ATLASSERT(m_hDC != NULL); ATLASSERT((hBitmap == NULL) || (::GetObjectType(hBitmap) == OBJ_BITMAP)); return (HBITMAP)::SelectObject(m_hDC, hBitmap); } int SelectRgn(HRGN hRgn) // special return for regions { ATLASSERT(m_hDC != NULL); ATLASSERT((hRgn == NULL) || (::GetObjectType(hRgn) == OBJ_REGION)); return PtrToInt(::SelectObject(m_hDC, hRgn)); } // Type-safe selection helpers for stock objects HPEN SelectStockPen(int nPen) { ATLASSERT(m_hDC != NULL); ATLASSERT((nPen == WHITE_PEN) || (nPen == BLACK_PEN) || (nPen == NULL_PEN) || (nPen == DC_PEN)); return SelectPen((HPEN)::GetStockObject(nPen)); } HBRUSH SelectStockBrush(int nBrush) { ATLASSERT(((nBrush >= WHITE_BRUSH) && (nBrush <= HOLLOW_BRUSH)) || (nBrush == DC_BRUSH)); return SelectBrush((HBRUSH)::GetStockObject(nBrush)); } HFONT SelectStockFont(int nFont) { ATLASSERT(((nFont >= OEM_FIXED_FONT) && (nFont <= SYSTEM_FIXED_FONT)) || (nFont == DEFAULT_GUI_FONT)); return SelectFont((HFONT)::GetStockObject(nFont)); } HPALETTE SelectStockPalette(int nPalette, BOOL bForceBackground) { ATLASSERT(nPalette == DEFAULT_PALETTE); // the only one supported return SelectPalette((HPALETTE)::GetStockObject(nPalette), bForceBackground); } // Color and Color Palette Functions COLORREF GetNearestColor(COLORREF crColor) const { ATLASSERT(m_hDC != NULL); return ::GetNearestColor(m_hDC, crColor); } HPALETTE SelectPalette(HPALETTE hPalette, BOOL bForceBackground) { ATLASSERT(m_hDC != NULL); return ::SelectPalette(m_hDC, hPalette, bForceBackground); } UINT RealizePalette() { ATLASSERT(m_hDC != NULL); return ::RealizePalette(m_hDC); } void UpdateColors() { ATLASSERT(m_hDC != NULL); ::UpdateColors(m_hDC); } // Drawing-Attribute Functions COLORREF GetBkColor() const { ATLASSERT(m_hDC != NULL); return ::GetBkColor(m_hDC); } int GetBkMode() const { ATLASSERT(m_hDC != NULL); return ::GetBkMode(m_hDC); } int GetPolyFillMode() const { ATLASSERT(m_hDC != NULL); return ::GetPolyFillMode(m_hDC); } int GetROP2() const { ATLASSERT(m_hDC != NULL); return ::GetROP2(m_hDC); } int GetStretchBltMode() const { ATLASSERT(m_hDC != NULL); return ::GetStretchBltMode(m_hDC); } COLORREF GetTextColor() const { ATLASSERT(m_hDC != NULL); return ::GetTextColor(m_hDC); } COLORREF SetBkColor(COLORREF crColor) { ATLASSERT(m_hDC != NULL); return ::SetBkColor(m_hDC, crColor); } int SetBkMode(int nBkMode) { ATLASSERT(m_hDC != NULL); return ::SetBkMode(m_hDC, nBkMode); } int SetPolyFillMode(int nPolyFillMode) { ATLASSERT(m_hDC != NULL); return ::SetPolyFillMode(m_hDC, nPolyFillMode); } int SetROP2(int nDrawMode) { ATLASSERT(m_hDC != NULL); return ::SetROP2(m_hDC, nDrawMode); } int SetStretchBltMode(int nStretchMode) { ATLASSERT(m_hDC != NULL); return ::SetStretchBltMode(m_hDC, nStretchMode); } COLORREF SetTextColor(COLORREF crColor) { ATLASSERT(m_hDC != NULL); return ::SetTextColor(m_hDC, crColor); } BOOL GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const { ATLASSERT(m_hDC != NULL); return ::GetColorAdjustment(m_hDC, lpColorAdjust); } BOOL SetColorAdjustment(const COLORADJUSTMENT* lpColorAdjust) { ATLASSERT(m_hDC != NULL); return ::SetColorAdjustment(m_hDC, lpColorAdjust); } // Mapping Functions int GetMapMode() const { ATLASSERT(m_hDC != NULL); return ::GetMapMode(m_hDC); } BOOL GetViewportOrg(LPPOINT lpPoint) const { ATLASSERT(m_hDC != NULL); return ::GetViewportOrgEx(m_hDC, lpPoint); } int SetMapMode(int nMapMode) { ATLASSERT(m_hDC != NULL); return ::SetMapMode(m_hDC, nMapMode); } // Viewport Origin BOOL SetViewportOrg(int x, int y, LPPOINT lpPoint = NULL) { ATLASSERT(m_hDC != NULL); return ::SetViewportOrgEx(m_hDC, x, y, lpPoint); } BOOL SetViewportOrg(POINT point, LPPOINT lpPointRet = NULL) { ATLASSERT(m_hDC != NULL); return SetViewportOrg(point.x, point.y, lpPointRet); } BOOL OffsetViewportOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL) { ATLASSERT(m_hDC != NULL); return ::OffsetViewportOrgEx(m_hDC, nWidth, nHeight, lpPoint); } // Viewport Extent BOOL GetViewportExt(LPSIZE lpSize) const { ATLASSERT(m_hDC != NULL); return ::GetViewportExtEx(m_hDC, lpSize); } BOOL SetViewportExt(int x, int y, LPSIZE lpSize = NULL) { ATLASSERT(m_hDC != NULL); return ::SetViewportExtEx(m_hDC, x, y, lpSize); } BOOL SetViewportExt(SIZE size, LPSIZE lpSizeRet = NULL) { ATLASSERT(m_hDC != NULL); return SetViewportExt(size.cx, size.cy, lpSizeRet); } BOOL ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL) { ATLASSERT(m_hDC != NULL); return ::ScaleViewportExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize); } // Window Origin BOOL GetWindowOrg(LPPOINT lpPoint) const { ATLASSERT(m_hDC != NULL); return ::GetWindowOrgEx(m_hDC, lpPoint); } BOOL SetWindowOrg(int x, int y, LPPOINT lpPoint = NULL) { ATLASSERT(m_hDC != NULL); return ::SetWindowOrgEx(m_hDC, x, y, lpPoint); } BOOL SetWindowOrg(POINT point, LPPOINT lpPointRet = NULL) { ATLASSERT(m_hDC != NULL); return SetWindowOrg(point.x, point.y, lpPointRet); } BOOL OffsetWindowOrg(int nWidth, int nHeight, LPPOINT lpPoint = NULL) { ATLASSERT(m_hDC != NULL); return ::OffsetWindowOrgEx(m_hDC, nWidth, nHeight, lpPoint); } // Window extent BOOL GetWindowExt(LPSIZE lpSize) const { ATLASSERT(m_hDC != NULL); return ::GetWindowExtEx(m_hDC, lpSize); } BOOL SetWindowExt(int x, int y, LPSIZE lpSize = NULL) { ATLASSERT(m_hDC != NULL); return ::SetWindowExtEx(m_hDC, x, y, lpSize); } BOOL SetWindowExt(SIZE size, LPSIZE lpSizeRet = NULL) { ATLASSERT(m_hDC != NULL); return SetWindowExt(size.cx, size.cy, lpSizeRet); } BOOL ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom, LPSIZE lpSize = NULL) { ATLASSERT(m_hDC != NULL); return ::ScaleWindowExtEx(m_hDC, xNum, xDenom, yNum, yDenom, lpSize); } // Coordinate Functions BOOL DPtoLP(LPPOINT lpPoints, int nCount = 1) const { ATLASSERT(m_hDC != NULL); return ::DPtoLP(m_hDC, lpPoints, nCount); } BOOL DPtoLP(LPRECT lpRect) const { ATLASSERT(m_hDC != NULL); return ::DPtoLP(m_hDC, (LPPOINT)lpRect, 2); } BOOL DPtoLP(LPSIZE lpSize) const { SIZE sizeWinExt = {}; if(!GetWindowExt(&sizeWinExt)) return FALSE; SIZE sizeVpExt = {}; if(!GetViewportExt(&sizeVpExt)) return FALSE; lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeWinExt.cx), abs(sizeVpExt.cx)); lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeWinExt.cy), abs(sizeVpExt.cy)); return TRUE; } BOOL LPtoDP(LPPOINT lpPoints, int nCount = 1) const { ATLASSERT(m_hDC != NULL); return ::LPtoDP(m_hDC, lpPoints, nCount); } BOOL LPtoDP(LPRECT lpRect) const { ATLASSERT(m_hDC != NULL); return ::LPtoDP(m_hDC, (LPPOINT)lpRect, 2); } BOOL LPtoDP(LPSIZE lpSize) const { SIZE sizeWinExt = {}; if(!GetWindowExt(&sizeWinExt)) return FALSE; SIZE sizeVpExt = {}; if(!GetViewportExt(&sizeVpExt)) return FALSE; lpSize->cx = ::MulDiv(lpSize->cx, abs(sizeVpExt.cx), abs(sizeWinExt.cx)); lpSize->cy = ::MulDiv(lpSize->cy, abs(sizeVpExt.cy), abs(sizeWinExt.cy)); return TRUE; } // Special Coordinate Functions (useful for dealing with metafiles and OLE) #define HIMETRIC_INCH 2540 // HIMETRIC units per inch void DPtoHIMETRIC(LPSIZE lpSize) { ATLASSERT(m_hDC != NULL); int nMapMode = GetMapMode(); if((nMapMode < MM_ISOTROPIC) && (nMapMode != MM_TEXT)) { // when using a constrained map mode, map against physical inch SetMapMode(MM_HIMETRIC); DPtoLP(lpSize); SetMapMode(nMapMode); } else { // map against logical inch for non-constrained mapping modes int cxPerInch = GetDeviceCaps(LOGPIXELSX); int cyPerInch = GetDeviceCaps(LOGPIXELSY); ATLASSERT((cxPerInch != 0) && (cyPerInch != 0)); lpSize->cx = ::MulDiv(lpSize->cx, HIMETRIC_INCH, cxPerInch); lpSize->cy = ::MulDiv(lpSize->cy, HIMETRIC_INCH, cyPerInch); } } void HIMETRICtoDP(LPSIZE lpSize) { ATLASSERT(m_hDC != NULL); int nMapMode = GetMapMode(); if((nMapMode < MM_ISOTROPIC) && (nMapMode != MM_TEXT)) { // when using a constrained map mode, map against physical inch SetMapMode(MM_HIMETRIC); LPtoDP(lpSize); SetMapMode(nMapMode); } else { // map against logical inch for non-constrained mapping modes int cxPerInch = GetDeviceCaps(LOGPIXELSX); int cyPerInch = GetDeviceCaps(LOGPIXELSY); ATLASSERT((cxPerInch != 0) && (cyPerInch != 0)); lpSize->cx = ::MulDiv(lpSize->cx, cxPerInch, HIMETRIC_INCH); lpSize->cy = ::MulDiv(lpSize->cy, cyPerInch, HIMETRIC_INCH); } } void LPtoHIMETRIC(LPSIZE lpSize) { LPtoDP(lpSize); DPtoHIMETRIC(lpSize); } void HIMETRICtoLP(LPSIZE lpSize) { HIMETRICtoDP(lpSize); DPtoLP(lpSize); } // Region Functions BOOL FillRgn(HRGN hRgn, HBRUSH hBrush) { ATLASSERT(m_hDC != NULL); return ::FillRgn(m_hDC, hRgn, hBrush); } BOOL FrameRgn(HRGN hRgn, HBRUSH hBrush, int nWidth, int nHeight) { ATLASSERT(m_hDC != NULL); return ::FrameRgn(m_hDC, hRgn, hBrush, nWidth, nHeight); } BOOL InvertRgn(HRGN hRgn) { ATLASSERT(m_hDC != NULL); return ::InvertRgn(m_hDC, hRgn); } BOOL PaintRgn(HRGN hRgn) { ATLASSERT(m_hDC != NULL); return ::PaintRgn(m_hDC, hRgn); } // Clipping Functions int GetClipBox(LPRECT lpRect) const { ATLASSERT(m_hDC != NULL); return ::GetClipBox(m_hDC, lpRect); } int GetClipRgn(CRgn& region) const { ATLASSERT(m_hDC != NULL); if(region.IsNull()) region.CreateRectRgn(0, 0, 0, 0); int nRet = ::GetClipRgn(m_hDC, region); if(nRet != 1) region.DeleteObject(); return nRet; } BOOL PtVisible(int x, int y) const { ATLASSERT(m_hDC != NULL); return ::PtVisible(m_hDC, x, y); } BOOL PtVisible(POINT point) const { ATLASSERT(m_hDC != NULL); return ::PtVisible(m_hDC, point.x, point.y); } BOOL RectVisible(LPCRECT lpRect) const { ATLASSERT(m_hDC != NULL); return ::RectVisible(m_hDC, lpRect); } int SelectClipRgn(HRGN hRgn) { ATLASSERT(m_hDC != NULL); return ::SelectClipRgn(m_hDC, (HRGN)hRgn); } int ExcludeClipRect(int x1, int y1, int x2, int y2) { ATLASSERT(m_hDC != NULL); return ::ExcludeClipRect(m_hDC, x1, y1, x2, y2); } int ExcludeClipRect(LPCRECT lpRect) { ATLASSERT(m_hDC != NULL); return ::ExcludeClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } int ExcludeUpdateRgn(HWND hWnd) { ATLASSERT(m_hDC != NULL); return ::ExcludeUpdateRgn(m_hDC, hWnd); } int IntersectClipRect(int x1, int y1, int x2, int y2) { ATLASSERT(m_hDC != NULL); return ::IntersectClipRect(m_hDC, x1, y1, x2, y2); } int IntersectClipRect(LPCRECT lpRect) { ATLASSERT(m_hDC != NULL); return ::IntersectClipRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } int OffsetClipRgn(int x, int y) { ATLASSERT(m_hDC != NULL); return ::OffsetClipRgn(m_hDC, x, y); } int OffsetClipRgn(SIZE size) { ATLASSERT(m_hDC != NULL); return ::OffsetClipRgn(m_hDC, size.cx, size.cy); } int SelectClipRgn(HRGN hRgn, int nMode) { ATLASSERT(m_hDC != NULL); return ::ExtSelectClipRgn(m_hDC, hRgn, nMode); } // Line-Output Functions BOOL GetCurrentPosition(LPPOINT lpPoint) const { ATLASSERT(m_hDC != NULL); return ::GetCurrentPositionEx(m_hDC, lpPoint); } BOOL MoveTo(int x, int y, LPPOINT lpPoint = NULL) { ATLASSERT(m_hDC != NULL); return ::MoveToEx(m_hDC, x, y, lpPoint); } BOOL MoveTo(POINT point, LPPOINT lpPointRet = NULL) { ATLASSERT(m_hDC != NULL); return MoveTo(point.x, point.y, lpPointRet); } BOOL LineTo(int x, int y) { ATLASSERT(m_hDC != NULL); return ::LineTo(m_hDC, x, y); } BOOL LineTo(POINT point) { ATLASSERT(m_hDC != NULL); return LineTo(point.x, point.y); } BOOL Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { ATLASSERT(m_hDC != NULL); return ::Arc(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); } BOOL Arc(LPCRECT lpRect, POINT ptStart, POINT ptEnd) { ATLASSERT(m_hDC != NULL); return ::Arc(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); } BOOL Polyline(const POINT* lpPoints, int nCount) { ATLASSERT(m_hDC != NULL); return ::Polyline(m_hDC, lpPoints, nCount); } BOOL AngleArc(int x, int y, int nRadius, float fStartAngle, float fSweepAngle) { ATLASSERT(m_hDC != NULL); return ::AngleArc(m_hDC, x, y, nRadius, fStartAngle, fSweepAngle); } BOOL ArcTo(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { ATLASSERT(m_hDC != NULL); return ::ArcTo(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); } BOOL ArcTo(LPCRECT lpRect, POINT ptStart, POINT ptEnd) { ATLASSERT(m_hDC != NULL); return ArcTo(lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); } int GetArcDirection() const { ATLASSERT(m_hDC != NULL); return ::GetArcDirection(m_hDC); } int SetArcDirection(int nArcDirection) { ATLASSERT(m_hDC != NULL); return ::SetArcDirection(m_hDC, nArcDirection); } BOOL PolyDraw(const POINT* lpPoints, const BYTE* lpTypes, int nCount) { ATLASSERT(m_hDC != NULL); return ::PolyDraw(m_hDC, lpPoints, lpTypes, nCount); } BOOL PolylineTo(const POINT* lpPoints, int nCount) { ATLASSERT(m_hDC != NULL); return ::PolylineTo(m_hDC, lpPoints, nCount); } BOOL PolyPolyline(const POINT* lpPoints, const DWORD* lpPolyPoints, int nCount) { ATLASSERT(m_hDC != NULL); return ::PolyPolyline(m_hDC, lpPoints, lpPolyPoints, nCount); } BOOL PolyBezier(const POINT* lpPoints, int nCount) { ATLASSERT(m_hDC != NULL); return ::PolyBezier(m_hDC, lpPoints, nCount); } BOOL PolyBezierTo(const POINT* lpPoints, int nCount) { ATLASSERT(m_hDC != NULL); return ::PolyBezierTo(m_hDC, lpPoints, nCount); } // Simple Drawing Functions BOOL FillRect(LPCRECT lpRect, HBRUSH hBrush) { ATLASSERT(m_hDC != NULL); return ::FillRect(m_hDC, lpRect, hBrush); } BOOL FillRect(LPCRECT lpRect, int nColorIndex) { ATLASSERT(m_hDC != NULL); return ::FillRect(m_hDC, lpRect, (HBRUSH)LongToPtr(nColorIndex + 1)); } BOOL FrameRect(LPCRECT lpRect, HBRUSH hBrush) { ATLASSERT(m_hDC != NULL); return ::FrameRect(m_hDC, lpRect, hBrush); } BOOL InvertRect(LPCRECT lpRect) { ATLASSERT(m_hDC != NULL); return ::InvertRect(m_hDC, lpRect); } BOOL DrawIcon(int x, int y, HICON hIcon) { ATLASSERT(m_hDC != NULL); return ::DrawIcon(m_hDC, x, y, hIcon); } BOOL DrawIcon(POINT point, HICON hIcon) { ATLASSERT(m_hDC != NULL); return ::DrawIcon(m_hDC, point.x, point.y, hIcon); } BOOL DrawIconEx(int x, int y, HICON hIcon, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) { ATLASSERT(m_hDC != NULL); return ::DrawIconEx(m_hDC, x, y, hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); } BOOL DrawIconEx(POINT point, HICON hIcon, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) { ATLASSERT(m_hDC != NULL); return ::DrawIconEx(m_hDC, point.x, point.y, hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); } BOOL DrawState(POINT pt, SIZE size, HBITMAP hBitmap, UINT nFlags, HBRUSH hBrush = NULL) { ATLASSERT(m_hDC != NULL); return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hBitmap, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_BITMAP); } BOOL DrawState(POINT pt, SIZE size, HICON hIcon, UINT nFlags, HBRUSH hBrush = NULL) { ATLASSERT(m_hDC != NULL); return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)hIcon, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_ICON); } BOOL DrawState(POINT pt, SIZE size, LPCTSTR lpszText, UINT nFlags, BOOL bPrefixText = TRUE, int nTextLen = 0, HBRUSH hBrush = NULL) { ATLASSERT(m_hDC != NULL); return ::DrawState(m_hDC, hBrush, NULL, (LPARAM)lpszText, (WPARAM)nTextLen, pt.x, pt.y, size.cx, size.cy, nFlags | (bPrefixText ? DST_PREFIXTEXT : DST_TEXT)); } BOOL DrawState(POINT pt, SIZE size, DRAWSTATEPROC lpDrawProc, LPARAM lData, UINT nFlags, HBRUSH hBrush = NULL) { ATLASSERT(m_hDC != NULL); return ::DrawState(m_hDC, hBrush, lpDrawProc, lData, 0, pt.x, pt.y, size.cx, size.cy, nFlags | DST_COMPLEX); } // Ellipse and Polygon Functions BOOL Chord(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { ATLASSERT(m_hDC != NULL); return ::Chord(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); } BOOL Chord(LPCRECT lpRect, POINT ptStart, POINT ptEnd) { ATLASSERT(m_hDC != NULL); return ::Chord(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); } void DrawFocusRect(LPCRECT lpRect) { ATLASSERT(m_hDC != NULL); ::DrawFocusRect(m_hDC, lpRect); } BOOL Ellipse(int x1, int y1, int x2, int y2) { ATLASSERT(m_hDC != NULL); return ::Ellipse(m_hDC, x1, y1, x2, y2); } BOOL Ellipse(LPCRECT lpRect) { ATLASSERT(m_hDC != NULL); return ::Ellipse(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } BOOL Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { ATLASSERT(m_hDC != NULL); return ::Pie(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); } BOOL Pie(LPCRECT lpRect, POINT ptStart, POINT ptEnd) { ATLASSERT(m_hDC != NULL); return ::Pie(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); } BOOL Polygon(const POINT* lpPoints, int nCount) { ATLASSERT(m_hDC != NULL); return ::Polygon(m_hDC, lpPoints, nCount); } BOOL PolyPolygon(const POINT* lpPoints, const INT* lpPolyCounts, int nCount) { ATLASSERT(m_hDC != NULL); return ::PolyPolygon(m_hDC, lpPoints, lpPolyCounts, nCount); } BOOL Rectangle(int x1, int y1, int x2, int y2) { ATLASSERT(m_hDC != NULL); return ::Rectangle(m_hDC, x1, y1, x2, y2); } BOOL Rectangle(LPCRECT lpRect) { ATLASSERT(m_hDC != NULL); return ::Rectangle(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } BOOL RoundRect(int x1, int y1, int x2, int y2, int x3, int y3) { ATLASSERT(m_hDC != NULL); return ::RoundRect(m_hDC, x1, y1, x2, y2, x3, y3); } BOOL RoundRect(LPCRECT lpRect, POINT point) { ATLASSERT(m_hDC != NULL); return ::RoundRect(m_hDC, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, point.x, point.y); } // Bitmap Functions BOOL PatBlt(int x, int y, int nWidth, int nHeight, DWORD dwRop) { ATLASSERT(m_hDC != NULL); return ::PatBlt(m_hDC, x, y, nWidth, nHeight, dwRop); } BOOL BitBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, DWORD dwRop) { ATLASSERT(m_hDC != NULL); return ::BitBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, dwRop); } BOOL StretchBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop) { ATLASSERT(m_hDC != NULL); return ::StretchBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, dwRop); } COLORREF GetPixel(int x, int y) const { ATLASSERT(m_hDC != NULL); return ::GetPixel(m_hDC, x, y); } COLORREF GetPixel(POINT point) const { ATLASSERT(m_hDC != NULL); return ::GetPixel(m_hDC, point.x, point.y); } COLORREF SetPixel(int x, int y, COLORREF crColor) { ATLASSERT(m_hDC != NULL); return ::SetPixel(m_hDC, x, y, crColor); } COLORREF SetPixel(POINT point, COLORREF crColor) { ATLASSERT(m_hDC != NULL); return ::SetPixel(m_hDC, point.x, point.y, crColor); } BOOL FloodFill(int x, int y, COLORREF crColor) { ATLASSERT(m_hDC != NULL); return ::FloodFill(m_hDC, x, y, crColor); } BOOL ExtFloodFill(int x, int y, COLORREF crColor, UINT nFillType) { ATLASSERT(m_hDC != NULL); return ::ExtFloodFill(m_hDC, x, y, crColor, nFillType); } BOOL MaskBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, HBITMAP hMaskBitmap, int xMask, int yMask, DWORD dwRop) { ATLASSERT(m_hDC != NULL); return ::MaskBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, hMaskBitmap, xMask, yMask, dwRop); } BOOL PlgBlt(LPPOINT lpPoint, HDC hSrcDC, int xSrc, int ySrc, int nWidth, int nHeight, HBITMAP hMaskBitmap, int xMask, int yMask) { ATLASSERT(m_hDC != NULL); return ::PlgBlt(m_hDC, lpPoint, hSrcDC, xSrc, ySrc, nWidth, nHeight, hMaskBitmap, xMask, yMask); } BOOL SetPixelV(int x, int y, COLORREF crColor) { ATLASSERT(m_hDC != NULL); return ::SetPixelV(m_hDC, x, y, crColor); } BOOL SetPixelV(POINT point, COLORREF crColor) { ATLASSERT(m_hDC != NULL); return ::SetPixelV(m_hDC, point.x, point.y, crColor); } BOOL TransparentBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, UINT crTransparent) { ATLASSERT(m_hDC != NULL); return ::TransparentBlt(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, crTransparent); } BOOL GradientFill(const PTRIVERTEX pVertices, DWORD nVertices, void* pMeshElements, DWORD nMeshElements, DWORD dwMode) { ATLASSERT(m_hDC != NULL); return ::GradientFill(m_hDC, pVertices, nVertices, pMeshElements, nMeshElements, dwMode); } BOOL GradientFillRect(RECT& rect, COLORREF clr1, COLORREF clr2, bool bHorizontal) { ATLASSERT(m_hDC != NULL); TRIVERTEX arrTvx[2] = { { 0 }, { 0 } }; arrTvx[0].x = rect.left; arrTvx[0].y = rect.top; arrTvx[0].Red = MAKEWORD(0, GetRValue(clr1)); arrTvx[0].Green = MAKEWORD(0, GetGValue(clr1)); arrTvx[0].Blue = MAKEWORD(0, GetBValue(clr1)); arrTvx[0].Alpha = 0; arrTvx[1].x = rect.right; arrTvx[1].y = rect.bottom; arrTvx[1].Red = MAKEWORD(0, GetRValue(clr2)); arrTvx[1].Green = MAKEWORD(0, GetGValue(clr2)); arrTvx[1].Blue = MAKEWORD(0, GetBValue(clr2)); arrTvx[1].Alpha = 0; GRADIENT_RECT gr = { 0, 1 }; return ::GradientFill(m_hDC, arrTvx, 2, &gr, 1, bHorizontal ? GRADIENT_FILL_RECT_H : GRADIENT_FILL_RECT_V); } BOOL AlphaBlend(int x, int y, int nWidth, int nHeight, HDC hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, BLENDFUNCTION bf) { ATLASSERT(m_hDC != NULL); return ::AlphaBlend(m_hDC, x, y, nWidth, nHeight, hSrcDC, xSrc, ySrc, nSrcWidth, nSrcHeight, bf); } // Extra bitmap functions // Helper function for painting a disabled toolbar or menu bitmap // This function can take either an HBITMAP (for SS) or a DC with // the bitmap already painted (for cmdbar) BOOL DitherBlt(int x, int y, int nWidth, int nHeight, HDC hSrcDC, HBITMAP hBitmap, int xSrc, int ySrc, HBRUSH hBrushBackground = ::GetSysColorBrush(COLOR_3DFACE), HBRUSH hBrush3DEffect = ::GetSysColorBrush(COLOR_3DHILIGHT), HBRUSH hBrushDisabledImage = ::GetSysColorBrush(COLOR_3DSHADOW)) { ATLASSERT((m_hDC != NULL) || (hBitmap != NULL)); ATLASSERT((nWidth > 0) && (nHeight > 0)); // Create a generic DC for all BitBlts CDCT dc = (hSrcDC != NULL) ? hSrcDC : ::CreateCompatibleDC(m_hDC); ATLASSERT(dc.m_hDC != NULL); if(dc.m_hDC == NULL) return FALSE; // Create a DC for the monochrome DIB section CDCT dcBW = ::CreateCompatibleDC(m_hDC); ATLASSERT(dcBW.m_hDC != NULL); if(dcBW.m_hDC == NULL) { if(hSrcDC == NULL) dc.DeleteDC(); return FALSE; } // Create the monochrome DIB section with a black and white palette struct RGBBWBITMAPINFO { BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[2]; }; RGBBWBITMAPINFO rgbBWBitmapInfo = { { sizeof(BITMAPINFOHEADER), nWidth, nHeight, 1, 1, BI_RGB, 0, 0, 0, 0, 0 }, { { 0x00, 0x00, 0x00, 0x00 }, { 0xFF, 0xFF, 0xFF, 0x00 } } }; VOID* pbitsBW; CBitmap bmpBW = ::CreateDIBSection(dcBW, (LPBITMAPINFO)&rgbBWBitmapInfo, DIB_RGB_COLORS, &pbitsBW, NULL, 0); ATLASSERT(bmpBW.m_hBitmap != NULL); if(bmpBW.m_hBitmap == NULL) { if(hSrcDC == NULL) dc.DeleteDC(); return FALSE; } // Attach the monochrome DIB section and the bitmap to the DCs HBITMAP hbmOldBW = dcBW.SelectBitmap(bmpBW); HBITMAP hbmOldDC = NULL; if(hBitmap != NULL) hbmOldDC = dc.SelectBitmap(hBitmap); // Block: Dark gray removal: we want (128, 128, 128) pixels to become black and not white { CDCT dcTemp1 = ::CreateCompatibleDC(m_hDC); CDCT dcTemp2 = ::CreateCompatibleDC(m_hDC); CBitmap bmpTemp1; bmpTemp1.CreateCompatibleBitmap(dc, nWidth, nHeight); CBitmap bmpTemp2; bmpTemp2.CreateBitmap(nWidth, nHeight, 1, 1, NULL); HBITMAP hOldBmp1 = dcTemp1.SelectBitmap(bmpTemp1); HBITMAP hOldBmp2 = dcTemp2.SelectBitmap(bmpTemp2); // Let's copy our image, it will be altered dcTemp1.BitBlt(0, 0, nWidth, nHeight, dc, xSrc, ySrc, SRCCOPY); // All dark gray pixels will become white, the others black dcTemp1.SetBkColor(RGB(128, 128, 128)); dcTemp2.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY); // Do an XOR to set to black these white pixels dcTemp1.BitBlt(0, 0, nWidth, nHeight, dcTemp2, 0, 0, SRCINVERT); // BitBlt the bitmap into the monochrome DIB section // The DIB section will do a true monochrome conversion // The magenta background being closer to white will become white dcBW.BitBlt(0, 0, nWidth, nHeight, dcTemp1, 0, 0, SRCCOPY); // Cleanup dcTemp1.SelectBitmap(hOldBmp1); dcTemp2.SelectBitmap(hOldBmp2); } // Paint the destination rectangle using hBrushBackground if(hBrushBackground != NULL) { RECT rc = { x, y, x + nWidth, y + nHeight }; FillRect(&rc, hBrushBackground); } // BitBlt the black bits in the monochrome bitmap into hBrush3DEffect color in the destination DC // The magic ROP comes from the Charles Petzold's book HBRUSH hOldBrush = SelectBrush(hBrush3DEffect); BitBlt(x + 1, y + 1, nWidth, nHeight, dcBW, 0, 0, 0xB8074A); // BitBlt the black bits in the monochrome bitmap into hBrushDisabledImage color in the destination DC SelectBrush(hBrushDisabledImage); BitBlt(x, y, nWidth, nHeight, dcBW, 0, 0, 0xB8074A); SelectBrush(hOldBrush); dcBW.SelectBitmap(hbmOldBW); dc.SelectBitmap(hbmOldDC); if(hSrcDC == NULL) dc.DeleteDC(); return TRUE; } // Text Functions BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount = -1) { ATLASSERT(m_hDC != NULL); if(nCount == -1) nCount = lstrlen(lpszString); return ::TextOut(m_hDC, x, y, lpszString, nCount); } BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect, LPCTSTR lpszString, int nCount = -1, LPINT lpDxWidths = NULL) { ATLASSERT(m_hDC != NULL); if(nCount == -1) nCount = lstrlen(lpszString); ATLASSERT((nCount >= 0) && (nCount <= 8192)); return ::ExtTextOut(m_hDC, x, y, nOptions, lpRect, lpszString, (UINT)nCount, lpDxWidths); } SIZE TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL, int nTabOrigin = 0) { ATLASSERT(m_hDC != NULL); if(nCount == -1) nCount = lstrlen(lpszString); LONG lRes = ::TabbedTextOut(m_hDC, x, y, lpszString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin); SIZE size = { GET_X_LPARAM(lRes), GET_Y_LPARAM(lRes) }; return size; } int DrawText(LPCTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) { ATLASSERT(m_hDC != NULL); ATLASSERT((uFormat & DT_MODIFYSTRING) == 0); return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); } int DrawText(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat) { ATLASSERT(m_hDC != NULL); return ::DrawText(m_hDC, lpstrText, cchText, lpRect, uFormat); } int DrawTextEx(LPTSTR lpstrText, int cchText, LPRECT lpRect, UINT uFormat, LPDRAWTEXTPARAMS lpDTParams = NULL) { ATLASSERT(m_hDC != NULL); return ::DrawTextEx(m_hDC, lpstrText, cchText, lpRect, uFormat, lpDTParams); } // Note - ::DrawShadowText() is present only if comctl32.dll version 6 is loaded int DrawShadowText(LPCWSTR lpstrText, int cchText, LPRECT lpRect, DWORD dwFlags, COLORREF clrText, COLORREF clrShadow, int xOffset, int yOffset) { ATLASSERT(m_hDC != NULL); ATLASSERT(lpRect != NULL); return ::DrawShadowText(m_hDC, lpstrText, cchText, lpRect, dwFlags, clrText, clrShadow, xOffset, yOffset); } BOOL GetTextExtent(LPCTSTR lpszString, int nCount, LPSIZE lpSize) const { ATLASSERT(m_hDC != NULL); if(nCount == -1) nCount = lstrlen(lpszString); return ::GetTextExtentPoint32(m_hDC, lpszString, nCount, lpSize); } BOOL GetTextExtentExPoint(LPCTSTR lpszString, int cchString, LPSIZE lpSize, int nMaxExtent, LPINT lpnFit = NULL, LPINT alpDx = NULL) { ATLASSERT(m_hDC != NULL); return ::GetTextExtentExPoint(m_hDC, lpszString, cchString, nMaxExtent, lpnFit, alpDx, lpSize); } DWORD GetTabbedTextExtent(LPCTSTR lpszString, int nCount = -1, int nTabPositions = 0, LPINT lpnTabStopPositions = NULL) const { ATLASSERT(m_hDC != NULL); if(nCount == -1) nCount = lstrlen(lpszString); return ::GetTabbedTextExtent(m_hDC, lpszString, nCount, nTabPositions, lpnTabStopPositions); } BOOL GrayString(HBRUSH hBrush, BOOL (CALLBACK* lpfnOutput)(HDC, LPARAM, int), LPARAM lpData, int nCount, int x, int y, int nWidth, int nHeight) { ATLASSERT(m_hDC != NULL); return ::GrayString(m_hDC, hBrush, (GRAYSTRINGPROC)lpfnOutput, lpData, nCount, x, y, nWidth, nHeight); } UINT GetTextAlign() const { ATLASSERT(m_hDC != NULL); return ::GetTextAlign(m_hDC); } UINT SetTextAlign(UINT nFlags) { ATLASSERT(m_hDC != NULL); return ::SetTextAlign(m_hDC, nFlags); } int GetTextFace(LPTSTR lpszFacename, int nCount) const { ATLASSERT(m_hDC != NULL); return ::GetTextFace(m_hDC, nCount, lpszFacename); } int GetTextFaceLen() const { ATLASSERT(m_hDC != NULL); return ::GetTextFace(m_hDC, 0, NULL); } #ifdef _OLEAUTO_H_ BOOL GetTextFace(BSTR& bstrFace) const { USES_CONVERSION; ATLASSERT(m_hDC != NULL); ATLASSERT(bstrFace == NULL); int nLen = GetTextFaceLen(); if(nLen == 0) return FALSE; ATL::CTempBuffer buff; LPTSTR lpszText = buff.Allocate(nLen); if(lpszText == NULL) return FALSE; if(!GetTextFace(lpszText, nLen)) return FALSE; bstrFace = ::SysAllocString(T2OLE(lpszText)); return (bstrFace != NULL) ? TRUE : FALSE; } #endif #ifdef __ATLSTR_H__ int GetTextFace(ATL::CString& strFace) const { ATLASSERT(m_hDC != NULL); int nLen = GetTextFaceLen(); if(nLen == 0) return 0; LPTSTR lpstr = strFace.GetBufferSetLength(nLen); if(lpstr == NULL) return 0; int nRet = GetTextFace(lpstr, nLen); strFace.ReleaseBuffer(); return nRet; } #endif // __ATLSTR_H__ BOOL GetTextMetrics(LPTEXTMETRIC lpMetrics) const { ATLASSERT(m_hDC != NULL); return ::GetTextMetrics(m_hDC, lpMetrics); } int SetTextJustification(int nBreakExtra, int nBreakCount) { ATLASSERT(m_hDC != NULL); return ::SetTextJustification(m_hDC, nBreakExtra, nBreakCount); } int GetTextCharacterExtra() const { ATLASSERT(m_hDC != NULL); return ::GetTextCharacterExtra(m_hDC); } int SetTextCharacterExtra(int nCharExtra) { ATLASSERT(m_hDC != NULL); return ::SetTextCharacterExtra(m_hDC, nCharExtra); } // Advanced Drawing BOOL DrawEdge(LPRECT lpRect, UINT nEdge, UINT nFlags) { ATLASSERT(m_hDC != NULL); return ::DrawEdge(m_hDC, lpRect, nEdge, nFlags); } BOOL DrawFrameControl(LPRECT lpRect, UINT nType, UINT nState) { ATLASSERT(m_hDC != NULL); return ::DrawFrameControl(m_hDC, lpRect, nType, nState); } // Scrolling Functions BOOL ScrollDC(int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate) { ATLASSERT(m_hDC != NULL); return ::ScrollDC(m_hDC, dx, dy, lpRectScroll, lpRectClip, hRgnUpdate, lpRectUpdate); } // Font Functions BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const { ATLASSERT(m_hDC != NULL); return ::GetCharWidth(m_hDC, nFirstChar, nLastChar, lpBuffer); } // GetCharWidth32 is not supported under Win9x BOOL GetCharWidth32(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const { ATLASSERT(m_hDC != NULL); return ::GetCharWidth32(m_hDC, nFirstChar, nLastChar, lpBuffer); } DWORD SetMapperFlags(DWORD dwFlag) { ATLASSERT(m_hDC != NULL); return ::SetMapperFlags(m_hDC, dwFlag); } BOOL GetAspectRatioFilter(LPSIZE lpSize) const { ATLASSERT(m_hDC != NULL); return ::GetAspectRatioFilterEx(m_hDC, lpSize); } BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABC lpabc) const { ATLASSERT(m_hDC != NULL); return ::GetCharABCWidths(m_hDC, nFirstChar, nLastChar, lpabc); } DWORD GetFontData(DWORD dwTable, DWORD dwOffset, LPVOID lpData, DWORD cbData) const { ATLASSERT(m_hDC != NULL); return ::GetFontData(m_hDC, dwTable, dwOffset, lpData, cbData); } int GetKerningPairs(int nPairs, LPKERNINGPAIR lpkrnpair) const { ATLASSERT(m_hDC != NULL); return ::GetKerningPairs(m_hDC, nPairs, lpkrnpair); } UINT GetOutlineTextMetrics(UINT cbData, LPOUTLINETEXTMETRIC lpotm) const { ATLASSERT(m_hDC != NULL); return ::GetOutlineTextMetrics(m_hDC, cbData, lpotm); } DWORD GetGlyphOutline(UINT nChar, UINT nFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpBuffer, const MAT2* lpmat2) const { ATLASSERT(m_hDC != NULL); return ::GetGlyphOutline(m_hDC, nChar, nFormat, lpgm, cbBuffer, lpBuffer, lpmat2); } BOOL GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABCFLOAT lpABCF) const { ATLASSERT(m_hDC != NULL); return ::GetCharABCWidthsFloat(m_hDC, nFirstChar, nLastChar, lpABCF); } BOOL GetCharWidth(UINT nFirstChar, UINT nLastChar, float* lpFloatBuffer) const { ATLASSERT(m_hDC != NULL); return ::GetCharWidthFloat(m_hDC, nFirstChar, nLastChar, lpFloatBuffer); } // Printer/Device Escape Functions int Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData) { ATLASSERT(m_hDC != NULL); return ::Escape(m_hDC, nEscape, nCount, lpszInData, lpOutData); } int Escape(int nEscape, int nInputSize, LPCSTR lpszInputData, int nOutputSize, LPSTR lpszOutputData) { ATLASSERT(m_hDC != NULL); return ::ExtEscape(m_hDC, nEscape, nInputSize, lpszInputData, nOutputSize, lpszOutputData); } int DrawEscape(int nEscape, int nInputSize, LPCSTR lpszInputData) { ATLASSERT(m_hDC != NULL); return ::DrawEscape(m_hDC, nEscape, nInputSize, lpszInputData); } // Escape helpers int StartDoc(LPCTSTR lpszDocName) // old Win3.0 version { DOCINFO di = {}; di.cbSize = sizeof(DOCINFO); di.lpszDocName = lpszDocName; return StartDoc(&di); } int StartDoc(LPDOCINFO lpDocInfo) { ATLASSERT(m_hDC != NULL); return ::StartDoc(m_hDC, lpDocInfo); } int StartPage() { ATLASSERT(m_hDC != NULL); return ::StartPage(m_hDC); } int EndPage() { ATLASSERT(m_hDC != NULL); return ::EndPage(m_hDC); } int SetAbortProc(BOOL (CALLBACK* lpfn)(HDC, int)) { ATLASSERT(m_hDC != NULL); return ::SetAbortProc(m_hDC, (ABORTPROC)lpfn); } int AbortDoc() { ATLASSERT(m_hDC != NULL); return ::AbortDoc(m_hDC); } int EndDoc() { ATLASSERT(m_hDC != NULL); return ::EndDoc(m_hDC); } // MetaFile Functions BOOL PlayMetaFile(HMETAFILE hMF) { ATLASSERT(m_hDC != NULL); if(::GetDeviceCaps(m_hDC, TECHNOLOGY) == DT_METAFILE) { // playing metafile in metafile, just use core windows API return ::PlayMetaFile(m_hDC, hMF); } // for special playback, lParam == pDC return ::EnumMetaFile(m_hDC, hMF, EnumMetaFileProc, (LPARAM)this); } BOOL PlayMetaFile(HENHMETAFILE hEnhMetaFile, LPCRECT lpBounds) { ATLASSERT(m_hDC != NULL); return ::PlayEnhMetaFile(m_hDC, hEnhMetaFile, lpBounds); } BOOL AddMetaFileComment(UINT nDataSize, const BYTE* pCommentData) // can be used for enhanced metafiles only { ATLASSERT(m_hDC != NULL); return ::GdiComment(m_hDC, nDataSize, pCommentData); } // Special handling for metafile playback static int CALLBACK EnumMetaFileProc(HDC hDC, HANDLETABLE* pHandleTable, METARECORD* pMetaRec, int nHandles, LPARAM lParam) { CDCT* pDC = (CDCT*)lParam; switch (pMetaRec->rdFunction) { case META_SETMAPMODE: pDC->SetMapMode((int)(short)pMetaRec->rdParm[0]); break; case META_SETWINDOWEXT: pDC->SetWindowExt((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); break; case META_SETWINDOWORG: pDC->SetWindowOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); break; case META_SETVIEWPORTEXT: pDC->SetViewportExt((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); break; case META_SETVIEWPORTORG: pDC->SetViewportOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); break; case META_SCALEWINDOWEXT: pDC->ScaleWindowExt((int)(short)pMetaRec->rdParm[3], (int)(short)pMetaRec->rdParm[2], (int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); break; case META_SCALEVIEWPORTEXT: pDC->ScaleViewportExt((int)(short)pMetaRec->rdParm[3], (int)(short)pMetaRec->rdParm[2], (int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); break; case META_OFFSETVIEWPORTORG: pDC->OffsetViewportOrg((int)(short)pMetaRec->rdParm[1], (int)(short)pMetaRec->rdParm[0]); break; case META_SAVEDC: pDC->SaveDC(); break; case META_RESTOREDC: pDC->RestoreDC((int)(short)pMetaRec->rdParm[0]); break; case META_SETBKCOLOR: pDC->SetBkColor(*(UNALIGNED COLORREF*)&pMetaRec->rdParm[0]); break; case META_SETTEXTCOLOR: pDC->SetTextColor(*(UNALIGNED COLORREF*)&pMetaRec->rdParm[0]); break; // need to watch out for SelectObject(HFONT), for custom font mapping case META_SELECTOBJECT: { HGDIOBJ hObject = pHandleTable->objectHandle[pMetaRec->rdParm[0]]; UINT nObjType = ::GetObjectType(hObject); if(nObjType == 0) { // object type is unknown, determine if it is a font HFONT hStockFont = (HFONT)::GetStockObject(SYSTEM_FONT); HFONT hFontOld = (HFONT)::SelectObject(pDC->m_hDC, hStockFont); HGDIOBJ hObjOld = ::SelectObject(pDC->m_hDC, hObject); if(hObjOld == hStockFont) { // got the stock object back, so must be selecting a font pDC->SelectFont((HFONT)hObject); break; // don't play the default record } else { // didn't get the stock object back, so restore everything ::SelectObject(pDC->m_hDC, hFontOld); ::SelectObject(pDC->m_hDC, hObjOld); } // and fall through to PlayMetaFileRecord... } else if(nObjType == OBJ_FONT) { // play back as CDCHandle::SelectFont(HFONT) pDC->SelectFont((HFONT)hObject); break; // don't play the default record } } // fall through... default: ::PlayMetaFileRecord(hDC, pHandleTable, pMetaRec, nHandles); break; } return 1; } // Path Functions BOOL AbortPath() { ATLASSERT(m_hDC != NULL); return ::AbortPath(m_hDC); } BOOL BeginPath() { ATLASSERT(m_hDC != NULL); return ::BeginPath(m_hDC); } BOOL CloseFigure() { ATLASSERT(m_hDC != NULL); return ::CloseFigure(m_hDC); } BOOL EndPath() { ATLASSERT(m_hDC != NULL); return ::EndPath(m_hDC); } BOOL FillPath() { ATLASSERT(m_hDC != NULL); return ::FillPath(m_hDC); } BOOL FlattenPath() { ATLASSERT(m_hDC != NULL); return ::FlattenPath(m_hDC); } BOOL StrokeAndFillPath() { ATLASSERT(m_hDC != NULL); return ::StrokeAndFillPath(m_hDC); } BOOL StrokePath() { ATLASSERT(m_hDC != NULL); return ::StrokePath(m_hDC); } BOOL WidenPath() { ATLASSERT(m_hDC != NULL); return ::WidenPath(m_hDC); } BOOL GetMiterLimit(PFLOAT pfMiterLimit) const { ATLASSERT(m_hDC != NULL); return ::GetMiterLimit(m_hDC, pfMiterLimit); } BOOL SetMiterLimit(float fMiterLimit) { ATLASSERT(m_hDC != NULL); return ::SetMiterLimit(m_hDC, fMiterLimit, NULL); } int GetPath(LPPOINT lpPoints, LPBYTE lpTypes, int nCount) const { ATLASSERT(m_hDC != NULL); return ::GetPath(m_hDC, lpPoints, lpTypes, nCount); } BOOL SelectClipPath(int nMode) { ATLASSERT(m_hDC != NULL); return ::SelectClipPath(m_hDC, nMode); } // Misc Helper Functions static CBrushHandle PASCAL GetHalftoneBrush() { HBRUSH halftoneBrush = NULL; WORD grayPattern[8] = {}; for(int i = 0; i < 8; i++) grayPattern[i] = (WORD)(0x5555 << (i & 1)); HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern); if(grayBitmap != NULL) { halftoneBrush = ::CreatePatternBrush(grayBitmap); DeleteObject(grayBitmap); } return CBrushHandle(halftoneBrush); } void DrawDragRect(LPCRECT lpRect, SIZE size, LPCRECT lpRectLast, SIZE sizeLast, HBRUSH hBrush = NULL, HBRUSH hBrushLast = NULL) { // first, determine the update region and select it CRgn rgnOutside; rgnOutside.CreateRectRgnIndirect(lpRect); RECT rect = *lpRect; ::InflateRect(&rect, -size.cx, -size.cy); ::IntersectRect(&rect, &rect, lpRect); CRgn rgnInside; rgnInside.CreateRectRgnIndirect(&rect); CRgn rgnNew; rgnNew.CreateRectRgn(0, 0, 0, 0); rgnNew.CombineRgn(rgnOutside, rgnInside, RGN_XOR); HBRUSH hBrushOld = NULL; CBrush brushHalftone; if(hBrush == NULL) brushHalftone = hBrush = CDCHandle::GetHalftoneBrush(); if(hBrushLast == NULL) hBrushLast = hBrush; CRgn rgnLast; CRgn rgnUpdate; if(lpRectLast != NULL) { // find difference between new region and old region rgnLast.CreateRectRgn(0, 0, 0, 0); rgnOutside.SetRectRgn(lpRectLast->left, lpRectLast->top, lpRectLast->right, lpRectLast->bottom); rect = *lpRectLast; ::InflateRect(&rect, -sizeLast.cx, -sizeLast.cy); ::IntersectRect(&rect, &rect, lpRectLast); rgnInside.SetRectRgn(rect.left, rect.top, rect.right, rect.bottom); rgnLast.CombineRgn(rgnOutside, rgnInside, RGN_XOR); // only diff them if brushes are the same if(hBrush == hBrushLast) { rgnUpdate.CreateRectRgn(0, 0, 0, 0); rgnUpdate.CombineRgn(rgnLast, rgnNew, RGN_XOR); } } if((hBrush != hBrushLast) && (lpRectLast != NULL)) { // brushes are different -- erase old region first SelectClipRgn(rgnLast); GetClipBox(&rect); hBrushOld = SelectBrush(hBrushLast); PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); SelectBrush(hBrushOld); hBrushOld = NULL; } // draw into the update/new region SelectClipRgn(rgnUpdate.IsNull() ? rgnNew : rgnUpdate); GetClipBox(&rect); hBrushOld = SelectBrush(hBrush); PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); // cleanup DC if(hBrushOld != NULL) SelectBrush(hBrushOld); SelectClipRgn(NULL); } void FillSolidRect(LPCRECT lpRect, COLORREF clr) { ATLASSERT(m_hDC != NULL); COLORREF clrOld = ::SetBkColor(m_hDC, clr); ATLASSERT(clrOld != CLR_INVALID); if(clrOld != CLR_INVALID) { ::ExtTextOut(m_hDC, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL); ::SetBkColor(m_hDC, clrOld); } } void FillSolidRect(int x, int y, int cx, int cy, COLORREF clr) { ATLASSERT(m_hDC != NULL); RECT rect = { x, y, x + cx, y + cy }; FillSolidRect(&rect, clr); } void Draw3dRect(LPCRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight) { Draw3dRect(lpRect->left, lpRect->top, lpRect->right - lpRect->left, lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight); } void Draw3dRect(int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight) { FillSolidRect(x, y, cx - 1, 1, clrTopLeft); FillSolidRect(x, y, 1, cy - 1, clrTopLeft); FillSolidRect(x + cx, y, -1, cy, clrBottomRight); FillSolidRect(x, y + cy, cx, -1, clrBottomRight); } // DIB support int SetDIBitsToDevice(int x, int y, DWORD dwWidth, DWORD dwHeight, int xSrc, int ySrc, UINT uStartScan, UINT cScanLines, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse) { ATLASSERT(m_hDC != NULL); return ::SetDIBitsToDevice(m_hDC, x, y, dwWidth, dwHeight, xSrc, ySrc, uStartScan, cScanLines, lpvBits, lpbmi, uColorUse); } int StretchDIBits(int x, int y, int nWidth, int nHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, CONST VOID* lpvBits, CONST BITMAPINFO* lpbmi, UINT uColorUse, DWORD dwRop) { ATLASSERT(m_hDC != NULL); return ::StretchDIBits(m_hDC, x, y, nWidth, nHeight, xSrc, ySrc, nSrcWidth, nSrcHeight, lpvBits, lpbmi, uColorUse, dwRop); } UINT GetDIBColorTable(UINT uStartIndex, UINT cEntries, RGBQUAD* pColors) const { ATLASSERT(m_hDC != NULL); return ::GetDIBColorTable(m_hDC, uStartIndex, cEntries, pColors); } UINT SetDIBColorTable(UINT uStartIndex, UINT cEntries, CONST RGBQUAD* pColors) { ATLASSERT(m_hDC != NULL); return ::SetDIBColorTable(m_hDC, uStartIndex, cEntries, pColors); } // OpenGL support #if !defined(_ATL_NO_OPENGL) int ChoosePixelFormat(CONST PIXELFORMATDESCRIPTOR* ppfd) { ATLASSERT(m_hDC != NULL); return ::ChoosePixelFormat(m_hDC, ppfd); } int DescribePixelFormat(int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd) { ATLASSERT(m_hDC != NULL); return ::DescribePixelFormat(m_hDC, iPixelFormat, nBytes, ppfd); } int GetPixelFormat() const { ATLASSERT(m_hDC != NULL); return ::GetPixelFormat(m_hDC); } BOOL SetPixelFormat(int iPixelFormat, CONST PIXELFORMATDESCRIPTOR* ppfd) { ATLASSERT(m_hDC != NULL); return ::SetPixelFormat(m_hDC, iPixelFormat, ppfd); } BOOL SwapBuffers() { ATLASSERT(m_hDC != NULL); return ::SwapBuffers(m_hDC); } HGLRC wglCreateContext() { ATLASSERT(m_hDC != NULL); return ::wglCreateContext(m_hDC); } HGLRC wglCreateLayerContext(int iLayerPlane) { ATLASSERT(m_hDC != NULL); return ::wglCreateLayerContext(m_hDC, iLayerPlane); } BOOL wglMakeCurrent(HGLRC hglrc) { ATLASSERT(m_hDC != NULL); return ::wglMakeCurrent(m_hDC, hglrc); } BOOL wglUseFontBitmaps(DWORD dwFirst, DWORD dwCount, DWORD listBase) { ATLASSERT(m_hDC != NULL); return ::wglUseFontBitmaps(m_hDC, dwFirst, dwCount, listBase); } BOOL wglUseFontOutlines(DWORD dwFirst, DWORD dwCount, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf) { ATLASSERT(m_hDC != NULL); return ::wglUseFontOutlines(m_hDC, dwFirst, dwCount, listBase, deviation, extrusion, format, lpgmf); } BOOL wglDescribeLayerPlane(int iPixelFormat, int iLayerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd) { ATLASSERT(m_hDC != NULL); return ::wglDescribeLayerPlane(m_hDC, iPixelFormat, iLayerPlane, nBytes, plpd); } int wglSetLayerPaletteEntries(int iLayerPlane, int iStart, int cEntries, CONST COLORREF* pclr) { ATLASSERT(m_hDC != NULL); return ::wglSetLayerPaletteEntries(m_hDC, iLayerPlane, iStart, cEntries, pclr); } int wglGetLayerPaletteEntries(int iLayerPlane, int iStart, int cEntries, COLORREF* pclr) { ATLASSERT(m_hDC != NULL); return ::wglGetLayerPaletteEntries(m_hDC, iLayerPlane, iStart, cEntries, pclr); } BOOL wglRealizeLayerPalette(int iLayerPlane, BOOL bRealize) { ATLASSERT(m_hDC != NULL); return ::wglRealizeLayerPalette(m_hDC, iLayerPlane, bRealize); } BOOL wglSwapLayerBuffers(UINT uPlanes) { ATLASSERT(m_hDC != NULL); return ::wglSwapLayerBuffers(m_hDC, uPlanes); } #endif // !defined(_ATL_NO_OPENGL) COLORREF GetDCPenColor() const { ATLASSERT(m_hDC != NULL); return ::GetDCPenColor(m_hDC); } COLORREF SetDCPenColor(COLORREF clr) { ATLASSERT(m_hDC != NULL); return ::SetDCPenColor(m_hDC, clr); } COLORREF GetDCBrushColor() const { ATLASSERT(m_hDC != NULL); return ::GetDCBrushColor(m_hDC); } COLORREF SetDCBrushColor(COLORREF clr) { ATLASSERT(m_hDC != NULL); return ::SetDCBrushColor(m_hDC, clr); } DWORD GetFontUnicodeRanges(LPGLYPHSET lpgs) const { ATLASSERT(m_hDC != NULL); return ::GetFontUnicodeRanges(m_hDC, lpgs); } DWORD GetGlyphIndices(LPCTSTR lpstr, int cch, LPWORD pgi, DWORD dwFlags) const { ATLASSERT(m_hDC != NULL); return ::GetGlyphIndices(m_hDC, lpstr, cch, pgi, dwFlags); } BOOL GetTextExtentPointI(LPWORD pgiIn, int cgi, LPSIZE lpSize) const { ATLASSERT(m_hDC != NULL); return ::GetTextExtentPointI(m_hDC, pgiIn, cgi, lpSize); } BOOL GetTextExtentExPointI(LPWORD pgiIn, int cgi, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize) const { ATLASSERT(m_hDC != NULL); return ::GetTextExtentExPointI(m_hDC, pgiIn, cgi, nMaxExtent, lpnFit, alpDx, lpSize); } BOOL GetCharWidthI(UINT giFirst, UINT cgi, LPWORD pgi, LPINT lpBuffer) const { ATLASSERT(m_hDC != NULL); return ::GetCharWidthI(m_hDC, giFirst, cgi, pgi, lpBuffer); } BOOL GetCharABCWidthsI(UINT giFirst, UINT cgi, LPWORD pgi, LPABC lpabc) const { ATLASSERT(m_hDC != NULL); return ::GetCharABCWidthsI(m_hDC, giFirst, cgi, pgi, lpabc); } BOOL ColorCorrectPalette(HPALETTE hPalette, DWORD dwFirstEntry, DWORD dwNumOfEntries) { ATLASSERT(m_hDC != NULL); return ::ColorCorrectPalette(m_hDC, hPalette, dwFirstEntry, dwNumOfEntries); } }; /////////////////////////////////////////////////////////////////////////////// // CDC Helpers class CPaintDC : public CDC { public: // Data members HWND m_hWnd; PAINTSTRUCT m_ps; // Constructor/destructor CPaintDC(HWND hWnd) { ATLASSERT(::IsWindow(hWnd)); m_hWnd = hWnd; m_hDC = ::BeginPaint(hWnd, &m_ps); } ~CPaintDC() { ATLASSERT(m_hDC != NULL); ATLASSERT(::IsWindow(m_hWnd)); ::EndPaint(m_hWnd, &m_ps); Detach(); } }; class CClientDC : public CDC { public: // Data members HWND m_hWnd; // Constructor/destructor CClientDC(HWND hWnd) { ATLASSERT((hWnd == NULL) || ::IsWindow(hWnd)); m_hWnd = hWnd; m_hDC = ::GetDC(hWnd); } ~CClientDC() { ATLASSERT(m_hDC != NULL); ::ReleaseDC(m_hWnd, Detach()); } }; class CWindowDC : public CDC { public: // Data members HWND m_hWnd; // Constructor/destructor CWindowDC(HWND hWnd) { ATLASSERT((hWnd == NULL) || ::IsWindow(hWnd)); m_hWnd = hWnd; m_hDC = ::GetWindowDC(hWnd); } ~CWindowDC() { ATLASSERT(m_hDC != NULL); ::ReleaseDC(m_hWnd, Detach()); } }; class CMemoryDC : public CDC { public: // Data members HDC m_hDCOriginal; RECT m_rcPaint; CBitmap m_bmp; HBITMAP m_hBmpOld; // Constructor/destructor CMemoryDC(HDC hDC, const RECT& rcPaint) : m_hDCOriginal(hDC), m_hBmpOld(NULL) { m_rcPaint = rcPaint; CreateCompatibleDC(m_hDCOriginal); ATLASSERT(m_hDC != NULL); m_bmp.CreateCompatibleBitmap(m_hDCOriginal, m_rcPaint.right - m_rcPaint.left, m_rcPaint.bottom - m_rcPaint.top); ATLASSERT(m_bmp.m_hBitmap != NULL); m_hBmpOld = SelectBitmap(m_bmp); SetViewportOrg(-m_rcPaint.left, -m_rcPaint.top); } ~CMemoryDC() { ::BitBlt(m_hDCOriginal, m_rcPaint.left, m_rcPaint.top, m_rcPaint.right - m_rcPaint.left, m_rcPaint.bottom - m_rcPaint.top, m_hDC, m_rcPaint.left, m_rcPaint.top, SRCCOPY); SelectBitmap(m_hBmpOld); } }; /////////////////////////////////////////////////////////////////////////////// // Enhanced metafile support class CEnhMetaFileInfo { public: // Data members HENHMETAFILE m_hEMF; BYTE* m_pBits; TCHAR* m_pDesc; ENHMETAHEADER m_header; PIXELFORMATDESCRIPTOR m_pfd; // Constructor/destructor CEnhMetaFileInfo(HENHMETAFILE hEMF) : m_hEMF(hEMF), m_pBits(NULL), m_pDesc(NULL) { memset(&m_header, 0, sizeof(m_header)); memset(&m_pfd, 0, sizeof(m_pfd)); } ~CEnhMetaFileInfo() { delete [] m_pBits; delete [] m_pDesc; } // Operations BYTE* GetEnhMetaFileBits() { ATLASSERT(m_hEMF != NULL); UINT nBytes = ::GetEnhMetaFileBits(m_hEMF, 0, NULL); delete [] m_pBits; m_pBits = NULL; ATLTRY(m_pBits = new BYTE[nBytes]); if (m_pBits != NULL) ::GetEnhMetaFileBits(m_hEMF, nBytes, m_pBits); return m_pBits; } LPTSTR GetEnhMetaFileDescription() { ATLASSERT(m_hEMF != NULL); UINT nLen = ::GetEnhMetaFileDescription(m_hEMF, 0, NULL); delete [] m_pDesc; m_pDesc = NULL; ATLTRY(m_pDesc = new TCHAR[nLen]); if (m_pDesc != NULL) nLen = ::GetEnhMetaFileDescription(m_hEMF, nLen, m_pDesc); return m_pDesc; } ENHMETAHEADER* GetEnhMetaFileHeader() { ATLASSERT(m_hEMF != NULL); memset(&m_header, 0, sizeof(m_header)); m_header.iType = EMR_HEADER; m_header.nSize = sizeof(ENHMETAHEADER); UINT n = ::GetEnhMetaFileHeader(m_hEMF, sizeof(ENHMETAHEADER), &m_header); return (n != 0) ? &m_header : NULL; } PIXELFORMATDESCRIPTOR* GetEnhMetaFilePixelFormat() { ATLASSERT(m_hEMF != NULL); memset(&m_pfd, 0, sizeof(m_pfd)); UINT n = ::GetEnhMetaFilePixelFormat(m_hEMF, sizeof(m_pfd), &m_pfd); return (n != 0) ? &m_pfd : NULL; } }; template class CEnhMetaFileT { public: // Data members HENHMETAFILE m_hEMF; // Constructor/destructor CEnhMetaFileT(HENHMETAFILE hEMF = NULL) : m_hEMF(hEMF) { } ~CEnhMetaFileT() { if(t_bManaged && (m_hEMF != NULL)) DeleteObject(); } // Operations CEnhMetaFileT& operator =(HENHMETAFILE hEMF) { Attach(hEMF); return *this; } void Attach(HENHMETAFILE hEMF) { if(t_bManaged && (m_hEMF != NULL) && (m_hEMF != hEMF)) DeleteObject(); m_hEMF = hEMF; } HENHMETAFILE Detach() { HENHMETAFILE hEMF = m_hEMF; m_hEMF = NULL; return hEMF; } operator HENHMETAFILE() const { return m_hEMF; } bool IsNull() const { return (m_hEMF == NULL); } BOOL DeleteObject() { ATLASSERT(m_hEMF != NULL); BOOL bRet = ::DeleteEnhMetaFile(m_hEMF); m_hEMF = NULL; return bRet; } UINT GetEnhMetaFileBits(UINT cbBuffer, LPBYTE lpbBuffer) const { ATLASSERT(m_hEMF != NULL); return ::GetEnhMetaFileBits(m_hEMF, cbBuffer, lpbBuffer); } UINT GetEnhMetaFileDescription(UINT cchBuffer, LPTSTR lpszDescription) const { ATLASSERT(m_hEMF != NULL); return ::GetEnhMetaFileDescription(m_hEMF, cchBuffer, lpszDescription); } UINT GetEnhMetaFileHeader(LPENHMETAHEADER lpemh) const { ATLASSERT(m_hEMF != NULL); lpemh->iType = EMR_HEADER; lpemh->nSize = sizeof(ENHMETAHEADER); return ::GetEnhMetaFileHeader(m_hEMF, sizeof(ENHMETAHEADER), lpemh); } UINT GetEnhMetaFilePaletteEntries(UINT cEntries, LPPALETTEENTRY lppe) const { ATLASSERT(m_hEMF != NULL); return ::GetEnhMetaFilePaletteEntries(m_hEMF, cEntries, lppe); } UINT GetEnhMetaFilePixelFormat(DWORD cbBuffer, PIXELFORMATDESCRIPTOR* ppfd) const { ATLASSERT(m_hEMF != NULL); return ::GetEnhMetaFilePixelFormat(m_hEMF, cbBuffer, ppfd); } }; typedef CEnhMetaFileT CEnhMetaFileHandle; typedef CEnhMetaFileT CEnhMetaFile; class CEnhMetaFileDC : public CDC { public: // Constructor/destructor CEnhMetaFileDC() { } CEnhMetaFileDC(HDC hdc, LPCRECT lpRect) { Create(hdc, NULL, lpRect, NULL); ATLASSERT(m_hDC != NULL); } CEnhMetaFileDC(HDC hdcRef, LPCTSTR lpFilename, LPCRECT lpRect, LPCTSTR lpDescription) { Create(hdcRef, lpFilename, lpRect, lpDescription); ATLASSERT(m_hDC != NULL); } ~CEnhMetaFileDC() { HENHMETAFILE hEMF = Close(); if (hEMF != NULL) ::DeleteEnhMetaFile(hEMF); } // Operations void Create(HDC hdcRef, LPCTSTR lpFilename, LPCRECT lpRect, LPCTSTR lpDescription) { ATLASSERT(m_hDC == NULL); m_hDC = ::CreateEnhMetaFile(hdcRef, lpFilename, lpRect, lpDescription); } HENHMETAFILE Close() { HENHMETAFILE hEMF = NULL; if (m_hDC != NULL) { hEMF = ::CloseEnhMetaFile(m_hDC); m_hDC = NULL; } return hEMF; } }; } // namespace WTL #endif // __ATLGDI_H__ ================================================ FILE: third_party/WTL/Include/atlmisc.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLMISC_H__ #define __ATLMISC_H__ #pragma once #ifndef __ATLAPP_H__ #error atlmisc.h requires atlapp.h to be included first #endif #ifndef _WTL_NO_COMPATIBILITY_INCLUDES #include #include #endif // _WTL_NO_COMPATIBILITY_INCLUDES /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CRecentDocumentListBase // CRecentDocumentList // CFindFile // CRegProperty // CRegPropertyImpl // // Global functions: // AtlGetStockPen() // AtlGetStockBrush() // AtlGetStockFont() // AtlGetStockPalette() // // AtlCompactPath() namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CSize scalar operators #if !defined(_WTL_NO_SIZE_SCALAR) && defined(__ATLTYPES_H__) template inline CSize operator *(SIZE s, Num n) { return CSize((int)(s.cx * n), (int)(s.cy * n)); }; template inline void operator *=(SIZE & s, Num n) { s = s * n; }; template inline CSize operator /(SIZE s, Num n) { return CSize((int)(s.cx / n), (int)(s.cy / n)); }; template inline void operator /=(SIZE & s, Num n) { s = s / n; }; #endif // !defined(_WTL_NO_SIZE_SCALAR) && defined(__ATLTYPES_H__) /////////////////////////////////////////////////////////////////////////////// // CRecentDocumentList - MRU List Support #ifndef _WTL_MRUEMPTY_TEXT #define _WTL_MRUEMPTY_TEXT _T("(empty)") #endif // forward declaration inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen); template class CRecentDocumentListBase { public: // Declarations struct _DocEntry { TCHAR szDocName[t_cchItemLen]; bool operator ==(const _DocEntry& de) const { return (lstrcmpi(szDocName, de.szDocName) == 0); } }; enum { m_nMaxEntries_Min = 2, m_nMaxEntries_Max = t_nLastID - t_nFirstID + 1, m_cchMaxItemLen_Min = 6, m_cchMaxItemLen_Max = t_cchItemLen, m_cchItemNameLen = 11 }; // Data members ATL::CSimpleArray<_DocEntry> m_arrDocs; int m_nMaxEntries; // default is 4 HMENU m_hMenu; TCHAR m_szNoEntries[t_cchItemLen]; int m_cchMaxItemLen; // Constructor CRecentDocumentListBase() : m_nMaxEntries(4), m_hMenu(NULL), m_cchMaxItemLen(-1) { m_szNoEntries[0] = 0; // These ASSERTs verify values of the template arguments ATLASSERT(t_cchItemLen > m_cchMaxItemLen_Min); ATLASSERT(m_nMaxEntries_Max > m_nMaxEntries_Min); } // Attributes HMENU GetMenuHandle() const { return m_hMenu; } void SetMenuHandle(HMENU hMenu) { ATLASSERT((hMenu == NULL) || ::IsMenu(hMenu)); m_hMenu = hMenu; if((m_hMenu == NULL) || (::GetMenuString(m_hMenu, t_nFirstID, m_szNoEntries, t_cchItemLen, MF_BYCOMMAND) == 0)) { T* pT = static_cast(this); (void)pT; // avoid level 4 warning ATL::Checked::tcsncpy_s(m_szNoEntries, _countof(m_szNoEntries), pT->GetMRUEmptyText(), _TRUNCATE); } } int GetMaxEntries() const { return m_nMaxEntries; } void SetMaxEntries(int nMaxEntries) { ATLASSERT((nMaxEntries >= m_nMaxEntries_Min) && (nMaxEntries <= m_nMaxEntries_Max)); if(nMaxEntries < m_nMaxEntries_Min) nMaxEntries = m_nMaxEntries_Min; else if(nMaxEntries > m_nMaxEntries_Max) nMaxEntries = m_nMaxEntries_Max; m_nMaxEntries = nMaxEntries; } int GetMaxItemLength() const { return m_cchMaxItemLen; } void SetMaxItemLength(int cchMaxLen) { ATLASSERT(((cchMaxLen >= m_cchMaxItemLen_Min) && (cchMaxLen <= m_cchMaxItemLen_Max)) || (cchMaxLen == -1)); if(cchMaxLen != -1) { if(cchMaxLen < m_cchMaxItemLen_Min) cchMaxLen = m_cchMaxItemLen_Min; else if(cchMaxLen > m_cchMaxItemLen_Max) cchMaxLen = m_cchMaxItemLen_Max; } m_cchMaxItemLen = cchMaxLen; T* pT = static_cast(this); pT->UpdateMenu(); } // Operations BOOL AddToList(LPCTSTR lpstrDocName) { _DocEntry de; errno_t nRet = ATL::Checked::tcsncpy_s(de.szDocName, _countof(de.szDocName), lpstrDocName, _TRUNCATE); if((nRet != 0) && (nRet != STRUNCATE)) return FALSE; for(int i = 0; i < m_arrDocs.GetSize(); i++) { if(lstrcmpi(m_arrDocs[i].szDocName, lpstrDocName) == 0) { m_arrDocs.RemoveAt(i); break; } } if(m_arrDocs.GetSize() == m_nMaxEntries) m_arrDocs.RemoveAt(0); BOOL bRet = m_arrDocs.Add(de); if(bRet) { T* pT = static_cast(this); bRet = pT->UpdateMenu(); } return bRet; } // This function is deprecated because it is not safe. // Use the version below that accepts the buffer length. __declspec(deprecated) BOOL GetFromList(int /*nItemID*/, LPTSTR /*lpstrDocName*/) { ATLASSERT(FALSE); return FALSE; } BOOL GetFromList(int nItemID, LPTSTR lpstrDocName, int cchLength) { int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; if((nIndex < 0) || (nIndex >= m_arrDocs.GetSize())) return FALSE; if(lstrlen(m_arrDocs[nIndex].szDocName) >= cchLength) return FALSE; ATL::Checked::tcscpy_s(lpstrDocName, cchLength, m_arrDocs[nIndex].szDocName); return TRUE; } #ifdef __ATLSTR_H__ BOOL GetFromList(int nItemID, ATL::CString& strDocName) { int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; if((nIndex < 0) || (nIndex >= m_arrDocs.GetSize())) return FALSE; strDocName = m_arrDocs[nIndex].szDocName; return TRUE; } #endif // __ATLSTR_H__ BOOL RemoveFromList(int nItemID) { int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; BOOL bRet = m_arrDocs.RemoveAt(nIndex); if(bRet) { T* pT = static_cast(this); bRet = pT->UpdateMenu(); } return bRet; } BOOL MoveToTop(int nItemID) { int nIndex = m_arrDocs.GetSize() - (nItemID - t_nFirstID) - 1; if((nIndex < 0) || (nIndex >= m_arrDocs.GetSize())) return FALSE; _DocEntry de; de = m_arrDocs[nIndex]; m_arrDocs.RemoveAt(nIndex); BOOL bRet = m_arrDocs.Add(de); if(bRet) { T* pT = static_cast(this); bRet = pT->UpdateMenu(); } return bRet; } BOOL ReadFromRegistry(LPCTSTR lpstrRegKey) { T* pT = static_cast(this); ATL::CRegKey rkParent; ATL::CRegKey rk; LONG lRet = rkParent.Open(HKEY_CURRENT_USER, lpstrRegKey); if(lRet != ERROR_SUCCESS) return FALSE; lRet = rk.Open(rkParent, pT->GetRegKeyName()); if(lRet != ERROR_SUCCESS) return FALSE; DWORD dwRet = 0; lRet = rk.QueryDWORDValue(pT->GetRegCountName(), dwRet); if(lRet != ERROR_SUCCESS) return FALSE; SetMaxEntries(dwRet); m_arrDocs.RemoveAll(); TCHAR szRetString[t_cchItemLen] = {}; _DocEntry de; for(int nItem = m_nMaxEntries; nItem > 0; nItem--) { TCHAR szBuff[m_cchItemNameLen] = {}; _stprintf_s(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); ULONG ulCount = t_cchItemLen; lRet = rk.QueryStringValue(szBuff, szRetString, &ulCount); if(lRet == ERROR_SUCCESS) { ATL::Checked::tcscpy_s(de.szDocName, _countof(de.szDocName), szRetString); m_arrDocs.Add(de); } } rk.Close(); rkParent.Close(); return pT->UpdateMenu(); } BOOL WriteToRegistry(LPCTSTR lpstrRegKey) { T* pT = static_cast(this); (void)pT; // avoid level 4 warning ATL::CRegKey rkParent; ATL::CRegKey rk; LONG lRet = rkParent.Create(HKEY_CURRENT_USER, lpstrRegKey); if(lRet != ERROR_SUCCESS) return FALSE; lRet = rk.Create(rkParent, pT->GetRegKeyName()); if(lRet != ERROR_SUCCESS) return FALSE; lRet = rk.SetDWORDValue(pT->GetRegCountName(), m_nMaxEntries); ATLASSERT(lRet == ERROR_SUCCESS); // set new values int nItem; for(nItem = m_arrDocs.GetSize(); nItem > 0; nItem--) { TCHAR szBuff[m_cchItemNameLen] = {}; _stprintf_s(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); TCHAR szDocName[t_cchItemLen] = {}; GetFromList(t_nFirstID + nItem - 1, szDocName, t_cchItemLen); lRet = rk.SetStringValue(szBuff, szDocName); ATLASSERT(lRet == ERROR_SUCCESS); } // delete unused keys for(nItem = m_arrDocs.GetSize() + 1; nItem <= m_nMaxEntries_Max; nItem++) { TCHAR szBuff[m_cchItemNameLen] = {}; _stprintf_s(szBuff, m_cchItemNameLen, pT->GetRegItemName(), nItem); rk.DeleteValue(szBuff); } rk.Close(); rkParent.Close(); return TRUE; } // Implementation BOOL UpdateMenu() { if(m_hMenu == NULL) return FALSE; ATLASSERT(::IsMenu(m_hMenu)); int nItems = ::GetMenuItemCount(m_hMenu); int nInsertPoint = 0; for(int i = 0; i < nItems; i++) { CMenuItemInfo mi; mi.fMask = MIIM_ID; ::GetMenuItemInfo(m_hMenu, i, TRUE, &mi); if (mi.wID == t_nFirstID) { nInsertPoint = i; break; } } ATLASSERT((nInsertPoint < nItems) && "You need a menu item with an ID = t_nFirstID"); for(int j = t_nFirstID; j < (t_nFirstID + m_nMaxEntries); j++) { // keep the first one as an insertion point if (j != t_nFirstID) ::DeleteMenu(m_hMenu, j, MF_BYCOMMAND); } TCHAR szItemText[t_cchItemLen + 6] = {}; // add space for &, 2 digits, and a space int nSize = m_arrDocs.GetSize(); int nItem = 0; if(nSize > 0) { for(nItem = 0; nItem < nSize; nItem++) { if(m_cchMaxItemLen == -1) { _stprintf_s(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, m_arrDocs[nSize - 1 - nItem].szDocName); } else { TCHAR szBuff[t_cchItemLen] = {}; T* pT = static_cast(this); (void)pT; // avoid level 4 warning bool bRet = pT->CompactDocumentName(szBuff, m_arrDocs[nSize - 1 - nItem].szDocName, m_cchMaxItemLen); (void)bRet; // avoid level 4 warning ATLASSERT(bRet); _stprintf_s(szItemText, t_cchItemLen + 6, _T("&%i %s"), nItem + 1, szBuff); } ::InsertMenu(m_hMenu, nInsertPoint + nItem, MF_BYPOSITION | MF_STRING, t_nFirstID + nItem, szItemText); } } else // empty { ::InsertMenu(m_hMenu, nInsertPoint, MF_BYPOSITION | MF_STRING, t_nFirstID, m_szNoEntries); ::EnableMenuItem(m_hMenu, t_nFirstID, MF_GRAYED); nItem++; } ::DeleteMenu(m_hMenu, nInsertPoint + nItem, MF_BYPOSITION); return TRUE; } // Overrideables // override to provide a different method of compacting document names static bool CompactDocumentName(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) { return AtlCompactPath(lpstrOut, lpstrIn, cchLen); } static LPCTSTR GetRegKeyName() { return _T("Recent Document List"); } static LPCTSTR GetRegCountName() { return _T("DocumentCount"); } static LPCTSTR GetRegItemName() { // Note: This string is a format string used with wsprintf(). // Resulting formatted string must be m_cchItemNameLen or less // characters long, including the terminating null character. return _T("Document%i"); } static LPCTSTR GetMRUEmptyText() { return _WTL_MRUEMPTY_TEXT; } }; class CRecentDocumentList : public CRecentDocumentListBase { public: // nothing here }; /////////////////////////////////////////////////////////////////////////////// // CFindFile - file search helper class class CFindFile { public: // Data members HANDLE m_hFind; WIN32_FIND_DATA m_fd; LPTSTR m_lpszRoot; const TCHAR m_chDirSeparator; BOOL m_bFound; // Constructor/destructor CFindFile() : m_hFind(NULL), m_lpszRoot(NULL), m_chDirSeparator(_T('\\')), m_bFound(FALSE) { memset(&m_fd, 0, sizeof(m_fd)); } ~CFindFile() { Close(); } // Attributes ULONGLONG GetFileSize() const { ATLASSERT(m_hFind != NULL); ULARGE_INTEGER nFileSize = {}; if(m_bFound) { nFileSize.LowPart = m_fd.nFileSizeLow; nFileSize.HighPart = m_fd.nFileSizeHigh; } else { nFileSize.QuadPart = 0; } return nFileSize.QuadPart; } BOOL GetFileName(LPTSTR lpstrFileName, int cchLength) const { ATLASSERT(m_hFind != NULL); if(lstrlen(m_fd.cFileName) >= cchLength) return FALSE; if(m_bFound) ATL::Checked::tcscpy_s(lpstrFileName, cchLength, m_fd.cFileName); return m_bFound; } BOOL GetFilePath(LPTSTR lpstrFilePath, int cchLength) const { ATLASSERT(m_hFind != NULL); int nLen = lstrlen(m_lpszRoot); ATLASSERT(nLen > 0); if(nLen == 0) return FALSE; bool bAddSep = (m_lpszRoot[nLen - 1] != m_chDirSeparator); if((lstrlen(m_lpszRoot) + (bAddSep ? 1 : 0)) >= cchLength) return FALSE; ATL::Checked::tcscpy_s(lpstrFilePath, cchLength, m_lpszRoot); if(bAddSep) { TCHAR szSeparator[2] = { m_chDirSeparator, 0 }; ATL::Checked::tcscat_s(lpstrFilePath, cchLength, szSeparator); } ATL::Checked::tcscat_s(lpstrFilePath, cchLength, m_fd.cFileName); return TRUE; } BOOL GetFileTitle(LPTSTR lpstrFileTitle, int cchLength) const { ATLASSERT(m_hFind != NULL); TCHAR szBuff[MAX_PATH] = {}; if(!GetFileName(szBuff, MAX_PATH)) return FALSE; if(lstrlen(szBuff) >= cchLength) return FALSE; // find the last dot LPTSTR pstrDot = _tcsrchr(szBuff, _T('.')); if(pstrDot != NULL) *pstrDot = 0; ATL::Checked::tcscpy_s(lpstrFileTitle, cchLength, szBuff); return TRUE; } BOOL GetFileURL(LPTSTR lpstrFileURL, int cchLength) const { ATLASSERT(m_hFind != NULL); LPCTSTR lpstrFileURLPrefix = _T("file://"); const int cchPrefix = lstrlen(lpstrFileURLPrefix); if(cchPrefix >= cchLength) return FALSE; ATL::Checked::tcscpy_s(lpstrFileURL, cchLength, lpstrFileURLPrefix); return GetFilePath(&lpstrFileURL[cchPrefix], cchLength - cchPrefix); } BOOL GetRoot(LPTSTR lpstrRoot, int cchLength) const { ATLASSERT(m_hFind != NULL); if(lstrlen(m_lpszRoot) >= cchLength) return FALSE; ATL::Checked::tcscpy_s(lpstrRoot, cchLength, m_lpszRoot); return TRUE; } #ifdef __ATLSTR_H__ ATL::CString GetFileName() const { ATLASSERT(m_hFind != NULL); ATL::CString ret; if(m_bFound) ret = m_fd.cFileName; return ret; } ATL::CString GetFilePath() const { ATLASSERT(m_hFind != NULL); ATL::CString strResult = m_lpszRoot; int nLen = strResult.GetLength(); ATLASSERT(nLen > 0); if(nLen == 0) return strResult; if(strResult[nLen - 1] != m_chDirSeparator) strResult += m_chDirSeparator; strResult += GetFileName(); return strResult; } ATL::CString GetFileTitle() const { ATLASSERT(m_hFind != NULL); ATL::CString strResult; GetFileTitle(strResult.GetBuffer(MAX_PATH), MAX_PATH); strResult.ReleaseBuffer(); return strResult; } ATL::CString GetFileURL() const { ATLASSERT(m_hFind != NULL); ATL::CString strResult("file://"); strResult += GetFilePath(); return strResult; } ATL::CString GetRoot() const { ATLASSERT(m_hFind != NULL); ATL::CString str = m_lpszRoot; return str; } #endif // __ATLSTR_H__ BOOL GetLastWriteTime(FILETIME* pTimeStamp) const { ATLASSERT(m_hFind != NULL); ATLASSERT(pTimeStamp != NULL); if(m_bFound && (pTimeStamp != NULL)) { *pTimeStamp = m_fd.ftLastWriteTime; return TRUE; } return FALSE; } BOOL GetLastAccessTime(FILETIME* pTimeStamp) const { ATLASSERT(m_hFind != NULL); ATLASSERT(pTimeStamp != NULL); if(m_bFound && (pTimeStamp != NULL)) { *pTimeStamp = m_fd.ftLastAccessTime; return TRUE; } return FALSE; } BOOL GetCreationTime(FILETIME* pTimeStamp) const { ATLASSERT(m_hFind != NULL); if(m_bFound && (pTimeStamp != NULL)) { *pTimeStamp = m_fd.ftCreationTime; return TRUE; } return FALSE; } BOOL MatchesMask(DWORD dwMask) const { ATLASSERT(m_hFind != NULL); if(m_bFound) return ((m_fd.dwFileAttributes & dwMask) != 0); return FALSE; } BOOL IsDots() const { ATLASSERT(m_hFind != NULL); // return TRUE if the file name is "." or ".." and // the file is a directory BOOL bResult = FALSE; if(m_bFound && IsDirectory()) { if((m_fd.cFileName[0] == _T('.')) && ((m_fd.cFileName[1] == _T('\0')) || ((m_fd.cFileName[1] == _T('.')) && (m_fd.cFileName[2] == _T('\0'))))) bResult = TRUE; } return bResult; } BOOL IsReadOnly() const { return MatchesMask(FILE_ATTRIBUTE_READONLY); } BOOL IsDirectory() const { return MatchesMask(FILE_ATTRIBUTE_DIRECTORY); } BOOL IsCompressed() const { return MatchesMask(FILE_ATTRIBUTE_COMPRESSED); } BOOL IsSystem() const { return MatchesMask(FILE_ATTRIBUTE_SYSTEM); } BOOL IsHidden() const { return MatchesMask(FILE_ATTRIBUTE_HIDDEN); } BOOL IsTemporary() const { return MatchesMask(FILE_ATTRIBUTE_TEMPORARY); } BOOL IsNormal() const { return MatchesMask(FILE_ATTRIBUTE_NORMAL); } BOOL IsArchived() const { return MatchesMask(FILE_ATTRIBUTE_ARCHIVE); } // Operations BOOL FindFile(LPCTSTR pstrName = NULL, bool bAutoLongPath = false) { Close(); if(pstrName == NULL) pstrName = _T("*.*"); if(bAutoLongPath && (lstrlen(pstrName) >= MAX_PATH)) { LPCTSTR lpstrPrefix = _T("\\\\?\\"); int cchLongPath = lstrlen(lpstrPrefix) + lstrlen(pstrName) + 1; ATL::CTempBuffer buff; LPTSTR lpstrLongPath = buff.Allocate(cchLongPath); if(lpstrLongPath != NULL) { ATL::Checked::tcscpy_s(lpstrLongPath, cchLongPath, lpstrPrefix); ATL::Checked::tcscat_s(lpstrLongPath, cchLongPath, pstrName); m_hFind = ::FindFirstFile(lpstrLongPath, &m_fd); } } else { m_hFind = ::FindFirstFile(pstrName, &m_fd); } if(m_hFind == INVALID_HANDLE_VALUE) return FALSE; int cchRoot = ::GetFullPathName(pstrName, 0, NULL, NULL); if(cchRoot > 0) ATLTRY(m_lpszRoot = new TCHAR[cchRoot]); if(m_lpszRoot == NULL) return FALSE; bool bFullPath = (::GetFullPathName(pstrName, cchRoot, m_lpszRoot, NULL) != 0); // passed name isn't a valid path but was found by the API ATLASSERT(bFullPath); if(!bFullPath) { Close(); ::SetLastError(ERROR_INVALID_NAME); return FALSE; } else { // find the last separator LPTSTR pstrSep = _tcsrchr(m_lpszRoot, m_chDirSeparator); if(pstrSep != NULL) *pstrSep = _T('\0'); } m_bFound = TRUE; return TRUE; } BOOL FindNextFile() { ATLASSERT(m_hFind != NULL); if(m_hFind == NULL) return FALSE; if(!m_bFound) return FALSE; m_bFound = ::FindNextFile(m_hFind, &m_fd); return m_bFound; } void Close() { m_bFound = FALSE; delete [] m_lpszRoot; m_lpszRoot = NULL; if((m_hFind != NULL) && (m_hFind != INVALID_HANDLE_VALUE)) { ::FindClose(m_hFind); m_hFind = NULL; } } }; /////////////////////////////////////////////////////////////////////////////// // CRegProperty and CRegPropertyImpl<> - properties stored in registry // How to use: Derive a class from CRegPropertyImpl, add data members // for properties, and add REGPROP map to map properties to registry value names. // You can then call Read() and Write() methods to read and write properties to/from registry. // You can also use CRegProperty class directly, for one time read/write, or for custom stuff. #define REGPROP_CURRENTUSER 0x0000 #define REGPROP_LOCALMACHINE 0x0001 #define REGPROP_READONLY 0x0002 #define REGPROP_WRITEONLY 0x0004 class CRegProperty { public: // Type declarations struct BinaryProp { void* pBinary; ULONG uSize; // buffer size in bytes, used size after read BinaryProp() : pBinary(NULL), uSize(0U) { } }; struct CharArrayProp { LPTSTR lpstrText; ULONG uSize; // buffer size in chars CharArrayProp() : lpstrText(NULL), uSize(0U) { } }; // Data members ATL::CRegKey m_regkey; WORD m_wFlags; // Constructor CRegProperty() : m_wFlags(REGPROP_CURRENTUSER) { } // Registry key methods LSTATUS OpenRegKey(LPCTSTR lpstrRegKey, bool bWrite) { ATLASSERT(m_regkey.m_hKey == NULL); HKEY hKey = ((m_wFlags & REGPROP_LOCALMACHINE) != 0) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; REGSAM sam = KEY_READ | KEY_WRITE; LSTATUS lRet = -1; if(bWrite) lRet = m_regkey.Create(hKey, lpstrRegKey, NULL, 0, ((m_wFlags & REGPROP_WRITEONLY) != 0) ? KEY_WRITE : sam); else lRet = m_regkey.Open(hKey, lpstrRegKey, ((m_wFlags & REGPROP_READONLY) != 0) ? KEY_READ : sam); return lRet; } void CloseRegKey() { LSTATUS lRet = m_regkey.Close(); (void)lRet; // avoid level 4 warning ATLASSERT(lRet == ERROR_SUCCESS); } // Flag methods WORD GetFlags() const { return m_wFlags; } WORD SetFlags(WORD wFlags, WORD wMask = 0) { WORD wPrevFlags = m_wFlags; if(wMask == 0) m_wFlags = wFlags; else m_wFlags = (m_wFlags & ~wMask) | (wFlags & wMask); return wPrevFlags; } // Generic read/write methods template LSTATUS ReadProp(LPCTSTR lpstrRegValue, TProp& prop) { ATLASSERT(m_regkey.m_hKey != NULL); DWORD dwRet = 0; LSTATUS lRet = m_regkey.QueryDWORDValue(lpstrRegValue, dwRet); if(lRet == ERROR_SUCCESS) prop = static_cast(dwRet); return lRet; } template LSTATUS WriteProp(LPCTSTR lpstrRegValue, TProp& prop) { ATLASSERT(m_regkey.m_hKey != NULL); return m_regkey.SetDWORDValue(lpstrRegValue, (DWORD)prop); } // Specialization for bool template <> LSTATUS ReadProp(LPCTSTR lpstrRegValue, bool& bProp) { ATLASSERT(m_regkey.m_hKey != NULL); DWORD dwRet = 0; LSTATUS lRet = m_regkey.QueryDWORDValue(lpstrRegValue, dwRet); if(lRet == ERROR_SUCCESS) bProp = (dwRet != 0); return lRet; } template <> LSTATUS WriteProp(LPCTSTR lpstrRegValue, bool& bProp) { ATLASSERT(m_regkey.m_hKey != NULL); return m_regkey.SetDWORDValue(lpstrRegValue, bProp ? 1 : 0); } // Specialization for HFONT template <> LSTATUS ReadProp(LPCTSTR lpstrRegValue, HFONT& hFont) { ATLASSERT(m_regkey.m_hKey != NULL); LOGFONT lf = {}; ULONG uSize = sizeof(lf); LSTATUS lRet = m_regkey.QueryBinaryValue(lpstrRegValue, &lf, &uSize); if(lRet == ERROR_SUCCESS) { if(hFont != NULL) ::DeleteObject(hFont); hFont = ::CreateFontIndirect(&lf); if(hFont == NULL) lRet = ERROR_INVALID_DATA; } return lRet; } template <> LSTATUS WriteProp(LPCTSTR lpstrRegValue, HFONT& hFont) { ATLASSERT(m_regkey.m_hKey != NULL); CLogFont lf(hFont); return m_regkey.SetBinaryValue(lpstrRegValue, &lf, sizeof(lf)); } // Specialization for BinaryProp template <> LSTATUS ReadProp(LPCTSTR lpstrRegValue, BinaryProp& binProp) { ATLASSERT(m_regkey.m_hKey != NULL); ULONG uSize = 0U; LSTATUS lRet = m_regkey.QueryBinaryValue(lpstrRegValue, NULL, &uSize); if(lRet == ERROR_SUCCESS) { if(uSize <= binProp.uSize) lRet = m_regkey.QueryBinaryValue(lpstrRegValue, binProp.pBinary, &binProp.uSize); else lRet = ERROR_OUTOFMEMORY; } return lRet; } template <> LSTATUS WriteProp(LPCTSTR lpstrRegValue, BinaryProp& binProp) { ATLASSERT(m_regkey.m_hKey != NULL); return m_regkey.SetBinaryValue(lpstrRegValue, binProp.pBinary, binProp.uSize); } // Specialization for CharArrayProp template <> LSTATUS ReadProp(LPCTSTR lpstrRegValue, CharArrayProp& caProp) { ATLASSERT(m_regkey.m_hKey != NULL); ULONG uSize = 0U; LSTATUS lRet = m_regkey.QueryStringValue(lpstrRegValue, NULL, &uSize); if(lRet == ERROR_SUCCESS) { if(uSize <= caProp.uSize) lRet = m_regkey.QueryStringValue(lpstrRegValue, caProp.lpstrText, &caProp.uSize); else lRet = ERROR_OUTOFMEMORY; } return lRet; } template <> LSTATUS WriteProp(LPCTSTR lpstrRegValue, CharArrayProp& caProp) { ATLASSERT(m_regkey.m_hKey != NULL); return m_regkey.SetStringValue(lpstrRegValue, caProp.lpstrText); } // Specialization for CString #ifdef __ATLSTR_H__ template <> LSTATUS ReadProp(LPCTSTR lpstrRegValue, ATL::CString& strProp) { ATLASSERT(m_regkey.m_hKey != NULL); ULONG uSize = 0U; LSTATUS lRet = m_regkey.QueryStringValue(lpstrRegValue, NULL, &uSize); if(lRet == ERROR_SUCCESS) { lRet = m_regkey.QueryStringValue(lpstrRegValue, strProp.GetBufferSetLength(uSize), &uSize); strProp.ReleaseBuffer(); } return lRet; } template <> LSTATUS WriteProp(LPCTSTR lpstrRegValue, ATL::CString& strProp) { ATLASSERT(m_regkey.m_hKey != NULL); return m_regkey.SetStringValue(lpstrRegValue, (LPCTSTR)strProp); } #endif // __ATLSTR_H__ // Static methods for one time read/write template static bool ReadOne(LPCTSTR lpstrRegKey, LPCTSTR lpstrRegValue, TProp& prop, WORD wFlags = REGPROP_CURRENTUSER) { CRegProperty rp; rp.SetFlags(wFlags); LSTATUS lRet = rp.OpenRegKey(lpstrRegKey, false); if(lRet == ERROR_SUCCESS) { lRet = rp.ReadProp(lpstrRegValue, prop); rp.CloseRegKey(); } return (lRet == ERROR_SUCCESS) || (lRet == ERROR_FILE_NOT_FOUND); } template static bool WriteOne(LPCTSTR lpstrRegKey, LPCTSTR lpstrRegValue, TProp& prop, WORD wFlags = REGPROP_CURRENTUSER) { CRegProperty rp; rp.SetFlags(wFlags); LSTATUS lRet = rp.OpenRegKey(lpstrRegKey, true); if(lRet == ERROR_SUCCESS) { lRet = rp.WriteProp(lpstrRegValue, prop); rp.CloseRegKey(); } return (lRet == ERROR_SUCCESS); } }; #define BEGIN_REGPROP_MAP(class) \ void ReadWriteAll(bool bWrite) \ { #define REG_PROPERTY(name, prop) \ this->ReadWriteProp(name, prop, bWrite); #define END_REGPROP_MAP() \ } template class CRegPropertyImpl : public CRegProperty { public: // Methods void Read(LPCTSTR lpstrRegKey) { T* pT = static_cast(this); LSTATUS lRet = pT->OpenRegKey(lpstrRegKey, false); if(lRet == ERROR_SUCCESS) { pT->ReadWriteAll(false); pT->OnRead(lpstrRegKey); pT->CloseRegKey(); } else if(lRet != ERROR_FILE_NOT_FOUND) { pT->OnReadError(NULL, lRet); } } void Write(LPCTSTR lpstrRegKey) { T* pT = static_cast(this); LSTATUS lRet = pT->OpenRegKey(lpstrRegKey, true); if(lRet == ERROR_SUCCESS) { pT->ReadWriteAll(true); pT->OnWrite(lpstrRegKey); pT->CloseRegKey(); } else { pT->OnWriteError(NULL, lRet); } } // Implementation template void ReadWriteProp(LPCTSTR lpstrRegValue, TProp& prop, bool bWrite) { T* pT = static_cast(this); if(bWrite) { LSTATUS lRet = pT->WriteProp(lpstrRegValue, prop); if(lRet != ERROR_SUCCESS) pT->OnWriteError(lpstrRegValue, lRet); } else { LSTATUS lRet = pT->ReadProp(lpstrRegValue, prop); if((lRet != ERROR_SUCCESS) && (lRet != ERROR_FILE_NOT_FOUND)) pT->OnReadError(lpstrRegValue, lRet); } } // Overrideable handlers void OnRead(LPCTSTR /*lpstrRegKey*/) { } void OnWrite(LPCTSTR /*lpstrRegKey*/) { } void OnReadError(LPCTSTR /*lpstrRegValue*/, LSTATUS /*lError*/) { ATLASSERT(FALSE); } void OnWriteError(LPCTSTR /*lpstrRegValue*/, LSTATUS /*lError*/) { ATLASSERT(FALSE); } }; /////////////////////////////////////////////////////////////////////////////// // Global functions for stock GDI objects inline HPEN AtlGetStockPen(int nPen) { ATLASSERT((nPen == WHITE_PEN) || (nPen == BLACK_PEN) || (nPen == NULL_PEN) || (nPen == DC_PEN)); return (HPEN)::GetStockObject(nPen); } inline HBRUSH AtlGetStockBrush(int nBrush) { ATLASSERT(((nBrush >= WHITE_BRUSH) && (nBrush <= HOLLOW_BRUSH)) || (nBrush == DC_BRUSH)); return (HBRUSH)::GetStockObject(nBrush); } inline HFONT AtlGetStockFont(int nFont) { ATLASSERT(((nFont >= OEM_FIXED_FONT) && (nFont <= SYSTEM_FIXED_FONT)) || (nFont == DEFAULT_GUI_FONT)); return (HFONT)::GetStockObject(nFont); } inline HPALETTE AtlGetStockPalette(int nPalette) { ATLASSERT(nPalette == DEFAULT_PALETTE); // the only one supported return (HPALETTE)::GetStockObject(nPalette); } /////////////////////////////////////////////////////////////////////////////// // Global function for compacting a path by replacing parts with ellipsis // helper for multi-byte character sets inline bool _IsDBCSTrailByte(LPCTSTR lpstr, int nChar) { #ifndef _UNICODE int i = nChar; for( ; i > 0; i--) { if(!::IsDBCSLeadByte(lpstr[i - 1])) break; } return ((nChar > 0) && (((nChar - i) & 1) != 0)); #else // _UNICODE (void)lpstr; // avoid level 4 warning (void)nChar; // avoid level 4 warning return false; #endif // _UNICODE } inline bool AtlCompactPath(LPTSTR lpstrOut, LPCTSTR lpstrIn, int cchLen) { ATLASSERT(lpstrOut != NULL); ATLASSERT(lpstrIn != NULL); ATLASSERT(cchLen > 0); LPCTSTR szEllipsis = _T("..."); const int cchEndEllipsis = 3; const int cchMidEllipsis = 4; if(lstrlen(lpstrIn) < cchLen) { ATL::Checked::tcscpy_s(lpstrOut, cchLen, lpstrIn); return true; } lpstrOut[0] = 0; // check if the separator is a slash or a backslash TCHAR chSlash = _T('\\'); for(LPTSTR lpstr = (LPTSTR)lpstrIn; *lpstr != 0; lpstr = ::CharNext(lpstr)) { if((*lpstr == _T('/')) || (*lpstr == _T('\\'))) chSlash = *lpstr; } // find the filename portion of the path LPCTSTR lpstrFileName = lpstrIn; for(LPCTSTR pPath = lpstrIn; *pPath; pPath = ::CharNext(pPath)) { if(((pPath[0] == _T('\\')) || (pPath[0] == _T(':')) || (pPath[0] == _T('/'))) && pPath[1] && (pPath[1] != _T('\\')) && (pPath[1] != _T('/'))) lpstrFileName = pPath + 1; } int cchFileName = lstrlen(lpstrFileName); // handle just the filename without a path if((lpstrFileName == lpstrIn) && (cchLen > cchEndEllipsis)) { bool bRet = (ATL::Checked::tcsncpy_s(lpstrOut, cchLen, lpstrIn, cchLen - cchEndEllipsis - 1) == 0); if(bRet) { #ifndef _UNICODE if(_IsDBCSTrailByte(lpstrIn, cchLen - cchEndEllipsis)) lpstrOut[cchLen - cchEndEllipsis - 1] = 0; #endif // _UNICODE ATL::Checked::tcscat_s(lpstrOut, cchLen, szEllipsis); } return bRet; } // handle just ellipsis if((cchLen < (cchMidEllipsis + cchEndEllipsis))) { for(int i = 0; i < cchLen - 1; i++) lpstrOut[i] = ((i + 1) == cchMidEllipsis) ? chSlash : _T('.'); lpstrOut[cchLen - 1] = 0; return true; } // calc how much we have to copy int cchToCopy = cchLen - (cchMidEllipsis + cchFileName) - 1; if(cchToCopy < 0) cchToCopy = 0; #ifndef _UNICODE if((cchToCopy > 0) && _IsDBCSTrailByte(lpstrIn, cchToCopy)) cchToCopy--; #endif // _UNICODE bool bRet = (ATL::Checked::tcsncpy_s(lpstrOut, cchLen, lpstrIn, cchToCopy) == 0); if(!bRet) return false; // add ellipsis ATL::Checked::tcscat_s(lpstrOut, cchLen, szEllipsis); TCHAR szSlash[2] = { chSlash, 0 }; ATL::Checked::tcscat_s(lpstrOut, cchLen, szSlash); // add filename (and ellipsis, if needed) if(cchLen > (cchMidEllipsis + cchFileName)) { ATL::Checked::tcscat_s(lpstrOut, cchLen, lpstrFileName); } else { cchToCopy = cchLen - cchMidEllipsis - cchEndEllipsis - 1; #ifndef _UNICODE if((cchToCopy > 0) && _IsDBCSTrailByte(lpstrFileName, cchToCopy)) cchToCopy--; #endif // _UNICODE bRet = (ATL::Checked::tcsncpy_s(&lpstrOut[cchMidEllipsis], cchLen - cchMidEllipsis, lpstrFileName, cchToCopy) == 0); if(bRet) ATL::Checked::tcscat_s(lpstrOut, cchLen, szEllipsis); } return bRet; } } // namespace WTL #endif // __ATLMISC_H__ ================================================ FILE: third_party/WTL/Include/atlprint.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLPRINT_H__ #define __ATLPRINT_H__ #pragma once #ifndef __ATLAPP_H__ #error atlprint.h requires atlapp.h to be included first #endif #ifndef __ATLWIN_H__ #error atlprint.h requires atlwin.h to be included first #endif #include /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CPrinterInfo // CPrinterT // CDevModeT // CPrinterDC // CPrintJobInfo // CPrintJob // CPrintPreview // CPrintPreviewWindowImpl // CPrintPreviewWindow // CZoomPrintPreviewWindowImpl // CZoomPrintPreviewWindow namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CPrinterInfo - This class wraps all of the PRINTER_INFO_* structures // and provided by ::GetPrinter. template class _printer_info { public: typedef void infotype; }; template <> class _printer_info<1> { public: typedef PRINTER_INFO_1 infotype; }; template <> class _printer_info<2> { public: typedef PRINTER_INFO_2 infotype; }; template <> class _printer_info<3> { public: typedef PRINTER_INFO_3 infotype; }; template <> class _printer_info<4> { public: typedef PRINTER_INFO_4 infotype; }; template <> class _printer_info<5> { public: typedef PRINTER_INFO_5 infotype; }; template <> class _printer_info<6> { public: typedef PRINTER_INFO_6 infotype; }; template <> class _printer_info<7> { public: typedef PRINTER_INFO_7 infotype; }; template <> class _printer_info<8> { public: typedef PRINTER_INFO_8 infotype; }; template <> class _printer_info<9> { public: typedef PRINTER_INFO_9 infotype; }; template class CPrinterInfo { public: // Data members typename _printer_info::infotype* m_pi; // Constructor/destructor CPrinterInfo() : m_pi(NULL) { } CPrinterInfo(HANDLE hPrinter) : m_pi(NULL) { GetPrinterInfo(hPrinter); } ~CPrinterInfo() { Cleanup(); } // Operations bool GetPrinterInfo(HANDLE hPrinter) { Cleanup(); return GetPrinterInfoHelper(hPrinter, (BYTE**)&m_pi, t_nInfo); } // Implementation void Cleanup() { delete [] (BYTE*)m_pi; m_pi = NULL; } static bool GetPrinterInfoHelper(HANDLE hPrinter, BYTE** pi, int nIndex) { ATLASSERT(pi != NULL); DWORD dw = 0; BYTE* pb = NULL; ::GetPrinter(hPrinter, nIndex, NULL, 0, &dw); if (dw > 0) { ATLTRY(pb = new BYTE[dw]); if (pb != NULL) { memset(pb, 0, dw); DWORD dwNew; if (!::GetPrinter(hPrinter, nIndex, pb, dw, &dwNew)) { delete [] pb; pb = NULL; } } } *pi = pb; return (pb != NULL); } }; /////////////////////////////////////////////////////////////////////////////// // CPrinter - Wrapper class for a HANDLE to a printer template class CPrinterT { public: // Data members HANDLE m_hPrinter; // Constructor/destructor CPrinterT(HANDLE hPrinter = NULL) : m_hPrinter(hPrinter) { } ~CPrinterT() { ClosePrinter(); } // Operations CPrinterT& operator =(HANDLE hPrinter) { if (hPrinter != m_hPrinter) { ClosePrinter(); m_hPrinter = hPrinter; } return *this; } bool IsNull() const { return (m_hPrinter == NULL); } bool OpenPrinter(HANDLE hDevNames, const DEVMODE* pDevMode = NULL) { bool b = false; DEVNAMES* pdn = (DEVNAMES*)::GlobalLock(hDevNames); if (pdn != NULL) { LPTSTR lpszPrinterName = (LPTSTR)pdn + pdn->wDeviceOffset; b = OpenPrinter(lpszPrinterName, pDevMode); ::GlobalUnlock(hDevNames); } return b; } bool OpenPrinter(LPCTSTR lpszPrinterName, const DEVMODE* pDevMode = NULL) { ClosePrinter(); PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE }; ::OpenPrinter((LPTSTR) lpszPrinterName, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs); return (m_hPrinter != NULL); } bool OpenPrinter(LPCTSTR lpszPrinterName, PRINTER_DEFAULTS* pprintdefs) { ClosePrinter(); ::OpenPrinter((LPTSTR) lpszPrinterName, &m_hPrinter, pprintdefs); return (m_hPrinter != NULL); } bool OpenDefaultPrinter(const DEVMODE* pDevMode = NULL) { ClosePrinter(); DWORD cchBuff = 0; ::GetDefaultPrinter(NULL, &cchBuff); TCHAR* pszBuff = new TCHAR[cchBuff]; BOOL bRet = ::GetDefaultPrinter(pszBuff, &cchBuff); if(bRet != FALSE) { PRINTER_DEFAULTS pdefs = { NULL, (DEVMODE*)pDevMode, PRINTER_ACCESS_USE }; ::OpenPrinter(pszBuff, &m_hPrinter, (pDevMode == NULL) ? NULL : &pdefs); } delete [] pszBuff; return m_hPrinter != NULL; } void ClosePrinter() { if (m_hPrinter != NULL) { if (t_bManaged) ::ClosePrinter(m_hPrinter); m_hPrinter = NULL; } } bool PrinterProperties(HWND hWnd = NULL) { if (hWnd == NULL) hWnd = ::GetActiveWindow(); return !!::PrinterProperties(hWnd, m_hPrinter); } HANDLE CopyToHDEVNAMES() const { HANDLE hDevNames = NULL; CPrinterInfo<5> pinfon5; CPrinterInfo<2> pinfon2; LPTSTR lpszPrinterName = NULL; LPTSTR lpszPortName = NULL; // Some printers fail for PRINTER_INFO_5 in some situations if(pinfon5.GetPrinterInfo(m_hPrinter)) { lpszPrinterName = pinfon5.m_pi->pPrinterName; lpszPortName = pinfon5.m_pi->pPortName; } else if(pinfon2.GetPrinterInfo(m_hPrinter)) { lpszPrinterName = pinfon2.m_pi->pPrinterName; lpszPortName = pinfon2.m_pi->pPortName; } if(lpszPrinterName != NULL) { int nLen = sizeof(DEVNAMES) + (lstrlen(lpszPrinterName) + 1 + lstrlen(lpszPortName) + 1) * sizeof(TCHAR); hDevNames = ::GlobalAlloc(GMEM_MOVEABLE, nLen); BYTE* pv = (BYTE*)::GlobalLock(hDevNames); DEVNAMES* pdev = (DEVNAMES*)pv; if(pv != NULL) { memset(pv, 0, nLen); pdev->wDeviceOffset = sizeof(DEVNAMES) / sizeof(TCHAR); pv = pv + sizeof(DEVNAMES); // now points to end ATL::Checked::tcscpy_s((LPTSTR)pv, lstrlen(lpszPrinterName) + 1, lpszPrinterName); pdev->wOutputOffset = (WORD)(sizeof(DEVNAMES) / sizeof(TCHAR) + lstrlen(lpszPrinterName) + 1); pv = pv + (lstrlen(lpszPrinterName) + 1) * sizeof(TCHAR); ATL::Checked::tcscpy_s((LPTSTR)pv, lstrlen(lpszPortName) + 1, lpszPortName); ::GlobalUnlock(hDevNames); } } return hDevNames; } HDC CreatePrinterDC(const DEVMODE* pdm = NULL) const { CPrinterInfo<5> pinfo5; CPrinterInfo<2> pinfo2; HDC hDC = NULL; LPTSTR lpszPrinterName = NULL; // Some printers fail for PRINTER_INFO_5 in some situations if (pinfo5.GetPrinterInfo(m_hPrinter)) lpszPrinterName = pinfo5.m_pi->pPrinterName; else if (pinfo2.GetPrinterInfo(m_hPrinter)) lpszPrinterName = pinfo2.m_pi->pPrinterName; if (lpszPrinterName != NULL) hDC = ::CreateDC(NULL, lpszPrinterName, NULL, pdm); return hDC; } HDC CreatePrinterIC(const DEVMODE* pdm = NULL) const { CPrinterInfo<5> pinfo5; CPrinterInfo<2> pinfo2; HDC hDC = NULL; LPTSTR lpszPrinterName = NULL; // Some printers fail for PRINTER_INFO_5 in some situations if (pinfo5.GetPrinterInfo(m_hPrinter)) lpszPrinterName = pinfo5.m_pi->pPrinterName; else if (pinfo2.GetPrinterInfo(m_hPrinter)) lpszPrinterName = pinfo2.m_pi->pPrinterName; if (lpszPrinterName != NULL) hDC = ::CreateIC(NULL, lpszPrinterName, NULL, pdm); return hDC; } void Attach(HANDLE hPrinter) { ClosePrinter(); m_hPrinter = hPrinter; } HANDLE Detach() { HANDLE hPrinter = m_hPrinter; m_hPrinter = NULL; return hPrinter; } operator HANDLE() const { return m_hPrinter; } }; typedef CPrinterT CPrinterHandle; typedef CPrinterT CPrinter; /////////////////////////////////////////////////////////////////////////////// // CDevMode - Wrapper class for DEVMODE template class CDevModeT { public: // Data members HANDLE m_hDevMode; DEVMODE* m_pDevMode; // Constructor/destructor CDevModeT(HANDLE hDevMode = NULL) : m_hDevMode(hDevMode) { m_pDevMode = (m_hDevMode != NULL) ? (DEVMODE*)::GlobalLock(m_hDevMode) : NULL; } ~CDevModeT() { Cleanup(); } // Operations CDevModeT& operator =(HANDLE hDevMode) { Attach(hDevMode); return *this; } void Attach(HANDLE hDevModeNew) { Cleanup(); m_hDevMode = hDevModeNew; m_pDevMode = (m_hDevMode != NULL) ? (DEVMODE*)::GlobalLock(m_hDevMode) : NULL; } HANDLE Detach() { if (m_hDevMode != NULL) ::GlobalUnlock(m_hDevMode); HANDLE hDevMode = m_hDevMode; m_hDevMode = NULL; return hDevMode; } bool IsNull() const { return (m_hDevMode == NULL); } bool CopyFromPrinter(HANDLE hPrinter) { CPrinterInfo<2> pinfo; bool b = pinfo.GetPrinterInfo(hPrinter); if (b) b = CopyFromDEVMODE(pinfo.m_pi->pDevMode); return b; } bool CopyFromDEVMODE(const DEVMODE* pdm) { if (pdm == NULL) return false; int nSize = pdm->dmSize + pdm->dmDriverExtra; HANDLE h = ::GlobalAlloc(GMEM_MOVEABLE, nSize); if (h != NULL) { void* p = ::GlobalLock(h); ATL::Checked::memcpy_s(p, nSize, pdm, nSize); ::GlobalUnlock(h); } Attach(h); return (h != NULL); } bool CopyFromHDEVMODE(HANDLE hdm) { bool b = false; if (hdm != NULL) { DEVMODE* pdm = (DEVMODE*)::GlobalLock(hdm); b = CopyFromDEVMODE(pdm); ::GlobalUnlock(hdm); } return b; } HANDLE CopyToHDEVMODE() { if ((m_hDevMode == NULL) || (m_pDevMode == NULL)) return NULL; int nSize = m_pDevMode->dmSize + m_pDevMode->dmDriverExtra; HANDLE h = ::GlobalAlloc(GMEM_MOVEABLE, nSize); if (h != NULL) { void* p = ::GlobalLock(h); ATL::Checked::memcpy_s(p, nSize, m_pDevMode, nSize); ::GlobalUnlock(h); } return h; } // If this devmode was for another printer, this will create a new devmode // based on the existing devmode, but retargeted at the new printer bool UpdateForNewPrinter(HANDLE hPrinter) { bool bRet = false; LONG nLen = ::DocumentProperties(NULL, hPrinter, NULL, NULL, NULL, 0); ATL::CTempBuffer buff; DEVMODE* pdm = buff.AllocateBytes(nLen); if(pdm != NULL) { memset(pdm, 0, nLen); LONG l = ::DocumentProperties(NULL, hPrinter, NULL, pdm, m_pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER); if (l == IDOK) bRet = CopyFromDEVMODE(pdm); } return bRet; } bool DocumentProperties(HANDLE hPrinter, HWND hWnd = NULL) { CPrinterInfo<1> pi; pi.GetPrinterInfo(hPrinter); if (hWnd == NULL) hWnd = ::GetActiveWindow(); bool bRet = false; LONG nLen = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, NULL, NULL, 0); ATL::CTempBuffer buff; DEVMODE* pdm = buff.AllocateBytes(nLen); if(pdm != NULL) { memset(pdm, 0, nLen); LONG l = ::DocumentProperties(hWnd, hPrinter, pi.m_pi->pName, pdm, m_pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER | DM_PROMPT); if (l == IDOK) bRet = CopyFromDEVMODE(pdm); } return bRet; } operator HANDLE() const { return m_hDevMode; } operator DEVMODE*() const { return m_pDevMode; } // Implementation void Cleanup() { if (m_hDevMode != NULL) { ::GlobalUnlock(m_hDevMode); if(t_bManaged) ::GlobalFree(m_hDevMode); m_hDevMode = NULL; } } }; typedef CDevModeT CDevModeHandle; typedef CDevModeT CDevMode; /////////////////////////////////////////////////////////////////////////////// // CPrinterDC class CPrinterDC : public CDC { public: // Constructors/destructor CPrinterDC() { CPrinter printer; printer.OpenDefaultPrinter(); Attach(printer.CreatePrinterDC()); ATLASSERT(m_hDC != NULL); } CPrinterDC(HANDLE hPrinter, const DEVMODE* pdm = NULL) { CPrinterHandle p; p.Attach(hPrinter); Attach(p.CreatePrinterDC(pdm)); ATLASSERT(m_hDC != NULL); } ~CPrinterDC() { DeleteDC(); } }; /////////////////////////////////////////////////////////////////////////////// // CPrintJob - Wraps a set of tasks for a specific printer (StartDoc/EndDoc) // Handles aborting, background printing // Defines callbacks used by CPrintJob (not a COM interface) class ATL_NO_VTABLE IPrintJobInfo { public: virtual void BeginPrintJob(HDC hDC) = 0; // allocate handles needed, etc. virtual void EndPrintJob(HDC hDC, bool bAborted) = 0; // free handles, etc. virtual void PrePrintPage(UINT nPage, HDC hDC) = 0; virtual bool PrintPage(UINT nPage, HDC hDC) = 0; virtual void PostPrintPage(UINT nPage, HDC hDC) = 0; // If you want per page devmodes, return the DEVMODE* to use for nPage. // You can optimize by only returning a new DEVMODE* when it is different // from the one for nLastPage, otherwise return NULL. // When nLastPage==0, the current DEVMODE* will be the default passed to // StartPrintJob. // Note: During print preview, nLastPage will always be "0". virtual DEVMODE* GetNewDevModeForPage(UINT nLastPage, UINT nPage) = 0; virtual bool IsValidPage(UINT nPage) = 0; }; // Provides a default implementatin for IPrintJobInfo // Typically, MI'd into a document or view class class ATL_NO_VTABLE CPrintJobInfo : public IPrintJobInfo { public: CPrintJobInfo() : m_nPJState(0) { } virtual void BeginPrintJob(HDC /*hDC*/) // allocate handles needed, etc { } virtual void EndPrintJob(HDC /*hDC*/, bool /*bAborted*/) // free handles, etc { } virtual void PrePrintPage(UINT /*nPage*/, HDC hDC) { m_nPJState = ::SaveDC(hDC); } virtual bool PrintPage(UINT /*nPage*/, HDC /*hDC*/) = 0; virtual void PostPrintPage(UINT /*nPage*/, HDC hDC) { RestoreDC(hDC, m_nPJState); } virtual DEVMODE* GetNewDevModeForPage(UINT /*nLastPage*/, UINT /*nPage*/) { return NULL; } virtual bool IsValidPage(UINT /*nPage*/) { return true; } // Implementation - data int m_nPJState; }; class CPrintJob { public: // Data members CPrinterHandle m_printer; IPrintJobInfo* m_pInfo; DEVMODE* m_pDefDevMode; DOCINFO m_docinfo; int m_nJobID; bool m_bCancel; bool m_bComplete; unsigned long m_nStartPage; unsigned long m_nEndPage; // Constructor/destructor CPrintJob() : m_pInfo(NULL), m_pDefDevMode(NULL), m_nJobID(0), m_bCancel(false), m_bComplete(true), m_nStartPage(0), m_nEndPage(0) { memset(&m_docinfo, 0, sizeof(m_docinfo)); } ~CPrintJob() { ATLASSERT(IsJobComplete()); // premature destruction? } // Operations bool IsJobComplete() const { return m_bComplete; } bool StartPrintJob(bool bBackground, HANDLE hPrinter, DEVMODE* pDefaultDevMode, IPrintJobInfo* pInfo, LPCTSTR lpszDocName, unsigned long nStartPage, unsigned long nEndPage, bool bPrintToFile = false, LPCTSTR lpstrOutputFile = NULL) { ATLASSERT(m_bComplete); // previous job not done yet? if (pInfo == NULL) return false; memset(&m_docinfo, 0, sizeof(m_docinfo)); m_docinfo.cbSize = sizeof(m_docinfo); m_docinfo.lpszDocName = lpszDocName; m_pInfo = pInfo; m_nStartPage = nStartPage; m_nEndPage = nEndPage; m_printer.Attach(hPrinter); m_pDefDevMode = pDefaultDevMode; m_bComplete = false; if(bPrintToFile) m_docinfo.lpszOutput = (lpstrOutputFile != NULL) ? lpstrOutputFile : _T("FILE:"); if (!bBackground) { m_bComplete = true; return StartHelper(); } // Create a thread and return DWORD dwThreadID = 0; #ifdef _MT HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, (UINT (WINAPI*)(void*))StartProc, this, 0, (UINT*)&dwThreadID); #else HANDLE hThread = ::CreateThread(NULL, 0, StartProc, (void*)this, 0, &dwThreadID); #endif if (hThread == NULL) return false; ::CloseHandle(hThread); return true; } // Implementation static DWORD WINAPI StartProc(void* p) { CPrintJob* pThis = (CPrintJob*)p; pThis->StartHelper(); pThis->m_bComplete = true; return 0; } bool StartHelper() { CDC dcPrinter; dcPrinter.Attach(m_printer.CreatePrinterDC(m_pDefDevMode)); if (dcPrinter.IsNull()) return false; m_nJobID = ::StartDoc(dcPrinter, &m_docinfo); if (m_nJobID <= 0) return false; m_pInfo->BeginPrintJob(dcPrinter); // print all the pages now unsigned long nLastPage = 0; for (unsigned long nPage = m_nStartPage; nPage <= m_nEndPage; nPage++) { if (!m_pInfo->IsValidPage(nPage)) break; DEVMODE* pdm = m_pInfo->GetNewDevModeForPage(nLastPage, nPage); if (pdm != NULL) dcPrinter.ResetDC(pdm); dcPrinter.StartPage(); m_pInfo->PrePrintPage(nPage, dcPrinter); if (!m_pInfo->PrintPage(nPage, dcPrinter)) m_bCancel = true; m_pInfo->PostPrintPage(nPage, dcPrinter); dcPrinter.EndPage(); if (m_bCancel) break; nLastPage = nPage; } m_pInfo->EndPrintJob(dcPrinter, m_bCancel); if (m_bCancel) ::AbortDoc(dcPrinter); else ::EndDoc(dcPrinter); m_nJobID = 0; return true; } // Cancels a print job. Can be called asynchronously. void CancelPrintJob() { m_bCancel = true; } }; /////////////////////////////////////////////////////////////////////////////// // CPrintPreview - Adds print preview support to an existing window class CPrintPreview { public: // Data members IPrintJobInfo* m_pInfo; CPrinterHandle m_printer; CEnhMetaFile m_meta; DEVMODE* m_pDefDevMode; DEVMODE* m_pCurDevMode; SIZE m_sizeCurPhysOffset; // Implementation - data int m_nCurPage; // Constructor CPrintPreview() : m_pInfo(NULL), m_pDefDevMode(NULL), m_pCurDevMode(NULL), m_nCurPage(0) { m_sizeCurPhysOffset.cx = 0; m_sizeCurPhysOffset.cy = 0; } // Operations void SetPrintPreviewInfo(HANDLE hPrinter, DEVMODE* pDefaultDevMode, IPrintJobInfo* pji) { m_printer.Attach(hPrinter); m_pDefDevMode = pDefaultDevMode; m_pInfo = pji; m_nCurPage = 0; m_pCurDevMode = NULL; } void SetEnhMetaFile(HENHMETAFILE hEMF) { m_meta = hEMF; } void SetPage(int nPage) { if (!m_pInfo->IsValidPage(nPage)) return; m_nCurPage = nPage; m_pCurDevMode = m_pInfo->GetNewDevModeForPage(0, nPage); if (m_pCurDevMode == NULL) m_pCurDevMode = m_pDefDevMode; CDC dcPrinter = m_printer.CreatePrinterDC(m_pCurDevMode); int iWidth = dcPrinter.GetDeviceCaps(PHYSICALWIDTH); int iHeight = dcPrinter.GetDeviceCaps(PHYSICALHEIGHT); int nLogx = dcPrinter.GetDeviceCaps(LOGPIXELSX); int nLogy = dcPrinter.GetDeviceCaps(LOGPIXELSY); RECT rcMM = { 0, 0, ::MulDiv(iWidth, 2540, nLogx), ::MulDiv(iHeight, 2540, nLogy) }; m_sizeCurPhysOffset.cx = dcPrinter.GetDeviceCaps(PHYSICALOFFSETX); m_sizeCurPhysOffset.cy = dcPrinter.GetDeviceCaps(PHYSICALOFFSETY); CEnhMetaFileDC dcMeta(dcPrinter, &rcMM); m_pInfo->PrePrintPage(nPage, dcMeta); m_pInfo->PrintPage(nPage, dcMeta); m_pInfo->PostPrintPage(nPage, dcMeta); m_meta.Attach(dcMeta.Close()); } void GetPageRect(RECT& rc, LPRECT prc) { int x1 = rc.right-rc.left; int y1 = rc.bottom - rc.top; if ((x1 < 0) || (y1 < 0)) return; CEnhMetaFileInfo emfinfo(m_meta); ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); if(pmh == NULL) { ATLASSERT(FALSE); return; } // Compute whether we are OK vertically or horizontally int x2 = pmh->szlDevice.cx; int y2 = pmh->szlDevice.cy; int y1p = MulDiv(x1, y2, x2); int x1p = MulDiv(y1, x2, y2); ATLASSERT((x1p <= x1) || (y1p <= y1)); if (x1p <= x1) { prc->left = rc.left + (x1 - x1p) / 2; prc->right = prc->left + x1p; prc->top = rc.top; prc->bottom = rc.bottom; } else { prc->left = rc.left; prc->right = rc.right; prc->top = rc.top + (y1 - y1p) / 2; prc->bottom = prc->top + y1p; } } // Painting helpers void DoPaint(CDCHandle dc) { // this one is not used } void DoPaint(CDCHandle dc, RECT& rc) { CEnhMetaFileInfo emfinfo(m_meta); ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); if(pmh == NULL) { ATLASSERT(FALSE); return; } int nOffsetX = MulDiv(m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); int nOffsetY = MulDiv(m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); dc.OffsetWindowOrg(-nOffsetX, -nOffsetY); dc.PlayMetaFile(m_meta, &rc); } }; /////////////////////////////////////////////////////////////////////////////// // CPrintPreviewWindow - Implements a print preview window template class ATL_NO_VTABLE CPrintPreviewWindowImpl : public ATL::CWindowImpl, public CPrintPreview { public: DECLARE_WND_CLASS_EX2(NULL, T, CS_VREDRAW | CS_HREDRAW, -1) enum { m_cxOffset = 10, m_cyOffset = 10 }; // Constructor CPrintPreviewWindowImpl() : m_nMinPage(0), m_nMaxPage(0) { } // Operations void SetPrintPreviewInfo(HANDLE hPrinter, DEVMODE* pDefaultDevMode, IPrintJobInfo* pji, int nMinPage, int nMaxPage) { CPrintPreview::SetPrintPreviewInfo(hPrinter, pDefaultDevMode, pji); m_nMinPage = nMinPage; m_nMaxPage = nMaxPage; } bool NextPage() { if (m_nCurPage == m_nMaxPage) return false; SetPage(m_nCurPage + 1); this->Invalidate(); return true; } bool PrevPage() { if (m_nCurPage == m_nMinPage) return false; if (m_nCurPage == 0) return false; SetPage(m_nCurPage - 1); this->Invalidate(); return true; } // Message map and handlers BEGIN_MSG_MAP(CPrintPreviewWindowImpl) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) END_MSG_MAP() LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return 1; // no need for the background } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); RECT rc = {}; if(wParam != NULL) { pT->DoPrePaint((HDC)wParam, rc); pT->DoPaint((HDC)wParam, rc); } else { CPaintDC dc(this->m_hWnd); pT->DoPrePaint(dc.m_hDC, rc); pT->DoPaint(dc.m_hDC, rc); } return 0; } // Painting helper void DoPrePaint(CDCHandle dc, RECT& rc) { RECT rcClient = {}; this->GetClientRect(&rcClient); RECT rcArea = rcClient; T* pT = static_cast(this); (void)pT; // avoid level 4 warning ::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset); if (rcArea.left > rcArea.right) rcArea.right = rcArea.left; if (rcArea.top > rcArea.bottom) rcArea.bottom = rcArea.top; GetPageRect(rcArea, &rc); CRgn rgn1, rgn2; rgn1.CreateRectRgnIndirect(&rc); rgn2.CreateRectRgnIndirect(&rcClient); rgn2.CombineRgn(rgn1, RGN_DIFF); dc.SelectClipRgn(rgn2); dc.FillRect(&rcClient, COLOR_BTNSHADOW); dc.SelectClipRgn(NULL); dc.FillRect(&rc, (HBRUSH)::GetStockObject(WHITE_BRUSH)); } // Implementation - data int m_nMinPage; int m_nMaxPage; }; class CPrintPreviewWindow : public CPrintPreviewWindowImpl { public: DECLARE_WND_CLASS_EX(_T("WTL_PrintPreview"), CS_VREDRAW | CS_HREDRAW, -1) }; /////////////////////////////////////////////////////////////////////////////// // CZoomPrintPreviewWindowImpl - Implements print preview window with zooming #ifdef __ATLSCRL_H__ template class ATL_NO_VTABLE CZoomPrintPreviewWindowImpl : public CPrintPreviewWindowImpl< T, TBase, TWinTraits >, public CZoomScrollImpl< T > { public: bool m_bSized; CZoomPrintPreviewWindowImpl() { this->SetScrollExtendedStyle(SCRL_DISABLENOSCROLL); InitZoom(); } // should be called to reset data members before recreating window void InitZoom() { m_bSized = false; this->m_nZoomMode = ZOOMMODE_OFF; this->m_fZoomScaleMin = 1.0; this->m_fZoomScale = 1.0; } BEGIN_MSG_MAP(CZoomPrintPreviewWindowImpl) MESSAGE_HANDLER(WM_SETCURSOR, CZoomScrollImpl< T >::OnSetCursor) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown) MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove) MESSAGE_HANDLER(WM_LBUTTONUP, CZoomScrollImpl< T >::OnLButtonUp) MESSAGE_HANDLER(WM_CAPTURECHANGED, CZoomScrollImpl< T >::OnCaptureChanged) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) END_MSG_MAP() LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { SIZE sizeClient = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; POINT ptOffset = this->m_ptOffset; SIZE sizeAll = this->m_sizeAll; this->SetScrollSize(sizeClient); if(sizeAll.cx > 0) ptOffset.x = ::MulDiv(ptOffset.x, this->m_sizeAll.cx, sizeAll.cx); if(sizeAll.cy > 0) ptOffset.y = ::MulDiv(ptOffset.y, this->m_sizeAll.cy, sizeAll.cy); this->SetScrollOffset(ptOffset); CScrollImpl< T >::OnSize(uMsg, wParam, lParam, bHandled); if(!m_bSized) { m_bSized = true; T* pT = static_cast(this); pT->ShowScrollBar(SB_HORZ, TRUE); pT->ShowScrollBar(SB_VERT, TRUE); } return 0; } LRESULT OnEraseBkgnd(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return 1; } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); RECT rc = {}; if(wParam != NULL) { CDCHandle dc = (HDC)wParam; int nMapModeSav = dc.GetMapMode(); dc.SetMapMode(MM_ANISOTROPIC); SIZE szWindowExt = { 0, 0 }; dc.SetWindowExt(this->m_sizeLogAll, &szWindowExt); SIZE szViewportExt = { 0, 0 }; dc.SetViewportExt(this->m_sizeAll, &szViewportExt); POINT ptViewportOrg = { 0, 0 }; dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y, &ptViewportOrg); pT->DoPrePaint(dc, rc); pT->DoPaint(dc, rc); dc.SetMapMode(nMapModeSav); dc.SetWindowExt(szWindowExt); dc.SetViewportExt(szViewportExt); dc.SetViewportOrg(ptViewportOrg); } else { CPaintDC dc(pT->m_hWnd); pT->PrepareDC(dc.m_hDC); pT->DoPrePaint(dc.m_hDC, rc); pT->DoPaint(dc.m_hDC, rc); } return 0; } // Painting helpers void DoPaint(CDCHandle dc) { // this one is not used } void DoPrePaint(CDCHandle dc, RECT& rc) { RECT rcClient = {}; this->GetClientRect(&rcClient); RECT rcArea = rcClient; T* pT = static_cast(this); (void)pT; // avoid level 4 warning ::InflateRect(&rcArea, -pT->m_cxOffset, -pT->m_cyOffset); if (rcArea.left > rcArea.right) rcArea.right = rcArea.left; if (rcArea.top > rcArea.bottom) rcArea.bottom = rcArea.top; this->GetPageRect(rcArea, &rc); HBRUSH hbrOld = dc.SelectBrush(::GetSysColorBrush(COLOR_BTNSHADOW)); dc.PatBlt(rcClient.left, rcClient.top, rc.left - rcClient.left, rcClient.bottom - rcClient.top, PATCOPY); dc.PatBlt(rc.left, rcClient.top, rc.right - rc.left, rc.top - rcClient.top, PATCOPY); dc.PatBlt(rc.right, rcClient.top, rcClient.right - rc.right, rcClient.bottom - rcClient.top, PATCOPY); dc.PatBlt(rc.left, rc.bottom, rc.right - rc.left, rcClient.bottom - rc.bottom, PATCOPY); dc.SelectBrush((HBRUSH)::GetStockObject(WHITE_BRUSH)); dc.PatBlt(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY); dc.SelectBrush(::GetSysColorBrush(COLOR_3DDKSHADOW)); dc.PatBlt(rc.right, rc.top + 4, 4, rc.bottom - rc.top, PATCOPY); dc.PatBlt(rc.left + 4, rc.bottom, rc.right - rc.left, 4, PATCOPY); dc.SelectBrush(hbrOld); } void DoPaint(CDCHandle dc, RECT& rc) { CEnhMetaFileInfo emfinfo(this->m_meta); ENHMETAHEADER* pmh = emfinfo.GetEnhMetaFileHeader(); if(pmh == NULL) { ATLASSERT(FALSE); return; } int nOffsetX = MulDiv(this->m_sizeCurPhysOffset.cx, rc.right-rc.left, pmh->szlDevice.cx); int nOffsetY = MulDiv(this->m_sizeCurPhysOffset.cy, rc.bottom-rc.top, pmh->szlDevice.cy); dc.OffsetWindowOrg(-nOffsetX, -nOffsetY); dc.PlayMetaFile(this->m_meta, &rc); } }; class CZoomPrintPreviewWindow : public CZoomPrintPreviewWindowImpl { public: DECLARE_WND_CLASS_EX(_T("WTL_ZoomPrintPreview"), CS_VREDRAW | CS_HREDRAW, -1) }; #endif // __ATLSCRL_H__ } // namespace WTL #endif // __ATLPRINT_H__ ================================================ FILE: third_party/WTL/Include/atlres.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLRES_H__ #define __ATLRES_H__ #pragma once #ifdef RC_INVOKED #ifndef _INC_WINDOWS #define _INC_WINDOWS #define VS_VERSION_INFO 1 #ifdef APSTUDIO_INVOKED #define APSTUDIO_HIDDEN_SYMBOLS // Ignore following symbols #endif // APSTUDIO_INVOKED #ifndef WINVER #define WINVER 0x0500 #endif // !WINVER #include // operation messages sent to DLGINIT #define LB_ADDSTRING (WM_USER+1) #define CB_ADDSTRING (WM_USER+3) #ifdef APSTUDIO_INVOKED #undef APSTUDIO_HIDDEN_SYMBOLS #endif // APSTUDIO_INVOKED #ifdef IDC_STATIC #undef IDC_STATIC #endif // IDC_STATIC #define IDC_STATIC (-1) #endif // !_INC_WINDOWS #endif // RC_INVOKED #ifdef APSTUDIO_INVOKED #define APSTUDIO_HIDDEN_SYMBOLS #endif // APSTUDIO_INVOKED /////////////////////////////////////////////////////////////////////////////// // ATL resource types #ifndef RC_INVOKED #define RT_DLGINIT MAKEINTRESOURCE(240) #define RT_TOOLBAR MAKEINTRESOURCE(241) #endif // RC_INVOKED /////////////////////////////////////////////////////////////////////////////// #ifdef APSTUDIO_INVOKED #undef APSTUDIO_HIDDEN_SYMBOLS #endif // APSTUDIO_INVOKED /////////////////////////////////////////////////////////////////////////////// // Standard window components #define ID_SEPARATOR 0 // special separator value #define ID_DEFAULT_PANE 0 // default status bar pane #ifndef RC_INVOKED // code only // standard control bars (IDW = window ID) #define ATL_IDW_TOOLBAR 0xE800 // main Toolbar for window #define ATL_IDW_STATUS_BAR 0xE801 // Status bar window #define ATL_IDW_COMMAND_BAR 0xE802 // Command bar window // parts of a frame window #define ATL_IDW_CLIENT 0xE900 #define ATL_IDW_PANE_FIRST 0xE900 // first pane (256 max) #define ATL_IDW_PANE_LAST 0xE9FF #define ATL_IDW_HSCROLL_FIRST 0xEA00 // first Horz scrollbar (16 max) #define ATL_IDW_VSCROLL_FIRST 0xEA10 // first Vert scrollbar (16 max) #define ATL_IDW_SIZE_BOX 0xEA20 // size box for splitters #define ATL_IDW_PANE_SAVE 0xEA21 // to shift ATL_IDW_PANE_FIRST // bands for a rebar #define ATL_IDW_BAND_FIRST 0xEB00 #define ATL_IDW_BAND_LAST 0xEBFF #endif // !RC_INVOKED /////////////////////////////////////////////////////////////////////////////// // Standard Commands // File commands #define ID_FILE_NEW 0xE100 #define ID_FILE_OPEN 0xE101 #define ID_FILE_CLOSE 0xE102 #define ID_FILE_SAVE 0xE103 #define ID_FILE_SAVE_AS 0xE104 #define ID_FILE_PAGE_SETUP 0xE105 #define ID_FILE_PRINT_SETUP 0xE106 #define ID_FILE_PRINT 0xE107 #define ID_FILE_PRINT_DIRECT 0xE108 #define ID_FILE_PRINT_PREVIEW 0xE109 #define ID_FILE_UPDATE 0xE10A #define ID_FILE_SAVE_COPY_AS 0xE10B #define ID_FILE_SEND_MAIL 0xE10C #define ID_FILE_MRU_FIRST 0xE110 #define ID_FILE_MRU_FILE1 0xE110 // range - 16 max #define ID_FILE_MRU_FILE2 0xE111 #define ID_FILE_MRU_FILE3 0xE112 #define ID_FILE_MRU_FILE4 0xE113 #define ID_FILE_MRU_FILE5 0xE114 #define ID_FILE_MRU_FILE6 0xE115 #define ID_FILE_MRU_FILE7 0xE116 #define ID_FILE_MRU_FILE8 0xE117 #define ID_FILE_MRU_FILE9 0xE118 #define ID_FILE_MRU_FILE10 0xE119 #define ID_FILE_MRU_FILE11 0xE11A #define ID_FILE_MRU_FILE12 0xE11B #define ID_FILE_MRU_FILE13 0xE11C #define ID_FILE_MRU_FILE14 0xE11D #define ID_FILE_MRU_FILE15 0xE11E #define ID_FILE_MRU_FILE16 0xE11F #define ID_FILE_MRU_LAST 0xE11F // Edit commands #define ID_EDIT_CLEAR 0xE120 #define ID_EDIT_CLEAR_ALL 0xE121 #define ID_EDIT_COPY 0xE122 #define ID_EDIT_CUT 0xE123 #define ID_EDIT_FIND 0xE124 #define ID_EDIT_PASTE 0xE125 #define ID_EDIT_PASTE_LINK 0xE126 #define ID_EDIT_PASTE_SPECIAL 0xE127 #define ID_EDIT_REPEAT 0xE128 #define ID_EDIT_REPLACE 0xE129 #define ID_EDIT_SELECT_ALL 0xE12A #define ID_EDIT_UNDO 0xE12B #define ID_EDIT_REDO 0xE12C #define ID_EDIT_DELETE ID_EDIT_CLEAR #define ID_EDIT_FIND_NEXT ID_EDIT_REPEAT #define ID_EDIT_FIND_PREVIOUS 0xE12D // Window commands #define ID_WINDOW_NEW 0xE130 #define ID_WINDOW_ARRANGE 0xE131 #define ID_WINDOW_CASCADE 0xE132 #define ID_WINDOW_TILE_HORZ 0xE133 #define ID_WINDOW_TILE_VERT 0xE134 #define ID_WINDOW_SPLIT 0xE135 #ifndef RC_INVOKED // code only #define ATL_IDM_WINDOW_FIRST 0xE130 #define ATL_IDM_WINDOW_LAST 0xE13F #define ATL_IDM_FIRST_MDICHILD 0xFF00 // window list starts here #define ATL_IDM_LAST_MDICHILD 0xFFFD #endif // !RC_INVOKED // TabView #define ID_WINDOW_TABFIRST 0xFF00 // = ATL_IDM_FIRST_MDICHILD #define ID_WINDOW_TABLAST 0xFFFD #define ID_WINDOW_SHOWTABLIST 0xFFFE // Help and App commands #define ID_APP_ABOUT 0xE140 #define ID_APP_EXIT 0xE141 #define ID_HELP_INDEX 0xE142 #define ID_HELP_FINDER 0xE143 #define ID_HELP_USING 0xE144 #define ID_CONTEXT_HELP 0xE145 // shift-F1 // special commands for processing help #define ID_HELP 0xE146 // first attempt for F1 #define ID_DEFAULT_HELP 0xE147 // last attempt // Misc #define ID_NEXT_PANE 0xE150 #define ID_PREV_PANE 0xE151 #define ID_PANE_CLOSE 0xE152 #define ID_PANE_NEXT ID_NEXT_PANE #define ID_PANE_PREVIOUS ID_PREV_PANE // Format #define ID_FORMAT_FONT 0xE160 // Scroll #define ID_SCROLL_UP 0xE170 #define ID_SCROLL_DOWN 0xE171 #define ID_SCROLL_PAGE_UP 0xE172 #define ID_SCROLL_PAGE_DOWN 0xE173 #define ID_SCROLL_TOP 0xE174 #define ID_SCROLL_BOTTOM 0xE175 #define ID_SCROLL_LEFT 0xE176 #define ID_SCROLL_RIGHT 0xE177 #define ID_SCROLL_PAGE_LEFT 0xE178 #define ID_SCROLL_PAGE_RIGHT 0xE179 #define ID_SCROLL_ALL_LEFT 0xE17A #define ID_SCROLL_ALL_RIGHT 0xE17B // OLE commands #define ID_OLE_INSERT_NEW 0xE200 #define ID_OLE_EDIT_LINKS 0xE201 #define ID_OLE_EDIT_CONVERT 0xE202 #define ID_OLE_EDIT_CHANGE_ICON 0xE203 #define ID_OLE_EDIT_PROPERTIES 0xE204 #define ID_OLE_VERB_FIRST 0xE210 // range - 16 max #ifndef RC_INVOKED // code only #define ID_OLE_VERB_LAST 0xE21F #endif // !RC_INVOKED // View commands (same number used as IDW used for toolbar and status bar) #define ID_VIEW_TOOLBAR 0xE800 #define ID_VIEW_STATUS_BAR 0xE801 #define ID_VIEW_REFRESH 0xE803 #define ID_VIEW_RIBBON 0xE804 /////////////////////////////////////////////////////////////////////////////// // Standard control IDs #ifdef IDC_STATIC #undef IDC_STATIC #endif // IDC_STATIC #define IDC_STATIC (-1) // all static controls /////////////////////////////////////////////////////////////////////////////// // Standard string error/warnings // idle status bar message #define ATL_IDS_IDLEMESSAGE 0xE001 #ifndef RC_INVOKED // code only #define ATL_IDS_SCFIRST 0xEF00 #endif // !RC_INVOKED #define ATL_IDS_SCSIZE 0xEF00 #define ATL_IDS_SCMOVE 0xEF01 #define ATL_IDS_SCMINIMIZE 0xEF02 #define ATL_IDS_SCMAXIMIZE 0xEF03 #define ATL_IDS_SCNEXTWINDOW 0xEF04 #define ATL_IDS_SCPREVWINDOW 0xEF05 #define ATL_IDS_SCCLOSE 0xEF06 #define ATL_IDS_SCRESTORE 0xEF12 #define ATL_IDS_SCTASKLIST 0xEF13 #define ATL_IDS_MDICHILD 0xEF1F #define ATL_IDS_MRU_FILE 0xEFDA /////////////////////////////////////////////////////////////////////////////// // Misc. control IDs // Property Sheet control id's (determined with Spy++) #define ID_APPLY_NOW 0x3021 #define ID_WIZBACK 0x3023 #define ID_WIZNEXT 0x3024 #define ID_WIZFINISH 0x3025 #define ATL_IDC_TAB_CONTROL 0x3020 #endif // __ATLRES_H__ ================================================ FILE: third_party/WTL/Include/atlribbon.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLRIBBON_H__ #define __ATLRIBBON_H__ #pragma once #if (_MSC_VER < 1500) #error atlribbon.h requires Visual C++ 2008 compiler or higher #endif #ifndef _UNICODE #error atlribbon.h requires the Unicode character set #endif #if !defined(NTDDI_WIN7) || (NTDDI_VERSION < NTDDI_WIN7) #error atlribbon.h requires the Windows 7 SDK or higher #endif #ifndef __ATLAPP_H__ #error atlribbon.h requires atlapp.h to be included first #endif #include // for RecentDocumentList classes #include // for Frame and UpdateUI classes #include // required for atlctrlw.h #include // for CCommandBarCtrl #ifndef __ATLSTR_H__ #pragma warning(push) #pragma warning(disable: 4530) // unwind semantics not enabled #include #pragma warning(pop) #endif #include #pragma comment(lib, "dwmapi.lib") #include "UIRibbon.h" #include "UIRibbonPropertyHelpers.h" #pragma comment(lib, "propsys.lib") #include // for CHARFORMAT2 /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CRibbonUpdateUI : Automatic mapping of ribbon UI elements // // RibbonUI::Text // RibbonUI::CharFormat // RibbonUI::ICtrl // RibbonUI::CtrlImpl // RibbonUI::CommandCtrlImpl // RibbonUI::ItemProperty // RibbonUI::CollectionImplBase // RibbonUI::CollectionImpl // RibbonUI::TextCollectionImpl // RibbonUI::ItemCollectionImpl // RibbonUI::ComboCollectionImpl // RibbonUI::CommandCollectionImpl // RibbonUI::ToolbarCollectionImpl // RibbonUI::SimpleCollectionImpl // RibbonUI::CollectionCtrlImpl // RibbonUI::ToolbarGalleryCtrlImpl // RibbonUI::SimpleCollectionCtrlImpl // RibbonUI::RecentItemsCtrlImpl // RibbonUI::FontCtrlImpl // RibbonUI::ColorCtrlImpl // RibbonUI::SpinnerCtrlImpl // // RibbonUI::CRibbonImpl // CRibbonImpl::CRibbonComboCtrl // CRibbonImpl::CRibbonItemGalleryCtrl // CRibbonImpl::CRibbonCommandGalleryCtrl // CRibbonImpl::CRibbonToolbarGalleryCtrl // CRibbonImpl::CRibbonSimpleComboCtrl // CRibbonImpl::CRibbonSimpleGalleryCtrl // CRibbonImpl::CRibbonRecentItemsCtrl // CRibbonImpl::CRibbonColorCtrl // CRibbonImpl::CRibbonFontCtrl // CRibbonImpl::CRibbonSpinnerCtrl // CRibbonImpl::CRibbonFloatSpinnerCtrl // CRibbonImpl::CRibbonCommandCtrl // // CRibbonFrameWindowImplBase // CRibbonFrameWindowImpl // CRibbonMDIFrameWindowImpl // CRibbonPersist // // Global functions: // RibbonUI::SetPropertyVal() // RibbonUI::GetImage() // Constants #ifndef RIBBONUI_MAX_TEXT #define RIBBONUI_MAX_TEXT 128 #endif #define TWIPS_PER_POINT 20 // For font size namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CRibbonUpdateUI : Automatic mapping of ribbon UI elements template class CRibbonUpdateUI : public CAutoUpdateUI { public: enum { UPDUI_RIBBON = 0x0080, UPDUI_PERSIST = 0x0020 }; bool IsRibbonElement(const CUpdateUIBase::_AtlUpdateUIMap& UIMap) { return (UIMap.m_wType & UPDUI_RIBBON) != 0; } bool IsRibbonID(UINT nID) { for(int i = 0; i < this->m_arrUIMap.GetSize(); i++) { if(this->m_arrUIMap[i].m_nID == nID) return IsRibbonElement(this->m_arrUIMap[i]); } return false; } // Element bool UIAddRibbonElement(UINT nID) { return this->UIAddElement(nID); } bool UIRemoveRibbonElement(UINT nID) { return this->UIRemoveElement(nID); } bool UIPersistElement(UINT nID, bool bPersist = true) { return bPersist ? this->UIAddElement(nID) : this->UIRemoveElement(nID); } // methods for Ribbon elements BOOL UISetText(int nID, LPCWSTR sText, BOOL bForceUpdate = FALSE) { T* pT = static_cast(this); BOOL bRes = CUpdateUIBase::UISetText(nID, sText, bForceUpdate); if (pT->IsRibbonUI() && IsRibbonID(nID)) bRes = SUCCEEDED(pT->InvalidateProperty(nID, UI_PKEY_Label)); return bRes; } BOOL UISetText(int nID, UINT uIdResource, BOOL bForceUpdate = FALSE) { ATL::CTempBuffer sText(RIBBONUI_MAX_TEXT); int nRet = ATL::AtlLoadString(uIdResource, sText, RIBBONUI_MAX_TEXT); if(nRet > 0) UISetText(nID, sText, bForceUpdate); return (nRet > 0) ? TRUE : FALSE; } LPCTSTR UIGetText(int nID) { T* pT = static_cast(this); LPCTSTR sUI = CAutoUpdateUI::UIGetText(nID); // replace 'tab' by 'space' for RibbonUI elements if (sUI && pT->IsRibbonUI() && IsRibbonID(nID) && wcschr(sUI, L'\t')) { static WCHAR sText[RIBBONUI_MAX_TEXT] = {}; wcscpy_s(sText, sUI); WCHAR* pch = wcschr(sText, L'\t'); if (pch != NULL) *pch = L' '; return sText; } else { return sUI; } } BOOL UIEnable(int nID, BOOL bEnable, BOOL bForceUpdate = FALSE) { T* pT = static_cast(this); BOOL bRes = CUpdateUIBase::UIEnable(nID, bEnable, bForceUpdate); if (pT->IsRibbonUI() && IsRibbonID(nID)) bRes = SUCCEEDED(pT->SetProperty((WORD)nID, UI_PKEY_Enabled, bEnable)); return bRes; } BOOL UISetCheck(int nID, INT nCheck, BOOL bForceUpdate = FALSE) { if ((nCheck == 0) || (nCheck == 1)) return UISetCheck(nID, nCheck != 0, bForceUpdate); else return CUpdateUIBase::UISetCheck(nID, nCheck, bForceUpdate); } BOOL UISetCheck(int nID, bool bCheck, BOOL bForceUpdate = FALSE) { T* pT = static_cast(this); BOOL bRes = CUpdateUIBase::UISetCheck(nID, bCheck, bForceUpdate); if (bRes && pT->IsRibbonUI() && IsRibbonID(nID)) bRes = SUCCEEDED(pT->SetProperty((WORD)nID, UI_PKEY_BooleanValue, bCheck)); return bRes; } }; /////////////////////////////////////////////////////////////////////////////// // RibbonUI namespace // namespace RibbonUI { // Minimal string allocation support for various PROPERTYKEY values #ifdef __ATLSTR_H__ typedef ATL::CString Text; #else class Text : public std::wstring { public: Text(std::wstring& s) : std::wstring(s) { } Text(LPCWSTR s) : std::wstring(s) { } Text() { } bool IsEmpty() { return empty(); } operator LPCWSTR() { return c_str(); } Text& operator =(LPCWSTR s) { return static_cast(std::wstring::operator =(s)); } }; #endif // __ATLSTR_H__ // PROPERTYKEY enum and helpers enum k_KEY { // state k_Enabled = 1, k_BooleanValue = 200, // text properties k_LabelDescription = 2, k_Keytip = 3, k_Label = 4, k_TooltipDescription = 5, k_TooltipTitle = 6, // image properties k_LargeImage = 7, k_LargeHighContrastImage = 8, k_SmallImage = 9, k_SmallHighContrastImage = 10, // collection properties k_ItemsSource = 101, k_Categories = 102, k_SelectedItem = 104, // collection item properties k_CommandId = 100, k_CategoryId = 103, k_CommandType = 105, k_ItemImage = 106, // combo control property k_StringValue = 202, // spinner control properties k_DecimalValue = 201, k_MaxValue = 203, k_MinValue, k_Increment, k_DecimalPlaces, k_FormatString, k_RepresentativeString = 208, // font control properties k_FontProperties = 300, k_FontProperties_Family, k_FontProperties_Size, k_FontProperties_Bold, k_FontProperties_Italic = 304, k_FontProperties_Underline = 305, k_FontProperties_Strikethrough, k_FontProperties_VerticalPositioning, k_FontProperties_ForegroundColor = 308, k_FontProperties_BackgroundColor = 309, k_FontProperties_ForegroundColorType, k_FontProperties_BackgroundColorType, k_FontProperties_ChangedProperties = 312, k_FontProperties_DeltaSize = 313, // recent items properties k_RecentItems = 350, k_Pinned = 351, // color control properties k_Color = 400, k_ColorType = 401, k_ColorMode, k_ThemeColorsCategoryLabel = 403, k_StandardColorsCategoryLabel, k_RecentColorsCategoryLabel = 405, k_AutomaticColorLabel = 406, k_NoColorLabel = 407, k_MoreColorsLabel = 408, k_ThemeColors = 409, k_StandardColors = 410, k_ThemeColorsTooltips = 411, k_StandardColorsTooltips = 412, // Ribbon state k_Viewable = 1000, k_Minimized = 1001, k_QuickAccessToolbarDock = 1002, k_ContextAvailable = 1100, // Ribbon UI colors k_GlobalBackgroundColor = 2000, k_GlobalHighlightColor, k_GlobalTextColor = 2002 }; inline k_KEY k_(REFPROPERTYKEY key) { return (k_KEY)key.fmtid.Data1; } // PROPERTYKEY value assignment and specializations // template HRESULT SetPropertyVal(REFPROPERTYKEY key, V val, PROPVARIANT* ppv) { switch (k_(key)) { case k_Enabled: case k_BooleanValue: return InitPropVariantFromBoolean(val, ppv); default: return UIInitPropertyFromUInt32(key, val, ppv); } } inline HRESULT SetPropertyVal(REFPROPERTYKEY key, DOUBLE val, PROPVARIANT* ppv) { return SetPropertyVal(key, (LONG)val, ppv); } inline HRESULT SetPropertyVal(REFPROPERTYKEY key, IUIImage* val, PROPVARIANT* ppv) { HRESULT hr = UIInitPropertyFromImage(key, val, ppv); ATLVERIFY(val->Release() == 1); return hr; } inline HRESULT SetPropertyVal(REFPROPERTYKEY key, IUnknown* val, PROPVARIANT* ppv) { return UIInitPropertyFromInterface(key, val, ppv); } inline HRESULT SetPropertyVal(REFPROPERTYKEY key, IPropertyStore* val, PROPVARIANT* ppv) { return UIInitPropertyFromInterface(key, val, ppv); } inline HRESULT SetPropertyVal(REFPROPERTYKEY key, SAFEARRAY* val, PROPVARIANT* ppv) { return UIInitPropertyFromIUnknownArray(key, val, ppv); } inline HRESULT SetPropertyVal(REFPROPERTYKEY key, DECIMAL* val, PROPVARIANT* ppv) { return UIInitPropertyFromDecimal(key, *val, ppv); } inline HRESULT SetPropertyVal(REFPROPERTYKEY key, bool val, PROPVARIANT* ppv) { return UIInitPropertyFromBoolean(key, val, ppv); } inline HRESULT SetPropertyVal(REFPROPERTYKEY key, LPCWSTR val, PROPVARIANT* ppv) { return UIInitPropertyFromString(key, val, ppv); } // CharFormat helper struct for RibbonUI font control // struct CharFormat : CHARFORMAT2 { // Default constructor CharFormat() { cbSize = sizeof(CHARFORMAT2); Reset(); } // Copy constructor CharFormat(const CharFormat& cf) { this->CharFormat::CharFormat(); ::CopyMemory(this, &cf, sizeof(CharFormat)); } // Assign operator CharFormat& operator =(const CharFormat& cf) { ::CopyMemory(this, &cf, sizeof(CharFormat)); return (*this); } void Reset() { uValue = dwMask = dwEffects = 0; PropVariantInit(&propvar); } void operator <<(IPropertyStore* pStore) { if (pStore == NULL) { ATLASSERT(FALSE); return; } static void (CharFormat::*Getk_[])(IPropertyStore*) = { &CharFormat::Getk_Family, &CharFormat::Getk_FontProperties_Size, &CharFormat::Getk_MaskEffectBold, &CharFormat::Getk_MaskEffectItalic, &CharFormat::Getk_MaskEffectUnderline, &CharFormat::Getk_MaskEffectStrikeout, &CharFormat::Getk_VerticalPositioning, &CharFormat::Getk_Color, &CharFormat::Getk_ColorBack, &CharFormat::Getk_ColorType, &CharFormat::Getk_ColorTypeBack, }; DWORD nProps = 0; Reset(); ATLVERIFY(SUCCEEDED(pStore->GetCount(&nProps))); for (DWORD iProp = 0; iProp < nProps; iProp++) { PROPERTYKEY key; ATLVERIFY(SUCCEEDED(pStore->GetAt(iProp, &key))); ATLASSERT(k_(key) >= k_FontProperties_Family); if (k_(key) <= k_FontProperties_BackgroundColorType) (this->*Getk_[k_(key) - k_FontProperties_Family])(pStore); } } void operator >>(IPropertyStore* pStore) { if (pStore == NULL) { ATLASSERT(FALSE); return; } PutFace(pStore); PutSize(pStore); PutMaskEffect(CFM_BOLD, CFE_BOLD, UI_PKEY_FontProperties_Bold, pStore); PutMaskEffect(CFM_ITALIC, CFE_ITALIC, UI_PKEY_FontProperties_Italic, pStore); PutMaskEffect(CFM_UNDERLINE, CFE_UNDERLINE, UI_PKEY_FontProperties_Underline, pStore); PutMaskEffect(CFM_STRIKEOUT, CFE_STRIKEOUT, UI_PKEY_FontProperties_Strikethrough, pStore); PutVerticalPos(pStore); PutColor(pStore); PutBackColor(pStore); } private: PROPVARIANT propvar; UINT uValue; // Getk_ functions void Getk_Family(IPropertyStore* pStore) { if (SUCCEEDED(pStore->GetValue(UI_PKEY_FontProperties_Family, &propvar))) { PropVariantToString(propvar, szFaceName, LF_FACESIZE); if (*szFaceName) dwMask |= CFM_FACE; } } void Getk_FontProperties_Size(IPropertyStore* pStore) { if (SUCCEEDED(pStore->GetValue(UI_PKEY_FontProperties_Size, &propvar))) { DECIMAL decSize = {}; UIPropertyToDecimal(UI_PKEY_FontProperties_Size, propvar, &decSize); DOUBLE dSize = 0; VarR8FromDec(&decSize, &dSize); if (dSize > 0) { dwMask |= CFM_SIZE; yHeight = (LONG)(dSize * TWIPS_PER_POINT); } } } void Getk_MaskEffectBold(IPropertyStore* pStore) { Getk_MaskEffectAll(pStore, CFM_BOLD, CFE_BOLD, UI_PKEY_FontProperties_Bold); } void Getk_MaskEffectItalic(IPropertyStore* pStore) { Getk_MaskEffectAll(pStore, CFM_ITALIC, CFE_ITALIC, UI_PKEY_FontProperties_Italic); } void Getk_MaskEffectUnderline(IPropertyStore* pStore) { Getk_MaskEffectAll(pStore, CFM_UNDERLINE, CFE_UNDERLINE, UI_PKEY_FontProperties_Underline); } void Getk_MaskEffectStrikeout(IPropertyStore* pStore) { Getk_MaskEffectAll(pStore, CFM_STRIKEOUT, CFE_STRIKEOUT, UI_PKEY_FontProperties_Strikethrough); } void Getk_MaskEffectAll(IPropertyStore* pStore, DWORD _dwMask, DWORD _dwEffects, REFPROPERTYKEY key) { if (SUCCEEDED(pStore->GetValue(key, &propvar))) { UIPropertyToUInt32(key, propvar, &uValue); if ((UI_FONTPROPERTIES)uValue != UI_FONTPROPERTIES_NOTAVAILABLE) { dwMask |= _dwMask; dwEffects |= ((UI_FONTPROPERTIES)uValue == UI_FONTPROPERTIES_SET) ? _dwEffects : 0; } } } void Getk_VerticalPositioning(IPropertyStore* pStore) { if (SUCCEEDED(pStore->GetValue(UI_PKEY_FontProperties_VerticalPositioning, &propvar))) { UIPropertyToUInt32(UI_PKEY_FontProperties_VerticalPositioning, propvar, &uValue); UI_FONTVERTICALPOSITION uVerticalPosition = (UI_FONTVERTICALPOSITION) uValue; if ((uVerticalPosition != UI_FONTVERTICALPOSITION_NOTAVAILABLE)) { dwMask |= (CFM_SUPERSCRIPT | CFM_SUBSCRIPT); if (uVerticalPosition != UI_FONTVERTICALPOSITION_NOTSET) { dwEffects |= (uVerticalPosition == UI_FONTVERTICALPOSITION_SUPERSCRIPT) ? CFE_SUPERSCRIPT : CFE_SUBSCRIPT; } } } } void Getk_Color(IPropertyStore* pStore) { Getk_ColorAll(pStore, CFM_COLOR, UI_PKEY_FontProperties_ForegroundColor); } void Getk_ColorBack(IPropertyStore* pStore) { Getk_ColorAll(pStore, CFM_BACKCOLOR, UI_PKEY_FontProperties_BackgroundColor); } void Getk_ColorAll(IPropertyStore* pStore, DWORD _dwMask, REFPROPERTYKEY key) { UINT32 color = 0; if (SUCCEEDED(pStore->GetValue(key, &propvar))) { UIPropertyToUInt32(key, propvar, &color); dwMask |= _dwMask; if (_dwMask == CFM_COLOR) crTextColor = color; else crBackColor = color; } } void Getk_ColorType(IPropertyStore* pStore) { Getk_ColorTypeAll(pStore, CFM_COLOR, CFE_AUTOCOLOR, UI_SWATCHCOLORTYPE_AUTOMATIC, UI_PKEY_FontProperties_ForegroundColor); } void Getk_ColorTypeBack(IPropertyStore* pStore) { Getk_ColorTypeAll(pStore, CFM_BACKCOLOR, CFE_AUTOBACKCOLOR, UI_SWATCHCOLORTYPE_NOCOLOR, UI_PKEY_FontProperties_BackgroundColor); } void Getk_ColorTypeAll(IPropertyStore* pStore, DWORD _dwMask, DWORD _dwEffects, UI_SWATCHCOLORTYPE _type, REFPROPERTYKEY key) { if (SUCCEEDED(pStore->GetValue(key, &propvar))) { UIPropertyToUInt32(key, propvar, &uValue); if (_type == (UI_SWATCHCOLORTYPE)uValue) { dwMask |= _dwMask; dwEffects |= _dwEffects; } } } // Put functions void PutMaskEffect(WORD dwMaskVal, WORD dwEffectVal, REFPROPERTYKEY key, IPropertyStore* pStore) { PROPVARIANT var; UI_FONTPROPERTIES uProp = UI_FONTPROPERTIES_NOTAVAILABLE; if ((dwMask & dwMaskVal) != 0) uProp = dwEffects & dwEffectVal ? UI_FONTPROPERTIES_SET : UI_FONTPROPERTIES_NOTSET; SetPropertyVal(key, uProp, &var); pStore->SetValue(key, var); } void PutVerticalPos(IPropertyStore* pStore) { PROPVARIANT var; UI_FONTVERTICALPOSITION uProp = UI_FONTVERTICALPOSITION_NOTAVAILABLE; if ((dwMask & CFE_SUBSCRIPT) != 0) { if ((dwMask & CFM_SUBSCRIPT) && (dwEffects & CFE_SUBSCRIPT)) uProp = UI_FONTVERTICALPOSITION_SUBSCRIPT; else uProp = UI_FONTVERTICALPOSITION_SUPERSCRIPT; } else if ((dwMask & CFM_OFFSET) != 0) { if (yOffset > 0) uProp = UI_FONTVERTICALPOSITION_SUPERSCRIPT; else if (yOffset < 0) uProp = UI_FONTVERTICALPOSITION_SUBSCRIPT; } SetPropertyVal(UI_PKEY_FontProperties_VerticalPositioning, uProp, &var); pStore->SetValue(UI_PKEY_FontProperties_VerticalPositioning, var); } void PutFace(IPropertyStore* pStore) { PROPVARIANT var; SetPropertyVal(UI_PKEY_FontProperties_Family, dwMask & CFM_FACE ? szFaceName : L"", &var); pStore->SetValue(UI_PKEY_FontProperties_Family, var); } void PutSize(IPropertyStore* pStore) { PROPVARIANT var; DECIMAL decVal; if ((dwMask & CFM_SIZE) != 0) VarDecFromR8((DOUBLE)yHeight / TWIPS_PER_POINT, &decVal); else VarDecFromI4(0, &decVal); SetPropertyVal(UI_PKEY_FontProperties_Size, &decVal, &var); pStore->SetValue(UI_PKEY_FontProperties_Size, var); } void PutColor(IPropertyStore* pStore) { if ((dwMask & CFM_COLOR) != 0) { if ((dwEffects & CFE_AUTOCOLOR) == 0) { SetPropertyVal(UI_PKEY_FontProperties_ForegroundColorType, UI_SWATCHCOLORTYPE_RGB, &propvar); pStore->SetValue(UI_PKEY_FontProperties_ForegroundColorType, propvar); SetPropertyVal(UI_PKEY_FontProperties_ForegroundColor, crTextColor, &propvar); pStore->SetValue(UI_PKEY_FontProperties_ForegroundColor, propvar); } else { SetPropertyVal(UI_PKEY_FontProperties_ForegroundColorType, UI_SWATCHCOLORTYPE_AUTOMATIC, &propvar); pStore->SetValue(UI_PKEY_FontProperties_ForegroundColorType, propvar); } } } void PutBackColor(IPropertyStore* pStore) { if (((dwMask & CFM_BACKCOLOR) != 0) && ((dwEffects & CFE_AUTOBACKCOLOR) == 0)) { SetPropertyVal(UI_PKEY_FontProperties_BackgroundColorType, UI_SWATCHCOLORTYPE_RGB, &propvar); pStore->SetValue(UI_PKEY_FontProperties_BackgroundColorType, propvar); SetPropertyVal(UI_PKEY_FontProperties_BackgroundColor, crBackColor, &propvar); pStore->SetValue(UI_PKEY_FontProperties_BackgroundColor, propvar); } else { SetPropertyVal(UI_PKEY_FontProperties_BackgroundColorType, UI_SWATCHCOLORTYPE_NOCOLOR, &propvar); pStore->SetValue(UI_PKEY_FontProperties_BackgroundColorType, propvar); } } }; // IUIImage helper // inline IUIImage* GetImage(HBITMAP hbm, UI_OWNERSHIP owner) { ATLASSERT(hbm); IUIImage* pIUII = NULL; ATL::CComPtr pIFB; if SUCCEEDED(pIFB.CoCreateInstance(CLSID_UIRibbonImageFromBitmapFactory)) ATLVERIFY(SUCCEEDED(pIFB->CreateImage(hbm, owner, &pIUII))); return pIUII; } /////////////////////////////////////////////////////////////////////////////// // Ribbon control classes // RibbonUI::ICtrl abstract interface of RibbonUI::CRibbonImpl and all RibbonUI control classes // struct ICtrl { virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCommandExecutionProperties) = 0; virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) = 0; }; // RibbonUI::CtrlImpl base class for all ribbon controls // template class ATL_NO_VTABLE CtrlImpl : public ICtrl { protected: T* m_pWndRibbon; public: typedef T WndRibbon; CtrlImpl() : m_pWndRibbon(T::pWndRibbon) { } virtual ~CtrlImpl() { } WndRibbon& GetWndRibbon() { return *m_pWndRibbon; } static WORD GetID() { return t_ID; } Text m_sTxt[5]; // Operations HRESULT Invalidate() { return GetWndRibbon().InvalidateCtrl(GetID()); } HRESULT Invalidate(REFPROPERTYKEY key, UI_INVALIDATIONS flags = UI_INVALIDATIONS_PROPERTY) { return GetWndRibbon().InvalidateProperty(GetID(), key, flags); } HRESULT SetText(REFPROPERTYKEY key, LPCWSTR sTxt, bool bUpdate = false) { ATLASSERT((k_(key) <= k_TooltipTitle) && (k_(key) >= k_LabelDescription)); m_sTxt[k_(key) - k_LabelDescription] = sTxt; return bUpdate ? GetWndRibbon().InvalidateProperty(GetID(), key) : S_OK; } // Implementation template HRESULT SetProperty(REFPROPERTYKEY key, V val) { return GetWndRibbon().SetProperty(GetID(), key, val); } HRESULT OnGetText(REFPROPERTYKEY key, PROPVARIANT* ppv) { ATLASSERT((k_(key) <= k_TooltipTitle) && (k_(key) >= k_LabelDescription)); const INT iText = k_(key) - k_LabelDescription; if (m_sTxt[iText].IsEmpty()) if (LPCWSTR sText = GetWndRibbon().OnRibbonQueryText(GetID(), key)) m_sTxt[iText] = sText; return !m_sTxt[iText].IsEmpty() ? SetPropertyVal(key, (LPCWSTR)m_sTxt[iText], ppv) : S_OK; } virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCommandExecutionProperties) { ATLASSERT(nCmdID == t_ID); return GetWndRibbon().DoExecute(nCmdID, verb, key, ppropvarValue, pCommandExecutionProperties); } virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { ATLASSERT(nCmdID == t_ID); const INT iMax = k_TooltipTitle - k_LabelDescription; const INT iVal = k_(key) - k_LabelDescription; return (iVal <= iMax) && (iVal >= 0) ? OnGetText(key, ppropvarNewValue) : GetWndRibbon().DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); } }; // CommandCtrlImpl base class for most ribbon controls // template class CommandCtrlImpl : public CtrlImpl { public: CBitmap m_hbm[4]; HRESULT SetImage(REFPROPERTYKEY key, HBITMAP hbm, bool bUpdate = false) { ATLASSERT((k_(key) <= k_SmallHighContrastImage) && (k_(key) >= k_LargeImage)); m_hbm[k_(key) - k_LargeImage].Attach(hbm); return bUpdate ? this->GetWndRibbon().InvalidateProperty(this->GetID(), key) : S_OK; } HRESULT OnGetImage(REFPROPERTYKEY key, PROPVARIANT* ppv) { ATLASSERT((k_(key) <= k_SmallHighContrastImage) && (k_(key) >= k_LargeImage)); const INT iImage = k_(key) - k_LargeImage; if (m_hbm[iImage].IsNull()) m_hbm[iImage] = this->GetWndRibbon().OnRibbonQueryImage(this->GetID(), key); return m_hbm[iImage].IsNull() ? E_NOTIMPL : SetPropertyVal(key, GetImage(m_hbm[iImage], UI_OWNERSHIP_COPY), ppv); } virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { ATLASSERT (nCmdID == this->GetID()); return (k_(key) <= k_SmallHighContrastImage) && (k_(key) >= k_LargeImage) ? OnGetImage(key, ppropvarNewValue) : CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); } }; /////////////////////////////////////////////////////////////////////////////// // Ribbon collection base classes // ItemProperty class: ribbon callback for each item in a collection // #pragma warning(push) #pragma warning(disable: 4512) // assignment operator could not be generated template class ItemProperty : public IUISimplePropertySet { public: ItemProperty(UINT i, TCollection* pCollection) : m_Index(i), m_pCollection(pCollection) { } const UINT m_Index; TCollection* m_pCollection; // IUISimplePropertySet method. STDMETHODIMP GetValue(REFPROPERTYKEY key, PROPVARIANT *value) { return m_pCollection->OnGetItem(m_Index, key, value); } // IUnknown methods. STDMETHODIMP_(ULONG) AddRef() { return 1; } STDMETHODIMP_(ULONG) Release() { return 1; } STDMETHODIMP QueryInterface(REFIID iid, void** ppv) { if ((iid == __uuidof(IUnknown)) || (iid == __uuidof(IUISimplePropertySet))) { *ppv = this; return S_OK; } else { return E_NOINTERFACE; } } }; #pragma warning(pop) // CollectionImplBase: base class for all RibbonUI collections // template class CollectionImplBase { typedef CollectionImplBase thisClass; public: CollectionImplBase() { memset(&m_apItems, 0, sizeof(m_apItems)); for (int i = 0; i < t_size; i++) m_apItems[i] = new ItemProperty(i, static_cast(this)); } ~CollectionImplBase() { for (int i = 0; i < t_size; i++) delete m_apItems[i]; } // Data members ItemProperty* m_apItems[t_size]; }; // CollectionImpl: handles categories and collecton resizing // template class CollectionImpl : public CollectionImplBase, t_items + t_categories> { typedef CollectionImpl thisClass; public: typedef thisClass Collection; CollectionImpl() : m_size(t_items) { ::FillMemory(m_auItemCat, sizeof(m_auItemCat), 0xff); // UI_COLLECTION_INVALIDINDEX } UINT32 m_auItemCat[t_items]; Text m_asCatName[__max(t_categories, 1)]; size_t m_size; // Operations HRESULT SetItemCategory(UINT uItem, UINT uCat, bool bUpdate = false) { ATLASSERT((uItem < t_items) && (uCat < t_categories)); m_auItemCat[uItem] = uCat; return bUpdate ? InvalidateItems() : S_OK; } HRESULT SetCategoryText(UINT uCat, LPCWSTR sText, bool bUpdate = false) { ATLASSERT(uCat < t_categories); m_asCatName[uCat] = sText; return bUpdate ? InvalidateCategories() : S_OK; } HRESULT Resize(size_t size, bool bUpdate = false) { ATLASSERT(size <= t_items); m_size = size; return bUpdate ? InvalidateItems() : S_OK; } // Implementation HRESULT OnGetItem(UINT uIndex, REFPROPERTYKEY key, PROPVARIANT *value) { ATLASSERT(uIndex < t_items + t_categories); TCtrl* pCtrl = static_cast(this); return uIndex < t_items ? pCtrl->DoGetItem(uIndex, key, value) : pCtrl->DoGetCategory(uIndex - t_items, key, value); } HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) { ATLASSERT(k_(key) == k_CategoryId); UINT32 uCat = UI_COLLECTION_INVALIDINDEX; if (t_categories != 0) { if (m_auItemCat[uItem] == UI_COLLECTION_INVALIDINDEX) { typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); m_auItemCat[uItem] = ribbon.OnRibbonQueryItemCategory(TCtrl::GetID(), uItem); } uCat = m_auItemCat[uItem]; } return SetPropertyVal(key, uCat, value); } HRESULT DoGetCategory(UINT uCat, REFPROPERTYKEY key, PROPVARIANT *value) { HRESULT hr = S_OK; switch (k_(key)) { case k_Label: if (m_asCatName[uCat].IsEmpty()) { typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); m_asCatName[uCat] = ribbon.OnRibbonQueryCategoryText(TCtrl::GetID(), uCat); } hr = SetPropertyVal(key, (LPCWSTR)m_asCatName[uCat], value); break; case k_CategoryId: hr = SetPropertyVal(key, uCat, value); break; default: ATLASSERT(FALSE); break; } return hr; } HRESULT InvalidateItems() { return static_cast(this)->Invalidate(UI_PKEY_ItemsSource); } HRESULT InvalidateCategories() { return static_cast(this)->Invalidate(UI_PKEY_Categories); } HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* /*ppropvarNewValue*/) { ATLASSERT(nCmdID == TCtrl::GetID()); (void)nCmdID; // avoid level 4 warning HRESULT hr = E_NOTIMPL; switch (k_(key)) { case k_ItemsSource: { ATL::CComQIPtr pIUICollection(ppropvarCurrentValue->punkVal); ATLASSERT(pIUICollection); hr = pIUICollection->Clear(); for (UINT i = 0; i < m_size; i++) { if FAILED(hr = pIUICollection->Add(this->m_apItems[i])) break; } ATLASSERT(SUCCEEDED(hr)); } break; case k_Categories: if (t_categories != 0) { ATL::CComQIPtr pIUICategory(ppropvarCurrentValue->punkVal); ATLASSERT(pIUICategory.p); hr = pIUICategory->Clear(); for (UINT i = t_items; i < (t_items + t_categories); i++) { if FAILED(hr = pIUICategory->Add(this->m_apItems[i])) break; } ATLASSERT(SUCCEEDED(hr)); } break; } return hr; } }; // TextCollectionImpl: handles item labels and selection // template class TextCollectionImpl : public CollectionImpl { typedef TextCollectionImpl thisClass; public: typedef thisClass TextCollection; TextCollectionImpl() : m_uSelected(UI_COLLECTION_INVALIDINDEX) { } Text m_asText[t_items]; UINT m_uSelected; // Operations HRESULT SetItemText(UINT uItem, LPCWSTR sText, bool bUpdate = false) { ATLASSERT(uItem < t_items); m_asText[uItem] = sText; return bUpdate ? this->InvalidateItems() : S_OK; } UINT GetSelected() { return m_uSelected; } HRESULT Select(UINT uItem, bool bUpdate = false) { ATLASSERT((uItem < t_items) || (uItem == UI_COLLECTION_INVALIDINDEX)); m_uSelected = uItem; typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); return bUpdate ? ribbon.SetProperty(TCtrl::GetID(), UI_PKEY_SelectedItem, uItem) : S_OK; } // Implementation HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) { ATLASSERT(uItem < t_items); if (k_(key) == k_Label) { if (m_asText[uItem].IsEmpty()) { typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); m_asText[uItem] = ribbon.OnRibbonQueryItemText(TCtrl::GetID(), uItem); } return SetPropertyVal(key, (LPCWSTR)m_asText[uItem], value); } else { return CollectionImpl::Collection::DoGetItem(uItem, key, value); } } HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { ATLASSERT(nCmdID == TCtrl::GetID()); if (k_(key) == k_SelectedItem) { typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); UINT uSel = UI_COLLECTION_INVALIDINDEX; if ((m_uSelected == UI_COLLECTION_INVALIDINDEX) && ribbon.OnRibbonQuerySelectedItem(TCtrl::GetID(), uSel)) m_uSelected = uSel; return SetPropertyVal(key, m_uSelected, ppropvarNewValue); } else { return CollectionImpl::Collection::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); } } }; // ItemCollectionImpl: handles item image // template class ItemCollectionImpl : public TextCollectionImpl { typedef ItemCollectionImpl thisClass; public: typedef thisClass ItemCollection; CBitmap m_aBitmap[t_items]; // Operations HRESULT SetItemImage(UINT uIndex, HBITMAP hbm, bool bUpdate = false) { ATLASSERT(uIndex < t_items); m_aBitmap[uIndex] = hbm; return bUpdate ? this->InvalidateItems() : S_OK; } // Implementation HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) { ATLASSERT(uItem < t_items); if (k_(key) == k_ItemImage) { if (m_aBitmap[uItem].IsNull()) { typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); m_aBitmap[uItem] = ribbon.OnRibbonQueryItemImage(TCtrl::GetID(), uItem); } return m_aBitmap[uItem].IsNull() ? E_NOTIMPL : SetPropertyVal(key, GetImage(m_aBitmap[uItem], UI_OWNERSHIP_COPY), value); } else { return TextCollectionImpl::TextCollection::DoGetItem(uItem, key, value); } } }; // ComboCollectionImpl: handles combo text // template class ComboCollectionImpl : public ItemCollectionImpl { typedef ComboCollectionImpl thisClass; public: typedef thisClass ComboCollection; // Operations HRESULT SetComboText(LPCWSTR sText) { typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); return ribbon.IsRibbonUI() ? ribbon.SetProperty(TCtrl::GetID(), UI_PKEY_StringValue, sText) : S_OK; } LPCWSTR GetComboText() { static WCHAR sCombo[RIBBONUI_MAX_TEXT] = {}; typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); PROPVARIANT var; if (ribbon.IsRibbonUI()) { HRESULT hr = ribbon.GetIUIFrameworkPtr()->GetUICommandProperty(TCtrl::GetID(), UI_PKEY_StringValue, &var); ATLASSERT(SUCCEEDED(hr)); hr = PropVariantToString(var, sCombo, RIBBONUI_MAX_TEXT); ATLASSERT(SUCCEEDED(hr)); return sCombo; } return NULL; } }; // CommandCollectionImpl: handles RibbonUI command collection controls // template class CommandCollectionImpl : public CollectionImpl { typedef CommandCollectionImpl thisClass; public: typedef thisClass CommandCollection; CommandCollectionImpl() { ::ZeroMemory(m_auCmd, sizeof(m_auCmd)); ::ZeroMemory(m_aCmdType, sizeof(m_aCmdType)); } UINT32 m_auCmd[t_items]; BYTE m_aCmdType[t_items]; // Operations HRESULT SetItemCommand(UINT uItem, UINT32 uCommandID, bool bUpdate = false) { ATLASSERT(uItem < t_items); if (uCommandID == m_auCmd[uItem]) return S_OK; typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); m_auCmd[uItem] = uCommandID; if (uCommandID != 0) ribbon.UIAddRibbonElement(uCommandID); return bUpdate ? this->InvalidateItems() : S_OK; } HRESULT SetItemCommandType(UINT uItem, UI_COMMANDTYPE type, bool bUpdate = false) { ATLASSERT(uItem < t_items); m_aCmdType[uItem] = (BYTE)type; return bUpdate ? this->InvalidateItems() : S_OK; } // Implementation HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) { ATLASSERT(uItem < t_items); typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); HRESULT hr = E_FAIL; switch (k_(key)) { case k_CommandId: if (m_auCmd[uItem] == 0) SetItemCommand(uItem, ribbon.OnRibbonQueryItemCommand(TCtrl::GetID(), uItem)); hr = SetPropertyVal(key, m_auCmd[uItem], value); break; case k_CommandType: if (m_aCmdType[uItem] == UI_COMMANDTYPE_UNKNOWN) SetItemCommandType(uItem, ribbon.OnRibbonQueryItemCommandType(TCtrl::GetID(), uItem)); hr = SetPropertyVal(key, UINT32(m_aCmdType[uItem]), value); break; case k_CategoryId: default: hr = CollectionImpl::Collection::DoGetItem(uItem, key, value); break; } return hr; } HRESULT Select(UINT /*uItem*/, bool /*bUpdate*/ = false) { ATLASSERT(FALSE); return S_OK; } }; // SimpleCollectionImpl: collection class for ribbon simple collection controls // template class SimpleCollectionImpl : public CollectionImplBase, t_size> { typedef SimpleCollectionImpl thisClass; public: typedef CollectionImplBase CollectionBase; typedef thisClass SimpleCollection; // Implementation HRESULT OnGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) { ATLASSERT(uItem < t_size); typename TCtrl::WndRibbon& ribbon = static_cast(this)->GetWndRibbon(); HRESULT hr = E_NOTIMPL; switch (k_(key)) { case k_ItemImage: if (HBITMAP hbm = ribbon.DefRibbonQueryItemImage(TCtrl::GetID(), uItem)) hr = SetPropertyVal(key, GetImage(hbm, UI_OWNERSHIP_TRANSFER), value); break; case k_Label: if (LPCWSTR sText = ribbon.DefRibbonQueryItemText(TCtrl::GetID(), uItem)) hr = SetPropertyVal(key, (LPCWSTR)sText, value); break; case k_CommandType: hr = SetPropertyVal(key, t_CommandType, value); break; case k_CommandId: hr = SetPropertyVal(key, ribbon.DefRibbonQueryItemCommand(TCtrl::GetID(), uItem), value); break; case k_CategoryId: hr = SetPropertyVal(key, UI_COLLECTION_INVALIDINDEX, value); break; default: ATLASSERT(FALSE); break; } return hr; } }; /////////////////////////////////////////////////////////////////////////////// // Ribbon collection control classes // CollectionCtrlImpl: specializable class for ribbon collection controls // template class CollectionCtrlImpl : public CommandCtrlImpl, public TCollection { typedef CollectionCtrlImpl thisClass; public: typedef CommandCtrlImpl CommandCtrl; typedef TCollection Collection; // Implementation virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { ATLASSERT(nCmdID == this->GetID()); ATLASSERT(ppropvarNewValue); HRESULT hr = Collection::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); if FAILED(hr) hr = CommandCtrl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); return hr; } virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* /*pCommandExecutionProperties*/) { ATLASSERT (nCmdID == this->GetID()); (void)nCmdID; // avoid level4 warning if (key == NULL) // gallery button pressed { this->GetWndRibbon().OnRibbonItemSelected(this->GetID(), UI_EXECUTIONVERB_EXECUTE, UI_COLLECTION_INVALIDINDEX); return S_OK; } ATLASSERT(k_(*key) == k_SelectedItem); ATLASSERT(ppropvarValue); HRESULT hr = S_OK; UINT32 uSel = 0xffff; hr = UIPropertyToUInt32(*key, *ppropvarValue, &uSel); if (SUCCEEDED(hr)) { if (this->GetWndRibbon().OnRibbonItemSelected(this->GetID(), verb, uSel)) TCollection::Select(uSel); } return hr; } }; // ToolbarGalleryCtrlImpl: base class for ribbon toolbar gallery controls // template class ToolbarGalleryCtrlImpl : public CollectionCtrlImpl, t_size>> { public: ToolbarGalleryCtrlImpl() { CResource tbres; ATLVERIFY(tbres.Load(RT_TOOLBAR, t_idTB)); _AtlToolBarData* pData = (_AtlToolBarData*)tbres.Lock(); ATLASSERT(pData); ATLASSERT(pData->wVersion == 1); WORD* pItems = pData->items(); INT j = 0; for (int i = 0; (i < pData->wItemCount) && (j < t_size); i++) { if (pItems[i] != 0) { this->m_aCmdType[j] = UI_COMMANDTYPE_ACTION; this->m_auCmd[j++] = pItems[i]; } } if (j < t_size) this->Resize(j); } HRESULT DoGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) { ATLASSERT(uItem < this->m_size); ATLASSERT(this->m_auCmd[uItem]); HRESULT hr = E_FAIL; switch (k_(key)) { case k_CommandId: hr = SetPropertyVal(key, this->m_auCmd[uItem], value); break; case k_CommandType: hr = SetPropertyVal(key, UINT32(this->m_aCmdType[uItem]), value); break; case k_CategoryId: hr = SetPropertyVal(key, UI_COLLECTION_INVALIDINDEX, value); break; default: ATLASSERT(FALSE); break; } return hr; } }; // SimpleCollectionCtrlImpl: base class for simple gallery and listbox controls // template class SimpleCollectionCtrlImpl : public CommandCtrlImpl, public SimpleCollectionImpl, t_size, t_CommandType> { typedef SimpleCollectionCtrlImpl thisClass; public: typedef thisClass SimpleCollection; SimpleCollectionCtrlImpl() : m_uSelected(0) { } UINT m_uSelected; HRESULT Select(UINT uItem, bool bUpdate = false) { ATLASSERT((uItem < t_size) || (uItem == UI_COLLECTION_INVALIDINDEX)); m_uSelected = uItem; return bUpdate ? this->GetWndRibbon().SetProperty(this->GetID(), UI_PKEY_SelectedItem, uItem) : S_OK; } // Implementation virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { ATLASSERT(nCmdID == this->GetID()); ATLASSERT(ppropvarNewValue != NULL); HRESULT hr = S_OK; switch (k_(key)) { case k_ItemsSource: { ATL::CComQIPtr pIUICollection(ppropvarCurrentValue->punkVal); ATLASSERT(pIUICollection.p); hr = pIUICollection->Clear(); for (UINT i = 0; i < t_size; i++) { if FAILED(hr = pIUICollection->Add(this->m_apItems[i])) break; } ATLASSERT(SUCCEEDED(hr)); } break; case k_SelectedItem: hr = SetPropertyVal(UI_PKEY_SelectedItem, m_uSelected, ppropvarNewValue); break; default: hr = CommandCtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); break; } return hr; } virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* /*pCommandExecutionProperties*/) { ATLASSERT (nCmdID == this->GetID()); (void)nCmdID; // avoid level 4 warning HRESULT hr = S_OK; if (key == NULL) // gallery button pressed { this->GetWndRibbon().OnRibbonItemSelected(this->GetID(), UI_EXECUTIONVERB_EXECUTE, UI_COLLECTION_INVALIDINDEX); return hr; } ATLASSERT(k_(*key) == k_SelectedItem); ATLASSERT(ppropvarValue); if SUCCEEDED(hr = UIPropertyToUInt32(*key, *ppropvarValue, &m_uSelected)) this->GetWndRibbon().OnRibbonItemSelected(this->GetID(), verb, m_uSelected); return hr; } }; // RecentItemsCtrlImpl // template class RecentItemsCtrlImpl : public CtrlImpl, public CollectionImplBase, TDocList::m_nMaxEntries_Max>, public TDocList { typedef RecentItemsCtrlImpl thisClass; public: typedef thisClass RecentItems; // Implementation HRESULT OnGetItem(UINT uItem, REFPROPERTYKEY key, PROPVARIANT *value) { ATLASSERT((INT)uItem < this->GetMaxEntries()); LPCWSTR sPath = this->m_arrDocs[uItem].szDocName; HRESULT hr = E_NOTIMPL; switch (k_(key)) { case k_Label: hr = SetPropertyVal(key, this->GetWndRibbon().OnRibbonQueryRecentItemName(sPath), value); break; case k_LabelDescription: hr = SetPropertyVal(key, sPath, value); break; default: ATLASSERT(FALSE); break; } return hr; } virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { ATLASSERT(nCmdID == this->GetID()); ATLASSERT(ppropvarNewValue); HRESULT hr = S_OK; switch (k_(key)) { case k_RecentItems: if (SAFEARRAY* psa = SafeArrayCreateVector(VT_UNKNOWN, 0, this->m_arrDocs.GetSize())) { const int iLastIndex = this->m_arrDocs.GetSize() - 1; for (LONG i = 0; i <= iLastIndex; i++) SafeArrayPutElement(psa, &i, this->m_apItems[iLastIndex - i]); // reverse order hr = SetPropertyVal(key, psa, ppropvarNewValue); SafeArrayDestroy(psa); } break; default: hr = CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); break; } return hr; } virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* /*pCommandExecutionProperties*/) { ATLASSERT(nCmdID == this->GetID()); (void)nCmdID; // avoid level 4 warning ATLASSERT(verb == UI_EXECUTIONVERB_EXECUTE); (void)verb; // avoid level 4 warning ATLASSERT((key) && (k_(*key) == k_SelectedItem)); ATLASSERT(ppropvarValue); UINT32 uSel = 0xffff; HRESULT hr = UIPropertyToUInt32(*key, *ppropvarValue, &uSel); if SUCCEEDED(hr) { ATLASSERT(uSel < (UINT)this->GetMaxEntries()); this->GetWndRibbon().DefCommandExecute(ID_FILE_MRU_FIRST + uSel); } return hr; } }; /////////////////////////////////////////////////////////////////////////////// // Ribbon stand-alone control classes // FontCtrlImpl // template class FontCtrlImpl : public CtrlImpl { public: CharFormat m_cf; // Implementation virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCommandExecutionProperties) { ATLASSERT (nCmdID == this->GetID()); (void)nCmdID; // avoid level 4 warning ATLASSERT ((key) && (k_(*key) == k_FontProperties)); (void)key; // avoid level 4 warning HRESULT hr = E_INVALIDARG; switch (verb) { case UI_EXECUTIONVERB_PREVIEW: case UI_EXECUTIONVERB_EXECUTE: ATLASSERT(pCommandExecutionProperties); PROPVARIANT propvar; if (SUCCEEDED(hr = pCommandExecutionProperties->GetValue(UI_PKEY_FontProperties_ChangedProperties, &propvar))) m_cf << ATL::CComQIPtr(propvar.punkVal); break; case UI_EXECUTIONVERB_CANCELPREVIEW: ATLASSERT(ppropvarValue); ATL::CComPtr pStore; if (SUCCEEDED(hr = UIPropertyToInterface(UI_PKEY_FontProperties, *ppropvarValue, &pStore))) m_cf << pStore; break; } if (SUCCEEDED(hr)) this->GetWndRibbon().OnRibbonFontCtrlExecute(this->GetID(), verb, &m_cf); else ATLASSERT(FALSE); return hr; } virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { if ((k_(key) == k_FontProperties) && (this->GetWndRibbon().OnRibbonQueryFont(t_ID, m_cf))) { ATL::CComQIPtr pStore(ppropvarCurrentValue->punkVal); m_cf >> pStore; return SetPropertyVal(key, pStore.p, ppropvarNewValue); } else { return CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); } } }; // ColorCtrlImpl // template class ColorCtrlImpl : public CommandCtrlImpl { public: ColorCtrlImpl() : m_colorType(UI_SWATCHCOLORTYPE_NOCOLOR), m_color(0x800080) /*MAGENTA*/ { } UINT32 m_colorType; // value in UI_SWATCHCOLORTYPE COLORREF m_color; Text m_sLabels[6]; // k_MoreColorsLabel to k_ThemeColorsCategoryLabel ATL::CSimpleArray m_aColors[2]; ATL::CSimpleArray m_aTooltips[2]; // Operations HRESULT SetColor(COLORREF color, bool bUpdate = false) { if (m_colorType != UI_SWATCHCOLORTYPE_RGB) SetColorType(UI_SWATCHCOLORTYPE_RGB, bUpdate); m_color = color; return bUpdate ? this->SetProperty(UI_PKEY_Color, color) : S_OK; } HRESULT SetColorType(UI_SWATCHCOLORTYPE type, bool bUpdate = false) { m_colorType = type; return bUpdate ? this->SetProperty(UI_PKEY_ColorType, type) : S_OK; } HRESULT SetColorLabel(REFPROPERTYKEY key, LPCWSTR sLabel, bool bUpdate = false) { ATLASSERT((k_(key) >= k_ThemeColorsCategoryLabel) && (k_(key) <= k_MoreColorsLabel)); m_sLabels[k_(key) - k_ThemeColorsCategoryLabel] = sLabel; return bUpdate ? this->SetProperty(key, sLabel) : S_OK; } HRESULT SetColorArray(REFPROPERTYKEY key, COLORREF* pColor, bool bUpdate = false) { ATLASSERT((k_(key) == k_ThemeColors) || (k_(key) == k_StandardColors)); const INT ic = k_(key) - k_ThemeColors; m_aColors[ic].RemoveAll(); while (*pColor != 0x800080) /*MAGENTA*/ m_aColors[ic].Add(*pColor++); if (bUpdate) { PROPVARIANT var; if SUCCEEDED(InitPropVariantFromUInt32Vector(m_aColors[ic].GetData(), m_aColors[ic].GetSize(), &var)) return this->SetProperty(key, var); else return E_INVALIDARG; } else { return S_OK; } } HRESULT SetColorTooltips(REFPROPERTYKEY key, LPCWSTR* ppsTT, bool bUpdate = false) { ATLASSERT((k_(key) == k_ThemeColorsTooltips) || (k_(key) == k_StandardColorsTooltips)); const INT ic = k_(key) - k_ThemeColorsTooltips; m_aTooltips[ic].RemoveAll(); while (*ppsTT) m_aTooltips[ic].Add(*ppsTT++); if (bUpdate) { PROPVARIANT var; if SUCCEEDED(InitPropVariantFromStringVector(m_aTooltips[ic].GetData(), m_aTooltips[ic].GetSize(), &var)) return this->SetProperty(key, var); else return E_INVALIDARG; } else { return S_OK; } } // Implementation virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCommandExecutionProperties) { ATLASSERT (nCmdID == this->GetID()); (void)nCmdID; // avoid level 4 warning ATLASSERT (key && (k_(*key) == k_ColorType)); (void)key; // avoid level 4 warning ATLASSERT (ppropvarValue); HRESULT hr = PropVariantToUInt32(*ppropvarValue, &m_colorType); ATLASSERT(SUCCEEDED(hr)); if (SUCCEEDED(hr) && (m_colorType == UI_SWATCHCOLORTYPE_RGB)) { ATLASSERT(pCommandExecutionProperties); PROPVARIANT var; if SUCCEEDED(hr = pCommandExecutionProperties->GetValue(UI_PKEY_Color, &var)) hr = PropVariantToUInt32(var, &m_color); } if SUCCEEDED(hr) this->GetWndRibbon().OnRibbonColorCtrlExecute(this->GetID(), verb, (UI_SWATCHCOLORTYPE)m_colorType/*uType*/, m_color); else ATLASSERT(FALSE); // something was wrong return hr; } virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { ATLASSERT (nCmdID == this->GetID()); HRESULT hr = E_NOTIMPL; switch (k_(key)) { case k_ColorType: hr = SetPropertyVal(key, m_colorType, ppropvarNewValue); break; case k_Color: if (m_color == 0x800080) /*MAGENTA*/ m_color = this->GetWndRibbon().OnRibbonQueryColor(this->GetID()); hr = SetPropertyVal(key, m_color, ppropvarNewValue); break; case k_ColorMode: break; case k_ThemeColorsCategoryLabel: case k_StandardColorsCategoryLabel: case k_RecentColorsCategoryLabel: case k_AutomaticColorLabel: case k_NoColorLabel: case k_MoreColorsLabel: { const UINT iLabel = k_(key) - k_ThemeColorsCategoryLabel; if (m_sLabels[iLabel].IsEmpty()) if (LPCWSTR psLabel = this->GetWndRibbon().OnRibbonQueryColorLabel(this->GetID(), key)) m_sLabels[iLabel] = psLabel; if (!m_sLabels[iLabel].IsEmpty()) hr = SetPropertyVal(key, (LPCWSTR)m_sLabels[iLabel], ppropvarNewValue); } break; case k_ThemeColors: case k_StandardColors: { const INT ic = k_(key) - k_ThemeColors; if (!m_aColors[ic].GetSize()) if (COLORREF* pColor = this->GetWndRibbon().OnRibbonQueryColorArray(this->GetID(), key)) SetColorArray(key, pColor); if (INT iMax = m_aColors[ic].GetSize()) hr = InitPropVariantFromUInt32Vector(m_aColors[ic].GetData(), iMax, ppropvarNewValue); } break; case k_ThemeColorsTooltips: case k_StandardColorsTooltips: { const INT ic = k_(key) - k_ThemeColorsTooltips; if (m_aTooltips[ic].GetSize() == 0) if (LPCWSTR* ppsTT = this->GetWndRibbon().OnRibbonQueryColorTooltips(this->GetID(), key)) SetColorTooltips(key, ppsTT); if (INT iMax = m_aTooltips[ic].GetSize()) hr = InitPropVariantFromStringVector(m_aTooltips[ic].GetData(), iMax, ppropvarNewValue); } break; default: hr = CommandCtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); break; } return hr; } }; // SpinnerCtrlImpl // template class SpinnerCtrlImpl : public CtrlImpl { public: SpinnerCtrlImpl() { m_Values[0] = m_Values[2] = m_Values[4] = 0; m_Values[1] = 100; m_Values[3] = 1; } V m_Values[5]; // k_DecimalValue = 201, k_MaxValue = 203, k_MinValue, k_Increment, k_DecimalPlaces Text m_FormatString; Text m_RepresentativeString; // Operations HRESULT SetDecimalPlaces(V vPlaces, bool bUpdate = false) { return SetValue(UI_PKEY_DecimalPlaces, vPlaces, bUpdate); } HRESULT SetMin(V vMin, bool bUpdate = false) { return SetValue(UI_PKEY_MinValue, vMin, bUpdate); } HRESULT SetMax(V vMax, bool bUpdate = false) { return SetValue(UI_PKEY_MaxValue, vMax, bUpdate); } HRESULT SetVal(V vVal, bool bUpdate = false) { return SetValue(UI_PKEY_DecimalValue, vVal, bUpdate); } HRESULT SetIncrement(V vIncrement, bool bUpdate = false) { return SetValue(UI_PKEY_Increment, vIncrement, bUpdate); } HRESULT SetFormatString(LPCWSTR sFormat, bool bUpdate = false) { return SetText(UI_PKEY_FormatString, sFormat, bUpdate); } HRESULT SetRepresentativeString(LPCWSTR sRepresentative, bool bUpdate = false) { return SetText(UI_PKEY_RepresentativeString, sRepresentative, bUpdate); } // Implementation HRESULT SetText(REFPROPERTYKEY key, LPCWSTR sText, bool bUpdate = false) { switch (k_(key)) { case k_FormatString: m_FormatString = sText; break; case k_RepresentativeString: m_RepresentativeString = sText; break; default: return CtrlImpl::SetText(key, sText, bUpdate); } return bUpdate ? this->GetWndRibbon().InvalidateProperty(this->GetID(), key) : S_OK; } HRESULT SetValue(REFPROPERTYKEY key, V val, bool bUpdate = false) { ATLASSERT((k_(key) <= k_DecimalPlaces) && (k_(key) >= k_DecimalValue)); const INT iVal = k_(key) == k_DecimalValue ? 0 : k_(key) - k_StringValue; m_Values[iVal] = val; if (bUpdate) { if(k_(key) == k_DecimalValue) { DECIMAL decVal; InitDecimal(val, &decVal); return this->SetProperty(key, &decVal); } else { return this->GetWndRibbon().InvalidateProperty(this->GetID(), key); } } else { return S_OK; } } HRESULT QueryValue(REFPROPERTYKEY key, LONG* plVal) { return this->GetWndRibbon().OnRibbonQuerySpinnerValue(this->GetID(), key, plVal) ? S_OK : S_FALSE; } HRESULT QueryValue(REFPROPERTYKEY key, DOUBLE* pdVal) { return this->GetWndRibbon().OnRibbonQueryFloatSpinnerValue(this->GetID(), key, pdVal) ? S_OK : S_FALSE; } HRESULT OnGetValue(REFPROPERTYKEY key, PROPVARIANT* ppv) { ATLASSERT((k_(key) <= k_DecimalPlaces) && (k_(key) >= k_DecimalValue)); const INT iVal = k_(key) == k_DecimalValue ? 0 : k_(key) - k_StringValue; QueryValue(key, m_Values + iVal); if (k_(key) == k_DecimalPlaces) { return SetPropertyVal(key, m_Values[iVal], ppv); } else { DECIMAL decVal; InitDecimal(m_Values[iVal], &decVal); return SetPropertyVal(key, &decVal, ppv); } } HRESULT OnGetText(REFPROPERTYKEY key, Text& sVal, PROPVARIANT* ppv) { if (LPCWSTR sNew = this->GetWndRibbon().OnRibbonQueryText(this->GetID(), key)) sVal = sNew; return SetPropertyVal(key, (LPCWSTR)sVal, ppv); } virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* /*pCommandExecutionProperties*/) { ATLASSERT (nCmdID == this->GetID()); (void)nCmdID; // avoid level 4 warning ATLASSERT (key && (k_(*key) == k_DecimalValue)); (void)key; // avoid level 4 warning ATLASSERT (verb == UI_EXECUTIONVERB_EXECUTE); (void)verb; // avoid level 4 warning DECIMAL decVal; HRESULT hr = UIPropertyToDecimal(UI_PKEY_DecimalValue, *ppropvarValue, &decVal); ATLASSERT(SUCCEEDED(hr)); hr = InitVal(m_Values[0], &decVal); ATLASSERT(SUCCEEDED(hr)); this->GetWndRibbon().OnRibbonSpinnerCtrlExecute(this->GetID(), &m_Values[0]); return hr; } virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { ATLASSERT (nCmdID == this->GetID()); HRESULT hr = E_NOTIMPL; switch (k_(key)) { case k_DecimalPlaces: case k_DecimalValue: case k_Increment: case k_MaxValue: case k_MinValue: hr = OnGetValue(key, ppropvarNewValue); break; case k_FormatString: hr = OnGetText(key, m_FormatString, ppropvarNewValue); break; case k_RepresentativeString: hr = OnGetText(key, m_RepresentativeString, ppropvarNewValue); break; default: hr = CtrlImpl::DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); break; } return hr; } // decimal conversion helpers static HRESULT InitDecimal(LONG& val, DECIMAL* pDecimal) { return ::VarDecFromI4(val, pDecimal); } static HRESULT InitDecimal(DOUBLE& val, DECIMAL* pDecimal) { return ::VarDecFromR8(val, pDecimal); } static HRESULT InitVal(LONG& val, const DECIMAL* pDecimal) { return ::VarI4FromDec(pDecimal, &val); } static HRESULT InitVal(DOUBLE& val, const DECIMAL* pDecimal) { return ::VarR8FromDec(pDecimal, &val); } }; // CRibbonImpl Ribbon implementation class // template class CRibbonImpl : public CRibbonUpdateUI, public ICtrl, public IUIApplication, public IUICommandHandler { typedef CRibbonImpl thisClass; public: typedef thisClass Ribbon; typedef T WndRibbon; CRibbonImpl() : m_bRibbonUI(false), m_hgRibbonSettings(NULL) { #ifdef _DEBUG m_cRef = 1; #endif pWndRibbon = static_cast(this); HRESULT hr = ::CoInitialize(NULL); if(SUCCEEDED(hr)) if (RunTimeHelper::IsRibbonUIAvailable()) hr = m_pIUIFramework.CoCreateInstance(CLSID_UIRibbonFramework); else ATLTRACE2(atlTraceUI, 0, _T("Ribbon UI not available\n")); if FAILED(hr) ATLTRACE2(atlTraceUI, 0, _T("Ribbon construction failed\n")); ATLASSERT(SUCCEEDED(hr)); } virtual ~CRibbonImpl() { ::GlobalFree(m_hgRibbonSettings); m_pIUIFramework.Release(); ::CoUninitialize(); } ICtrl& GetRibbonCtrl(UINT) { return static_cast(*this); } ATL::CComPtr m_pIUIFramework; bool m_bRibbonUI; HGLOBAL m_hgRibbonSettings; bool IsRibbonUI() { return m_bRibbonUI; } IUIFramework* GetIUIFrameworkPtr() { return m_pIUIFramework; } template I* GetRibbonViewPtr(UINT32 uID) { ATLASSERT(m_pIUIFramework); ATL::CComPtr pI; return m_pIUIFramework->GetView(uID, __uuidof(I), (void**) &pI) == S_OK ? pI : NULL; } IUIRibbon* GetRibbonPtr() { return GetRibbonViewPtr(0); } IUIContextualUI* GetMenuPtr(UINT32 uID) { ATLASSERT(uID); return GetRibbonViewPtr(uID); } UINT GetRibbonHeight() { ATLASSERT(IsRibbonUI()); UINT32 cy = 0; if (ATL::CComPtr pIUIRibbon = GetRibbonPtr()) pIUIRibbon->GetHeight(&cy); return cy; } HRESULT CreateRibbon(LPCWSTR sResName = L"APPLICATION_RIBBON") { T* pT = static_cast(this); ATLASSERT(GetIUIFrameworkPtr() && !IsRibbonUI()); ATLASSERT(pT->IsWindow()); HRESULT hr = m_pIUIFramework->Initialize(pT->m_hWnd, this); if (hr == S_OK) hr = m_pIUIFramework->LoadUI(ModuleHelper::GetResourceInstance(), sResName); return hr; } HRESULT DestroyRibbon() { T* pT = static_cast(this); ATLASSERT(GetIUIFrameworkPtr() && IsRibbonUI()); ATLASSERT(pT->IsWindow()); HRESULT hRes = m_pIUIFramework->Destroy(); if (!RunTimeHelper::IsWin7()) pT->SetWindowRgn(NULL, TRUE); // Vista Basic bug workaround return hRes; } // Ribbon persistency HRESULT operator >>(IStream* pIStream) { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(pIStream); HRESULT hr = E_FAIL; if (ATL::CComPtr pIUIRibbon = GetRibbonPtr()) { const LARGE_INTEGER li0 = {}; pIStream->Seek(li0, STREAM_SEEK_SET, NULL); hr = pIUIRibbon->SaveSettingsToStream(pIStream); pIStream->Commit(STGC_DEFAULT); } return hr; } HRESULT operator <<(IStream* pIStream) { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(pIStream); HRESULT hr = E_FAIL; if (ATL::CComPtr pIUIRibbon = GetRibbonPtr()) { const LARGE_INTEGER li0 = {}; pIStream->Seek(li0, STREAM_SEEK_SET, NULL); hr = pIUIRibbon->LoadSettingsFromStream(pIStream); } return hr; } void ResetRibbonSettings() { if (m_hgRibbonSettings != NULL) { ::GlobalFree(m_hgRibbonSettings); m_hgRibbonSettings = NULL; } } HRESULT SaveRibbonSettings() { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(static_cast(this)->IsWindow()); HRESULT hr = E_FAIL; ATL::CComPtr pIStream; if SUCCEEDED(hr = ::CreateStreamOnHGlobal(m_hgRibbonSettings, FALSE, &pIStream)) hr = *this >> pIStream; if (SUCCEEDED(hr) && (m_hgRibbonSettings == NULL)) hr = ::GetHGlobalFromStream(pIStream, &m_hgRibbonSettings); if FAILED(hr) ResetRibbonSettings(); return hr; } HRESULT RestoreRibbonSettings() { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(m_hgRibbonSettings); ATLASSERT(static_cast(this)->IsWindow()); HRESULT hr = E_FAIL; ATL::CComPtr pIStream; if SUCCEEDED(hr = ::CreateStreamOnHGlobal(m_hgRibbonSettings, FALSE, &pIStream)) hr = *this << pIStream; if FAILED(hr) ResetRibbonSettings(); return hr; } // QAT dock states UI_CONTROLDOCK GetQATDock() { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(IsRibbonUI()); UINT32 uDock = 0; PROPVARIANT propvar; ATL::CComQIPtrpIPS(GetRibbonPtr()); if ((pIPS != NULL) && SUCCEEDED(pIPS->GetValue(UI_PKEY_QuickAccessToolbarDock, &propvar)) && SUCCEEDED(UIPropertyToUInt32(UI_PKEY_QuickAccessToolbarDock, propvar, &uDock))) return (UI_CONTROLDOCK)uDock; ATLASSERT(FALSE); // something was wrong return (UI_CONTROLDOCK)0; } bool SetQATDock(UI_CONTROLDOCK dockState) { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(IsRibbonUI()); PROPVARIANT propvar; ATLVERIFY(SUCCEEDED(SetPropertyVal(UI_PKEY_QuickAccessToolbarDock, dockState, &propvar))); ATL::CComQIPtrpIPS(GetRibbonPtr()); if ((pIPS != NULL) && SUCCEEDED(pIPS->SetValue(UI_PKEY_QuickAccessToolbarDock, propvar))) { pIPS->Commit(); return true; } ATLASSERT(FALSE); // something was wrong return false; } // Ribbon display states bool GetRibbonDisplayState(REFPROPERTYKEY key) { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(IsRibbonUI()); ATLASSERT((k_(key) == k_Viewable) || (k_(key) == k_Minimized)); PROPVARIANT propvar; ATL::CComQIPtrpIPS(GetRibbonPtr()); if ((pIPS != NULL) && SUCCEEDED(pIPS->GetValue(key, &propvar))) { BOOL bState = FALSE; if SUCCEEDED(UIPropertyToBoolean(key, propvar, &bState)) return (bState != FALSE); } ATLASSERT(FALSE); // something was wrong return false; } bool SetRibbonDisplayState(REFPROPERTYKEY key, bool bState = true) { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(IsRibbonUI()); ATLASSERT((k_(key) == k_Viewable) || (k_(key) == k_Minimized)); PROPVARIANT propvar; ATLVERIFY(SUCCEEDED(SetPropertyVal(key, bState, &propvar))); ATL::CComQIPtrpIPS(GetRibbonPtr()); if ((pIPS != NULL) && SUCCEEDED(pIPS->SetValue(key, propvar))) { pIPS->Commit(); return true; } ATLASSERT(FALSE); // something was wrong return false; } bool IsRibbonMinimized() { return GetRibbonDisplayState(UI_PKEY_Minimized); } bool MinimizeRibbon(bool bMinimize = true) { return SetRibbonDisplayState(UI_PKEY_Minimized, bMinimize); } bool IsRibbonHidden() { return !GetRibbonDisplayState(UI_PKEY_Viewable); } bool HideRibbon(bool bHide = true) { return SetRibbonDisplayState(UI_PKEY_Viewable, !bHide); } // Ribbon colors UI_HSBCOLOR GetRibbonColor(REFPROPERTYKEY key) { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(IsRibbonUI()); ATLASSERT((k_(key) >= k_GlobalBackgroundColor) && (k_(key) <= k_GlobalTextColor)); PROPVARIANT propvar; ATL::CComQIPtrpIPS(GetIUIFrameworkPtr()); if ((pIPS != NULL) && SUCCEEDED(pIPS->GetValue(key, &propvar))) { UINT32 color = 0; if SUCCEEDED(UIPropertyToUInt32(key, propvar, &color)) return color; } ATLASSERT(FALSE); // something was wrong return 0; } bool SetRibbonColor(REFPROPERTYKEY key, UI_HSBCOLOR color) { ATLASSERT(GetIUIFrameworkPtr()); ATLASSERT(IsRibbonUI()); ATLASSERT((k_(key) >= k_GlobalBackgroundColor) && (k_(key) <= k_GlobalTextColor)); PROPVARIANT propvar; ATLVERIFY(SUCCEEDED(SetPropertyVal(key, color, &propvar))); ATL::CComQIPtrpIPS(GetIUIFrameworkPtr()); if ((pIPS != NULL) && SUCCEEDED(pIPS->SetValue(key, propvar))) { pIPS->Commit(); return true; } ATLASSERT(FALSE); // something was wrong return false; } // Ribbon modes HRESULT SetRibbonModes(INT32 iModes) { ATLASSERT(IsRibbonUI()); return GetIUIFrameworkPtr()->SetModes(iModes); } // Ribbon contextual tab UI_CONTEXTAVAILABILITY GetRibbonContextAvail(UINT32 uID) { ATLASSERT(GetIUIFrameworkPtr()); PROPVARIANT propvar; if (IsRibbonUI() && SUCCEEDED(GetIUIFrameworkPtr()->GetUICommandProperty(uID, UI_PKEY_ContextAvailable, &propvar))) { UINT uav; if (SUCCEEDED(PropVariantToUInt32(propvar, &uav))) { CUpdateUIBase::UIEnable(uID, uav != UI_CONTEXTAVAILABILITY_NOTAVAILABLE); CUpdateUIBase::UISetCheck(uID, uav == UI_CONTEXTAVAILABILITY_ACTIVE); return (UI_CONTEXTAVAILABILITY)uav; } } return UI_CONTEXTAVAILABILITY_NOTAVAILABLE; } HRESULT SetRibbonContextAvail(UINT32 uID, UI_CONTEXTAVAILABILITY cav) { CUpdateUIBase::UIEnable(uID, cav != UI_CONTEXTAVAILABILITY_NOTAVAILABLE); CUpdateUIBase::UISetCheck(uID, cav == UI_CONTEXTAVAILABILITY_ACTIVE); return SetProperty((WORD)uID, UI_PKEY_ContextAvailable, UINT32(cav)); } // Ribbon context menu bool HasRibbonMenu(UINT32 uID) { ATL::CComPtr pI = GetMenuPtr(uID); return pI != NULL; } HRESULT TrackRibbonMenu(UINT32 uID, INT32 x, INT32 y) { ATLASSERT(HasRibbonMenu(uID)); return IsRibbonUI() ? ATL::CComPtr(GetMenuPtr(uID))->ShowAtLocation(x, y) : E_FAIL; } HRESULT TrackRibbonMenu(UINT32 uID, LPARAM lParam) { return TrackRibbonMenu(uID, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); } // Overrideables HBITMAP OnRibbonQueryImage(UINT nCmdID, REFPROPERTYKEY /*key*/) { return DefRibbonQueryImage(nCmdID); } LPCWSTR OnRibbonQueryText(UINT nCmdID, REFPROPERTYKEY key) { return DefRibbonQueryText(nCmdID, key); } bool OnRibbonQueryState(UINT nCmdID, REFPROPERTYKEY key) { return DefRibbonQueryState(nCmdID, key); } UI_CONTEXTAVAILABILITY OnRibbonQueryTabAvail(UINT nCmdID) { DWORD dwState = this->UIGetState(nCmdID); return ((dwState & CUpdateUIBase::UPDUI_DISABLED) == CUpdateUIBase::UPDUI_DISABLED) ? UI_CONTEXTAVAILABILITY_NOTAVAILABLE : (((dwState & CUpdateUIBase::UPDUI_CHECKED) == CUpdateUIBase::UPDUI_CHECKED) ? UI_CONTEXTAVAILABILITY_ACTIVE : UI_CONTEXTAVAILABILITY_AVAILABLE); } LPCWSTR OnRibbonQueryComboText(UINT32 /*uCtrlID*/) { return NULL; } LPCWSTR OnRibbonQueryCategoryText(UINT32 /*uCtrlID*/, UINT32 /*uCat*/) { return L"Category"; } UINT32 OnRibbonQueryItemCategory(UINT32 /*uCtrlID*/, UINT32 /*uItem*/) { return 0; } LPCWSTR OnRibbonQueryItemText(UINT32 uCtrlID, UINT32 uItem) { return DefRibbonQueryItemText(uCtrlID, uItem); } bool OnRibbonQuerySelectedItem(UINT32 /*uCtrlID*/, UINT32& /*uSel*/) { return false; } HBITMAP OnRibbonQueryItemImage(UINT32 uCtrlID, UINT32 uItem) { return DefRibbonQueryItemImage(uCtrlID, uItem); } UINT32 OnRibbonQueryItemCommand(UINT32 uCtrlID, UINT32 uItem) { return DefRibbonQueryItemCommand(uCtrlID, uItem); } UI_COMMANDTYPE OnRibbonQueryItemCommandType(UINT32 /*uCtrlID*/, UINT32 /*uItem*/) { return UI_COMMANDTYPE_ACTION; } LPCWSTR OnRibbonQueryRecentItemName(LPCWSTR sPath) { return ::PathFindFileName(sPath); } bool OnRibbonQueryFont(UINT /*nId*/, CHARFORMAT2& /*cf*/) { return false; } bool OnRibbonQuerySpinnerValue(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/, LONG* /*pVal*/) { return false; } bool OnRibbonQueryFloatSpinnerValue(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/, DOUBLE* /*pVal*/) { return false; } COLORREF OnRibbonQueryColor(UINT /*nCmdID*/) { return 0x800080; /*MAGENTA*/ } LPCWSTR OnRibbonQueryColorLabel(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/) { return NULL; } COLORREF* OnRibbonQueryColorArray(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/) { return NULL; } LPCWSTR* OnRibbonQueryColorTooltips(UINT /*nCmdID*/, REFPROPERTYKEY /*key*/) { return NULL; } bool OnRibbonItemSelected(UINT32 uCtrlID, UI_EXECUTIONVERB verb, UINT32 uItem) { DefCommandExecute(MAKELONG(uCtrlID, verb), uItem); return true; } void OnRibbonColorCtrlExecute(UINT32 uCtrlID, UI_EXECUTIONVERB verb, UI_SWATCHCOLORTYPE uType, COLORREF color) { DefRibbonColorCtrlExecute(uCtrlID, verb, uType, color); } void OnRibbonFontCtrlExecute(UINT32 uCtrlID, UI_EXECUTIONVERB verb, CHARFORMAT2* pcf) { DefCommandExecute(MAKELONG(uCtrlID, verb), (LPARAM)pcf); } void OnRibbonSpinnerCtrlExecute(UINT32 uCtrlID, LONG* pVal) { DefCommandExecute(uCtrlID, *pVal); } void OnRibbonSpinnerCtrlExecute(UINT32 uCtrlID, DOUBLE* pVal) { DefCommandExecute(uCtrlID, (LPARAM)pVal); } void OnRibbonCommandExecute(UINT32 uCmdID) { DefCommandExecute(uCmdID); } // Default implementations HBITMAP DefRibbonQueryImage(UINT nCmdID) { return AtlLoadBitmapImage(nCmdID, LR_CREATEDIBSECTION); } bool DefRibbonQueryState(UINT nCmdID, REFPROPERTYKEY key) { DWORD dwState = this->UIGetState(nCmdID); bool bRet = false; switch (k_(key)) { case k_BooleanValue: bRet = (dwState & CUpdateUIBase::UPDUI_CHECKED) == CUpdateUIBase::UPDUI_CHECKED; break; case k_Enabled: bRet = (dwState & CUpdateUIBase::UPDUI_DISABLED) != CUpdateUIBase::UPDUI_DISABLED; break; default: ATLASSERT(FALSE); break; } return bRet; } LPCTSTR DefRibbonQueryText(UINT nCmdID, REFPROPERTYKEY key) { static WCHAR sText[RIBBONUI_MAX_TEXT] = {}; if (k_(key) == k_Label) return this->UIGetText(nCmdID); if (ATL::AtlLoadString(nCmdID, sText, RIBBONUI_MAX_TEXT)) { PWCHAR pTitle = wcschr(sText, L'\n'); switch (k_(key)) { case k_Keytip: if (PWCHAR pAmp = wcschr(sText, L'&')) pTitle = pAmp; if (pTitle != NULL) *(pTitle + 2) = NULL; // fall through case k_TooltipTitle: return pTitle ? ++pTitle : NULL; case k_TooltipDescription: case k_LabelDescription: if (pTitle != NULL) *pTitle = NULL; return sText; } } return NULL; } LPCWSTR DefRibbonQueryItemText(UINT32 uCtrlID, UINT32 uItem) { return DefRibbonQueryText(uCtrlID + 1 + uItem, UI_PKEY_LabelDescription); } HBITMAP DefRibbonQueryItemImage(UINT32 uCtrlID, UINT32 uItem) { return DefRibbonQueryImage(uCtrlID + 1 + uItem); } UINT32 DefRibbonQueryItemCommand(UINT32 uCtrlID, UINT32 uItem) { return uCtrlID + 1 + uItem; } void DefRibbonColorCtrlExecute(UINT32 uCtrlID, UI_EXECUTIONVERB verb, UI_SWATCHCOLORTYPE uType, COLORREF color) { switch(uType) { case UI_SWATCHCOLORTYPE_RGB: break; case UI_SWATCHCOLORTYPE_AUTOMATIC: color = ::GetSysColor(COLOR_WINDOWTEXT); break; case UI_SWATCHCOLORTYPE_NOCOLOR: color = ::GetSysColor(COLOR_WINDOW); break; default: ATLASSERT(FALSE); break; } DefCommandExecute(MAKELONG(uCtrlID, verb), color); } void DefCommandExecute(UINT32 uCmd, LPARAM lParam = 0) { static_cast(this)->PostMessage(WM_COMMAND, uCmd, lParam); } // Elements setting helpers HRESULT InvalidateCtrl(UINT32 nID) { return IsRibbonUI() ? GetIUIFrameworkPtr()->InvalidateUICommand(nID, UI_INVALIDATIONS_ALLPROPERTIES, NULL) : E_FAIL; } HRESULT InvalidateProperty(UINT32 nID, REFPROPERTYKEY key, UI_INVALIDATIONS flags = UI_INVALIDATIONS_PROPERTY) { return IsRibbonUI() ? GetIUIFrameworkPtr()->InvalidateUICommand(nID, flags, &key) : E_FAIL; } template HRESULT SetProperty(WORD wID, REFPROPERTYKEY key, V val) { if (IsRibbonUI()) { PROPVARIANT var; if (SUCCEEDED(RibbonUI::SetPropertyVal(key, val, &var))) { return SetProperty(wID, key, var); } return E_INVALIDARG; } else { return E_FAIL; } } template <> HRESULT SetProperty(WORD nID, REFPROPERTYKEY key, PROPVARIANT var) { return IsRibbonUI() ? GetIUIFrameworkPtr()->SetUICommandProperty(nID, key, var) : E_FAIL; } // Interfaces // IUIApplication STDMETHODIMP OnViewChanged(UINT32, UI_VIEWTYPE, IUnknown*, UI_VIEWVERB verb, INT32) { switch (verb) { case UI_VIEWVERB_CREATE: m_bRibbonUI = true; if (m_hgRibbonSettings != NULL) RestoreRibbonSettings(); break; case UI_VIEWVERB_SIZE: static_cast(this)->UpdateLayout(FALSE); break; case UI_VIEWVERB_DESTROY: SaveRibbonSettings(); m_bRibbonUI = false; break; default: break; } return S_OK; } STDMETHODIMP OnCreateUICommand(UINT32 nCmdID, UI_COMMANDTYPE typeID, IUICommandHandler** ppCommandHandler) { this->UIAddRibbonElement(nCmdID); if (typeID == UI_COMMANDTYPE_CONTEXT) CUpdateUIBase::UIEnable(nCmdID, false); *ppCommandHandler = this; return S_OK; } STDMETHODIMP OnDestroyUICommand(UINT32 nCmdID, UI_COMMANDTYPE, IUICommandHandler*) { this->UIRemoveRibbonElement(nCmdID); return S_OK; } // IUICommandHandler STDMETHODIMP Execute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCommandExecutionProperties) { T* pT =static_cast(this); return pT->GetRibbonCtrl(nCmdID).DoExecute(nCmdID, verb, key, ppropvarValue, pCommandExecutionProperties); } STDMETHODIMP UpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* ppropvarCurrentValue, PROPVARIANT* ppropvarNewValue) { T* pT =static_cast(this); return pT->GetRibbonCtrl(nCmdID).DoUpdateProperty(nCmdID, key, ppropvarCurrentValue, ppropvarNewValue); } #ifdef _DEBUG // IUnknown methods (heavyweight) STDMETHODIMP_(ULONG) AddRef() { return InterlockedIncrement(&m_cRef); } STDMETHODIMP_(ULONG) Release() { LONG cRef = InterlockedDecrement(&m_cRef); if (cRef == 0) // NoOp for breakpoint { cRef = 0; } return cRef; } STDMETHODIMP QueryInterface(REFIID iid, void** ppv) { if (ppv == NULL) { return E_POINTER; } else if ((iid == __uuidof(IUnknown)) || (iid == __uuidof(IUICommandHandler)) || (iid == __uuidof(IUIApplication))) { *ppv = this; AddRef(); return S_OK; } else { return E_NOINTERFACE; } } LONG m_cRef; #else // IUnknown methods (lightweight) STDMETHODIMP QueryInterface(REFIID iid, void** ppv) { if ((iid == __uuidof(IUnknown)) || (iid == __uuidof(IUICommandHandler)) || (iid == __uuidof(IUIApplication))) { *ppv = this; return S_OK; } return E_NOINTERFACE; } ULONG STDMETHODCALLTYPE AddRef() { return 1; } ULONG STDMETHODCALLTYPE Release() { return 1; } #endif // CRibbonImpl ICtrl implementation virtual HRESULT DoExecute(UINT nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* /*pCommandExecutionProperties*/) { if (key != NULL) { if(k_(*key) != k_BooleanValue) { ATLTRACE2(atlTraceUI, 0, _T("Control ID %d is not handled\n"), nCmdID); return E_NOTIMPL; } BOOL bChecked = FALSE; ATLVERIFY(SUCCEEDED(PropVariantToBoolean(*ppropvarValue, &bChecked))); CUpdateUIBase::UISetCheck(nCmdID, bChecked); } ATLASSERT(verb == UI_EXECUTIONVERB_EXECUTE); (void)verb; // avoid level 4 warning static_cast(this)->OnRibbonCommandExecute(nCmdID); return S_OK; } virtual HRESULT DoUpdateProperty(UINT nCmdID, REFPROPERTYKEY key, const PROPVARIANT* /*ppropvarCurrentValue*/, PROPVARIANT* ppropvarNewValue) { T* pT = static_cast(this); HRESULT hr = E_NOTIMPL; switch (k_(key)) { case k_LargeImage: case k_LargeHighContrastImage: case k_SmallImage: case k_SmallHighContrastImage: if (HBITMAP hbm = pT->OnRibbonQueryImage(nCmdID, key)) hr = SetPropertyVal(key, GetImage(hbm, UI_OWNERSHIP_TRANSFER), ppropvarNewValue); break; case k_Label: case k_Keytip: case k_TooltipTitle: case k_TooltipDescription: case k_LabelDescription: if (LPCWSTR sText = pT->OnRibbonQueryText(nCmdID, key)) hr = SetPropertyVal(key, sText, ppropvarNewValue); break; case k_BooleanValue: case k_Enabled: hr = SetPropertyVal(key, pT->OnRibbonQueryState(nCmdID, key), ppropvarNewValue); break; case k_ContextAvailable: hr = SetPropertyVal(key, pT->OnRibbonQueryTabAvail(nCmdID), ppropvarNewValue); break; } return hr; } // CRibbonImpl::CRibbonXXXCtrl specialized classes //CRibbonComboCtrl template class CRibbonComboCtrl : public CollectionCtrlImpl, t_items, t_categories>> { public: CRibbonComboCtrl() { } }; // CRibbonItemGalleryCtrl template class CRibbonItemGalleryCtrl : public CollectionCtrlImpl, t_items, t_categories>> { public: CRibbonItemGalleryCtrl() { } }; // CRibbonCommandGalleryCtrl template class CRibbonCommandGalleryCtrl : public CollectionCtrlImpl, t_items, t_categories>> { public: CRibbonCommandGalleryCtrl() { } }; // CRibbonToolbarGalleryCtrl template class CRibbonToolbarGalleryCtrl : public ToolbarGalleryCtrlImpl { }; // CRibbonSimpleComboCtrl template class CRibbonSimpleComboCtrl : public SimpleCollectionCtrlImpl { }; // CRibbonSimpleGalleryCtrl template class CRibbonSimpleGalleryCtrl : public SimpleCollectionCtrlImpl { }; //CRibbonRecentItemsCtrl template class CRibbonRecentItemsCtrl : public RecentItemsCtrlImpl { public: CRibbonRecentItemsCtrl() { } }; // CRibbonColorCtrl template class CRibbonColorCtrl : public ColorCtrlImpl { public: CRibbonColorCtrl() { } }; //CRibbonFontCtrl template class CRibbonFontCtrl : public FontCtrlImpl { public: CRibbonFontCtrl() { } }; // CRibbonSpinnerCtrl template class CRibbonSpinnerCtrl : public SpinnerCtrlImpl { public: CRibbonSpinnerCtrl() { } }; // CRibbonFloatSpinnerCtrl template class CRibbonFloatSpinnerCtrl : public SpinnerCtrlImpl { public: CRibbonFloatSpinnerCtrl() { this->m_Values[4] = 1; // 1 decimal } }; // CRibbonCommandCtrl template class CRibbonCommandCtrl : public CommandCtrlImpl { public: CRibbonCommandCtrl() { } }; // Control classes access to T instance (re-initialized in constructor) static T* pWndRibbon; }; template __declspec(selectany) T* CRibbonImpl::pWndRibbon; // Control map element #pragma warning(push) #pragma warning(disable: 4510 610 4512) // missing default constructor, can't be instatiated, assignment operator could not be generated typedef struct { UINT uID; ICtrl& ctrl; } _ribbonCtrl; #pragma warning(pop) } // namespace RibbonUI /////////////////////////////////////////////////////////////////////////////// // RibbonUI Control map // Control map macros #define BEGIN_RIBBON_CONTROL_MAP(theClass) \ WTL::RibbonUI::ICtrl& GetRibbonCtrl(UINT id) \ { \ WTL::RibbonUI::_ribbonCtrl _ctrls[] = \ { #define RIBBON_CONTROL(member) {member.GetID(), static_cast(member)}, #define END_RIBBON_CONTROL_MAP() \ {0, *this} \ }; \ int i = 0; \ for(; i < _countof(_ctrls) - 1; i++) \ if (_ctrls[i].uID == id) \ break; \ return _ctrls[i].ctrl; \ } // Control message map macros #define RIBBON_GALLERY_CONTROL_HANDLER(id, func) \ if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = func((UI_EXECUTIONVERB)HIWORD(wParam), LOWORD(wParam), (UINT)lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define RIBBON_COMBO_CONTROL_HANDLER(id, func) \ RIBBON_GALLERY_CONTROL_HANDLER(id, func) #define RIBBON_FONT_CONTROL_HANDLER(id, func) \ if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = func((UI_EXECUTIONVERB)HIWORD(wParam), LOWORD(wParam), (CHARFORMAT2*)lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define RIBBON_COLOR_CONTROL_HANDLER(id, func) \ if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = func((UI_EXECUTIONVERB)HIWORD(wParam), LOWORD(wParam), (COLORREF)lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define RIBBON_SPINNER_CONTROL_HANDLER(id, func) \ if((uMsg == WM_COMMAND) && (id == wParam)) \ { \ bHandled = TRUE; \ lResult = func((WORD)wParam, (LONG)lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define RIBBON_FLOATSPINNER_CONTROL_HANDLER(id, func) \ if((uMsg == WM_COMMAND) && (id == wParam)) \ { \ bHandled = TRUE; \ lResult = func((WORD)wParam, (DOUBLE*)lParam, bHandled); \ if(bHandled) \ return TRUE; \ } // Handler prototypes /* LRESULT OnRibbonGalleryCtrl(UI_EXECUTIONVERB verb, WORD wID, UINT uSel, BOOL& bHandled); LRESULT OnRibbonComboCtrl(UI_EXECUTIONVERB verb, WORD wID, UINT uSel, BOOL& bHandled); LRESULT OnRibbonFontCtrl(UI_EXECUTIONVERB verb, WORD wID, CHARFORMAT2* pcf, BOOL& bHandled); LRESULT OnRibbonColorCtrl(UI_EXECUTIONVERB verb, WORD wID, COLORREF color, BOOL& bHandled); LRESULT OnRibbonSpinnerCtrl(WORD wID, LONG lVal, BOOL& bHandled); LRESULT OnRibbonFloatSpinnerCtrl(WORD wID, DOUBLE* pdVal, BOOL& bHandled); */ /////////////////////////////////////////////////////////////////////////////// // Ribbon frame classes // CRibbonFrameWindowImplBase // template class ATL_NO_VTABLE CRibbonFrameWindowImplBase : public TFrameImpl, public RibbonUI::CRibbonImpl { typedef TFrameImpl baseFrame; bool m_bUseCommandBarBitmaps; bool m_bWin7Fix; public: // Construction CRibbonFrameWindowImplBase(bool bUseCommandBarBitmaps = true) : m_bUseCommandBarBitmaps(bUseCommandBarBitmaps), m_bWin7Fix(false) { __if_not_exists(T::m_CmdBar) { m_bUseCommandBarBitmaps = false; } } // Win7 Aero fix helpers void ResetFrame() { const MARGINS margins = { 0, 0, 0, 0 }; ::DwmExtendFrameIntoClientArea(this->m_hWnd, &margins); } INT CalcWin7Fix() { ResetFrame(); RECT rc = {}; ::AdjustWindowRectEx(&rc, T::GetWndStyle(0), this->GetMenu() != NULL, T::GetWndExStyle(0)); return -rc.top; } bool NeedWin7Fix() { BOOL bComp = FALSE; return m_bWin7Fix && RunTimeHelper::IsWin7() && SUCCEEDED(DwmIsCompositionEnabled(&bComp)) && bComp; } // Operations bool UseCommandBarBitmaps(bool bUse) { __if_exists(T::m_CmdBar) { return m_bUseCommandBarBitmaps = bUse; } __if_not_exists(T::m_CmdBar) { (void)bUse; // avoid level 4 warning return false; } } bool ShowRibbonUI(bool bShow, INT32 imodes = UI_MAKEAPPMODE(0), LPCWSTR sResName = L"APPLICATION_RIBBON") { if (!RunTimeHelper::IsRibbonUIAvailable()) return false; ATLASSERT(this->GetIUIFrameworkPtr()); if (this->IsRibbonUI() == bShow) return bShow; bool bVisible = (this->IsWindowVisible() != FALSE); if(bVisible && !bShow) this->SetRedraw(FALSE); if (bShow && ::IsWindow(this->m_hWndToolBar)) { ::ShowWindow(this->m_hWndToolBar, SW_HIDE); UpdateLayout(); } m_bWin7Fix = !bShow; HRESULT hr = bShow ? this->CreateRibbon(sResName) : this->DestroyRibbon(); m_bWin7Fix = SUCCEEDED(hr) && !bShow; if (SUCCEEDED(hr)) { if(::IsWindow(this->m_hWndToolBar) && !bShow) { ::ShowWindow(this->m_hWndToolBar, SW_SHOWNA); UpdateLayout(); } else if (bShow) { this->PostMessage(WM_SIZE); this->SetRibbonModes(imodes); } } if(bVisible && !bShow) { this->SetRedraw(TRUE); this->RedrawWindow(NULL, NULL, RDW_FRAME | RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); } return SUCCEEDED(hr) ? bShow : !bShow; } // Overrideables HBITMAP OnRibbonQueryImage(UINT nCmdID, REFPROPERTYKEY key) { if ((key == UI_PKEY_SmallImage) && m_bUseCommandBarBitmaps) { if (HBITMAP hbm = GetCommandBarBitmap(nCmdID)) return (HBITMAP)::CopyImage(hbm, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); } return this->DefRibbonQueryImage(nCmdID); } BEGIN_MSG_MAP(CRibbonFrameWindowImplBase) if (!this->IsRibbonUI() && NeedWin7Fix()) { MESSAGE_HANDLER(WM_SIZING, OnSizing) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_ACTIVATE, OnActivate) MESSAGE_HANDLER(WM_NCCALCSIZE, OnNCCalcSize) } CHAIN_MSG_MAP(CRibbonUpdateUI) CHAIN_MSG_MAP(baseFrame) END_MSG_MAP() // Message handlers for Win7 Aero LRESULT OnSizing(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { switch (wParam) { case WMSZ_TOP: case WMSZ_TOPLEFT: case WMSZ_TOPRIGHT: this->SetWindowPos(NULL, (LPRECT)lParam, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); break; default: this->DefWindowProc(); break; } return 1; // handled } LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if (wParam != SIZE_MINIMIZED) this->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); bHandled = FALSE; return 1; } LRESULT OnActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(wParam != WA_INACTIVE) this->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); bHandled = FALSE; return 1; } LRESULT OnNCCalcSize(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { ATLASSERT(!this->IsRibbonUI() && NeedWin7Fix()); LRESULT lRet = this->DefWindowProc(); if(wParam) { LPNCCALCSIZE_PARAMS pParams = (LPNCCALCSIZE_PARAMS)lParam; pParams->rgrc[0].top = pParams->rgrc[1].top + CalcWin7Fix(); } return lRet; } // Overrides void UpdateLayout(BOOL bResizeBars = TRUE) { RECT rect = {}; this->GetClientRect(&rect); if (this->IsRibbonUI() && !this->IsRibbonHidden()) { rect.top += this->GetRibbonHeight(); } else if (!this->IsRibbonUI() && NeedWin7Fix()) { ResetFrame(); } // position bars and offset their dimensions this->UpdateBarsPosition(rect, bResizeBars); // resize client window if(this->m_hWndClient != NULL) ::SetWindowPos(this->m_hWndClient, NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE); } // Implementation HBITMAP GetCommandBarBitmap(UINT nCmdID) { __if_exists (T::m_CmdBar) { ATLASSERT(RunTimeHelper::IsVista()); T* pT =static_cast(this); int nIndex = pT->m_CmdBar.m_arrCommand.Find((WORD&)nCmdID); return (nIndex == -1) ? NULL : pT->m_CmdBar.m_arrVistaBitmap[nIndex]; } __if_not_exists (T::m_CmdBar) { (void)nCmdID; // avoid level 4 warning return NULL; } } }; // CRibbonFrameWindowImpl // template class ATL_NO_VTABLE CRibbonFrameWindowImpl : public CRibbonFrameWindowImplBase> { }; // CRibbonMDIFrameWindowImpl // template class ATL_NO_VTABLE CRibbonMDIFrameWindowImpl : public CRibbonFrameWindowImplBase> { }; /////////////////////////////////////////////////////////////////////////////// // CRibbonPersist helper for RibbonUI persistency class CRibbonPersist { public: CRibbonPersist(LPCWSTR sAppKey) { ATLASSERT(sAppKey && *sAppKey); m_Key.Create(HKEY_CURRENT_USER, sAppKey); ATLASSERT(m_Key.m_hKey); } ATL::CRegKey m_Key; LONG Save(bool bRibbonUI, HGLOBAL hgSettings = NULL) { ATL::CRegKey key; const DWORD dwUI = bRibbonUI; LONG lRet = key.Create(m_Key, L"Ribbon"); if(lRet != ERROR_SUCCESS) return lRet; lRet = key.SetDWORDValue(L"UI", dwUI); if(lRet != ERROR_SUCCESS) return lRet; if (hgSettings != NULL) { LPBYTE pVal = (LPBYTE)::GlobalLock(hgSettings); if (pVal != NULL) { lRet = key.SetBinaryValue(L"Settings", pVal, (ULONG)::GlobalSize(hgSettings)); ::GlobalUnlock(hgSettings); } else { lRet = GetLastError(); } } return lRet; } LONG Restore(bool& bRibbonUI, HGLOBAL& hgSettings) { ATLASSERT(hgSettings == NULL); ATL::CRegKey key; LONG lRet = key.Open(m_Key, L"Ribbon"); if(lRet != ERROR_SUCCESS) return lRet; DWORD dwUI = 0xffff; lRet = key.QueryDWORDValue(L"UI", dwUI); if(lRet == ERROR_SUCCESS) bRibbonUI = dwUI == 1; else return lRet; ULONG ulSize = 0; lRet = key.QueryBinaryValue(L"Settings", NULL, &ulSize); if (lRet == ERROR_SUCCESS) { ATLASSERT(ulSize != 0); hgSettings = ::GlobalAlloc(GHND, ulSize); if (hgSettings != NULL) { LPBYTE pData = (LPBYTE)::GlobalLock(hgSettings); if (pData != NULL) { lRet = key.QueryBinaryValue(L"Settings", pData, &ulSize); } else { lRet = GetLastError(); ::GlobalFree(hgSettings); hgSettings = NULL; } } else { lRet = GetLastError(); } } return lRet; } LONG Delete() { return m_Key.DeleteSubKey(L"Ribbon"); } }; } // namespace WTL #endif // __ATLRIBBON_H__ ================================================ FILE: third_party/WTL/Include/atlscrl.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLSCRL_H__ #define __ATLSCRL_H__ #pragma once #ifndef __ATLAPP_H__ #error atlscrl.h requires atlapp.h to be included first #endif #ifndef __ATLWIN_H__ #error atlscrl.h requires atlwin.h to be included first #endif /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CScrollImpl // CScrollWindowImpl // CMapScrollImpl // CMapScrollWindowImpl // CFSBWindowT // CZoomScrollImpl // CZoomScrollWindowImpl // CScrollContainerImpl // CScrollContainer namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CScrollImpl - Provides scrolling support to any window // Scroll extended styles #define SCRL_SCROLLCHILDREN 0x00000001 #define SCRL_ERASEBACKGROUND 0x00000002 #define SCRL_NOTHUMBTRACKING 0x00000004 #define SCRL_SMOOTHSCROLL 0x00000008 #define SCRL_DISABLENOSCROLLV 0x00000010 #define SCRL_DISABLENOSCROLLH 0x00000020 #define SCRL_DISABLENOSCROLL (SCRL_DISABLENOSCROLLV | SCRL_DISABLENOSCROLLH) template class CScrollImpl { public: enum { uSCROLL_FLAGS = SW_INVALIDATE }; POINT m_ptOffset; SIZE m_sizeAll; SIZE m_sizeLine; SIZE m_sizePage; SIZE m_sizeClient; int m_zDelta; // current wheel value int m_nWheelLines; // number of lines to scroll on wheel int m_zHDelta; // current horizontal wheel value int m_nHWheelChars; // number of chars to scroll on horizontal wheel UINT m_uScrollFlags; DWORD m_dwExtendedStyle; // scroll specific extended styles // Constructor CScrollImpl() : m_zDelta(0), m_nWheelLines(3), m_zHDelta(0), m_nHWheelChars(3), m_uScrollFlags(0U), m_dwExtendedStyle(0) { m_ptOffset.x = 0; m_ptOffset.y = 0; m_sizeAll.cx = 0; m_sizeAll.cy = 0; m_sizePage.cx = 0; m_sizePage.cy = 0; m_sizeLine.cx = 0; m_sizeLine.cy = 0; m_sizeClient.cx = 0; m_sizeClient.cy = 0; SetScrollExtendedStyle(SCRL_SCROLLCHILDREN | SCRL_ERASEBACKGROUND); } // Attributes & Operations DWORD GetScrollExtendedStyle() const { return m_dwExtendedStyle; } DWORD SetScrollExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) { DWORD dwPrevStyle = m_dwExtendedStyle; if(dwMask == 0) m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); // cache scroll flags T* pT = static_cast(this); (void)pT; // avoid level 4 warning m_uScrollFlags = pT->uSCROLL_FLAGS | (IsScrollingChildren() ? SW_SCROLLCHILDREN : 0) | (IsErasingBackground() ? SW_ERASE : 0); m_uScrollFlags |= (IsSmoothScroll() ? SW_SMOOTHSCROLL : 0); return dwPrevStyle; } // offset operations void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->AdjustScrollOffset(x, y); int dx = m_ptOffset.x - x; int dy = m_ptOffset.y - y; m_ptOffset.x = x; m_ptOffset.y = y; // block: set horizontal scroll bar { SCROLLINFO si = { sizeof(SCROLLINFO) }; si.fMask = SIF_POS; if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) si.fMask |= SIF_DISABLENOSCROLL; si.nPos = m_ptOffset.x; pT->SetScrollInfo(SB_HORZ, &si, bRedraw); } // block: set vertical scroll bar { SCROLLINFO si = { sizeof(SCROLLINFO) }; si.fMask = SIF_POS; if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) si.fMask |= SIF_DISABLENOSCROLL; si.nPos = m_ptOffset.y; pT->SetScrollInfo(SB_VERT, &si, bRedraw); } // Move all children if needed if(IsScrollingChildren() && ((dx != 0) || (dy != 0))) { for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) { RECT rect = {}; ::GetWindowRect(hWndChild, &rect); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 1); ::SetWindowPos(hWndChild, NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); } } if(bRedraw) pT->Invalidate(); } void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) { SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); } void GetScrollOffset(POINT& ptOffset) const { ptOffset = m_ptOffset; } // size operations void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE, bool bResetOffset = true) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); m_sizeAll.cx = cx; m_sizeAll.cy = cy; int x = 0; int y = 0; if(!bResetOffset) { x = m_ptOffset.x; y = m_ptOffset.y; pT->AdjustScrollOffset(x, y); } int dx = m_ptOffset.x - x; int dy = m_ptOffset.y - y; m_ptOffset.x = x; m_ptOffset.y = y; // block: set horizontal scroll bar { SCROLLINFO si = { sizeof(SCROLLINFO) }; si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) si.fMask |= SIF_DISABLENOSCROLL; si.nMin = 0; si.nMax = m_sizeAll.cx - 1; si.nPage = m_sizeClient.cx; si.nPos = m_ptOffset.x; pT->SetScrollInfo(SB_HORZ, &si, bRedraw); } // block: set vertical scroll bar { SCROLLINFO si = { sizeof(SCROLLINFO) }; si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) si.fMask |= SIF_DISABLENOSCROLL; si.nMin = 0; si.nMax = m_sizeAll.cy - 1; si.nPage = m_sizeClient.cy; si.nPos = m_ptOffset.y; pT->SetScrollInfo(SB_VERT, &si, bRedraw); } // Move all children if needed if(IsScrollingChildren() && ((dx != 0) || (dy != 0))) { for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) { RECT rect = {}; ::GetWindowRect(hWndChild, &rect); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 1); ::SetWindowPos(hWndChild, NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); } } SetScrollLine(0, 0); SetScrollPage(0, 0); if(bRedraw) pT->Invalidate(); } void SetScrollSize(SIZE size, BOOL bRedraw = TRUE, bool bResetOffset = true) { SetScrollSize(size.cx, size.cy, bRedraw, bResetOffset); } void GetScrollSize(SIZE& sizeWnd) const { sizeWnd = m_sizeAll; } // line operations void SetScrollLine(int cxLine, int cyLine) { ATLASSERT((cxLine >= 0) && (cyLine >= 0)); ATLASSERT((m_sizeAll.cx != 0) && (m_sizeAll.cy != 0)); m_sizeLine.cx = T::CalcLineOrPage(cxLine, m_sizeAll.cx, 100); m_sizeLine.cy = T::CalcLineOrPage(cyLine, m_sizeAll.cy, 100); } void SetScrollLine(SIZE sizeLine) { SetScrollLine(sizeLine.cx, sizeLine.cy); } void GetScrollLine(SIZE& sizeLine) const { sizeLine = m_sizeLine; } // page operations void SetScrollPage(int cxPage, int cyPage) { ATLASSERT((cxPage >= 0) && (cyPage >= 0)); ATLASSERT((m_sizeAll.cx != 0) && (m_sizeAll.cy != 0)); m_sizePage.cx = T::CalcLineOrPage(cxPage, m_sizeAll.cx, 10); m_sizePage.cy = T::CalcLineOrPage(cyPage, m_sizeAll.cy, 10); } void SetScrollPage(SIZE sizePage) { SetScrollPage(sizePage.cx, sizePage.cy); } void GetScrollPage(SIZE& sizePage) const { sizePage = m_sizePage; } // commands void ScrollLineDown() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_VERT, SB_LINEDOWN, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); } void ScrollLineUp() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_VERT, SB_LINEUP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); } void ScrollPageDown() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_VERT, SB_PAGEDOWN, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); } void ScrollPageUp() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_VERT, SB_PAGEUP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); } void ScrollTop() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_VERT, SB_TOP, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); } void ScrollBottom() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_VERT, SB_BOTTOM, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); } void ScrollLineRight() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_HORZ, SB_LINEDOWN, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); } void ScrollLineLeft() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_HORZ, SB_LINEUP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); } void ScrollPageRight() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_HORZ, SB_PAGEDOWN, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); } void ScrollPageLeft() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_HORZ, SB_PAGEUP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); } void ScrollAllLeft() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_HORZ, SB_TOP, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); } void ScrollAllRight() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_HORZ, SB_BOTTOM, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); } // scroll to make point/view/window visible void ScrollToView(POINT pt) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); RECT rect = { pt.x, pt.y, pt.x, pt.y }; pT->ScrollToView(rect); } void ScrollToView(RECT& rect) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); RECT rcClient = {}; pT->GetClientRect(&rcClient); int x = m_ptOffset.x; if(rect.left < m_ptOffset.x) x = rect.left; else if(rect.right > (m_ptOffset.x + rcClient.right)) x = rect.right - rcClient.right; int y = m_ptOffset.y; if(rect.top < m_ptOffset.y) y = rect.top; else if(rect.bottom > (m_ptOffset.y + rcClient.bottom)) y = rect.bottom - rcClient.bottom; SetScrollOffset(x, y); } void ScrollToView(HWND hWnd) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); RECT rect = {}; ::GetWindowRect(hWnd, &rect); ::OffsetRect(&rect, m_ptOffset.x, m_ptOffset.y); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 2); ScrollToView(rect); } BEGIN_MSG_MAP(CScrollImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_VSCROLL, OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel) MESSAGE_HANDLER(WM_MOUSEHWHEEL, OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) MESSAGE_HANDLER(WM_SIZE, OnSize) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) // standard scroll commands ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_SCROLL_UP, OnScrollUp) COMMAND_ID_HANDLER(ID_SCROLL_DOWN, OnScrollDown) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, OnScrollPageUp) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, OnScrollPageDown) COMMAND_ID_HANDLER(ID_SCROLL_TOP, OnScrollTop) COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, OnScrollBottom) COMMAND_ID_HANDLER(ID_SCROLL_LEFT, OnScrollLeft) COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, OnScrollRight) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, OnScrollPageLeft) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, OnScrollPageRight) COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, OnScrollAllLeft) COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, OnScrollAllRight) END_MSG_MAP() LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { T* pT = static_cast(this); pT->GetSystemSettings(); bHandled = FALSE; return 1; } LRESULT OnVScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_VERT, (int)(short)LOWORD(wParam), (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); return 0; } LRESULT OnHScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoScroll(SB_HORZ, (int)(short)LOWORD(wParam), (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); return 0; } LRESULT OnMouseWheel(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); int nScrollCode = (m_nWheelLines == WHEEL_PAGESCROLL) ? ((zDelta > 0) ? SB_PAGEUP : SB_PAGEDOWN) : ((zDelta > 0) ? SB_LINEUP : SB_LINEDOWN); m_zDelta += zDelta; // cumulative int zTotal = (m_nWheelLines == WHEEL_PAGESCROLL) ? abs(m_zDelta) : abs(m_zDelta) * m_nWheelLines; if(m_sizeAll.cy > m_sizeClient.cy) { for(int i = 0; i < zTotal; i += WHEEL_DELTA) { pT->DoScroll(SB_VERT, nScrollCode, (int&)m_ptOffset.y, m_sizeAll.cy, m_sizePage.cy, m_sizeLine.cy); pT->UpdateWindow(); } } else if(m_sizeAll.cx > m_sizeClient.cx) // can't scroll vertically, scroll horizontally { for(int i = 0; i < zTotal; i += WHEEL_DELTA) { pT->DoScroll(SB_HORZ, nScrollCode, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); pT->UpdateWindow(); } } m_zDelta %= WHEEL_DELTA; return 0; } LRESULT OnMouseHWheel(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); int nScrollCode = (m_nHWheelChars == WHEEL_PAGESCROLL) ? ((zDelta > 0) ? SB_PAGERIGHT : SB_PAGELEFT) : ((zDelta > 0) ? SB_LINERIGHT : SB_LINELEFT); m_zHDelta += zDelta; // cumulative int zTotal = (m_nHWheelChars == WHEEL_PAGESCROLL) ? abs(m_zHDelta) : abs(m_zHDelta) * m_nHWheelChars; if(m_sizeAll.cx > m_sizeClient.cx) { for(int i = 0; i < zTotal; i += WHEEL_DELTA) { pT->DoScroll(SB_HORZ, nScrollCode, (int&)m_ptOffset.x, m_sizeAll.cx, m_sizePage.cx, m_sizeLine.cx); pT->UpdateWindow(); } } m_zHDelta %= WHEEL_DELTA; return 0; } LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { GetSystemSettings(); return 0; } LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); pT->DoSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); bHandled = FALSE; return 1; } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); if(wParam != NULL) { CDCHandle dc = (HDC)wParam; POINT ptViewportOrg = { 0, 0 }; dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y, &ptViewportOrg); pT->DoPaint(dc); dc.SetViewportOrg(ptViewportOrg); } else { CPaintDC dc(pT->m_hWnd); dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y); pT->DoPaint(dc.m_hDC); } return 0; } // scrolling handlers LRESULT OnScrollUp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollLineUp(); return 0; } LRESULT OnScrollDown(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollLineDown(); return 0; } LRESULT OnScrollPageUp(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollPageUp(); return 0; } LRESULT OnScrollPageDown(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollPageDown(); return 0; } LRESULT OnScrollTop(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollTop(); return 0; } LRESULT OnScrollBottom(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollBottom(); return 0; } LRESULT OnScrollLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollLineLeft(); return 0; } LRESULT OnScrollRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollLineRight(); return 0; } LRESULT OnScrollPageLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollPageLeft(); return 0; } LRESULT OnScrollPageRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollPageRight(); return 0; } LRESULT OnScrollAllLeft(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollAllLeft(); return 0; } LRESULT OnScrollAllRight(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { ScrollAllRight(); return 0; } // Overrideables void DoPaint(CDCHandle /*dc*/) { // must be implemented in a derived class ATLASSERT(FALSE); } // Implementation void DoSize(int cx, int cy) { m_sizeClient.cx = cx; m_sizeClient.cy = cy; T* pT = static_cast(this); // block: set horizontal scroll bar { SCROLLINFO si = { sizeof(SCROLLINFO) }; si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; si.nMin = 0; si.nMax = m_sizeAll.cx - 1; if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLH) != 0) si.fMask |= SIF_DISABLENOSCROLL; si.nPage = m_sizeClient.cx; si.nPos = m_ptOffset.x; pT->SetScrollInfo(SB_HORZ, &si, TRUE); } // block: set vertical scroll bar { SCROLLINFO si = { sizeof(SCROLLINFO) }; si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; si.nMin = 0; si.nMax = m_sizeAll.cy - 1; if((m_dwExtendedStyle & SCRL_DISABLENOSCROLLV) != 0) si.fMask |= SIF_DISABLENOSCROLL; si.nPage = m_sizeClient.cy; si.nPos = m_ptOffset.y; pT->SetScrollInfo(SB_VERT, &si, TRUE); } int x = m_ptOffset.x; int y = m_ptOffset.y; if(pT->AdjustScrollOffset(x, y)) { // Children will be moved in SetScrollOffset, if needed pT->ScrollWindowEx(m_ptOffset.x - x, m_ptOffset.y - y, (m_uScrollFlags & ~SCRL_SCROLLCHILDREN)); SetScrollOffset(x, y, FALSE); } } void DoScroll(int nType, int nScrollCode, int& cxyOffset, int cxySizeAll, int cxySizePage, int cxySizeLine) { T* pT = static_cast(this); RECT rect = {}; pT->GetClientRect(&rect); int cxyClient = (nType == SB_VERT) ? rect.bottom : rect.right; int cxyMax = cxySizeAll - cxyClient; if(cxyMax < 0) // can't scroll, client area is bigger return; bool bUpdate = true; int cxyScroll = 0; switch(nScrollCode) { case SB_TOP: // top or all left cxyScroll = cxyOffset; cxyOffset = 0; break; case SB_BOTTOM: // bottom or all right cxyScroll = cxyOffset - cxyMax; cxyOffset = cxyMax; break; case SB_LINEUP: // line up or line left if(cxyOffset >= cxySizeLine) { cxyScroll = cxySizeLine; cxyOffset -= cxySizeLine; } else { cxyScroll = cxyOffset; cxyOffset = 0; } break; case SB_LINEDOWN: // line down or line right if(cxyOffset < cxyMax - cxySizeLine) { cxyScroll = -cxySizeLine; cxyOffset += cxySizeLine; } else { cxyScroll = cxyOffset - cxyMax; cxyOffset = cxyMax; } break; case SB_PAGEUP: // page up or page left if(cxyOffset >= cxySizePage) { cxyScroll = cxySizePage; cxyOffset -= cxySizePage; } else { cxyScroll = cxyOffset; cxyOffset = 0; } break; case SB_PAGEDOWN: // page down or page right if(cxyOffset < cxyMax - cxySizePage) { cxyScroll = -cxySizePage; cxyOffset += cxySizePage; } else { cxyScroll = cxyOffset - cxyMax; cxyOffset = cxyMax; } break; case SB_THUMBTRACK: if(IsNoThumbTracking()) break; // else fall through case SB_THUMBPOSITION: { SCROLLINFO si = { sizeof(SCROLLINFO), SIF_TRACKPOS }; if(pT->GetScrollInfo(nType, &si)) { cxyScroll = cxyOffset - si.nTrackPos; cxyOffset = si.nTrackPos; } } break; case SB_ENDSCROLL: default: bUpdate = false; break; } if(bUpdate && (cxyScroll != 0)) { pT->SetScrollPos(nType, cxyOffset, TRUE); if(nType == SB_VERT) pT->ScrollWindowEx(0, cxyScroll, m_uScrollFlags); else pT->ScrollWindowEx(cxyScroll, 0, m_uScrollFlags); } } static int CalcLineOrPage(int nVal, int nMax, int nDiv) { if(nVal == 0) { nVal = nMax / nDiv; if(nVal < 1) nVal = 1; } else if(nVal > nMax) { nVal = nMax; } return nVal; } bool AdjustScrollOffset(int& x, int& y) { int xOld = x; int yOld = y; int cxMax = m_sizeAll.cx - m_sizeClient.cx; if(x > cxMax) x = (cxMax >= 0) ? cxMax : 0; else if(x < 0) x = 0; int cyMax = m_sizeAll.cy - m_sizeClient.cy; if(y > cyMax) y = (cyMax >= 0) ? cyMax : 0; else if(y < 0) y = 0; return ((x != xOld) || (y != yOld)); } void GetSystemSettings() { ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &m_nWheelLines, 0); #ifndef SPI_GETWHEELSCROLLCHARS const UINT SPI_GETWHEELSCROLLCHARS = 0x006C; #endif ::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &m_nHWheelChars, 0); } bool IsScrollingChildren() const { return (m_dwExtendedStyle & SCRL_SCROLLCHILDREN) != 0; } bool IsErasingBackground() const { return (m_dwExtendedStyle & SCRL_ERASEBACKGROUND) != 0; } bool IsNoThumbTracking() const { return (m_dwExtendedStyle & SCRL_NOTHUMBTRACKING) != 0; } bool IsSmoothScroll() const { return (m_dwExtendedStyle & SCRL_SMOOTHSCROLL) != 0; } }; /////////////////////////////////////////////////////////////////////////////// // CScrollWindowImpl - Implements a scrollable window template class ATL_NO_VTABLE CScrollWindowImpl : public ATL::CWindowImpl, public CScrollImpl< T > { public: BOOL SubclassWindow(HWND hWnd) { BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); if(bRet != FALSE) { T* pT = static_cast(this); pT->GetSystemSettings(); RECT rect = {}; this->GetClientRect(&rect); pT->DoSize(rect.right, rect.bottom); } return bRet; } BEGIN_MSG_MAP(CScrollWindowImpl) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) MESSAGE_HANDLER(WM_PAINT, CScrollImpl< T >::OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, CScrollImpl< T >::OnPaint) ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CMapScrollImpl - Provides mapping and scrolling support to any window template class CMapScrollImpl : public CScrollImpl< T > { public: int m_nMapMode; RECT m_rectLogAll; SIZE m_sizeLogLine; SIZE m_sizeLogPage; // Constructor CMapScrollImpl() : m_nMapMode(MM_TEXT) { ::SetRectEmpty(&m_rectLogAll); m_sizeLogPage.cx = 0; m_sizeLogPage.cy = 0; m_sizeLogLine.cx = 0; m_sizeLogLine.cy = 0; } // Attributes & Operations // mapping mode operations void SetScrollMapMode(int nMapMode) { ATLASSERT((nMapMode >= MM_MIN) && (nMapMode <= MM_MAX_FIXEDSCALE)); m_nMapMode = nMapMode; } int GetScrollMapMode() const { ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); return m_nMapMode; } // offset operations void SetScrollOffset(int x, int y, BOOL bRedraw = TRUE) { ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); POINT ptOff = { x, y }; // block: convert logical to device units { CWindowDC dc(NULL); dc.SetMapMode(m_nMapMode); dc.LPtoDP(&ptOff); } CScrollImpl< T >::SetScrollOffset(ptOff, bRedraw); } void SetScrollOffset(POINT ptOffset, BOOL bRedraw = TRUE) { SetScrollOffset(ptOffset.x, ptOffset.y, bRedraw); } void GetScrollOffset(POINT& ptOffset) const { ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); ptOffset = this->m_ptOffset; // block: convert device to logical units { CWindowDC dc(NULL); dc.SetMapMode(m_nMapMode); dc.DPtoLP(&ptOffset); } } // size operations void SetScrollSize(int xMin, int yMin, int xMax, int yMax, BOOL bRedraw = TRUE, bool bResetOffset = true) { ATLASSERT((xMax > xMin) && (yMax > yMin)); ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); ::SetRect(&m_rectLogAll, xMin, yMin, xMax, yMax); SIZE sizeAll = {}; sizeAll.cx = xMax - xMin + 1; sizeAll.cy = yMax - yMin + 1; // block: convert logical to device units { CWindowDC dc(NULL); dc.SetMapMode(m_nMapMode); dc.LPtoDP(&sizeAll); } CScrollImpl< T >::SetScrollSize(sizeAll, bRedraw, bResetOffset); SetScrollLine(0, 0); SetScrollPage(0, 0); } void SetScrollSize(RECT& rcScroll, BOOL bRedraw = TRUE, bool bResetOffset = true) { SetScrollSize(rcScroll.left, rcScroll.top, rcScroll.right, rcScroll.bottom, bRedraw, bResetOffset); } void SetScrollSize(int cx, int cy, BOOL bRedraw = TRUE, bool bResetOffset = true) { SetScrollSize(0, 0, cx, cy, bRedraw, bResetOffset); } void SetScrollSize(SIZE size, BOOL bRedraw = TRUE, bool bResetOffset = true) { SetScrollSize(0, 0, size.cx, size.cy, bRedraw, bResetOffset); } void GetScrollSize(RECT& rcScroll) const { ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); rcScroll = m_rectLogAll; } // line operations void SetScrollLine(int cxLine, int cyLine) { ATLASSERT((cxLine >= 0) && (cyLine >= 0)); ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); m_sizeLogLine.cx = cxLine; m_sizeLogLine.cy = cyLine; SIZE sizeLine = m_sizeLogLine; // block: convert logical to device units { CWindowDC dc(NULL); dc.SetMapMode(m_nMapMode); dc.LPtoDP(&sizeLine); } CScrollImpl< T >::SetScrollLine(sizeLine); } void SetScrollLine(SIZE sizeLine) { SetScrollLine(sizeLine.cx, sizeLine.cy); } void GetScrollLine(SIZE& sizeLine) const { ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); sizeLine = m_sizeLogLine; } // page operations void SetScrollPage(int cxPage, int cyPage) { ATLASSERT((cxPage >= 0) && (cyPage >= 0)); ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); m_sizeLogPage.cx = cxPage; m_sizeLogPage.cy = cyPage; SIZE sizePage = m_sizeLogPage; // block: convert logical to device units { CWindowDC dc(NULL); dc.SetMapMode(m_nMapMode); dc.LPtoDP(&sizePage); } CScrollImpl< T >::SetScrollPage(sizePage); } void SetScrollPage(SIZE sizePage) { SetScrollPage(sizePage.cx, sizePage.cy); } void GetScrollPage(SIZE& sizePage) const { ATLASSERT((m_nMapMode >= MM_MIN) && (m_nMapMode <= MM_MAX_FIXEDSCALE)); sizePage = m_sizeLogPage; } BEGIN_MSG_MAP(CMapScrollImpl) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) END_MSG_MAP() LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); if(wParam != NULL) { CDCHandle dc = (HDC)wParam; int nMapModeSav = dc.GetMapMode(); dc.SetMapMode(m_nMapMode); POINT ptViewportOrg = { 0, 0 }; if(m_nMapMode == MM_TEXT) dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y, &ptViewportOrg); else dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y + this->m_sizeAll.cy, &ptViewportOrg); POINT ptWindowOrg = { 0, 0 }; dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top, &ptWindowOrg); pT->DoPaint(dc); dc.SetMapMode(nMapModeSav); dc.SetViewportOrg(ptViewportOrg); dc.SetWindowOrg(ptWindowOrg); } else { CPaintDC dc(pT->m_hWnd); dc.SetMapMode(m_nMapMode); if(m_nMapMode == MM_TEXT) dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y); else dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y + this->m_sizeAll.cy); dc.SetWindowOrg(m_rectLogAll.left, m_rectLogAll.top); pT->DoPaint(dc.m_hDC); } return 0; } }; /////////////////////////////////////////////////////////////////////////////// // CMapScrollWindowImpl - Implements scrolling window with mapping template class ATL_NO_VTABLE CMapScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CMapScrollImpl< T > { public: BOOL SubclassWindow(HWND hWnd) { BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); if(bRet != FALSE) { T* pT = static_cast(this); pT->GetSystemSettings(); RECT rect = {}; this->GetClientRect(&rect); pT->DoSize(rect.right, rect.bottom); } return bRet; } BEGIN_MSG_MAP(CMapScrollWindowImpl) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, CScrollImpl< T >::OnMouseWheel) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) MESSAGE_HANDLER(WM_PAINT, CMapScrollImpl< T >::OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, CMapScrollImpl< T >::OnPaint) ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CFSBWindow - Use as a base instead of CWindow to get flat scroll bar support #ifdef __ATLCTRLS_H__ template class CFSBWindowT : public TBase, public CFlatScrollBarImpl > { public: // Constructors CFSBWindowT(HWND hWnd = NULL) : TBase(hWnd) { } CFSBWindowT< TBase >& operator =(HWND hWnd) { this->m_hWnd = hWnd; return *this; } // CWindow overrides that use flat scroll bar API // (only those methods that are used by scroll window classes) int SetScrollPos(int nBar, int nPos, BOOL bRedraw = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return this->FlatSB_SetScrollPos(nBar, nPos, bRedraw); } BOOL GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) { ATLASSERT(::IsWindow(this->m_hWnd)); return this->FlatSB_GetScrollInfo(nBar, lpScrollInfo); } BOOL SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw = TRUE) { ATLASSERT(::IsWindow(this->m_hWnd)); return this->FlatSB_SetScrollInfo(nBar, lpScrollInfo, bRedraw); } }; typedef CFSBWindowT CFSBWindow; #endif // __ATLCTRLS_H__ /////////////////////////////////////////////////////////////////////////////// // CZoomScrollImpl - Provides zooming and scrolling support to any window // The zoom modes that can be set with the SetZoomMode method enum { ZOOMMODE_OFF, ZOOMMODE_IN, // If left mouse button is clicked or dragged, zoom in on point clicked or rectangle dragged. ZOOMMODE_OUT // If left mouse button clicked, zoom out on point clicked. }; // Notification to parent that zoom scale changed as a result of user mouse action. #define ZSN_ZOOMCHANGED (NM_FIRST - 50) template class CZoomScrollImpl : public CScrollImpl< T > { public: enum { m_cxyMinZoomRect = 12 }; // min rect size to zoom in on rect. struct _ChildPlacement { HWND hWnd; int x; int y; int cx; int cy; bool operator ==(const _ChildPlacement& cp) const { return (memcmp(this, &cp, sizeof(_ChildPlacement)) == 0); } }; // Data members SIZE m_sizeLogAll; SIZE m_sizeLogLine; SIZE m_sizeLogPage; float m_fZoomScale; float m_fZoomScaleMin; float m_fZoomScaleMax; float m_fZoomDelta; // Used in ZOOMMODE_IN and ZOOMMODE_OUT on left-button click. int m_nZoomMode; RECT m_rcTrack; bool m_bTracking; bool m_bZoomChildren; ATL::CSimpleArray<_ChildPlacement> m_arrChildren; // Constructor CZoomScrollImpl(): m_fZoomScale(1.0f), m_fZoomScaleMin(0.1f), m_fZoomScaleMax(100.0f), m_fZoomDelta(0.5f), m_nZoomMode(ZOOMMODE_OFF), m_bTracking(false), m_bZoomChildren(false) { m_sizeLogAll.cx = 0; m_sizeLogAll.cy = 0; m_sizeLogPage.cx = 0; m_sizeLogPage.cy = 0; m_sizeLogLine.cx = 0; m_sizeLogLine.cy = 0; ::SetRectEmpty(&m_rcTrack); } // Attributes & Operations // size operations void SetScrollSize(int cxLog, int cyLog, BOOL bRedraw = TRUE, bool bResetOffset = true) { ATLASSERT((cxLog >= 0) && (cyLog >= 0)); // Set up the defaults if((cxLog == 0) && (cyLog == 0)) { cxLog = 1; cyLog = 1; } m_sizeLogAll.cx = cxLog; m_sizeLogAll.cy = cyLog; SIZE sizeAll = {}; sizeAll.cx = (int)((float)m_sizeLogAll.cx * m_fZoomScale); sizeAll.cy = (int)((float)m_sizeLogAll.cy * m_fZoomScale); CScrollImpl< T >::SetScrollSize(sizeAll, bRedraw, bResetOffset); } void SetScrollSize(SIZE sizeLog, BOOL bRedraw = TRUE, bool bResetOffset = true) { SetScrollSize(sizeLog.cx, sizeLog.cy, bRedraw, bResetOffset); } void GetScrollSize(SIZE& sizeLog) const { sizeLog = m_sizeLogAll; } // line operations void SetScrollLine(int cxLogLine, int cyLogLine) { ATLASSERT((cxLogLine >= 0) && (cyLogLine >= 0)); m_sizeLogLine.cx = cxLogLine; m_sizeLogLine.cy = cyLogLine; SIZE sizeLine = {}; sizeLine.cx = (int)((float)m_sizeLogLine.cx * m_fZoomScale); sizeLine.cy = (int)((float)m_sizeLogLine.cy * m_fZoomScale); CScrollImpl< T >::SetScrollLine(sizeLine); } void SetScrollLine(SIZE sizeLogLine) { SetScrollLine(sizeLogLine.cx, sizeLogLine.cy); } void GetScrollLine(SIZE& sizeLogLine) const { sizeLogLine = m_sizeLogLine; } // page operations void SetScrollPage(int cxLogPage, int cyLogPage) { ATLASSERT((cxLogPage >= 0) && (cyLogPage >= 0)); m_sizeLogPage.cx = cxLogPage; m_sizeLogPage.cy = cyLogPage; SIZE sizePage = {}; sizePage.cx = (int)((float)m_sizeLogPage.cx * m_fZoomScale); sizePage.cy = (int)((float)m_sizeLogPage.cy * m_fZoomScale); CScrollImpl< T >::SetScrollPage(sizePage); } void SetScrollPage(SIZE sizeLogPage) { SetScrollPage(sizeLogPage.cx, sizeLogPage.cy); } void GetScrollPage(SIZE& sizeLogPage) const { sizeLogPage = m_sizeLogPage; } void SetZoomScale(float fZoomScale) { ATLASSERT(fZoomScale > 0.0f); if(fZoomScale <= 0.0f) return; m_fZoomScale = fZoomScale; if(m_fZoomScale < m_fZoomScaleMin) m_fZoomScale = m_fZoomScaleMin; else if(m_fZoomScale > m_fZoomScaleMax) m_fZoomScale = m_fZoomScaleMax; } float GetZoomScale() const { return m_fZoomScale; } void SetZoomScaleMin(float fZoomScaleMin) { ATLASSERT(fZoomScaleMin > 0.0f); ATLASSERT(fZoomScaleMin <= m_fZoomScaleMax); m_fZoomScaleMin = fZoomScaleMin; } float GetZoomScaleMin() const { return m_fZoomScaleMin; } void SetZoomScaleMax(float fZoomScaleMax) { ATLASSERT(fZoomScaleMax > 0.0f); ATLASSERT(m_fZoomScaleMin <= fZoomScaleMax); m_fZoomScaleMax = fZoomScaleMax; } float GetZoomScaleMax() const { return m_fZoomScaleMax; } void SetZoomDelta(float fZoomDelta) { ATLASSERT(fZoomDelta >= 0.0f); if(fZoomDelta >= 0.0f) m_fZoomDelta = fZoomDelta; } float GetZoomDelta() const { return m_fZoomDelta; } void SetZoomMode(int nZoomMode) { m_nZoomMode = nZoomMode; } int GetZoomMode() const { return m_nZoomMode; } void SetZoomChildren(bool bEnable = true) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); m_bZoomChildren = bEnable; m_arrChildren.RemoveAll(); if(m_bZoomChildren) { for(HWND hWndChild = ::GetWindow(pT->m_hWnd, GW_CHILD); hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT)) { RECT rect = {}; ::GetWindowRect(hWndChild, &rect); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rect, 2); _ChildPlacement cp = {}; cp.hWnd = hWndChild; cp.x = rect.left; cp.y = rect.top; cp.cx = rect.right - rect.left; cp.cy = rect.bottom - rect.top; m_arrChildren.Add(cp); } } } bool GetZoomChildren() const { return m_bZoomChildren; } void Zoom(int x, int y, float fZoomScale) { if(fZoomScale <= 0.0f) return; if(fZoomScale < m_fZoomScaleMin) fZoomScale = m_fZoomScaleMin; else if(fZoomScale > m_fZoomScaleMax) fZoomScale = m_fZoomScaleMax; T* pT = static_cast(this); POINT pt = { x, y }; if(!pT->PtInDevRect(pt)) return; pT->ViewDPtoLP(&pt); pT->Zoom(fZoomScale, false); pT->CenterOnLogicalPoint(pt); } void Zoom(POINT pt, float fZoomScale) { T* pT = static_cast(this); pT->Zoom(pt.x, pt.y, fZoomScale); } void Zoom(RECT& rc) { T* pT = static_cast(this); RECT rcZoom = rc; pT->NormalizeRect(rcZoom); SIZE size = { rcZoom.right - rcZoom.left, rcZoom.bottom - rcZoom.top }; POINT pt = { rcZoom.left + size.cx / 2, rcZoom.top + size.cy / 2 }; if((size.cx < m_cxyMinZoomRect) || (size.cy < m_cxyMinZoomRect)) { pT->Zoom(pt, m_fZoomScale + m_fZoomDelta); return; } ATLASSERT((size.cx > 0) && (size.cy > 0)); float fScaleH = (float)(this->m_sizeClient.cx + 1) / (float)size.cx; float fScaleV = (float)(this->m_sizeClient.cy + 1) / (float)size.cy; float fZoomScale = __min(fScaleH, fScaleV) * m_fZoomScale; pT->Zoom(pt, fZoomScale); } void Zoom(float fZoomScale, bool bCenter = true) { if(fZoomScale <= 0.0f) return; if(fZoomScale < m_fZoomScaleMin) fZoomScale = m_fZoomScaleMin; else if(fZoomScale > m_fZoomScaleMax) fZoomScale = m_fZoomScaleMax; T* pT = static_cast(this); POINT pt = { 0, 0 }; if(bCenter) { RECT rcClient = {}; ::GetClientRect(pT->m_hWnd, &rcClient); pt.x = rcClient.right / 2; pt.y = rcClient.bottom / 2; pT->ViewDPtoLP(&pt); } // Modify the Viewport extent SIZE sizeAll = {}; sizeAll.cx = (int)((float)m_sizeLogAll.cx * fZoomScale); sizeAll.cy = (int)((float)m_sizeLogAll.cy * fZoomScale); // Update scroll bars and window CScrollImpl< T >::SetScrollSize(sizeAll); // Zoom all children if needed if(m_bZoomChildren && (m_fZoomScale != fZoomScale)) { for(int i = 0; i < m_arrChildren.GetSize(); i++) { ATLASSERT(::IsWindow(m_arrChildren[i].hWnd)); ::SetWindowPos(m_arrChildren[i].hWnd, NULL, (int)((float)m_arrChildren[i].x * fZoomScale + 0.5f), (int)((float)m_arrChildren[i].y * fZoomScale + 0.5f), (int)((float)m_arrChildren[i].cx * fZoomScale + 0.5f), (int)((float)m_arrChildren[i].cy * fZoomScale + 0.5f), SWP_NOZORDER | SWP_NOACTIVATE); } } // Set new zoom scale m_fZoomScale = fZoomScale; if(bCenter) pT->CenterOnLogicalPoint(pt); } void ZoomIn(bool bCenter = true) { T* pT = static_cast(this); pT->Zoom(m_fZoomScale + m_fZoomDelta, bCenter); } void ZoomOut(bool bCenter = true) { T* pT = static_cast(this); pT->Zoom(m_fZoomScale - m_fZoomDelta, bCenter); } void ZoomDefault(bool bCenter = true) { T* pT = static_cast(this); pT->Zoom(1.0f, bCenter); } // Helper functions void PrepareDC(CDCHandle dc) { ATLASSERT((this->m_sizeAll.cx >= 0) && (this->m_sizeAll.cy >= 0)); dc.SetMapMode(MM_ANISOTROPIC); dc.SetWindowExt(this->m_sizeLogAll); dc.SetViewportExt(this->m_sizeAll); dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y); } void ViewDPtoLP(LPPOINT lpPoints, int nCount = 1) { ATLASSERT(lpPoints); T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); CWindowDC dc(pT->m_hWnd); pT->PrepareDC(dc.m_hDC); dc.DPtoLP(lpPoints, nCount); } void ViewLPtoDP(LPPOINT lpPoints, int nCount = 1) { ATLASSERT(lpPoints); T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); CWindowDC dc(pT->m_hWnd); pT->PrepareDC(dc.m_hDC); dc.LPtoDP(lpPoints, nCount); } void ClientToDevice(POINT &pt) { pt.x += this->m_ptOffset.x; pt.y += this->m_ptOffset.y; } void DeviceToClient(POINT &pt) { pt.x -= this->m_ptOffset.x; pt.y -= this->m_ptOffset.y; } void CenterOnPoint(POINT pt) { T* pT = static_cast(this); RECT rect = {}; pT->GetClientRect(&rect); int xOfs = pt.x - (rect.right / 2) + this->m_ptOffset.x; if(xOfs < 0) { xOfs = 0; } else { int xMax = __max((int)(this->m_sizeAll.cx - rect.right), 0); if(xOfs > xMax) xOfs = xMax; } int yOfs = pt.y - (rect.bottom / 2) + this->m_ptOffset.y; if(yOfs < 0) { yOfs = 0; } else { int yMax = __max((int)(this->m_sizeAll.cy - rect.bottom), 0); if(yOfs > yMax) yOfs = yMax; } CScrollImpl< T >::SetScrollOffset(xOfs, yOfs); } void CenterOnLogicalPoint(POINT ptLog) { T* pT = static_cast(this); pT->ViewLPtoDP(&ptLog); pT->DeviceToClient(ptLog); pT->CenterOnPoint(ptLog); } BOOL PtInDevRect(POINT pt) { RECT rc = { 0, 0, this->m_sizeAll.cx, this->m_sizeAll.cy }; ::OffsetRect(&rc, -this->m_ptOffset.x, -this->m_ptOffset.y); return ::PtInRect(&rc, pt); } void NormalizeRect(RECT& rc) { if(rc.left > rc.right) { int r = rc.right; rc.right = rc.left; rc.left = r; } if(rc.top > rc.bottom) { int b = rc.bottom; rc.bottom = rc.top; rc.top = b; } } void DrawTrackRect() { T* pT = static_cast(this); RECT rc = m_rcTrack; pT->NormalizeRect(rc); if(!::IsRectEmpty(&rc)) { const SIZE sizeLines = { 2, 2 }; CClientDC dc(pT->m_hWnd); dc.DrawDragRect(&rc, sizeLines, NULL, sizeLines); } } void NotifyParentZoomChanged() { T* pT = static_cast(this); int nId = pT->GetDlgCtrlID(); NMHDR nmhdr = { pT->m_hWnd, (UINT_PTR)nId, ZSN_ZOOMCHANGED }; ::SendMessage(pT->GetParent(), WM_NOTIFY, (WPARAM)nId, (LPARAM)&nmhdr); } void DoWheelZoom(int zDelta) { float fZoomScale = m_fZoomScale + ((zDelta > 0) ? m_fZoomDelta : -m_fZoomDelta); T* pT = static_cast(this); pT->Zoom(fZoomScale); pT->NotifyParentZoomChanged(); } BEGIN_MSG_MAP(CZoomScrollImpl) MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, OnMouseWheel) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) END_MSG_MAP() LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if((LOWORD(lParam) == HTCLIENT) && (m_nZoomMode != ZOOMMODE_OFF)) { T* pT = static_cast(this); if((HWND)wParam == pT->m_hWnd) { DWORD dwPos = ::GetMessagePos(); POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; pT->ScreenToClient(&pt); if(pT->PtInDevRect(pt)) { ::SetCursor(::LoadCursor(NULL, IDC_CROSS)); return 1; } } } bHandled = FALSE; return 0; } LRESULT OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if((GET_KEYSTATE_WPARAM(wParam) & MK_CONTROL) != 0) // handle zoom if Ctrl is pressed { int zDelta = (int)GET_WHEEL_DELTA_WPARAM(wParam); T* pT = static_cast(this); pT->DoWheelZoom(zDelta); } else { CScrollImpl< T >::OnMouseWheel(uMsg, wParam, lParam, bHandled); } return 0; } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); ATLASSERT((m_sizeLogAll.cx >= 0) && (m_sizeLogAll.cy >= 0)); ATLASSERT((this->m_sizeAll.cx >= 0) && (this->m_sizeAll.cy >= 0)); if(wParam != NULL) { CDCHandle dc = (HDC)wParam; int nMapModeSav = dc.GetMapMode(); dc.SetMapMode(MM_ANISOTROPIC); SIZE szWindowExt = { 0, 0 }; dc.SetWindowExt(m_sizeLogAll, &szWindowExt); SIZE szViewportExt = { 0, 0 }; dc.SetViewportExt(this->m_sizeAll, &szViewportExt); POINT ptViewportOrg = { 0, 0 }; dc.SetViewportOrg(-this->m_ptOffset.x, -this->m_ptOffset.y, &ptViewportOrg); pT->DoPaint(dc); dc.SetMapMode(nMapModeSav); dc.SetWindowExt(szWindowExt); dc.SetViewportExt(szViewportExt); dc.SetViewportOrg(ptViewportOrg); } else { CPaintDC dc(pT->m_hWnd); pT->PrepareDC(dc.m_hDC); pT->DoPaint(dc.m_hDC); } return 0; } LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if((m_nZoomMode == ZOOMMODE_IN) && !m_bTracking) { T* pT = static_cast(this); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if(pT->PtInDevRect(pt)) { pT->SetCapture(); m_bTracking = true; ::SetRect(&m_rcTrack, pt.x, pt.y, pt.x, pt.y); RECT rcClip; pT->GetClientRect(&rcClip); if((this->m_ptOffset.x == 0) && (this->m_ptOffset.y == 0)) { if(rcClip.right > this->m_sizeAll.cx) rcClip.right = this->m_sizeAll.cx; if(rcClip.bottom > this->m_sizeAll.cy) rcClip.bottom = this->m_sizeAll.cy; } ::MapWindowPoints(pT->m_hWnd, NULL, (LPPOINT)&rcClip, 2); ::ClipCursor(&rcClip); } } bHandled = FALSE; return 0; } LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { if(m_bTracking) { T* pT = static_cast(this); POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if(pT->PtInDevRect(pt)) { pT->DrawTrackRect(); m_rcTrack.right = pt.x + 1; m_rcTrack.bottom = pt.y + 1; pT->DrawTrackRect(); } } bHandled = FALSE; return 0; } LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { ::ReleaseCapture(); if(m_nZoomMode == ZOOMMODE_OUT) { T* pT = static_cast(this); pT->Zoom(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), m_fZoomScale - m_fZoomDelta); pT->NotifyParentZoomChanged(); } bHandled = FALSE; return 0; } LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_bTracking) { m_bTracking = false; T* pT = static_cast(this); pT->DrawTrackRect(); pT->Zoom(m_rcTrack); pT->NotifyParentZoomChanged(); ::SetRectEmpty(&m_rcTrack); ::ClipCursor(NULL); } bHandled = FALSE; return 0; } }; /////////////////////////////////////////////////////////////////////////////// // CZoomScrollWindowImpl - Implements scrolling window with zooming template class ATL_NO_VTABLE CZoomScrollWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CZoomScrollImpl< T > { public: BOOL SubclassWindow(HWND hWnd) { BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); if(bRet != FALSE) { T* pT = static_cast(this); pT->GetSystemSettings(); RECT rect = {}; this->GetClientRect(&rect); pT->DoSize(rect.right, rect.bottom); } return bRet; } BEGIN_MSG_MAP(CZoomScrollWindowImpl) MESSAGE_HANDLER(WM_SETCURSOR, CZoomScrollImpl< T >::OnSetCursor) MESSAGE_HANDLER(WM_VSCROLL, CScrollImpl< T >::OnVScroll) MESSAGE_HANDLER(WM_HSCROLL, CScrollImpl< T >::OnHScroll) MESSAGE_HANDLER(WM_MOUSEWHEEL, CZoomScrollImpl< T >::OnMouseWheel) MESSAGE_HANDLER(WM_MOUSEHWHEEL, CScrollImpl< T >::OnMouseHWheel) MESSAGE_HANDLER(WM_SETTINGCHANGE, CScrollImpl< T >::OnSettingChange) MESSAGE_HANDLER(WM_SIZE, CScrollImpl< T >::OnSize) MESSAGE_HANDLER(WM_PAINT, CZoomScrollImpl< T >::OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, CZoomScrollImpl< T >::OnPaint) MESSAGE_HANDLER(WM_LBUTTONDOWN, CZoomScrollImpl< T >::OnLButtonDown) MESSAGE_HANDLER(WM_MOUSEMOVE, CZoomScrollImpl< T >::OnMouseMove) MESSAGE_HANDLER(WM_LBUTTONUP, CZoomScrollImpl< T >::OnLButtonUp) MESSAGE_HANDLER(WM_CAPTURECHANGED, CZoomScrollImpl< T >::OnCaptureChanged) ALT_MSG_MAP(1) COMMAND_ID_HANDLER(ID_SCROLL_UP, CScrollImpl< T >::OnScrollUp) COMMAND_ID_HANDLER(ID_SCROLL_DOWN, CScrollImpl< T >::OnScrollDown) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_UP, CScrollImpl< T >::OnScrollPageUp) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_DOWN, CScrollImpl< T >::OnScrollPageDown) COMMAND_ID_HANDLER(ID_SCROLL_TOP, CScrollImpl< T >::OnScrollTop) COMMAND_ID_HANDLER(ID_SCROLL_BOTTOM, CScrollImpl< T >::OnScrollBottom) COMMAND_ID_HANDLER(ID_SCROLL_LEFT, CScrollImpl< T >::OnScrollLeft) COMMAND_ID_HANDLER(ID_SCROLL_RIGHT, CScrollImpl< T >::OnScrollRight) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_LEFT, CScrollImpl< T >::OnScrollPageLeft) COMMAND_ID_HANDLER(ID_SCROLL_PAGE_RIGHT, CScrollImpl< T >::OnScrollPageRight) COMMAND_ID_HANDLER(ID_SCROLL_ALL_LEFT, CScrollImpl< T >::OnScrollAllLeft) COMMAND_ID_HANDLER(ID_SCROLL_ALL_RIGHT, CScrollImpl< T >::OnScrollAllRight) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CScrollContainer template class ATL_NO_VTABLE CScrollContainerImpl : public CScrollWindowImpl< T, TBase, TWinTraits > { public: DECLARE_WND_CLASS_EX2(NULL, T, 0, -1) typedef CScrollWindowImpl< T, TBase, TWinTraits > _baseClass; // Data members ATL::CWindow m_wndClient; bool m_bAutoSizeClient; bool m_bDrawEdgeIfEmpty; // Constructor CScrollContainerImpl() : m_bAutoSizeClient(true), m_bDrawEdgeIfEmpty(false) { // Set CScrollWindowImpl extended style this->SetScrollExtendedStyle(SCRL_SCROLLCHILDREN); } // Attributes HWND GetClient() const { return m_wndClient; } HWND SetClient(HWND hWndClient, bool bClientSizeAsMin = true) { ATLASSERT(::IsWindow(this->m_hWnd)); HWND hWndOldClient = m_wndClient; m_wndClient = hWndClient; this->SetRedraw(FALSE); this->SetScrollSize(1, 1, FALSE); if(m_wndClient.m_hWnd != NULL) { m_wndClient.SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); if(bClientSizeAsMin) { RECT rect = {}; m_wndClient.GetWindowRect(&rect); if(((rect.right - rect.left) > 0) && ((rect.bottom - rect.top) > 0)) this->SetScrollSize(rect.right - rect.left, rect.bottom - rect.top, FALSE); } T* pT = static_cast(this); pT->UpdateLayout(); } this->SetRedraw(TRUE); this->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ALLCHILDREN); return hWndOldClient; } // Message map and handlers BEGIN_MSG_MAP(CScrollContainerImpl) MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) CHAIN_MSG_MAP(_baseClass) FORWARD_NOTIFICATIONS() ALT_MSG_MAP(1) CHAIN_MSG_MAP_ALT(_baseClass, 1) END_MSG_MAP() LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(m_wndClient.m_hWnd != NULL) m_wndClient.SetFocus(); return 0; } LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return 1; // no background needed } // Overrides for CScrollWindowImpl void DoSize(int cx, int cy) { _baseClass::DoSize(cx, cy); T* pT = static_cast(this); pT->UpdateLayout(); } void DoPaint(CDCHandle dc) { if(!m_bAutoSizeClient || (m_wndClient.m_hWnd == NULL)) { T* pT = static_cast(this); RECT rect = {}; pT->GetContainerRect(rect); if(m_bDrawEdgeIfEmpty && (m_wndClient.m_hWnd == NULL)) dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); dc.FillRect(&rect, COLOR_APPWORKSPACE); } } void ScrollToView(POINT pt) { CScrollWindowImpl< T, TBase, TWinTraits >::ScrollToView(pt); } void ScrollToView(RECT& rect) { CScrollWindowImpl< T, TBase, TWinTraits >::ScrollToView(rect); } void ScrollToView(HWND hWnd) // client window coordinates { T* pT = static_cast(this); (void)pT; // avoid level 4 warning ATLASSERT(::IsWindow(pT->m_hWnd)); ATLASSERT(m_wndClient.IsWindow()); RECT rect = {}; ::GetWindowRect(hWnd, &rect); ::MapWindowPoints(NULL, m_wndClient.m_hWnd, (LPPOINT)&rect, 2); ScrollToView(rect); } // Implementation - overrideable methods void UpdateLayout() { ATLASSERT(::IsWindow(this->m_hWnd)); if(m_bAutoSizeClient && (m_wndClient.m_hWnd != NULL)) { T* pT = static_cast(this); RECT rect = {}; pT->GetContainerRect(rect); m_wndClient.SetWindowPos(NULL, &rect, SWP_NOZORDER | SWP_NOMOVE); } else { this->Invalidate(); } } void GetContainerRect(RECT& rect) { this->GetClientRect(&rect); if(rect.right < this->m_sizeAll.cx) rect.right = this->m_sizeAll.cx; if(rect.bottom < this->m_sizeAll.cy) rect.bottom = this->m_sizeAll.cy; } }; class CScrollContainer : public CScrollContainerImpl { public: DECLARE_WND_CLASS_EX(_T("WTL_ScrollContainer"), 0, -1) }; } // namespace WTL #endif // __ATLSCRL_H__ ================================================ FILE: third_party/WTL/Include/atlsplit.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLSPLIT_H__ #define __ATLSPLIT_H__ #pragma once #ifndef __ATLAPP_H__ #error atlsplit.h requires atlapp.h to be included first #endif #ifndef __ATLWIN_H__ #error atlsplit.h requires atlwin.h to be included first #endif /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CSplitterImpl // CSplitterWindowImpl // CSplitterWindowT - CSplitterWindow, CHorSplitterWindow namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CSplitterImpl - Provides splitter support to any window // Splitter panes constants #define SPLIT_PANE_LEFT 0 #define SPLIT_PANE_RIGHT 1 #define SPLIT_PANE_TOP SPLIT_PANE_LEFT #define SPLIT_PANE_BOTTOM SPLIT_PANE_RIGHT #define SPLIT_PANE_NONE -1 // Splitter extended styles #define SPLIT_PROPORTIONAL 0x00000001 #define SPLIT_NONINTERACTIVE 0x00000002 #define SPLIT_RIGHTALIGNED 0x00000004 #define SPLIT_BOTTOMALIGNED SPLIT_RIGHTALIGNED #define SPLIT_GRADIENTBAR 0x00000008 #define SPLIT_FLATBAR 0x00000020 #define SPLIT_FIXEDBARSIZE 0x00000010 // Note: SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED are // mutually exclusive. If both are set, splitter defaults to SPLIT_PROPORTIONAL. // Also, SPLIT_FLATBAR overrides SPLIT_GRADIENTBAR if both are set. template class CSplitterImpl { public: enum { m_nPanesCount = 2, m_nPropMax = INT_MAX, m_cxyStep = 10 }; bool m_bVertical; HWND m_hWndPane[m_nPanesCount]; RECT m_rcSplitter; int m_xySplitterPos; // splitter bar position int m_xySplitterPosNew; // internal - new position while moving HWND m_hWndFocusSave; int m_nDefActivePane; int m_cxySplitBar; // splitter bar width/height HCURSOR m_hCursor; int m_cxyMin; // minimum pane size int m_cxyBarEdge; // splitter bar edge bool m_bFullDrag; int m_cxyDragOffset; // internal int m_nProportionalPos; bool m_bUpdateProportionalPos; DWORD m_dwExtendedStyle; // splitter specific extended styles int m_nSinglePane; // single pane mode int m_xySplitterDefPos; // default position bool m_bProportionalDefPos; // porportinal def pos // Constructor CSplitterImpl(bool bVertical = true) : m_bVertical(bVertical), m_xySplitterPos(-1), m_xySplitterPosNew(-1), m_hWndFocusSave(NULL), m_nDefActivePane(SPLIT_PANE_NONE), m_cxySplitBar(4), m_hCursor(NULL), m_cxyMin(0), m_cxyBarEdge(0), m_bFullDrag(true), m_cxyDragOffset(0), m_nProportionalPos(0), m_bUpdateProportionalPos(true), m_dwExtendedStyle(SPLIT_PROPORTIONAL), m_nSinglePane(SPLIT_PANE_NONE), m_xySplitterDefPos(-1), m_bProportionalDefPos(false) { m_hWndPane[SPLIT_PANE_LEFT] = NULL; m_hWndPane[SPLIT_PANE_RIGHT] = NULL; ::SetRectEmpty(&m_rcSplitter); } // Attributes void SetSplitterRect(LPRECT lpRect = NULL, bool bUpdate = true) { if(lpRect == NULL) { T* pT = static_cast(this); pT->GetClientRect(&m_rcSplitter); } else { m_rcSplitter = *lpRect; } if(IsProportional()) UpdateProportionalPos(); else if(IsRightAligned()) UpdateRightAlignPos(); if(bUpdate) UpdateSplitterLayout(); } void GetSplitterRect(LPRECT lpRect) const { ATLASSERT(lpRect != NULL); *lpRect = m_rcSplitter; } bool SetSplitterPos(int xyPos = -1, bool bUpdate = true) { if(xyPos == -1) // -1 == default position { if(m_bProportionalDefPos) { ATLASSERT((m_xySplitterDefPos >= 0) && (m_xySplitterDefPos <= m_nPropMax)); if(m_bVertical) xyPos = ::MulDiv(m_xySplitterDefPos, m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge, m_nPropMax); else xyPos = ::MulDiv(m_xySplitterDefPos, m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge, m_nPropMax); } else if(m_xySplitterDefPos != -1) { xyPos = m_xySplitterDefPos; } else // not set, use middle position { if(m_bVertical) xyPos = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2; else xyPos = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2; } } // Adjust if out of valid range int cxyMax = 0; if(m_bVertical) cxyMax = m_rcSplitter.right - m_rcSplitter.left; else cxyMax = m_rcSplitter.bottom - m_rcSplitter.top; if(xyPos < m_cxyMin + m_cxyBarEdge) xyPos = m_cxyMin; else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin)) xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin; // Set new position and update if requested bool bRet = (m_xySplitterPos != xyPos); m_xySplitterPos = xyPos; if(m_bUpdateProportionalPos) { if(IsProportional()) StoreProportionalPos(); else if(IsRightAligned()) StoreRightAlignPos(); } else { m_bUpdateProportionalPos = true; } if(bUpdate && bRet) UpdateSplitterLayout(); return bRet; } int GetSplitterPos() const { return m_xySplitterPos; } void SetSplitterPosPct(int nPct, bool bUpdate = true) { ATLASSERT((nPct >= 0) && (nPct <= 100)); m_nProportionalPos = ::MulDiv(nPct, m_nPropMax, 100); UpdateProportionalPos(); if(bUpdate) UpdateSplitterLayout(); } int GetSplitterPosPct() const { int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); return ((cxyTotal > 0) && (m_xySplitterPos >= 0)) ? ::MulDiv(m_xySplitterPos, 100, cxyTotal) : -1; } bool SetSinglePaneMode(int nPane = SPLIT_PANE_NONE) { ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT) || (nPane == SPLIT_PANE_NONE)); if(!((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT) || (nPane == SPLIT_PANE_NONE))) return false; if(nPane != SPLIT_PANE_NONE) { if(::IsWindowVisible(m_hWndPane[nPane]) == FALSE) ::ShowWindow(m_hWndPane[nPane], SW_SHOW); int nOtherPane = (nPane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT; ::ShowWindow(m_hWndPane[nOtherPane], SW_HIDE); if(m_nDefActivePane != nPane) m_nDefActivePane = nPane; } else if(m_nSinglePane != SPLIT_PANE_NONE) { int nOtherPane = (m_nSinglePane == SPLIT_PANE_LEFT) ? SPLIT_PANE_RIGHT : SPLIT_PANE_LEFT; ::ShowWindow(m_hWndPane[nOtherPane], SW_SHOW); } m_nSinglePane = nPane; UpdateSplitterLayout(); return true; } int GetSinglePaneMode() const { return m_nSinglePane; } DWORD GetSplitterExtendedStyle() const { return m_dwExtendedStyle; } DWORD SetSplitterExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) { DWORD dwPrevStyle = m_dwExtendedStyle; if(dwMask == 0) m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); #ifdef _DEBUG if(IsProportional() && IsRightAligned()) ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::SetSplitterExtendedStyle - SPLIT_PROPORTIONAL and SPLIT_RIGHTALIGNED are mutually exclusive, defaulting to SPLIT_PROPORTIONAL.\n")); #endif // _DEBUG return dwPrevStyle; } void SetSplitterDefaultPos(int xyPos = -1) { m_xySplitterDefPos = xyPos; m_bProportionalDefPos = false; } void SetSplitterDefaultPosPct(int nPct) { ATLASSERT((nPct >= 0) && (nPct <= 100)); m_xySplitterDefPos = ::MulDiv(nPct, m_nPropMax, 100); m_bProportionalDefPos = true; } // Splitter operations void SetSplitterPanes(HWND hWndLeftTop, HWND hWndRightBottom, bool bUpdate = true) { m_hWndPane[SPLIT_PANE_LEFT] = hWndLeftTop; m_hWndPane[SPLIT_PANE_RIGHT] = hWndRightBottom; ATLASSERT((m_hWndPane[SPLIT_PANE_LEFT] == NULL) || (m_hWndPane[SPLIT_PANE_RIGHT] == NULL) || (m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT])); if(bUpdate) UpdateSplitterLayout(); } bool SetSplitterPane(int nPane, HWND hWnd, bool bUpdate = true) { ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT)) return false; m_hWndPane[nPane] = hWnd; ATLASSERT((m_hWndPane[SPLIT_PANE_LEFT] == NULL) || (m_hWndPane[SPLIT_PANE_RIGHT] == NULL) || (m_hWndPane[SPLIT_PANE_LEFT] != m_hWndPane[SPLIT_PANE_RIGHT])); if(bUpdate) UpdateSplitterLayout(); return true; } HWND GetSplitterPane(int nPane) const { ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT)) return NULL; return m_hWndPane[nPane]; } bool SetActivePane(int nPane) { ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT)) return false; if((m_nSinglePane != SPLIT_PANE_NONE) && (nPane != m_nSinglePane)) return false; ::SetFocus(m_hWndPane[nPane]); m_nDefActivePane = nPane; return true; } int GetActivePane() const { int nRet = SPLIT_PANE_NONE; HWND hWndFocus = ::GetFocus(); if(hWndFocus != NULL) { for(int nPane = 0; nPane < m_nPanesCount; nPane++) { if((hWndFocus == m_hWndPane[nPane]) || (::IsChild(m_hWndPane[nPane], hWndFocus) != FALSE)) { nRet = nPane; break; } } } return nRet; } bool ActivateNextPane(bool bNext = true) { int nPane = m_nSinglePane; if(nPane == SPLIT_PANE_NONE) { switch(GetActivePane()) { case SPLIT_PANE_LEFT: nPane = SPLIT_PANE_RIGHT; break; case SPLIT_PANE_RIGHT: nPane = SPLIT_PANE_LEFT; break; default: nPane = bNext ? SPLIT_PANE_LEFT : SPLIT_PANE_RIGHT; break; } } return SetActivePane(nPane); } bool SetDefaultActivePane(int nPane) { ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); if((nPane != SPLIT_PANE_LEFT) && (nPane != SPLIT_PANE_RIGHT)) return false; m_nDefActivePane = nPane; return true; } bool SetDefaultActivePane(HWND hWnd) { for(int nPane = 0; nPane < m_nPanesCount; nPane++) { if(hWnd == m_hWndPane[nPane]) { m_nDefActivePane = nPane; return true; } } return false; // not found } int GetDefaultActivePane() const { return m_nDefActivePane; } void DrawSplitter(CDCHandle dc) { ATLASSERT(dc.m_hDC != NULL); if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1)) return; T* pT = static_cast(this); if(m_nSinglePane == SPLIT_PANE_NONE) { pT->DrawSplitterBar(dc); for(int nPane = 0; nPane < m_nPanesCount; nPane++) { if(m_hWndPane[nPane] == NULL) pT->DrawSplitterPane(dc, nPane); } } else { if(m_hWndPane[m_nSinglePane] == NULL) pT->DrawSplitterPane(dc, m_nSinglePane); } } // call to initiate moving splitter bar with keyboard void MoveSplitterBar() { T* pT = static_cast(this); int x = 0; int y = 0; if(m_bVertical) { x = m_xySplitterPos + (m_cxySplitBar / 2) + m_cxyBarEdge; y = (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge) / 2; } else { x = (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) / 2; y = m_xySplitterPos + (m_cxySplitBar / 2) + m_cxyBarEdge; } POINT pt = { x, y }; pT->ClientToScreen(&pt); ::SetCursorPos(pt.x, pt.y); m_xySplitterPosNew = m_xySplitterPos; pT->SetCapture(); m_hWndFocusSave = pT->SetFocus(); ::SetCursor(m_hCursor); if(!m_bFullDrag) DrawGhostBar(); if(m_bVertical) m_cxyDragOffset = x - m_rcSplitter.left - m_xySplitterPos; else m_cxyDragOffset = y - m_rcSplitter.top - m_xySplitterPos; } void SetOrientation(bool bVertical, bool bUpdate = true) { if(m_bVertical != bVertical) { m_bVertical = bVertical; m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE : IDC_SIZENS); T* pT = static_cast(this); pT->GetSystemSettings(false); if(m_bVertical) m_xySplitterPos = ::MulDiv(m_xySplitterPos, m_rcSplitter.right - m_rcSplitter.left, m_rcSplitter.bottom - m_rcSplitter.top); else m_xySplitterPos = ::MulDiv(m_xySplitterPos, m_rcSplitter.bottom - m_rcSplitter.top, m_rcSplitter.right - m_rcSplitter.left); } if(bUpdate) UpdateSplitterLayout(); } // Overrideables void DrawSplitterBar(CDCHandle dc) { RECT rect = {}; if(GetSplitterBarRect(&rect)) { dc.FillRect(&rect, COLOR_3DFACE); if((m_dwExtendedStyle & SPLIT_FLATBAR) != 0) { RECT rect1 = rect; if(m_bVertical) rect1.right = rect1.left + 1; else rect1.bottom = rect1.top + 1; dc.FillRect(&rect1, COLOR_WINDOW); rect1 = rect; if(m_bVertical) rect1.left = rect1.right - 1; else rect1.top = rect1.bottom - 1; dc.FillRect(&rect1, COLOR_3DSHADOW); } else if((m_dwExtendedStyle & SPLIT_GRADIENTBAR) != 0) { RECT rect2 = rect; if(m_bVertical) rect2.left = (rect.left + rect.right) / 2 - 1; else rect2.top = (rect.top + rect.bottom) / 2 - 1; dc.GradientFillRect(rect2, ::GetSysColor(COLOR_3DFACE), ::GetSysColor(COLOR_3DSHADOW), m_bVertical); } // draw 3D edge if needed T* pT = static_cast(this); if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0) dc.DrawEdge(&rect, EDGE_RAISED, m_bVertical ? (BF_LEFT | BF_RIGHT) : (BF_TOP | BF_BOTTOM)); } } // called only if pane is empty void DrawSplitterPane(CDCHandle dc, int nPane) { RECT rect = {}; if(GetSplitterPaneRect(nPane, &rect)) { T* pT = static_cast(this); if((pT->GetExStyle() & WS_EX_CLIENTEDGE) == 0) dc.DrawEdge(&rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); dc.FillRect(&rect, COLOR_APPWORKSPACE); } } // Message map and handlers BEGIN_MSG_MAP(CSplitterImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) if(IsInteractive()) { MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDoubleClick) MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) MESSAGE_HANDLER(WM_KEYDOWN, OnKeyDown) } MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) MESSAGE_HANDLER(WM_SETTINGCHANGE, OnSettingChange) END_MSG_MAP() LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { T* pT = static_cast(this); pT->Init(); bHandled = FALSE; return 1; } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); // try setting position if not set if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1)) pT->SetSplitterPos(); // do painting if(wParam != NULL) { pT->DrawSplitter((HDC)wParam); } else { CPaintDC dc(pT->m_hWnd); pT->DrawSplitter(dc.m_hDC); } return 0; } LRESULT OnSetCursor(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); if(((HWND)wParam == pT->m_hWnd) && (LOWORD(lParam) == HTCLIENT)) { DWORD dwPos = ::GetMessagePos(); POINT ptPos = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; pT->ScreenToClient(&ptPos); if(IsOverSplitterBar(ptPos.x, ptPos.y)) return 1; } bHandled = FALSE; return 0; } LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); int xPos = GET_X_LPARAM(lParam); int yPos = GET_Y_LPARAM(lParam); if(::GetCapture() == pT->m_hWnd) { int xyNewSplitPos = 0; if(m_bVertical) xyNewSplitPos = xPos - m_rcSplitter.left - m_cxyDragOffset; else xyNewSplitPos = yPos - m_rcSplitter.top - m_cxyDragOffset; if(xyNewSplitPos == -1) // avoid -1, that means default position xyNewSplitPos = -2; if(m_xySplitterPos != xyNewSplitPos) { if(m_bFullDrag) { if(pT->SetSplitterPos(xyNewSplitPos, true)) pT->UpdateWindow(); } else { DrawGhostBar(); pT->SetSplitterPos(xyNewSplitPos, false); DrawGhostBar(); } } } else // not dragging, just set cursor { if(IsOverSplitterBar(xPos, yPos)) ::SetCursor(m_hCursor); bHandled = FALSE; } return 0; } LRESULT OnLButtonDown(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); int xPos = GET_X_LPARAM(lParam); int yPos = GET_Y_LPARAM(lParam); if((::GetCapture() != pT->m_hWnd) && IsOverSplitterBar(xPos, yPos)) { m_xySplitterPosNew = m_xySplitterPos; pT->SetCapture(); m_hWndFocusSave = pT->SetFocus(); ::SetCursor(m_hCursor); if(!m_bFullDrag) DrawGhostBar(); if(m_bVertical) m_cxyDragOffset = xPos - m_rcSplitter.left - m_xySplitterPos; else m_cxyDragOffset = yPos - m_rcSplitter.top - m_xySplitterPos; } else if((::GetCapture() == pT->m_hWnd) && !IsOverSplitterBar(xPos, yPos)) { ::ReleaseCapture(); } bHandled = FALSE; return 1; } LRESULT OnLButtonUp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { T* pT = static_cast(this); if(::GetCapture() == pT->m_hWnd) { m_xySplitterPosNew = m_xySplitterPos; ::ReleaseCapture(); } bHandled = FALSE; return 1; } LRESULT OnLButtonDoubleClick(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->SetSplitterPos(); // default return 0; } LRESULT OnCaptureChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { if(!m_bFullDrag) DrawGhostBar(); if((m_xySplitterPosNew != -1) && (!m_bFullDrag || (m_xySplitterPos != m_xySplitterPosNew))) { m_xySplitterPos = m_xySplitterPosNew; m_xySplitterPosNew = -1; UpdateSplitterLayout(); T* pT = static_cast(this); pT->UpdateWindow(); } if(m_hWndFocusSave != NULL) ::SetFocus(m_hWndFocusSave); return 0; } LRESULT OnKeyDown(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { T* pT = static_cast(this); if(::GetCapture() == pT->m_hWnd) { switch(wParam) { case VK_RETURN: m_xySplitterPosNew = m_xySplitterPos; // FALLTHROUGH case VK_ESCAPE: ::ReleaseCapture(); break; case VK_LEFT: case VK_RIGHT: if(m_bVertical) { POINT pt = {}; ::GetCursorPos(&pt); int xyPos = m_xySplitterPos + ((wParam == VK_LEFT) ? -pT->m_cxyStep : pT->m_cxyStep); int cxyMax = m_rcSplitter.right - m_rcSplitter.left; if(xyPos < (m_cxyMin + m_cxyBarEdge)) xyPos = m_cxyMin; else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin)) xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin; pt.x += xyPos - m_xySplitterPos; ::SetCursorPos(pt.x, pt.y); } break; case VK_UP: case VK_DOWN: if(!m_bVertical) { POINT pt = {}; ::GetCursorPos(&pt); int xyPos = m_xySplitterPos + ((wParam == VK_UP) ? -pT->m_cxyStep : pT->m_cxyStep); int cxyMax = m_rcSplitter.bottom - m_rcSplitter.top; if(xyPos < (m_cxyMin + m_cxyBarEdge)) xyPos = m_cxyMin; else if(xyPos > (cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin)) xyPos = cxyMax - m_cxySplitBar - m_cxyBarEdge - m_cxyMin; pt.y += xyPos - m_xySplitterPos; ::SetCursorPos(pt.x, pt.y); } break; default: break; } } else { bHandled = FALSE; } return 0; } LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM, BOOL& bHandled) { T* pT = static_cast(this); if(::GetCapture() != pT->m_hWnd) { if(m_nSinglePane == SPLIT_PANE_NONE) { if((m_nDefActivePane == SPLIT_PANE_LEFT) || (m_nDefActivePane == SPLIT_PANE_RIGHT)) ::SetFocus(m_hWndPane[m_nDefActivePane]); } else { ::SetFocus(m_hWndPane[m_nSinglePane]); } } bHandled = FALSE; return 1; } LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) { T* pT = static_cast(this); LRESULT lRet = pT->DefWindowProc(uMsg, wParam, lParam); if((lRet == MA_ACTIVATE) || (lRet == MA_ACTIVATEANDEAT)) { DWORD dwPos = ::GetMessagePos(); POINT pt = { GET_X_LPARAM(dwPos), GET_Y_LPARAM(dwPos) }; pT->ScreenToClient(&pt); RECT rcPane = {}; for(int nPane = 0; nPane < m_nPanesCount; nPane++) { if(GetSplitterPaneRect(nPane, &rcPane) && (::PtInRect(&rcPane, pt) != FALSE)) { m_nDefActivePane = nPane; break; } } } return lRet; } LRESULT OnSettingChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); pT->GetSystemSettings(true); return 0; } // Implementation - internal helpers void Init() { m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE : IDC_SIZENS); T* pT = static_cast(this); pT->GetSystemSettings(false); } void UpdateSplitterLayout() { if((m_nSinglePane == SPLIT_PANE_NONE) && (m_xySplitterPos == -1)) return; T* pT = static_cast(this); RECT rect = {}; if(m_nSinglePane == SPLIT_PANE_NONE) { if(GetSplitterBarRect(&rect)) pT->InvalidateRect(&rect); for(int nPane = 0; nPane < m_nPanesCount; nPane++) { if(GetSplitterPaneRect(nPane, &rect)) { if(m_hWndPane[nPane] != NULL) ::SetWindowPos(m_hWndPane[nPane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); else pT->InvalidateRect(&rect); } } } else { if(GetSplitterPaneRect(m_nSinglePane, &rect)) { if(m_hWndPane[m_nSinglePane] != NULL) ::SetWindowPos(m_hWndPane[m_nSinglePane], NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); else pT->InvalidateRect(&rect); } } } bool GetSplitterBarRect(LPRECT lpRect) const { ATLASSERT(lpRect != NULL); if((m_nSinglePane != SPLIT_PANE_NONE) || (m_xySplitterPos == -1)) return false; if(m_bVertical) { lpRect->left = m_rcSplitter.left + m_xySplitterPos; lpRect->top = m_rcSplitter.top; lpRect->right = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; lpRect->bottom = m_rcSplitter.bottom; } else { lpRect->left = m_rcSplitter.left; lpRect->top = m_rcSplitter.top + m_xySplitterPos; lpRect->right = m_rcSplitter.right; lpRect->bottom = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; } return true; } bool GetSplitterPaneRect(int nPane, LPRECT lpRect) const { ATLASSERT((nPane == SPLIT_PANE_LEFT) || (nPane == SPLIT_PANE_RIGHT)); ATLASSERT(lpRect != NULL); bool bRet = true; if(m_nSinglePane != SPLIT_PANE_NONE) { if(nPane == m_nSinglePane) *lpRect = m_rcSplitter; else bRet = false; } else if(nPane == SPLIT_PANE_LEFT) { if(m_bVertical) { lpRect->left = m_rcSplitter.left; lpRect->top = m_rcSplitter.top; lpRect->right = m_rcSplitter.left + m_xySplitterPos; lpRect->bottom = m_rcSplitter.bottom; } else { lpRect->left = m_rcSplitter.left; lpRect->top = m_rcSplitter.top; lpRect->right = m_rcSplitter.right; lpRect->bottom = m_rcSplitter.top + m_xySplitterPos; } } else if(nPane == SPLIT_PANE_RIGHT) { if(m_bVertical) { lpRect->left = m_rcSplitter.left + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; lpRect->top = m_rcSplitter.top; lpRect->right = m_rcSplitter.right; lpRect->bottom = m_rcSplitter.bottom; } else { lpRect->left = m_rcSplitter.left; lpRect->top = m_rcSplitter.top + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge; lpRect->right = m_rcSplitter.right; lpRect->bottom = m_rcSplitter.bottom; } } else { bRet = false; } return bRet; } bool IsOverSplitterRect(int x, int y) const { // -1 == don't check return (((x == -1) || ((x >= m_rcSplitter.left) && (x <= m_rcSplitter.right))) && ((y == -1) || ((y >= m_rcSplitter.top) && (y <= m_rcSplitter.bottom)))); } bool IsOverSplitterBar(int x, int y) const { if(m_nSinglePane != SPLIT_PANE_NONE) return false; if((m_xySplitterPos == -1) || !IsOverSplitterRect(x, y)) return false; int xy = m_bVertical ? x : y; int xyOff = m_bVertical ? m_rcSplitter.left : m_rcSplitter.top; return ((xy >= (xyOff + m_xySplitterPos)) && (xy < (xyOff + m_xySplitterPos + m_cxySplitBar + m_cxyBarEdge))); } void DrawGhostBar() { RECT rect = {}; if(GetSplitterBarRect(&rect)) { // convert client to window coordinates T* pT = static_cast(this); RECT rcWnd = {}; pT->GetWindowRect(&rcWnd); ::MapWindowPoints(NULL, pT->m_hWnd, (LPPOINT)&rcWnd, 2); ::OffsetRect(&rect, -rcWnd.left, -rcWnd.top); // invert the brush pattern (looks just like frame window sizing) CBrush brush(CDCHandle::GetHalftoneBrush()); if(brush.m_hBrush != NULL) { CWindowDC dc(pT->m_hWnd); CBrushHandle brushOld = dc.SelectBrush(brush); dc.PatBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, PATINVERT); dc.SelectBrush(brushOld); } } } void GetSystemSettings(bool bUpdate) { if((m_dwExtendedStyle & SPLIT_FIXEDBARSIZE) == 0) { m_cxySplitBar = ::GetSystemMetrics(m_bVertical ? SM_CXSIZEFRAME : SM_CYSIZEFRAME); } T* pT = static_cast(this); if((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0) { m_cxyBarEdge = 2 * ::GetSystemMetrics(m_bVertical ? SM_CXEDGE : SM_CYEDGE); m_cxyMin = 0; } else { m_cxyBarEdge = 0; m_cxyMin = 2 * ::GetSystemMetrics(m_bVertical ? SM_CXEDGE : SM_CYEDGE); } ::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &m_bFullDrag, 0); if(bUpdate) UpdateSplitterLayout(); } bool IsProportional() const { return ((m_dwExtendedStyle & SPLIT_PROPORTIONAL) != 0); } void StoreProportionalPos() { int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); if(cxyTotal > 0) m_nProportionalPos = ::MulDiv(m_xySplitterPos, m_nPropMax, cxyTotal); else m_nProportionalPos = 0; ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreProportionalPos - %i\n"), m_nProportionalPos); } void UpdateProportionalPos() { int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); if(cxyTotal > 0) { int xyNewPos = ::MulDiv(m_nProportionalPos, cxyTotal, m_nPropMax); m_bUpdateProportionalPos = false; T* pT = static_cast(this); pT->SetSplitterPos(xyNewPos, false); } } bool IsRightAligned() const { return ((m_dwExtendedStyle & SPLIT_RIGHTALIGNED) != 0); } void StoreRightAlignPos() { int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); if(cxyTotal > 0) m_nProportionalPos = cxyTotal - m_xySplitterPos; else m_nProportionalPos = 0; ATLTRACE2(atlTraceUI, 0, _T("CSplitterImpl::StoreRightAlignPos - %i\n"), m_nProportionalPos); } void UpdateRightAlignPos() { int cxyTotal = m_bVertical ? (m_rcSplitter.right - m_rcSplitter.left - m_cxySplitBar - m_cxyBarEdge) : (m_rcSplitter.bottom - m_rcSplitter.top - m_cxySplitBar - m_cxyBarEdge); if(cxyTotal > 0) { m_bUpdateProportionalPos = false; T* pT = static_cast(this); pT->SetSplitterPos(cxyTotal - m_nProportionalPos, false); } } bool IsInteractive() const { return ((m_dwExtendedStyle & SPLIT_NONINTERACTIVE) == 0); } }; /////////////////////////////////////////////////////////////////////////////// // CSplitterWindowImpl - Implements a splitter window template class ATL_NO_VTABLE CSplitterWindowImpl : public ATL::CWindowImpl< T, TBase, TWinTraits >, public CSplitterImpl< T > { public: DECLARE_WND_CLASS_EX2(NULL, T, CS_DBLCLKS, COLOR_WINDOW) CSplitterWindowImpl(bool bVertical = true) : CSplitterImpl< T >(bVertical) { } BOOL SubclassWindow(HWND hWnd) { BOOL bRet = ATL::CWindowImpl< T, TBase, TWinTraits >::SubclassWindow(hWnd); if(bRet != FALSE) { T* pT = static_cast(this); pT->Init(); this->SetSplitterRect(); } return bRet; } BEGIN_MSG_MAP(CSplitterWindowImpl) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_SIZE, OnSize) CHAIN_MSG_MAP(CSplitterImpl< T >) FORWARD_NOTIFICATIONS() END_MSG_MAP() LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { // handled, no background painting needed return 1; } LRESULT OnSize(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled) { if(wParam != SIZE_MINIMIZED) this->SetSplitterRect(); bHandled = FALSE; return 1; } }; /////////////////////////////////////////////////////////////////////////////// // CSplitterWindow/CHorSplitterWindow - Implements splitter windows to be used as is template class CSplitterWindowT : public CSplitterWindowImpl > { public: DECLARE_WND_CLASS_EX2(_T("WTL_SplitterWindow"), CSplitterWindowT, CS_DBLCLKS, COLOR_WINDOW) CSplitterWindowT() : CSplitterWindowImpl >(t_bVertical) { } }; typedef CSplitterWindowT CSplitterWindow; typedef CSplitterWindowT CHorSplitterWindow; } // namespace WTL #endif // __ATLSPLIT_H__ ================================================ FILE: third_party/WTL/Include/atltheme.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLTHEME_H__ #define __ATLTHEME_H__ #pragma once #ifndef __ATLAPP_H__ #error atltheme.h requires atlapp.h to be included first #endif #ifndef __ATLWIN_H__ #error atltheme.h requires atlwin.h to be included first #endif #include // Note: To create an application that also runs on older versions of Windows, // use delay load of uxtheme.dll and ensure that no calls to the Theme API are // made if theming is not supported. It is enough to check if m_hTheme is NULL. // Example: // if(m_hTheme != NULL) // { // DrawThemeBackground(dc, BP_PUSHBUTTON, PBS_NORMAL, &rect, NULL); // DrawThemeText(dc, BP_PUSHBUTTON, PBS_NORMAL, L"Button", -1, DT_SINGLELINE | DT_CENTER | DT_VCENTER, 0, &rect); // } // else // { // dc.DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONPUSH); // dc.DrawText(_T("Button"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); // } // // Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib, // and add uxtheme.dll in the Linker.Input.Delay Loaded DLLs section of the // project properties. /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CTheme // CThemeImpl // // CBufferedPaint // CBufferedPaintImpl // CBufferedPaintWindowImpl // CBufferedAnimation // CBufferedAnimationImpl // CBufferedAnimationWindowImpl // // Global functions: // AtlDrawThemeClientEdge() namespace WTL { /////////////////////////////////////////////////////////////////////////////// // CTheme - wrapper for theme handle class CTheme { public: // Data members HTHEME m_hTheme; static int m_nIsThemingSupported; // Constructor CTheme(HTHEME hTheme = NULL) : m_hTheme(hTheme) { IsThemingSupported(); } // Operators and helpers bool IsThemeNull() const { return (m_hTheme == NULL); } CTheme& operator =(HTHEME hTheme) { m_hTheme = hTheme; return *this; } operator HTHEME() const { return m_hTheme; } void Attach(HTHEME hTheme) { m_hTheme = hTheme; } HTHEME Detach() { HTHEME hTheme = m_hTheme; m_hTheme = NULL; return hTheme; } // Theme support helper static bool IsThemingSupported() { if(m_nIsThemingSupported == -1) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CTheme::IsThemingSupported.\n")); ATLASSERT(FALSE); return false; } if(m_nIsThemingSupported == -1) { HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll")); m_nIsThemingSupported = (hThemeDLL != NULL) ? 1 : 0; if(hThemeDLL != NULL) ::FreeLibrary(hThemeDLL); } lock.Unlock(); } ATLASSERT(m_nIsThemingSupported != -1); return (m_nIsThemingSupported == 1); } // Operations and theme properties HTHEME OpenThemeData(HWND hWnd, LPCWSTR pszClassList) { if(!IsThemingSupported()) return NULL; ATLASSERT(m_hTheme == NULL); m_hTheme = ::OpenThemeData(hWnd, pszClassList); return m_hTheme; } HRESULT CloseThemeData() { HRESULT hRet = S_FALSE; if(m_hTheme != NULL) { hRet = ::CloseThemeData(m_hTheme); if(SUCCEEDED(hRet)) m_hTheme = NULL; } return hRet; } HRESULT DrawThemeBackground(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, LPCRECT pClipRect = NULL) { ATLASSERT(m_hTheme != NULL); return ::DrawThemeBackground(m_hTheme, hDC, nPartID, nStateID, pRect, pClipRect); } // Missing in original uxtheme.h #ifdef DTBG_CLIPRECT HRESULT DrawThemeBackgroundEx(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, const DTBGOPTS* pOptions = NULL) { ATLASSERT(m_hTheme != NULL); return ::DrawThemeBackgroundEx(m_hTheme, hDC, nPartID, nStateID, pRect, pOptions); } #endif // DTBG_CLIPRECT HRESULT DrawThemeText(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, LPCRECT pRect) { ATLASSERT(m_hTheme != NULL); return ::DrawThemeText(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, dwTextFlags2, pRect); } HRESULT GetThemeBackgroundContentRect(HDC hDC, int nPartID, int nStateID, LPCRECT pBoundingRect, LPRECT pContentRect) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeBackgroundContentRect(m_hTheme, hDC, nPartID, nStateID, pBoundingRect, pContentRect); } HRESULT GetThemeBackgroundExtent(HDC hDC, int nPartID, int nStateID, LPCRECT pContentRect, LPRECT pExtentRect) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeBackgroundExtent(m_hTheme, hDC, nPartID, nStateID, pContentRect, pExtentRect); } HRESULT GetThemePartSize(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, enum THEMESIZE eSize, LPSIZE pSize) const { ATLASSERT(m_hTheme != NULL); return ::GetThemePartSize(m_hTheme, hDC, nPartID, nStateID, pRect, eSize, pSize); } HRESULT GetThemeTextExtent(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, LPCRECT pBoundingRect, LPRECT pExtentRect) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeTextExtent(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, pBoundingRect, pExtentRect); } HRESULT GetThemeTextMetrics(HDC hDC, int nPartID, int nStateID, PTEXTMETRICW pTextMetric) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, pTextMetric); } HRESULT GetThemeBackgroundRegion(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HRGN* pRegion) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeBackgroundRegion(m_hTheme, hDC, nPartID, nStateID, pRect, pRegion); } HRESULT HitTestThemeBackground(HDC hDC, int nPartID, int nStateID, DWORD dwOptions, LPCRECT pRect, HRGN hrgn, POINT ptTest, WORD* pwHitTestCode) const { ATLASSERT(m_hTheme != NULL); return ::HitTestThemeBackground(m_hTheme, hDC, nPartID, nStateID, dwOptions, pRect, hrgn, ptTest, pwHitTestCode); } HRESULT DrawThemeEdge(HDC hDC, int nPartID, int nStateID, LPCRECT pDestRect, UINT uEdge, UINT uFlags, LPRECT pContentRect = NULL) { ATLASSERT(m_hTheme != NULL); return ::DrawThemeEdge(m_hTheme, hDC, nPartID, nStateID, pDestRect, uEdge, uFlags, pContentRect); } HRESULT DrawThemeIcon(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HIMAGELIST himl, int nImageIndex) { ATLASSERT(m_hTheme != NULL); return ::DrawThemeIcon(m_hTheme, hDC, nPartID, nStateID, pRect, himl, nImageIndex); } BOOL IsThemePartDefined(int nPartID, int nStateID) const { ATLASSERT(m_hTheme != NULL); return ::IsThemePartDefined(m_hTheme, nPartID, nStateID); } BOOL IsThemeBackgroundPartiallyTransparent(int nPartID, int nStateID) const { ATLASSERT(m_hTheme != NULL); return ::IsThemeBackgroundPartiallyTransparent(m_hTheme, nPartID, nStateID); } HRESULT GetThemeColor(int nPartID, int nStateID, int nPropID, COLORREF* pColor) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeColor(m_hTheme, nPartID, nStateID, nPropID, pColor); } HRESULT GetThemeMetric(HDC hDC, int nPartID, int nStateID, int nPropID, int* pnVal) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeMetric(m_hTheme, hDC, nPartID, nStateID, nPropID, pnVal); } HRESULT GetThemeString(int nPartID, int nStateID, int nPropID, LPWSTR pszBuff, int cchMaxBuffChars) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeString(m_hTheme, nPartID, nStateID, nPropID, pszBuff, cchMaxBuffChars); } HRESULT GetThemeBool(int nPartID, int nStateID, int nPropID, BOOL* pfVal) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeBool(m_hTheme, nPartID, nStateID, nPropID, pfVal); } HRESULT GetThemeInt(int nPartID, int nStateID, int nPropID, int* pnVal) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeInt(m_hTheme, nPartID, nStateID, nPropID, pnVal); } HRESULT GetThemeEnumValue(int nPartID, int nStateID, int nPropID, int* pnVal) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeEnumValue(m_hTheme, nPartID, nStateID, nPropID, pnVal); } HRESULT GetThemePosition(int nPartID, int nStateID, int nPropID, LPPOINT pPoint) const { ATLASSERT(m_hTheme != NULL); return ::GetThemePosition(m_hTheme, nPartID, nStateID, nPropID, pPoint); } // deprecated HRESULT GetThemeFont(int nPartID, HDC hDC, int nStateID, int nPropID, LOGFONTW* pFont) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); } HRESULT GetThemeFont(HDC hDC, int nPartID, int nStateID, int nPropID, LOGFONTW* pFont) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont); } HRESULT GetThemeRect(int nPartID, int nStateID, int nPropID, LPRECT pRect) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeRect(m_hTheme, nPartID, nStateID, nPropID, pRect); } HRESULT GetThemeMargins(HDC hDC, int nPartID, int nStateID, int nPropID, LPRECT pRect, PMARGINS pMargins) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeMargins(m_hTheme, hDC, nPartID, nStateID, nPropID, pRect, pMargins); } HRESULT GetThemeIntList(int nPartID, int nStateID, int nPropID, INTLIST* pIntList) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeIntList(m_hTheme, nPartID, nStateID, nPropID, pIntList); } HRESULT GetThemePropertyOrigin(int nPartID, int nStateID, int nPropID, enum PROPERTYORIGIN* pOrigin) const { ATLASSERT(m_hTheme != NULL); return ::GetThemePropertyOrigin(m_hTheme, nPartID, nStateID, nPropID, pOrigin); } HRESULT GetThemeFilename(int nPartID, int nStateID, int nPropID, LPWSTR pszThemeFileName, int cchMaxBuffChars) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeFilename(m_hTheme, nPartID, nStateID, nPropID, pszThemeFileName, cchMaxBuffChars); } COLORREF GetThemeSysColor(int nColorID) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeSysColor(m_hTheme, nColorID); } HBRUSH GetThemeSysColorBrush(int nColorID) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeSysColorBrush(m_hTheme, nColorID); } int GetThemeSysSize(int nSizeID) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeSysSize(m_hTheme, nSizeID); } BOOL GetThemeSysBool(int nBoolID) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeSysBool(m_hTheme, nBoolID); } HRESULT GetThemeSysFont(int nFontID, LOGFONTW* plf) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeSysFont(m_hTheme, nFontID, plf); } HRESULT GetThemeSysString(int nStringID, LPWSTR pszStringBuff, int cchMaxStringChars) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeSysString(m_hTheme, nStringID, pszStringBuff, cchMaxStringChars); } HRESULT GetThemeSysInt(int nIntID, int* pnValue) const { ATLASSERT(m_hTheme != NULL); return ::GetThemeSysInt(m_hTheme, nIntID, pnValue); } HTHEME OpenThemeDataEx(HWND hWnd, LPCWSTR pszClassList, DWORD dwFlags) { if(!IsThemingSupported()) return NULL; ATLASSERT(m_hTheme == NULL); m_hTheme = ::OpenThemeDataEx(hWnd, pszClassList, dwFlags); return m_hTheme; } #if (_WIN32_WINNT >= 0x0600) HRESULT DrawThemeTextEx(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT lpRect, const DTTOPTS* pOptions) { ATLASSERT(m_hTheme != NULL); return ::DrawThemeTextEx(m_hTheme, hDC, nPartID, nStateID, pszText, cchText, dwTextFlags, lpRect, pOptions); } HRESULT GetThemeTransitionDuration(int nPartID, int nFromStateID, int nToStateID, int nPropID, DWORD& dwDuration) { ATLASSERT(m_hTheme != NULL); return ::GetThemeTransitionDuration(m_hTheme, nPartID, nFromStateID, nToStateID, nPropID, &dwDuration); } #endif // (_WIN32_WINNT >= 0x0600) #if (_WIN32_WINNT >= 0x0600) HRESULT GetThemeBitmap(int nPartID, int nStateID, int nPropID, ULONG uFlags, HBITMAP& hBitmap) { ATLASSERT(m_hTheme != NULL); return ::GetThemeBitmap(m_hTheme, nPartID, nStateID, nPropID, uFlags, &hBitmap); } HRESULT GetThemeStream(int nPartID, int nStateID, int nPropID, VOID** ppvStream, DWORD* pcbStream, HINSTANCE hInstance) { ATLASSERT(m_hTheme != NULL); return ::GetThemeStream(m_hTheme, nPartID, nStateID, nPropID, ppvStream, pcbStream, hInstance); } #endif // (_WIN32_WINNT >= 0x0600) #if (_WIN32_WINNT >= 0x0602) HRESULT GetThemeAnimationProperty(int iStoryboardId, int iTargetId, TA_PROPERTY eProperty, VOID* pvProperty, DWORD cbSize, DWORD* pcbSizeOut) { ATLASSERT(m_hTheme != NULL); return ::GetThemeAnimationProperty(m_hTheme, iStoryboardId, iTargetId, eProperty, pvProperty, cbSize, pcbSizeOut); } HRESULT GetThemeAnimationTransform(int iStoryboardId, int iTargetId, DWORD dwTransformIndex, TA_TRANSFORM* pTransform, DWORD cbSize, DWORD* pcbSizeOut) { ATLASSERT(m_hTheme != NULL); return ::GetThemeAnimationTransform(m_hTheme, iStoryboardId, iTargetId, dwTransformIndex, pTransform, cbSize, pcbSizeOut); } HRESULT GetThemeTimingFunction(int iTimingFunctionId, TA_TIMINGFUNCTION* pTimingFunction, DWORD cbSize, DWORD* pcbSizeOut) { ATLASSERT(m_hTheme != NULL); return ::GetThemeTimingFunction(m_hTheme, iTimingFunctionId, pTimingFunction, cbSize, pcbSizeOut); } #endif // (_WIN32_WINNT >= 0x0602) }; __declspec(selectany) int CTheme::m_nIsThemingSupported = -1; /////////////////////////////////////////////////////////////////////////////// // CThemeImpl - theme support implementation // Derive from this class to implement window with theme support. // Example: // class CMyThemeWindow : public CWindowImpl, public CThemeImpl // { // ... // BEGIN_MSG_MAP(CMyThemeWindow) // CHAIN_MSG_MAP(CThemeImpl) // ... // END_MSG_MAP() // ... // }; // // If you set theme class list, the class will automaticaly open/close/reopen theme data. // Helper for drawing theme client edge inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = NULL, HBRUSH hBrush = NULL, int nPartID = 0, int nStateID = 0) { ATLASSERT(hTheme != NULL); ATLASSERT(::IsWindow(hWnd)); CWindowDC dc(hWnd); if(dc.IsNull()) return false; // Get border size int cxBorder = ::GetSystemMetrics(SM_CXBORDER); int cyBorder = ::GetSystemMetrics(SM_CYBORDER); if(SUCCEEDED(::GetThemeInt(hTheme, nPartID, nStateID, TMT_SIZINGBORDERWIDTH, &cxBorder))) cyBorder = cxBorder; RECT rect = {}; ::GetWindowRect(hWnd, &rect); // Remove the client edge from the update region int cxEdge = ::GetSystemMetrics(SM_CXEDGE); int cyEdge = ::GetSystemMetrics(SM_CYEDGE); ::InflateRect(&rect, -cxEdge, -cyEdge); CRgn rgn; rgn.CreateRectRgnIndirect(&rect); if(rgn.IsNull()) return false; if(hRgnUpdate != NULL) rgn.CombineRgn(hRgnUpdate, rgn, RGN_AND); ::OffsetRect(&rect, -rect.left, -rect.top); ::OffsetRect(&rect, cxEdge, cyEdge); dc.ExcludeClipRect(&rect); ::InflateRect(&rect, cxEdge, cyEdge); ::DrawThemeBackground(hTheme, dc, nPartID, nStateID, &rect, NULL); // Use background brush too, since theme border might not cover everything if((cxBorder < cxEdge) && (cyBorder < cyEdge)) { if(hBrush == NULL) hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND); ::InflateRect(&rect, cxBorder - cxEdge, cyBorder - cyEdge); dc.FillRect(&rect, hBrush); } ::DefWindowProc(hWnd, WM_NCPAINT, (WPARAM)rgn.m_hRgn, 0L); return true; } // Theme extended styles #define THEME_EX_3DCLIENTEDGE 0x00000001 #define THEME_EX_THEMECLIENTEDGE 0x00000002 template class CThemeImpl : public TBase { public: // Data members LPWSTR m_lpstrThemeClassList; DWORD m_dwExtendedStyle; // theme specific extended styles // Constructor & destructor CThemeImpl() : m_lpstrThemeClassList(NULL), m_dwExtendedStyle(0) { } ~CThemeImpl() { delete [] m_lpstrThemeClassList; } // Attributes bool SetThemeClassList(LPCWSTR lpstrThemeClassList) { if(m_lpstrThemeClassList != NULL) { delete [] m_lpstrThemeClassList; m_lpstrThemeClassList = NULL; } if(lpstrThemeClassList == NULL) return true; int cchLen = lstrlenW(lpstrThemeClassList) + 1; ATLTRY(m_lpstrThemeClassList = new WCHAR[cchLen]); if(m_lpstrThemeClassList == NULL) return false; ATL::Checked::wcscpy_s(m_lpstrThemeClassList, cchLen, lpstrThemeClassList); return true; } bool GetThemeClassList(LPWSTR lpstrThemeClassList, int cchListBuffer) const { int cchLen = lstrlenW(m_lpstrThemeClassList) + 1; if(cchListBuffer < cchLen) return false; ATL::Checked::wcscpy_s(lpstrThemeClassList, cchListBuffer, m_lpstrThemeClassList); return true; } LPCWSTR GetThemeClassList() const { return m_lpstrThemeClassList; } DWORD SetThemeExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0) { DWORD dwPrevStyle = m_dwExtendedStyle; if(dwMask == 0) m_dwExtendedStyle = dwExtendedStyle; else m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask); return dwPrevStyle; } DWORD GetThemeExtendedStyle() const { return m_dwExtendedStyle; } // Operations HTHEME OpenThemeData() { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); ATLASSERT(m_lpstrThemeClassList != NULL); if(m_lpstrThemeClassList == NULL) return NULL; this->CloseThemeData(); return TBase::OpenThemeData(pT->m_hWnd, m_lpstrThemeClassList); } HTHEME OpenThemeData(LPCWSTR pszClassList) { if(!SetThemeClassList(pszClassList)) return NULL; return OpenThemeData(); } HRESULT SetWindowTheme(LPCWSTR pszSubAppName, LPCWSTR pszSubIDList) { if(!this->IsThemingSupported()) return S_FALSE; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::SetWindowTheme(pT->m_hWnd, pszSubAppName, pszSubIDList); } HTHEME GetWindowTheme() const { if(!this->IsThemingSupported()) return NULL; const T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::GetWindowTheme(pT->m_hWnd); } HRESULT EnableThemeDialogTexture(DWORD dwFlags) { if(!this->IsThemingSupported()) return S_FALSE; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::EnableThemeDialogTexture(pT->m_hWnd, dwFlags); } BOOL IsThemeDialogTextureEnabled() const { if(!this->IsThemingSupported()) return FALSE; const T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::IsThemeDialogTextureEnabled(pT->m_hWnd); } HRESULT DrawThemeParentBackground(HDC hDC, const RECT* pRect = NULL) { if(!this->IsThemingSupported()) return S_FALSE; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DrawThemeParentBackground(pT->m_hWnd, hDC, pRect); } #if (_WIN32_WINNT >= 0x0600) HRESULT SetWindowThemeAttribute(WINDOWTHEMEATTRIBUTETYPE type, PVOID pvAttribute, DWORD cbAttribute) { if(!this->IsThemingSupported()) return S_FALSE; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::SetWindowThemeAttribute(pT->m_hWnd, type, pvAttribute, cbAttribute); } HRESULT SetWindowThemeNonClientAttributes(DWORD dwAttributes, DWORD dwMask) { if(!this->IsThemingSupported()) return S_FALSE; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); WTA_OPTIONS opt = { dwAttributes, dwMask }; return ::SetWindowThemeAttribute(pT->m_hWnd, WTA_NONCLIENT, (PVOID)&opt, sizeof(opt)); } HRESULT DrawThemeParentBackgroundEx(HDC hDC, DWORD dwFlags, const RECT* lpRect = NULL) { if(!this->IsThemingSupported()) return S_FALSE; T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); return ::DrawThemeParentBackgroundEx(pT->m_hWnd, hDC, dwFlags, lpRect); } #endif // (_WIN32_WINNT >= 0x0600) // Message map and handlers // Note: If you handle any of these messages in your derived class, // it is better to put CHAIN_MSG_MAP at the start of your message map. BEGIN_MSG_MAP(CThemeImpl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged) MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint) END_MSG_MAP() LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { if(m_lpstrThemeClassList != NULL) OpenThemeData(); bHandled = FALSE; return 1; } LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { this->CloseThemeData(); bHandled = FALSE; return 1; } LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) { this->CloseThemeData(); if(m_lpstrThemeClassList != NULL) this->OpenThemeData(); bHandled = FALSE; return 1; } LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { T* pT = static_cast(this); ATLASSERT(::IsWindow(pT->m_hWnd)); LRESULT lRet = 0; bHandled = FALSE; if(this->IsThemingSupported() && ((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0)) { if((m_dwExtendedStyle & THEME_EX_3DCLIENTEDGE) != 0) { lRet = ::DefWindowProc(pT->m_hWnd, uMsg, wParam, lParam); bHandled = TRUE; } else if((this->m_hTheme != NULL) && ((m_dwExtendedStyle & THEME_EX_THEMECLIENTEDGE) != 0)) { HRGN hRgn = (wParam != 1) ? (HRGN)wParam : NULL; if(pT->DrawThemeClientEdge(hRgn)) bHandled = TRUE; } } return lRet; } // Drawing helper bool DrawThemeClientEdge(HRGN hRgnUpdate) { T* pT = static_cast(this); return AtlDrawThemeClientEdge(this->m_hTheme, pT->m_hWnd, hRgnUpdate, NULL, 0, 0); } }; /////////////////////////////////////////////////////////////////////////////// // Buffered Paint and Animation #if (_WIN32_WINNT >= 0x0600) /////////////////////////////////////////////////////////////////////////////// // CBufferedPaintBase - Buffered Paint support for othe classes class CBufferedPaintBase { public: static int m_nIsBufferedPaintSupported; CBufferedPaintBase() { if(IsBufferedPaintSupported()) ATLVERIFY(SUCCEEDED(::BufferedPaintInit())); } ~CBufferedPaintBase() { if(IsBufferedPaintSupported()) ATLVERIFY(SUCCEEDED(::BufferedPaintUnInit())); } static bool IsBufferedPaintSupported() { if(m_nIsBufferedPaintSupported == -1) { CStaticDataInitCriticalSectionLock lock; if(FAILED(lock.Lock())) { ATLTRACE2(atlTraceUI, 0, _T("ERROR : Unable to lock critical section in CBufferedPaintBase::IsBufferedPaintSupported.\n")); ATLASSERT(FALSE); return false; } if(m_nIsBufferedPaintSupported == -1) m_nIsBufferedPaintSupported = RunTimeHelper::IsVista() ? 1 : 0; lock.Unlock(); } ATLASSERT(m_nIsBufferedPaintSupported != -1); return (m_nIsBufferedPaintSupported == 1); } }; __declspec(selectany) int CBufferedPaintBase::m_nIsBufferedPaintSupported = -1; /////////////////////////////////////////////////////////////////////////////// // CBufferedPaint - support for buffered paint functions class CBufferedPaint { public: HPAINTBUFFER m_hPaintBuffer; CBufferedPaint() : m_hPaintBuffer(NULL) { } ~CBufferedPaint() { ATLVERIFY(SUCCEEDED(End())); } bool IsNull() const { return (m_hPaintBuffer == NULL); } HPAINTBUFFER Begin(HDC hdcTarget, const RECT* prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, HDC* phdcPaint) { ATLASSERT(m_hPaintBuffer == NULL); m_hPaintBuffer = ::BeginBufferedPaint(hdcTarget, prcTarget, dwFormat, pPaintParams, phdcPaint); return m_hPaintBuffer; } HRESULT End(BOOL bUpdate = TRUE) { HRESULT hRet = S_FALSE; if(m_hPaintBuffer != NULL) { hRet = ::EndBufferedPaint(m_hPaintBuffer, bUpdate); m_hPaintBuffer = NULL; } return hRet; } HRESULT GetTargetRect(LPRECT pRect) const { ATLASSERT(m_hPaintBuffer != NULL); return ::GetBufferedPaintTargetRect(m_hPaintBuffer, pRect); } HDC GetTargetDC() const { ATLASSERT(m_hPaintBuffer != NULL); return ::GetBufferedPaintTargetDC(m_hPaintBuffer); } HDC GetPaintDC() const { ATLASSERT(m_hPaintBuffer != NULL); return ::GetBufferedPaintDC(m_hPaintBuffer); } HRESULT GetBits(RGBQUAD** ppbBuffer, int* pcxRow) const { ATLASSERT(m_hPaintBuffer != NULL); return ::GetBufferedPaintBits(m_hPaintBuffer, ppbBuffer, pcxRow); } HRESULT Clear(const RECT* pRect = NULL) { ATLASSERT(m_hPaintBuffer != NULL); return ::BufferedPaintClear(m_hPaintBuffer, pRect); } HRESULT SetAlpha(BYTE alpha, const RECT* pRect = NULL) { ATLASSERT(m_hPaintBuffer != NULL); return ::BufferedPaintSetAlpha(m_hPaintBuffer, pRect, alpha); } HRESULT MakeOpaque(const RECT* pRect = NULL) { ATLASSERT(m_hPaintBuffer != NULL); return ::BufferedPaintSetAlpha(m_hPaintBuffer, pRect, 255); } }; /////////////////////////////////////////////////////////////////////////////// // CBufferedPaintImpl - provides buffered paint for any window template class ATL_NO_VTABLE CBufferedPaintImpl : public CBufferedPaintBase { public: CBufferedPaint m_BufferedPaint; BP_BUFFERFORMAT m_dwFormat; BP_PAINTPARAMS m_PaintParams; CBufferedPaintImpl() : m_dwFormat(BPBF_TOPDOWNDIB) { memset(&m_PaintParams, 0, sizeof(BP_PAINTPARAMS)); m_PaintParams.cbSize = sizeof(BP_PAINTPARAMS); } // Message map and handlers BEGIN_MSG_MAP(CBufferedPaintImpl) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) END_MSG_MAP() LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return 1; // no background needed } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); if(wParam != NULL) { RECT rect = {}; pT->GetClientRect(&rect); pT->DoPaint((HDC)wParam, rect); } else { CPaintDC dc(pT->m_hWnd); pT->DoBufferedPaint(dc.m_hDC, dc.m_ps.rcPaint); } return 0; } // Overrideables void DoBufferedPaint(CDCHandle dc, RECT& rect) { HDC hDCPaint = NULL; if(IsBufferedPaintSupported()) m_BufferedPaint.Begin(dc, &rect, m_dwFormat, &m_PaintParams, &hDCPaint); T* pT = static_cast(this); if(hDCPaint != NULL) pT->DoPaint(hDCPaint, rect); else pT->DoPaint(dc.m_hDC, rect); if(IsBufferedPaintSupported()) m_BufferedPaint.End(); } void DoPaint(CDCHandle /*dc*/, RECT& /*rect*/) { // must be implemented in a derived class ATLASSERT(FALSE); } }; /////////////////////////////////////////////////////////////////////////////// // CBufferedPaintWindowImpl - implements a window that uses buffered paint template class ATL_NO_VTABLE CBufferedPaintWindowImpl : public ATL::CWindowImpl, public CBufferedPaintImpl< T > { public: BEGIN_MSG_MAP(CBufferedPaintWindowImpl) CHAIN_MSG_MAP(CBufferedPaintImpl< T >) END_MSG_MAP() }; /////////////////////////////////////////////////////////////////////////////// // CBufferedAnimation - support for buffered animation class CBufferedAnimation { public: HANIMATIONBUFFER m_hAnimationBuffer; CBufferedAnimation() : m_hAnimationBuffer(NULL) { } ~CBufferedAnimation() { ATLVERIFY(SUCCEEDED(End())); } bool IsNull() const { return (m_hAnimationBuffer == NULL); } HANIMATIONBUFFER Begin(HWND hWnd, HDC hDCTarget, const RECT* pRectTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, BP_ANIMATIONPARAMS* pAnimationParams, HDC* phdcFrom, HDC* phdcTo) { ATLASSERT(m_hAnimationBuffer == NULL); m_hAnimationBuffer = ::BeginBufferedAnimation(hWnd, hDCTarget, pRectTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo); return m_hAnimationBuffer; } HRESULT End(BOOL bUpdate = TRUE) { HRESULT hRet = S_FALSE; if(m_hAnimationBuffer != NULL) { hRet = ::EndBufferedAnimation(m_hAnimationBuffer, bUpdate); m_hAnimationBuffer = NULL; } return hRet; } static bool IsRendering(HWND hWnd, HDC hDC) { return (::BufferedPaintRenderAnimation(hWnd, hDC) != FALSE); } static HRESULT StopAllAnimations(HWND hWnd) { return ::BufferedPaintStopAllAnimations(hWnd); } }; /////////////////////////////////////////////////////////////////////////////// // CBufferedAnimationImpl - provides buffered animation support for any window // Note: You can either use m_State and m_NewState to store the state information // for the animation change, or map your state to those data members. DoPaint() // should only rely on the state information that is passed to it. template class ATL_NO_VTABLE CBufferedAnimationImpl : public CBufferedPaintBase { public: BP_BUFFERFORMAT m_dwFormat; BP_PAINTPARAMS m_PaintParams; BP_ANIMATIONPARAMS m_AnimationParams; TState m_State; TState m_NewState; CBufferedAnimationImpl(TState InitialState) : m_dwFormat(BPBF_TOPDOWNDIB) { memset(&m_PaintParams, 0, sizeof(BP_PAINTPARAMS)); m_PaintParams.cbSize = sizeof(BP_PAINTPARAMS); memset(&m_AnimationParams, 0, sizeof(BP_ANIMATIONPARAMS)); m_AnimationParams.cbSize = sizeof(BP_ANIMATIONPARAMS); m_AnimationParams.style = BPAS_LINEAR; m_AnimationParams.dwDuration = 500; T* pT = static_cast(this); pT->SetState(InitialState); pT->SetNewState(InitialState); } DWORD GetDuration() const { return m_AnimationParams.dwDuration; } void SetDuration(DWORD dwDuration) { m_AnimationParams.dwDuration = dwDuration; } void DoAnimation(TState NewState, const RECT* pRect = NULL) { T* pT = static_cast(this); pT->SetNewState(NewState); pT->InvalidateRect(pRect, FALSE); pT->UpdateWindow(); pT->SetState(NewState); } // Message map and handlers BEGIN_MSG_MAP(CBufferedAnimationImpl) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER(WM_PAINT, OnPaint) MESSAGE_HANDLER(WM_PRINTCLIENT, OnPaint) END_MSG_MAP() LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { return 1; // no background needed } LRESULT OnPaint(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { T* pT = static_cast(this); if(wParam != NULL) { RECT rect = {}; pT->GetClientRect(&rect); pT->DoPaint((HDC)wParam, rect, m_NewState); } else { CPaintDC dc(pT->m_hWnd); pT->DoAnimationPaint(dc.m_hDC, dc.m_ps.rcPaint); } return 0; } // Overrideables void SetState(TState State) { m_State = State; } void SetNewState(TState State) { m_NewState = State; } bool AreStatesEqual() const { return (m_State == m_NewState); } void DoAnimationPaint(CDCHandle dc, RECT& rect) { T* pT = static_cast(this); if(IsBufferedPaintSupported() && CBufferedAnimation::IsRendering(pT->m_hWnd, dc)) return; DWORD dwDurationSave = m_AnimationParams.dwDuration; if(pT->AreStatesEqual()) m_AnimationParams.dwDuration = 0; HDC hdcFrom = NULL, hdcTo = NULL; CBufferedAnimation ba; if(IsBufferedPaintSupported()) ba.Begin(pT->m_hWnd, dc, &rect, m_dwFormat, &m_PaintParams, &m_AnimationParams, &hdcFrom, &hdcTo); if(!ba.IsNull()) { if(hdcFrom != NULL) pT->DoPaint(hdcFrom, rect, m_State); if (hdcTo != NULL) pT->DoPaint(hdcTo, rect, m_NewState); } else { pT->DoPaint(dc.m_hDC, rect, m_NewState); } m_AnimationParams.dwDuration = dwDurationSave; } void DoPaint(CDCHandle /*dc*/, RECT& /*rect*/, TState /*State*/) { // must be implemented in a derived class ATLASSERT(FALSE); } }; /////////////////////////////////////////////////////////////////////////////// // CBufferedAnimationWindowImpl - implements a window that uses buffered animation template class ATL_NO_VTABLE CBufferedAnimationWindowImpl : public ATL::CWindowImpl, public CBufferedAnimationImpl< T, TState > { public: CBufferedAnimationWindowImpl(TState InitialState) : CBufferedAnimationImpl< T, TState >(InitialState) { } typedef CBufferedAnimationImpl< T, TState > _baseBufferedAnimation; BEGIN_MSG_MAP(CBufferedAnimationWindowImpl) CHAIN_MSG_MAP(_baseBufferedAnimation) END_MSG_MAP() }; #endif // (_WIN32_WINNT >= 0x0600) } // namespace WTL #endif // __ATLTHEME_H__ ================================================ FILE: third_party/WTL/Include/atluser.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLUSER_H__ #define __ATLUSER_H__ #pragma once #ifndef __ATLAPP_H__ #error atluser.h requires atlapp.h to be included first #endif /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CMenuItemInfo // CMenuT // CAcceleratorT // CIconT // CCursorT // CResource // // Global functions: // AtlMessageBox() // // AtlLoadAccelerators() // AtlLoadMenu() // AtlLoadBitmap() // AtlLoadSysBitmap() // AtlLoadCursor() // AtlLoadSysCursor() // AtlLoadIcon() // AtlLoadSysIcon() // AtlLoadBitmapImage() // AtlLoadCursorImage() // AtlLoadIconImage() // AtlLoadSysBitmapImage() // AtlLoadSysCursorImage() // AtlLoadSysIconImage() // AtlLoadString() namespace WTL { /////////////////////////////////////////////////////////////////////////////// // AtlMessageBox - accepts both memory and resource based strings inline int AtlMessageBox(HWND hWndOwner, ATL::_U_STRINGorID message, ATL::_U_STRINGorID title = (LPCTSTR)NULL, UINT uType = MB_OK | MB_ICONINFORMATION) { ATLASSERT((hWndOwner == NULL) || ::IsWindow(hWndOwner)); LPTSTR lpstrMessage = NULL; if(IS_INTRESOURCE(message.m_lpstr)) { for(int nLen = 256; ; nLen *= 2) { ATLTRY(lpstrMessage = new TCHAR[nLen]); if(lpstrMessage == NULL) { ATLASSERT(FALSE); return 0; } int nRes = ::LoadString(ModuleHelper::GetResourceInstance(), LOWORD(message.m_lpstr), lpstrMessage, nLen); if(nRes < nLen - 1) break; delete [] lpstrMessage; lpstrMessage = NULL; } message.m_lpstr = lpstrMessage; } LPTSTR lpstrTitle = NULL; if(IS_INTRESOURCE(title.m_lpstr) && (LOWORD(title.m_lpstr) != 0)) { for(int nLen = 256; ; nLen *= 2) { ATLTRY(lpstrTitle = new TCHAR[nLen]); if(lpstrTitle == NULL) { ATLASSERT(FALSE); return 0; } int nRes = ::LoadString(ModuleHelper::GetResourceInstance(), LOWORD(title.m_lpstr), lpstrTitle, nLen); if(nRes < nLen - 1) break; delete [] lpstrTitle; lpstrTitle = NULL; } title.m_lpstr = lpstrTitle; } int nRet = ::MessageBox(hWndOwner, message.m_lpstr, title.m_lpstr, uType); delete [] lpstrMessage; delete [] lpstrTitle; return nRet; } /////////////////////////////////////////////////////////////////////////////// // CMenu class CMenuItemInfo : public MENUITEMINFO { public: CMenuItemInfo() { memset(this, 0, sizeof(MENUITEMINFO)); cbSize = sizeof(MENUITEMINFO); } }; // forward declarations template class CMenuT; typedef CMenuT CMenuHandle; typedef CMenuT CMenu; template class CMenuT { public: // Data members HMENU m_hMenu; // Constructor/destructor/operators CMenuT(HMENU hMenu = NULL) : m_hMenu(hMenu) { } ~CMenuT() { if(t_bManaged && (m_hMenu != NULL)) DestroyMenu(); } CMenuT& operator =(HMENU hMenu) { Attach(hMenu); return *this; } void Attach(HMENU hMenuNew) { ATLASSERT(::IsMenu(hMenuNew)); if(t_bManaged && (m_hMenu != NULL) && (m_hMenu != hMenuNew)) ::DestroyMenu(m_hMenu); m_hMenu = hMenuNew; } HMENU Detach() { HMENU hMenu = m_hMenu; m_hMenu = NULL; return hMenu; } operator HMENU() const { return m_hMenu; } bool IsNull() const { return (m_hMenu == NULL); } BOOL IsMenu() const { return ::IsMenu(m_hMenu); } // Create/destroy methods BOOL CreateMenu() { ATLASSERT(m_hMenu == NULL); m_hMenu = ::CreateMenu(); return (m_hMenu != NULL) ? TRUE : FALSE; } BOOL CreatePopupMenu() { ATLASSERT(m_hMenu == NULL); m_hMenu = ::CreatePopupMenu(); return (m_hMenu != NULL) ? TRUE : FALSE; } BOOL LoadMenu(ATL::_U_STRINGorID menu) { ATLASSERT(m_hMenu == NULL); m_hMenu = ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); return (m_hMenu != NULL) ? TRUE : FALSE; } BOOL LoadMenuIndirect(const void* lpMenuTemplate) { ATLASSERT(m_hMenu == NULL); m_hMenu = ::LoadMenuIndirect(lpMenuTemplate); return (m_hMenu != NULL) ? TRUE : FALSE; } BOOL DestroyMenu() { if (m_hMenu == NULL) return FALSE; BOOL bRet = ::DestroyMenu(m_hMenu); if(bRet) m_hMenu = NULL; return bRet; } // Menu Operations BOOL DeleteMenu(UINT nPosition, UINT nFlags) { ATLASSERT(::IsMenu(m_hMenu)); return ::DeleteMenu(m_hMenu, nPosition, nFlags); } BOOL TrackPopupMenu(UINT nFlags, int x, int y, HWND hWnd, LPCRECT lpRect = NULL) { ATLASSERT(::IsMenu(m_hMenu)); x = _FixTrackMenuPopupX(x, y); return ::TrackPopupMenu(m_hMenu, nFlags, x, y, 0, hWnd, lpRect); } BOOL TrackPopupMenuEx(UINT uFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm = NULL) { ATLASSERT(::IsMenu(m_hMenu)); x = _FixTrackMenuPopupX(x, y); return ::TrackPopupMenuEx(m_hMenu, uFlags, x, y, hWnd, lptpm); } // helper that fixes popup menu X position when it's off-screen static int _FixTrackMenuPopupX(int x, int y) { POINT pt = { x, y }; HMONITOR hMonitor = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); if(hMonitor == NULL) { HMONITOR hMonitorNear = ::MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); if(hMonitorNear != NULL) { MONITORINFO mi = { sizeof(MONITORINFO) }; if(::GetMonitorInfo(hMonitorNear, &mi) != FALSE) { if(x < mi.rcWork.left) x = mi.rcWork.left; else if(x > mi.rcWork.right) x = mi.rcWork.right; } } } return x; } BOOL GetMenuInfo(LPMENUINFO lpMenuInfo) const { ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuInfo(m_hMenu, lpMenuInfo); } BOOL SetMenuInfo(LPCMENUINFO lpMenuInfo) { ATLASSERT(::IsMenu(m_hMenu)); return ::SetMenuInfo(m_hMenu, lpMenuInfo); } // Menu Item Operations BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) { ATLASSERT(::IsMenu(m_hMenu)); return ::AppendMenu(m_hMenu, nFlags, nIDNewItem, lpszNewItem); } BOOL AppendMenu(UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) { ATLASSERT(::IsMenu(m_hMenu)); ATLASSERT(::IsMenu(hSubMenu)); return ::AppendMenu(m_hMenu, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); } BOOL AppendMenu(UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) { ATLASSERT(::IsMenu(m_hMenu)); return ::AppendMenu(m_hMenu, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); } BOOL AppendMenu(UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) { ATLASSERT(::IsMenu(m_hMenu)); ATLASSERT(::IsMenu(hSubMenu)); return ::AppendMenu(m_hMenu, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); } UINT CheckMenuItem(UINT nIDCheckItem, UINT nCheck) { ATLASSERT(::IsMenu(m_hMenu)); return (UINT)::CheckMenuItem(m_hMenu, nIDCheckItem, nCheck); } UINT EnableMenuItem(UINT nIDEnableItem, UINT nEnable) { ATLASSERT(::IsMenu(m_hMenu)); return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable); } BOOL HiliteMenuItem(HWND hWnd, UINT uIDHiliteItem, UINT uHilite) { ATLASSERT(::IsMenu(m_hMenu)); return ::HiliteMenuItem(hWnd, m_hMenu, uIDHiliteItem, uHilite); } int GetMenuItemCount() const { ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuItemCount(m_hMenu); } UINT GetMenuItemID(int nPos) const { ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuItemID(m_hMenu, nPos); } UINT GetMenuState(UINT nID, UINT nFlags) const { ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuState(m_hMenu, nID, nFlags); } int GetMenuString(UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags) const { ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuString(m_hMenu, nIDItem, lpString, nMaxCount, nFlags); } int GetMenuStringLen(UINT nIDItem, UINT nFlags) const { ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuString(m_hMenu, nIDItem, NULL, 0, nFlags); } BOOL GetMenuString(UINT nIDItem, BSTR& bstrText, UINT nFlags) const { USES_CONVERSION; ATLASSERT(::IsMenu(m_hMenu)); ATLASSERT(bstrText == NULL); int nLen = GetMenuStringLen(nIDItem, nFlags); if(nLen == 0) { bstrText = ::SysAllocString(OLESTR("")); return (bstrText != NULL) ? TRUE : FALSE; } nLen++; // increment to include terminating NULL char ATL::CTempBuffer buff; LPTSTR lpszText = buff.Allocate(nLen); if(lpszText == NULL) return FALSE; if(!GetMenuString(nIDItem, lpszText, nLen, nFlags)) return FALSE; bstrText = ::SysAllocString(T2OLE(lpszText)); return (bstrText != NULL) ? TRUE : FALSE; } #ifdef __ATLSTR_H__ int GetMenuString(UINT nIDItem, ATL::CString& strText, UINT nFlags) const { ATLASSERT(::IsMenu(m_hMenu)); int nLen = GetMenuStringLen(nIDItem, nFlags); if(nLen == 0) return 0; nLen++; // increment to include terminating NULL char LPTSTR lpstr = strText.GetBufferSetLength(nLen); if(lpstr == NULL) return 0; int nRet = GetMenuString(nIDItem, lpstr, nLen, nFlags); strText.ReleaseBuffer(); return nRet; } #endif // __ATLSTR_H__ CMenuHandle GetSubMenu(int nPos) const { ATLASSERT(::IsMenu(m_hMenu)); return CMenuHandle(::GetSubMenu(m_hMenu, nPos)); } BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) { ATLASSERT(::IsMenu(m_hMenu)); return ::InsertMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); } BOOL InsertMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) { ATLASSERT(::IsMenu(m_hMenu)); ATLASSERT(::IsMenu(hSubMenu)); return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); } BOOL InsertMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) { ATLASSERT(::IsMenu(m_hMenu)); return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); } BOOL InsertMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) { ATLASSERT(::IsMenu(m_hMenu)); ATLASSERT(::IsMenu(hSubMenu)); return ::InsertMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); } BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem = 0, LPCTSTR lpszNewItem = NULL) { ATLASSERT(::IsMenu(m_hMenu)); return ::ModifyMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); } BOOL ModifyMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, LPCTSTR lpszNewItem) { ATLASSERT(::IsMenu(m_hMenu)); ATLASSERT(::IsMenu(hSubMenu)); return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_POPUP, (UINT_PTR)hSubMenu, lpszNewItem); } BOOL ModifyMenu(UINT nPosition, UINT nFlags, UINT_PTR nIDNewItem, HBITMAP hBmp) { ATLASSERT(::IsMenu(m_hMenu)); return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem, (LPCTSTR)hBmp); } BOOL ModifyMenu(UINT nPosition, UINT nFlags, HMENU hSubMenu, HBITMAP hBmp) { ATLASSERT(::IsMenu(m_hMenu)); ATLASSERT(::IsMenu(hSubMenu)); return ::ModifyMenu(m_hMenu, nPosition, nFlags | (MF_BITMAP | MF_POPUP), (UINT_PTR)hSubMenu, (LPCTSTR)hBmp); } BOOL RemoveMenu(UINT nPosition, UINT nFlags) { ATLASSERT(::IsMenu(m_hMenu)); return ::RemoveMenu(m_hMenu, nPosition, nFlags); } BOOL SetMenuItemBitmaps(UINT nPosition, UINT nFlags, HBITMAP hBmpUnchecked, HBITMAP hBmpChecked) { ATLASSERT(::IsMenu(m_hMenu)); return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags, hBmpUnchecked, hBmpChecked); } BOOL CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags) { ATLASSERT(::IsMenu(m_hMenu)); return ::CheckMenuRadioItem(m_hMenu, nIDFirst, nIDLast, nIDItem, nFlags); } BOOL GetMenuItemInfo(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) const { ATLASSERT(::IsMenu(m_hMenu)); return (BOOL)::GetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii); } BOOL SetMenuItemInfo(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) { ATLASSERT(::IsMenu(m_hMenu)); return (BOOL)::SetMenuItemInfo(m_hMenu, uItem, bByPosition, lpmii); } BOOL InsertMenuItem(UINT uItem, BOOL bByPosition, LPMENUITEMINFO lpmii) { ATLASSERT(::IsMenu(m_hMenu)); return (BOOL)::InsertMenuItem(m_hMenu, uItem, bByPosition, lpmii); } UINT GetMenuDefaultItem(BOOL bByPosition = FALSE, UINT uFlags = 0U) const { ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuDefaultItem(m_hMenu, (UINT)bByPosition, uFlags); } BOOL SetMenuDefaultItem(UINT uItem = (UINT)-1, BOOL bByPosition = FALSE) { ATLASSERT(::IsMenu(m_hMenu)); return ::SetMenuDefaultItem(m_hMenu, uItem, (UINT)bByPosition); } BOOL GetMenuItemRect(HWND hWnd, UINT uItem, LPRECT lprcItem) const { ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuItemRect(hWnd, m_hMenu, uItem, lprcItem); } int MenuItemFromPoint(HWND hWnd, POINT point) const { ATLASSERT(::IsMenu(m_hMenu)); return ::MenuItemFromPoint(hWnd, m_hMenu, point); } // Context Help Functions BOOL SetMenuContextHelpId(DWORD dwContextHelpId) { ATLASSERT(::IsMenu(m_hMenu)); return ::SetMenuContextHelpId(m_hMenu, dwContextHelpId); } DWORD GetMenuContextHelpId() const { ATLASSERT(::IsMenu(m_hMenu)); return ::GetMenuContextHelpId(m_hMenu); } }; /////////////////////////////////////////////////////////////////////////////// // CAccelerator template class CAcceleratorT { public: HACCEL m_hAccel; // Constructor/destructor/operators CAcceleratorT(HACCEL hAccel = NULL) : m_hAccel(hAccel) { } ~CAcceleratorT() { if(t_bManaged && (m_hAccel != NULL)) ::DestroyAcceleratorTable(m_hAccel); } CAcceleratorT& operator =(HACCEL hAccel) { Attach(hAccel); return *this; } void Attach(HACCEL hAccel) { if(t_bManaged && (m_hAccel != NULL)) ::DestroyAcceleratorTable(m_hAccel); m_hAccel = hAccel; } HACCEL Detach() { HACCEL hAccel = m_hAccel; m_hAccel = NULL; return hAccel; } operator HACCEL() const { return m_hAccel; } bool IsNull() const { return m_hAccel == NULL; } // Create/destroy methods HACCEL LoadAccelerators(ATL::_U_STRINGorID accel) { ATLASSERT(m_hAccel == NULL); m_hAccel = ::LoadAccelerators(ModuleHelper::GetResourceInstance(), accel.m_lpstr); return m_hAccel; } HACCEL CreateAcceleratorTable(LPACCEL pAccel, int cEntries) { ATLASSERT(m_hAccel == NULL); ATLASSERT(pAccel != NULL); m_hAccel = ::CreateAcceleratorTable(pAccel, cEntries); return m_hAccel; } void DestroyObject() { if(m_hAccel != NULL) { ::DestroyAcceleratorTable(m_hAccel); m_hAccel = NULL; } } // Operations int CopyAcceleratorTable(LPACCEL lpAccelDst, int cEntries) { ATLASSERT(m_hAccel != NULL); ATLASSERT(lpAccelDst != NULL); return ::CopyAcceleratorTable(m_hAccel, lpAccelDst, cEntries); } int GetEntriesCount() const { ATLASSERT(m_hAccel != NULL); return ::CopyAcceleratorTable(m_hAccel, NULL, 0); } BOOL TranslateAccelerator(HWND hWnd, LPMSG pMsg) { ATLASSERT(m_hAccel != NULL); ATLASSERT(::IsWindow(hWnd)); ATLASSERT(pMsg != NULL); return ::TranslateAccelerator(hWnd, m_hAccel, pMsg); } }; typedef CAcceleratorT CAcceleratorHandle; typedef CAcceleratorT CAccelerator; /////////////////////////////////////////////////////////////////////////////// // CIcon template class CIconT { public: HICON m_hIcon; // Constructor/destructor/operators CIconT(HICON hIcon = NULL) : m_hIcon(hIcon) { } ~CIconT() { if(t_bManaged && (m_hIcon != NULL)) ::DestroyIcon(m_hIcon); } CIconT& operator =(HICON hIcon) { Attach(hIcon); return *this; } void Attach(HICON hIcon) { if(t_bManaged && (m_hIcon != NULL)) ::DestroyIcon(m_hIcon); m_hIcon = hIcon; } HICON Detach() { HICON hIcon = m_hIcon; m_hIcon = NULL; return hIcon; } operator HICON() const { return m_hIcon; } bool IsNull() const { return m_hIcon == NULL; } // Create/destroy methods HICON LoadIcon(ATL::_U_STRINGorID icon) { ATLASSERT(m_hIcon == NULL); m_hIcon = ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); return m_hIcon; } HICON LoadIcon(ATL::_U_STRINGorID icon, int cxDesired, int cyDesired, UINT fuLoad = 0) { ATLASSERT(m_hIcon == NULL); m_hIcon = (HICON) ::LoadImage(ModuleHelper::GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); return m_hIcon; } HICON LoadOEMIcon(LPCTSTR lpstrIconName) { ATLASSERT(m_hIcon == NULL); ATLASSERT(IsOEMIcon(lpstrIconName)); m_hIcon = ::LoadIcon(NULL, lpstrIconName); return m_hIcon; } HICON CreateIcon(int nWidth, int nHeight, BYTE cPlanes, BYTE cBitsPixel, CONST BYTE* lpbANDbits, CONST BYTE *lpbXORbits) { ATLASSERT(m_hIcon == NULL); ATLASSERT(lpbANDbits != NULL); ATLASSERT(lpbXORbits != NULL); m_hIcon = ::CreateIcon(ModuleHelper::GetResourceInstance(), nWidth, nHeight, cPlanes, cBitsPixel, lpbANDbits, lpbXORbits); return m_hIcon; } HICON CreateIconFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000) { ATLASSERT(m_hIcon == NULL); ATLASSERT(pBits != NULL); m_hIcon = ::CreateIconFromResource(pBits, dwResSize, TRUE, dwVersion); return m_hIcon; } HICON CreateIconFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR) { ATLASSERT(m_hIcon == NULL); ATLASSERT(pbBits != NULL); ATLASSERT(cbBits > 0); m_hIcon = ::CreateIconFromResourceEx(pbBits, cbBits, TRUE, dwVersion, cxDesired, cyDesired, uFlags); return m_hIcon; } HICON CreateIconIndirect(PICONINFO pIconInfo) { ATLASSERT(m_hIcon == NULL); ATLASSERT(pIconInfo != NULL); m_hIcon = ::CreateIconIndirect(pIconInfo); return m_hIcon; } HICON ExtractIcon(LPCTSTR lpszExeFileName, UINT nIconIndex) { ATLASSERT(m_hIcon == NULL); ATLASSERT(lpszExeFileName != NULL); m_hIcon = ::ExtractIcon(ModuleHelper::GetModuleInstance(), lpszExeFileName, nIconIndex); return m_hIcon; } HICON ExtractAssociatedIcon(HINSTANCE hInst, LPTSTR lpIconPath, LPWORD lpiIcon) { ATLASSERT(m_hIcon == NULL); ATLASSERT(lpIconPath != NULL); ATLASSERT(lpiIcon != NULL); m_hIcon = ::ExtractAssociatedIcon(hInst, lpIconPath, lpiIcon); return m_hIcon; } BOOL DestroyIcon() { ATLASSERT(m_hIcon != NULL); BOOL bRet = ::DestroyIcon(m_hIcon); if(bRet != FALSE) m_hIcon = NULL; return bRet; } // Operations HICON CopyIcon() { ATLASSERT(m_hIcon != NULL); return ::CopyIcon(m_hIcon); } HICON DuplicateIcon() { ATLASSERT(m_hIcon != NULL); return ::DuplicateIcon(NULL, m_hIcon); } BOOL DrawIcon(HDC hDC, int x, int y) { ATLASSERT(m_hIcon != NULL); return ::DrawIcon(hDC, x, y, m_hIcon); } BOOL DrawIcon(HDC hDC, POINT pt) { ATLASSERT(m_hIcon != NULL); return ::DrawIcon(hDC, pt.x, pt.y, m_hIcon); } BOOL DrawIconEx(HDC hDC, int x, int y, int cxWidth, int cyWidth, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) { ATLASSERT(m_hIcon != NULL); return ::DrawIconEx(hDC, x, y, m_hIcon, cxWidth, cyWidth, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); } BOOL DrawIconEx(HDC hDC, POINT pt, SIZE size, UINT uStepIfAniCur = 0, HBRUSH hbrFlickerFreeDraw = NULL, UINT uFlags = DI_NORMAL) { ATLASSERT(m_hIcon != NULL); return ::DrawIconEx(hDC, pt.x, pt.y, m_hIcon, size.cx, size.cy, uStepIfAniCur, hbrFlickerFreeDraw, uFlags); } BOOL GetIconInfo(PICONINFO pIconInfo) const { ATLASSERT(m_hIcon != NULL); ATLASSERT(pIconInfo != NULL); return ::GetIconInfo(m_hIcon, pIconInfo); } #if (_WIN32_WINNT >= 0x0600) BOOL GetIconInfoEx(PICONINFOEX pIconInfo) const { ATLASSERT(m_hIcon != NULL); ATLASSERT(pIconInfo != NULL); return ::GetIconInfoEx(m_hIcon, pIconInfo); } #endif // (_WIN32_WINNT >= 0x0600) #if defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) HRESULT LoadIconMetric(ATL::_U_STRINGorID icon, int lims) { ATLASSERT(m_hIcon == NULL); USES_CONVERSION; return ::LoadIconMetric(ModuleHelper::GetResourceInstance(), T2CW(icon.m_lpstr), lims, &m_hIcon); } HRESULT LoadIconWithScaleDown(ATL::_U_STRINGorID icon, int cx, int cy) { ATLASSERT(m_hIcon == NULL); USES_CONVERSION; return ::LoadIconWithScaleDown(ModuleHelper::GetResourceInstance(), T2CW(icon.m_lpstr), cx, cy, &m_hIcon); } HRESULT LoadOEMIconMetric(LPCTSTR lpstrIconName, int lims) { ATLASSERT(m_hIcon == NULL); ATLASSERT(IsOEMIcon(lpstrIconName)); return ::LoadIconMetric(NULL, (LPCWSTR)lpstrIconName, lims, &m_hIcon); } HRESULT LoadOEMIconWithScaleDown(LPCTSTR lpstrIconName, int cx, int cy) { ATLASSERT(m_hIcon == NULL); ATLASSERT(IsOEMIcon(lpstrIconName)); USES_CONVERSION; return ::LoadIconWithScaleDown(NULL, (LPCWSTR)lpstrIconName, cx, cy, &m_hIcon); } #endif // defined(NTDDI_VERSION) && (NTDDI_VERSION >= NTDDI_LONGHORN) // Helper static bool IsOEMIcon(LPCTSTR lpstrIconName) { #if (WINVER >= 0x0600) return ((lpstrIconName == IDI_APPLICATION) || (lpstrIconName == IDI_ASTERISK) || (lpstrIconName == IDI_EXCLAMATION) || (lpstrIconName == IDI_HAND) || (lpstrIconName == IDI_QUESTION) || (lpstrIconName == IDI_WINLOGO) || (lpstrIconName == IDI_SHIELD)); #else // !(WINVER >= 0x0600) return ((lpstrIconName == IDI_APPLICATION) || (lpstrIconName == IDI_ASTERISK) || (lpstrIconName == IDI_EXCLAMATION) || (lpstrIconName == IDI_HAND) || (lpstrIconName == IDI_QUESTION) || (lpstrIconName == IDI_WINLOGO)); #endif // !(WINVER >= 0x0600) } }; typedef CIconT CIconHandle; typedef CIconT CIcon; /////////////////////////////////////////////////////////////////////////////// // CCursor // protect template member from a winuser.h macro #ifdef CopyCursor #undef CopyCursor #endif template class CCursorT { public: HCURSOR m_hCursor; // Constructor/destructor/operators CCursorT(HCURSOR hCursor = NULL) : m_hCursor(hCursor) { } ~CCursorT() { if(t_bManaged && (m_hCursor != NULL)) DestroyCursor(); } CCursorT& operator =(HCURSOR hCursor) { Attach(hCursor); return *this; } void Attach(HCURSOR hCursor) { if(t_bManaged && (m_hCursor != NULL)) DestroyCursor(); m_hCursor = hCursor; } HCURSOR Detach() { HCURSOR hCursor = m_hCursor; m_hCursor = NULL; return hCursor; } operator HCURSOR() const { return m_hCursor; } bool IsNull() const { return m_hCursor == NULL; } // Create/destroy methods HCURSOR LoadCursor(ATL::_U_STRINGorID cursor) { ATLASSERT(m_hCursor == NULL); m_hCursor = ::LoadCursor(ModuleHelper::GetResourceInstance(), cursor.m_lpstr); return m_hCursor; } HCURSOR LoadSysCursor(LPCTSTR lpstrCursorName) { ATLASSERT(m_hCursor == NULL); ATLASSERT((lpstrCursorName == IDC_ARROW) || (lpstrCursorName == IDC_IBEAM) || (lpstrCursorName == IDC_WAIT) || (lpstrCursorName == IDC_CROSS) || (lpstrCursorName == IDC_UPARROW) || (lpstrCursorName == IDC_SIZE) || (lpstrCursorName == IDC_ICON) || (lpstrCursorName == IDC_SIZENWSE) || (lpstrCursorName == IDC_SIZENESW) || (lpstrCursorName == IDC_SIZEWE) || (lpstrCursorName == IDC_SIZENS) || (lpstrCursorName == IDC_SIZEALL) || (lpstrCursorName == IDC_NO) || (lpstrCursorName == IDC_APPSTARTING) || (lpstrCursorName == IDC_HELP) || (lpstrCursorName == IDC_HAND)); m_hCursor = ::LoadCursor(NULL, lpstrCursorName); return m_hCursor; } // deprecated HCURSOR LoadOEMCursor(LPCTSTR lpstrCursorName) { return LoadSysCursor(lpstrCursorName); } HCURSOR LoadCursor(ATL::_U_STRINGorID cursor, int cxDesired, int cyDesired, UINT fuLoad = 0) { ATLASSERT(m_hCursor == NULL); m_hCursor = (HCURSOR) ::LoadImage(ModuleHelper::GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); return m_hCursor; } HCURSOR LoadCursorFromFile(LPCTSTR pstrFilename) { ATLASSERT(m_hCursor == NULL); ATLASSERT(pstrFilename != NULL); m_hCursor = ::LoadCursorFromFile(pstrFilename); return m_hCursor; } HCURSOR CreateCursor(int xHotSpot, int yHotSpot, int nWidth, int nHeight, CONST VOID *pvANDPlane, CONST VOID *pvXORPlane) { ATLASSERT(m_hCursor == NULL); m_hCursor = ::CreateCursor(ModuleHelper::GetResourceInstance(), xHotSpot, yHotSpot, nWidth, nHeight, pvANDPlane, pvXORPlane); return m_hCursor; } HCURSOR CreateCursorFromResource(PBYTE pBits, DWORD dwResSize, DWORD dwVersion = 0x00030000) { ATLASSERT(m_hCursor == NULL); ATLASSERT(pBits != NULL); m_hCursor = (HCURSOR)::CreateIconFromResource(pBits, dwResSize, FALSE, dwVersion); return m_hCursor; } HCURSOR CreateCursorFromResourceEx(PBYTE pbBits, DWORD cbBits, DWORD dwVersion = 0x00030000, int cxDesired = 0, int cyDesired = 0, UINT uFlags = LR_DEFAULTCOLOR) { ATLASSERT(m_hCursor == NULL); ATLASSERT(pbBits != NULL); ATLASSERT(cbBits > 0); m_hCursor = (HCURSOR)::CreateIconFromResourceEx(pbBits, cbBits, FALSE, dwVersion, cxDesired, cyDesired, uFlags); return m_hCursor; } BOOL DestroyCursor() { ATLASSERT(m_hCursor != NULL); BOOL bRet = ::DestroyCursor(m_hCursor); if(bRet != FALSE) m_hCursor = NULL; return bRet; } // Operations HCURSOR CopyCursor() { ATLASSERT(m_hCursor != NULL); return (HCURSOR)::CopyIcon((HICON)m_hCursor); } BOOL GetCursorInfo(LPCURSORINFO pCursorInfo) { ATLASSERT(m_hCursor != NULL); ATLASSERT(pCursorInfo != NULL); return ::GetCursorInfo(pCursorInfo); } }; typedef CCursorT CCursorHandle; typedef CCursorT CCursor; /////////////////////////////////////////////////////////////////////////////// // CResource - Wraps a generic Windows resource. // Use it with custom resource types other than the // standard RT_CURSOR, RT_BITMAP, etc. class CResource { public: HGLOBAL m_hGlobal; HRSRC m_hResource; // Constructor/destructor CResource() : m_hGlobal(NULL), m_hResource(NULL) { } ~CResource() { Release(); } // Load methods bool Load(ATL::_U_STRINGorID Type, ATL::_U_STRINGorID ID) { ATLASSERT(m_hResource == NULL); ATLASSERT(m_hGlobal == NULL); m_hResource = ::FindResource(ModuleHelper::GetResourceInstance(), ID.m_lpstr, Type.m_lpstr); if(m_hResource == NULL) return false; m_hGlobal = ::LoadResource(ModuleHelper::GetResourceInstance(), m_hResource); if(m_hGlobal == NULL) { m_hResource = NULL; return false; } return true; } bool LoadEx(ATL::_U_STRINGorID ID, ATL::_U_STRINGorID Type, WORD wLanguage) { ATLASSERT(m_hResource == NULL); ATLASSERT(m_hGlobal == NULL); m_hResource = ::FindResourceEx(ModuleHelper::GetResourceInstance(), Type.m_lpstr, ID.m_lpstr, wLanguage); if(m_hResource == NULL) return false; m_hGlobal = ::LoadResource(ModuleHelper::GetResourceInstance(), m_hResource); if(m_hGlobal == NULL) { m_hResource = NULL; return false; } return true; } // Misc. operations DWORD GetSize() const { ATLASSERT(m_hResource != NULL); return ::SizeofResource(ModuleHelper::GetResourceInstance(), m_hResource); } LPVOID Lock() { ATLASSERT(m_hResource != NULL); ATLASSERT(m_hGlobal != NULL); LPVOID pVoid = ::LockResource(m_hGlobal); ATLASSERT(pVoid != NULL); return pVoid; } void Release() { if(m_hGlobal != NULL) { FreeResource(m_hGlobal); m_hGlobal = NULL; m_hResource = NULL; } } }; /////////////////////////////////////////////////////////////////////////////// // Toolbar resource descriptor struct _AtlToolBarData { WORD wVersion; WORD wWidth; WORD wHeight; WORD wItemCount; WORD* items() { return (WORD*)(this+1); } }; /////////////////////////////////////////////////////////////////////////////// // Global functions for loading resources inline HACCEL AtlLoadAccelerators(ATL::_U_STRINGorID table) { return ::LoadAccelerators(ModuleHelper::GetResourceInstance(), table.m_lpstr); } inline HMENU AtlLoadMenu(ATL::_U_STRINGorID menu) { return ::LoadMenu(ModuleHelper::GetResourceInstance(), menu.m_lpstr); } inline HBITMAP AtlLoadBitmap(ATL::_U_STRINGorID bitmap) { return ::LoadBitmap(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr); } #ifdef OEMRESOURCE inline HBITMAP AtlLoadSysBitmap(ATL::_U_STRINGorID bitmap) { #ifdef _DEBUG WORD wID = LOWORD(bitmap.m_lpstr); ATLASSERT((wID >= 32734) && (wID <= 32767)); #endif // _DEBUG return ::LoadBitmap(NULL, bitmap.m_lpstr); } #endif // OEMRESOURCE inline HCURSOR AtlLoadCursor(ATL::_U_STRINGorID cursor) { return ::LoadCursor(ModuleHelper::GetResourceInstance(), cursor.m_lpstr); } inline HCURSOR AtlLoadSysCursor(LPCTSTR lpCursorName) { ATLASSERT((lpCursorName == IDC_ARROW) || (lpCursorName == IDC_IBEAM) || (lpCursorName == IDC_WAIT) || (lpCursorName == IDC_CROSS) || (lpCursorName == IDC_UPARROW) || (lpCursorName == IDC_SIZE) || (lpCursorName == IDC_ICON) || (lpCursorName == IDC_SIZENWSE) || (lpCursorName == IDC_SIZENESW) || (lpCursorName == IDC_SIZEWE) || (lpCursorName == IDC_SIZENS) || (lpCursorName == IDC_SIZEALL) || (lpCursorName == IDC_NO) || (lpCursorName == IDC_APPSTARTING) || (lpCursorName == IDC_HELP) || (lpCursorName == IDC_HAND)); return ::LoadCursor(NULL, lpCursorName); } inline HICON AtlLoadIcon(ATL::_U_STRINGorID icon) { return ::LoadIcon(ModuleHelper::GetResourceInstance(), icon.m_lpstr); } inline HICON AtlLoadSysIcon(LPCTSTR lpIconName) { #if (WINVER >= 0x0600) ATLASSERT((lpIconName == IDI_APPLICATION) || (lpIconName == IDI_ASTERISK) || (lpIconName == IDI_EXCLAMATION) || (lpIconName == IDI_HAND) || (lpIconName == IDI_QUESTION) || (lpIconName == IDI_WINLOGO) || (lpIconName == IDI_SHIELD)); #else // !(WINVER >= 0x0600) ATLASSERT((lpIconName == IDI_APPLICATION) || (lpIconName == IDI_ASTERISK) || (lpIconName == IDI_EXCLAMATION) || (lpIconName == IDI_HAND) || (lpIconName == IDI_QUESTION) || (lpIconName == IDI_WINLOGO)); #endif // !(WINVER >= 0x0600) return ::LoadIcon(NULL, lpIconName); } inline HBITMAP AtlLoadBitmapImage(ATL::_U_STRINGorID bitmap, UINT fuLoad = LR_DEFAULTCOLOR) { return (HBITMAP)::LoadImage(ModuleHelper::GetResourceInstance(), bitmap.m_lpstr, IMAGE_BITMAP, 0, 0, fuLoad); } inline HCURSOR AtlLoadCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) { return (HCURSOR)::LoadImage(ModuleHelper::GetResourceInstance(), cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); } inline HICON AtlLoadIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) { return (HICON)::LoadImage(ModuleHelper::GetResourceInstance(), icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); } #ifdef OEMRESOURCE inline HBITMAP AtlLoadSysBitmapImage(WORD wBitmapID, UINT fuLoad = LR_DEFAULTCOLOR) { ATLASSERT((wBitmapID >= 32734) && (wBitmapID <= 32767)); ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file return (HBITMAP)::LoadImage(NULL, MAKEINTRESOURCE(wBitmapID), IMAGE_BITMAP, 0, 0, fuLoad); } #endif // OEMRESOURCE inline HCURSOR AtlLoadSysCursorImage(ATL::_U_STRINGorID cursor, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) { #ifdef _DEBUG WORD wID = LOWORD(cursor.m_lpstr); ATLASSERT(((wID >= 32512) && (wID <= 32516)) || ((wID >= 32640) && (wID <= 32648)) || (wID == 32650) || (wID == 32651)); ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file #endif // _DEBUG return (HCURSOR)::LoadImage(NULL, cursor.m_lpstr, IMAGE_CURSOR, cxDesired, cyDesired, fuLoad); } inline HICON AtlLoadSysIconImage(ATL::_U_STRINGorID icon, UINT fuLoad = LR_DEFAULTCOLOR | LR_DEFAULTSIZE, int cxDesired = 0, int cyDesired = 0) { #ifdef _DEBUG WORD wID = LOWORD(icon.m_lpstr); ATLASSERT((wID >= 32512) && (wID <= 32517)); ATLASSERT((fuLoad & LR_LOADFROMFILE) == 0); // this one doesn't load from a file #endif // _DEBUG return (HICON)::LoadImage(NULL, icon.m_lpstr, IMAGE_ICON, cxDesired, cyDesired, fuLoad); } inline bool AtlLoadString(UINT uID, BSTR& bstrText) { USES_CONVERSION; ATLASSERT(bstrText == NULL); LPTSTR lpstrText = NULL; int nRes = 0; for(int nLen = 256; ; nLen *= 2) { ATLTRY(lpstrText = new TCHAR[nLen]); if(lpstrText == NULL) break; nRes = ::LoadString(ModuleHelper::GetResourceInstance(), uID, lpstrText, nLen); if(nRes < nLen - 1) break; delete [] lpstrText; lpstrText = NULL; } if(lpstrText != NULL) { if(nRes != 0) bstrText = ::SysAllocString(T2OLE(lpstrText)); delete [] lpstrText; } return (bstrText != NULL) ? true : false; } } // namespace WTL #endif // __ATLUSER_H__ ================================================ FILE: third_party/WTL/Include/atlwinx.h ================================================ // Windows Template Library - WTL version 10.0 // Copyright (C) Microsoft Corporation, WTL Team. All rights reserved. // // This file is a part of the Windows Template Library. // The use and distribution terms for this software are covered by the // Microsoft Public License (http://opensource.org/licenses/MS-PL) // which can be found in the file MS-PL.txt at the root folder. #ifndef __ATLWINX_H__ #define __ATLWINX_H__ #pragma once #ifndef __ATLAPP_H__ #error atlwinx.h requires atlapp.h to be included first #endif #include /////////////////////////////////////////////////////////////////////////////// // Classes in this file: // // CWindowEx ///////////////////////////////////////////////////////////////////////////// // Additional macros needed for template classes #ifndef DECLARE_WND_CLASS_EX2 #define DECLARE_WND_CLASS_EX2(WndClassName, EnclosingClass, style, bkgnd) \ static ATL::CWndClassInfo& GetWndClassInfo() \ { \ static ATL::CWndClassInfo wc = \ { \ { sizeof(WNDCLASSEX), style, EnclosingClass::StartWindowProc, \ 0, 0, NULL, NULL, NULL, (HBRUSH)(bkgnd + 1), NULL, WndClassName, NULL }, \ NULL, NULL, IDC_ARROW, TRUE, 0, _T("") \ }; \ return wc; \ } #endif // DECLARE_WND_CLASS_EX2 #ifndef DECLARE_WND_SUPERCLASS2 #define DECLARE_WND_SUPERCLASS2(WndClassName, EnclosingClass, OrigWndClassName) \ static ATL::CWndClassInfo& GetWndClassInfo() \ { \ static ATL::CWndClassInfo wc = \ { \ { sizeof(WNDCLASSEX), 0, EnclosingClass::StartWindowProc, \ 0, 0, NULL, NULL, NULL, NULL, NULL, WndClassName, NULL }, \ OrigWndClassName, NULL, NULL, TRUE, 0, _T("") \ }; \ return wc; \ } #endif // DECLARE_WND_SUPERCLASS2 /////////////////////////////////////////////////////////////////////////////// // Command Chaining Macros #define CHAIN_COMMANDS(theChainClass) \ if(uMsg == WM_COMMAND) \ CHAIN_MSG_MAP(theChainClass) #define CHAIN_COMMANDS_ALT(theChainClass, msgMapID) \ if(uMsg == WM_COMMAND) \ CHAIN_MSG_MAP_ALT(theChainClass, msgMapID) #define CHAIN_COMMANDS_MEMBER(theChainMember) \ if(uMsg == WM_COMMAND) \ CHAIN_MSG_MAP_MEMBER(theChainMember) #define CHAIN_COMMANDS_ALT_MEMBER(theChainMember, msgMapID) \ if(uMsg == WM_COMMAND) \ CHAIN_MSG_MAP_ALT_MEMBER(theChainMember, msgMapID) /////////////////////////////////////////////////////////////////////////////// // Macros for parent message map to selectively reflect control messages // NOTE: ReflectNotifications is a member of ATL's CWindowImplRoot // (and overridden in 2 cases - CContainedWindowT and CAxHostWindow) // Since we can't modify ATL, we'll provide the needed additions // in a separate function (that is not a member of CWindowImplRoot) namespace WTL { inline LRESULT WtlReflectNotificationsFiltered(HWND hWndParent, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled, UINT uMsgFilter = WM_NULL, UINT_PTR idFromFilter = 0, HWND hWndChildFilter = NULL) { if((uMsgFilter != WM_NULL) && (uMsgFilter != uMsg)) { // The notification message doesn't match the filter. bHandled = FALSE; return 1; } HWND hWndChild = NULL; UINT_PTR idFrom = 0; switch(uMsg) { case WM_COMMAND: if(lParam != NULL) // not from a menu { hWndChild = (HWND)lParam; idFrom = (UINT_PTR)LOWORD(wParam); } break; case WM_NOTIFY: hWndChild = ((LPNMHDR)lParam)->hwndFrom; idFrom = ((LPNMHDR)lParam)->idFrom; break; case WM_PARENTNOTIFY: switch(LOWORD(wParam)) { case WM_CREATE: case WM_DESTROY: hWndChild = (HWND)lParam; idFrom = (UINT_PTR)HIWORD(wParam); break; default: hWndChild = ::GetDlgItem(hWndParent, HIWORD(wParam)); idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); break; } break; case WM_DRAWITEM: if(wParam) // not from a menu { hWndChild = ((LPDRAWITEMSTRUCT)lParam)->hwndItem; idFrom = (UINT_PTR)wParam; } break; case WM_MEASUREITEM: if(wParam) // not from a menu { hWndChild = ::GetDlgItem(hWndParent, ((LPMEASUREITEMSTRUCT)lParam)->CtlID); idFrom = (UINT_PTR)wParam; } break; case WM_COMPAREITEM: if(wParam) // not from a menu { hWndChild = ((LPCOMPAREITEMSTRUCT)lParam)->hwndItem; idFrom = (UINT_PTR)wParam; } break; case WM_DELETEITEM: if(wParam) // not from a menu { hWndChild = ((LPDELETEITEMSTRUCT)lParam)->hwndItem; idFrom = (UINT_PTR)wParam; } break; case WM_VKEYTOITEM: case WM_CHARTOITEM: case WM_HSCROLL: case WM_VSCROLL: case WM_CTLCOLORBTN: case WM_CTLCOLORDLG: case WM_CTLCOLOREDIT: case WM_CTLCOLORLISTBOX: case WM_CTLCOLORMSGBOX: case WM_CTLCOLORSCROLLBAR: case WM_CTLCOLORSTATIC: hWndChild = (HWND)lParam; idFrom = (UINT_PTR)::GetDlgCtrlID(hWndChild); break; default: break; } if((hWndChild == NULL) || ((hWndChildFilter != NULL) && (hWndChildFilter != hWndChild))) { // Either hWndChild isn't valid, or // hWndChild doesn't match the filter. bHandled = FALSE; return 1; } if((idFromFilter != 0) && (idFromFilter != idFrom)) { // The dialog control id doesn't match the filter. bHandled = FALSE; return 1; } ATLASSERT(::IsWindow(hWndChild)); LRESULT lResult = ::SendMessage(hWndChild, OCM__BASE + uMsg, wParam, lParam); if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) { // Try to prevent problems with WM_CTLCOLOR* messages when // the message wasn't really handled bHandled = FALSE; } return lResult; } } // namespace WTL // Try to prevent problems with WM_CTLCOLOR* messages when // the message wasn't really handled #define REFLECT_NOTIFICATIONS_EX() \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if((lResult == 0) && (uMsg >= WM_CTLCOLORMSGBOX) && (uMsg <= WM_CTLCOLORSTATIC)) \ bHandled = FALSE; \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFICATIONS_MSG_FILTERED(uMsgFilter) \ { \ bHandled = TRUE; \ lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, NULL); \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFICATIONS_ID_FILTERED(idFromFilter) \ { \ bHandled = TRUE; \ lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, idFromFilter, NULL); \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFICATIONS_HWND_FILTERED(hWndChildFilter) \ { \ bHandled = TRUE; \ lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, WM_NULL, 0, hWndChildFilter); \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFICATIONS_MSG_ID_FILTERED(uMsgFilter, idFromFilter) \ { \ bHandled = TRUE; \ lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, idFromFilter, NULL); \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFICATIONS_MSG_HWND_FILTERED(uMsgFilter, hWndChildFilter) \ { \ bHandled = TRUE; \ lResult = WTL::WtlReflectNotificationsFiltered(this->m_hWnd, uMsg, wParam, lParam, bHandled, uMsgFilter, 0, hWndChildFilter); \ if(bHandled) \ return TRUE; \ } #define REFLECT_COMMAND(id, code) \ if((uMsg == WM_COMMAND) && (id == LOWORD(wParam)) && (code == HIWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define REFLECT_COMMAND_ID(id) \ if((uMsg == WM_COMMAND) && (id == LOWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define REFLECT_COMMAND_CODE(code) \ if((uMsg == WM_COMMAND) && (code == HIWORD(wParam))) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define REFLECT_COMMAND_RANGE(idFirst, idLast) \ if((uMsg == WM_COMMAND) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define REFLECT_COMMAND_RANGE_CODE(idFirst, idLast, code) \ if((uMsg == WM_COMMAND) && (code == HIWORD(wParam)) && (LOWORD(wParam) >= idFirst) && (LOWORD(wParam) <= idLast)) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFY(id, cd) \ if((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom) && (cd == ((LPNMHDR)lParam)->code)) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFY_ID(id) \ if((uMsg == WM_NOTIFY) && (id == ((LPNMHDR)lParam)->idFrom)) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFY_CODE(cd) \ if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code)) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFY_RANGE(idFirst, idLast) \ if((uMsg == WM_NOTIFY) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } #define REFLECT_NOTIFY_RANGE_CODE(idFirst, idLast, cd) \ if((uMsg == WM_NOTIFY) && (cd == ((LPNMHDR)lParam)->code) && (((LPNMHDR)lParam)->idFrom >= idFirst) && (((LPNMHDR)lParam)->idFrom <= idLast)) \ { \ bHandled = TRUE; \ lResult = this->ReflectNotifications(uMsg, wParam, lParam, bHandled); \ if(bHandled) \ return TRUE; \ } /////////////////////////////////////////////////////////////////////////////// // GetClassLong/SetClassLong redefinition to avoid problems with class members #ifdef SetClassLongPtrA #undef SetClassLongPtrA inline LONG_PTR SetClassLongPtrA(HWND hWnd, int nIndex, LONG_PTR dwNewLong) { return ::SetClassLongA(hWnd, nIndex, LONG(dwNewLong)); } #endif #ifdef SetClassLongPtrW #undef SetClassLongPtrW inline LONG_PTR SetClassLongPtrW(HWND hWnd, int nIndex, LONG_PTR dwNewLong) { return ::SetClassLongW(hWnd, nIndex, LONG(dwNewLong)); } #endif #ifdef GetClassLongPtrA #undef GetClassLongPtrA inline LONG_PTR GetClassLongPtrA(HWND hWnd, int nIndex) { return ::GetClassLongA(hWnd, nIndex); } #endif #ifdef GetClassLongPtrW #undef GetClassLongPtrW inline LONG_PTR GetClassLongPtrW(HWND hWnd, int nIndex) { return ::GetClassLongW(hWnd, nIndex); } #endif /////////////////////////////////////////////////////////////////////////////// // CWindowEx - extension of ATL::CWindow namespace WTL { class CWindowEx : public ATL::CWindow { public: CWindowEx(HWND hWnd = NULL) : ATL::CWindow(hWnd) { } CWindowEx& operator =(HWND hWnd) { m_hWnd = hWnd; return *this; } operator HWND() const { return m_hWnd; } // Methods BOOL PrintWindow(HDC hDC, UINT uFlags = 0) { ATLASSERT(::IsWindow(m_hWnd)); return ::PrintWindow(m_hWnd, hDC, uFlags); } BOOL DragDetect(POINT pt) { ATLASSERT(::IsWindow(m_hWnd)); return ::DragDetect(m_hWnd, pt); } BOOL DragDetect() { ATLASSERT(::IsWindow(m_hWnd)); POINT pt = {}; ::GetCursorPos(&pt); return ::DragDetect(m_hWnd, pt); } CWindowEx GetAncestor(UINT uFlags) const { ATLASSERT(::IsWindow(m_hWnd)); return CWindowEx(::GetAncestor(m_hWnd, uFlags)); } // Note: Does not work properly on Vista Aero and above BOOL AnimateWindow(DWORD dwFlags, DWORD dwTime = 200) { ATLASSERT(::IsWindow(m_hWnd)); return ::AnimateWindow(m_hWnd, dwTime, dwFlags); } BOOL FlashWindowEx(DWORD dwFlags, UINT uCount, DWORD dwTimeout = 0) { ATLASSERT(::IsWindow(m_hWnd)); FLASHWINFO fi = { sizeof(FLASHWINFO) }; fi.hwnd = m_hWnd; fi.dwFlags = dwFlags; fi.uCount = uCount; fi.dwTimeout = dwTimeout; return ::FlashWindowEx(&fi); } BOOL StopFlashWindowEx() { ATLASSERT(::IsWindow(m_hWnd)); FLASHWINFO fi = { sizeof(FLASHWINFO) }; fi.hwnd = m_hWnd; fi.dwFlags = FLASHW_STOP; return ::FlashWindowEx(&fi); } // Class long properties DWORD GetClassLong(int nIndex) const { ATLASSERT(::IsWindow(m_hWnd)); return ::GetClassLong(m_hWnd, nIndex); } DWORD SetClassLong(int nIndex, LONG dwNewLong) { ATLASSERT(::IsWindow(m_hWnd)); return ::SetClassLong(m_hWnd, nIndex, dwNewLong); } ULONG_PTR GetClassLongPtr(int nIndex) const { ATLASSERT(::IsWindow(m_hWnd)); return ::GetClassLongPtr(m_hWnd, nIndex); } ULONG_PTR SetClassLongPtr(int nIndex, LONG_PTR dwNewLong) { ATLASSERT(::IsWindow(m_hWnd)); return ::SetClassLongPtr(m_hWnd, nIndex, dwNewLong); } // Layered windows BOOL SetLayeredWindowAttributes(COLORREF crlKey, BYTE byteAlpha, DWORD dwFlags) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0); return ::SetLayeredWindowAttributes(m_hWnd, crlKey, byteAlpha, dwFlags); } BOOL UpdateLayeredWindow(HDC hdcDst, LPPOINT pptDst, LPSIZE psize, HDC hdcSrc, LPPOINT pptSrc, COLORREF crlKey, BLENDFUNCTION* pblend, DWORD dwFlags) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0); return ::UpdateLayeredWindow(m_hWnd, hdcDst, pptDst, psize, hdcSrc, pptSrc, crlKey, pblend, dwFlags); } BOOL UpdateLayeredWindow(LPPOINT pptDst = NULL) { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0); return ::UpdateLayeredWindow(m_hWnd, NULL, pptDst, NULL, NULL, NULL, CLR_NONE, NULL, 0); } BOOL GetLayeredWindowAttributes(COLORREF* pcrlKey, BYTE* pbyteAlpha, DWORD* pdwFlags) const { ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT((GetExStyle() & WS_EX_LAYERED) != 0); return ::GetLayeredWindowAttributes(m_hWnd, pcrlKey, pbyteAlpha, pdwFlags); } // Mouse tracking BOOL StartTrackMouseLeave() { ATLASSERT(::IsWindow(m_hWnd)); TRACKMOUSEEVENT tme = {}; tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_LEAVE; tme.hwndTrack = m_hWnd; return ::TrackMouseEvent(&tme); } BOOL StartTrackMouse(DWORD dwFlags, DWORD dwHoverTime = HOVER_DEFAULT) { ATLASSERT(::IsWindow(m_hWnd)); TRACKMOUSEEVENT tme = {}; tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = dwFlags; tme.hwndTrack = m_hWnd; tme.dwHoverTime = dwHoverTime; return ::TrackMouseEvent(&tme); } BOOL CancelTrackMouse(DWORD dwType) { ATLASSERT(::IsWindow(m_hWnd)); TRACKMOUSEEVENT tme = {}; tme.cbSize = sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_CANCEL | dwType; tme.hwndTrack = m_hWnd; return ::TrackMouseEvent(&tme); } // CString support #ifdef __ATLSTR_H__ int GetWindowText(ATL::CString& strText) const { int nLength = GetWindowTextLength(); LPTSTR pszText = strText.GetBuffer(nLength + 1); nLength = ::GetWindowText(m_hWnd, pszText, nLength + 1); strText.ReleaseBuffer(nLength); return nLength; } UINT GetDlgItemText(int nID, ATL::CString& strText) const { ATLASSERT(::IsWindow(m_hWnd)); HWND hItem = GetDlgItem(nID); if(hItem != NULL) { int nLength = ::GetWindowTextLength(hItem); LPTSTR pszText = strText.GetBuffer(nLength + 1); nLength = ::GetWindowText(hItem, pszText, nLength + 1); strText.ReleaseBuffer(nLength); return nLength; } else { strText.Empty(); return 0; } } #endif // __ATLSTR_H__ // Dialog window only UINT DlgGetDefID() const { ATLASSERT(::IsWindow(m_hWnd)); LRESULT lRet = ::SendMessage(m_hWnd, DM_GETDEFID, 0, 0L); UINT uID = 0U; if(HIWORD(lRet) == DC_HASDEFID) uID = LOWORD(lRet); return uID; } void DlgSetDefID(UINT uID) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, DM_SETDEFID, uID, 0L); } void DlgReposition() { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, DM_REPOSITION, 0, 0L); } }; } // namespace WTL #endif // __ATLWINX_H__ ================================================ FILE: third_party/WTL/MS-PL.txt ================================================ Microsoft Public License (MS-PL) This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 1. Definitions The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. A "contribution" is the original software, or any additions or changes to the software. A "contributor" is any person that distributes its contribution under this license. "Licensed patents" are a contributor's patent claims that read directly on its contribution. 2. Grant of Rights (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 3. Conditions and Limitations (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. ================================================ FILE: third_party/ced/.gitignore ================================================ CMakeCache.txt CMakeFiles Makefile bin cmake_install.cmake gtest lib ================================================ FILE: third_party/ced/CMakeLists.txt ================================================ # Copyright 2016 Google Inc. All Rights Reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. # Old enough to support Ubuntu Precise. cmake_minimum_required(VERSION 2.8.7) if (WIN32) if (NOT EXISTS "compact_enc_det/compact_enc_det.h") message(FATAL_ERROR "\nCould not find source code. Make sure you are running this script from the root of the distribution tree.") endif() if (NOT EXISTS "gtest") message(STATUS "Google Test not present. Fetching from the web...") file(DOWNLOAD "https://github.com/google/googletest/archive/master.zip" ${CMAKE_SOURCE_DIR}/master.zip) execute_process(COMMAND ${CMAKE_COMMAND} -E tar x master.zip) file(REMOVE master.zip) file(RENAME googletest-master gtest) endif() # Configure gtest. execute_process(COMMAND ${CMAKE_COMMAND} . WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/gtest) endif() project(CED CXX) set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings") option(BUILD_SHARED_LIBS "Build shared libraries" OFF) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-narrowing") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-c++11-narrowing") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if (NOT BUILD_SHARED_LIBS) foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) if(${flag_var} MATCHES "/MD") string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") endif(${flag_var} MATCHES "/MD") endforeach(flag_var) endif() endif() set(EXTRA_TARGET_LINK_LIBRARIES) if(WIN32) add_definitions(-DUNICODE -D_UNICODE -DSTRICT -DNOMINMAX) set(THREADING threadwin) else() set(THREADING thread) list(APPEND EXTRA_TARGET_LINK_LIBRARIES -pthread) endif() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CED_LIBRARY_SOURCES compact_enc_det/compact_enc_det.cc compact_enc_det/compact_enc_det_hint_code.cc util/encodings/encodings.cc util/languages/languages.cc ) add_library(ced ${CED_LIBRARY_SOURCES}) target_include_directories(ced PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) # Uncomment to put CED into WHATWG-compliant mode. #add_definitions(-DHTML5_MODE) set(GTEST_INCLUDE_DIR "gtest/googletest/include") set(GTEST_LIB_DIR "${CMAKE_SOURCE_DIR}/gtest/lib") set(CED_UNITTEST_SOURCES compact_enc_det/compact_enc_det_unittest.cc compact_enc_det/compact_enc_det_fuzz_test.cc compact_enc_det/detail_head_string.inc util/encodings/encodings_unittest.cc ) add_executable(ced_unittest ${CED_UNITTEST_SOURCES}) include_directories(${CMAKE_SOURCE_DIR}/${GTEST_INCLUDE_DIR}) if (WIN32) set(GTEST_LIB_DIR_DBG "${GTEST_LIB_DIR}/Debug") set(GTEST_LIB_DIR_REL "${GTEST_LIB_DIR}/Release") target_link_libraries(ced_unittest ced debug ${GTEST_LIB_DIR_DBG}/gtest.lib optimized ${GTEST_LIB_DIR_REL}/gtest.lib debug ${GTEST_LIB_DIR_DBG}/gtest_main.lib optimized ${GTEST_LIB_DIR_REL}/gtest_main.lib ${EXTRA_TARGET_LINK_LIBRARIES}) message("\nConfiguration completed. Open the created projects with Visual Studio to build the packages.\n") else() target_link_libraries(ced_unittest ced ${GTEST_LIB_DIR}/libgtest.a ${GTEST_LIB_DIR}/libgtest_main.a ${EXTRA_TARGET_LINK_LIBRARIES} ) endif() ================================================ FILE: third_party/ced/LICENSE ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: third_party/ced/README.md ================================================ ### Introduction Compact Encoding Detection(CED for short) is a library written in C++ that scans given raw bytes and detect the most likely text encoding. Basic usage: ``` #include "compact_enc_det/compact_enc_det.h" const char* text = "Input text"; bool is_reliable; int bytes_consumed; Encoding encoding = CompactEncDet::DetectEncoding( text, strlen(text), nullptr, nullptr, nullptr, UNKNOWN_ENCODING, UNKNOWN_LANGUAGE, CompactEncDet::WEB_CORPUS, false, &bytes_consumed, &is_reliable); ``` ### How to build You need [CMake](https://cmake.org/) to build the package. After unzipping the source code , run `autogen.sh` to build everything automatically. The script also downloads [Google Test](https://github.com/google/googletest) framework needed to build the unittest. ``` $ cd compact_enc_det $ ./autogen.sh ... $ bin/ced_unittest ``` On Windows, run `cmake .` to download the test framework, and generate project files for Visual Studio. ``` D:\packages\compact_enc_det> cmake . ``` ================================================ FILE: third_party/ced/autogen.sh ================================================ #!/bin/bash # # Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ################################################################################ # Run this script to generate the configure script and other files that will # be included in the distribution. These files are not checked in because they # are automatically generated. set -e gtest_release='release-1.12.1' if [ ! -z "$@" ]; then for argument in "$@"; do case $argument in # make curl silent "-s") curlopts="-s" ;; esac done fi # Check that we're being run from the right directory. if test ! -f compact_enc_det/compact_enc_det.h; then cat >&2 << __EOF__ Could not find source code. Make sure you are running this script from the root of the distribution tree. __EOF__ exit 1 fi # Check that gtest is present. It is used to build unit test suite. if test ! -e gtest; then if test -z $(which curl); then echo "curl cannot be found. Please install it to build the package." exit 1 fi echo "Google Test not present. Fetching from the web..." curl $curlopts -L -o main.zip https://codeload.github.com/google/googletest/zip/$gtest_release unzip -q main.zip rm main.zip mv googletest-$gtest_release gtest fi if test -z $(which cmake); then echo "CMake cannot be found. Please install it to build the package." exit 1 fi # Build gtest (cd gtest && cmake . && make) # Build the main package cmake . && make set -ex exit 0 ================================================ FILE: third_party/ced/compact_enc_det/compact_enc_det.cc ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #include "compact_enc_det/compact_enc_det.h" #include // for sqrt #include // for size_t #include // for printf, fprintf, NULL, etc #include // for qsort #include // for memset, memcpy, memcmp, etc #include #include // for string, operator==, etc #include "compact_enc_det/compact_enc_det_hint_code.h" #include "util/string_util.h" #include "util/basictypes.h" #include "util/commandlineflags.h" #include "util/logging.h" using std::string; // TODO as of 2007.10.09: // // Consider font=TT-BHxxx as user-defined => binary // Demote GB18030 if no 8x3x pair // Map byte2 ascii punct to 0x60, digits to 0x7e, gets them into hires // Consider removing/ignoring bytes 01-1F to avoid crap pollution // Possibly boost declared encoding in robust scan // googlebot tiny files // look for ranges of encodings // consider tags just as > < within aligned block of 32 // flag too few characters in postproc (Latin 6 problem) // Remove slow scan beyond 16KB // Consider removing kMostLikelyEncoding or cut it in half // A note on mixed encodings // // The most common encoding error on the web is a page containing a mixture of // CP-1252 and UTF-8. A less common encoding error is a third-party feed that // has been converted from CP-1252 to UTF-8 and then those bytes converted a // second time to UTF-8. CED originally attempted to detect these error cases // by using two synthetic encodings, UTF8CP1252 and UTF8UTF8. The intended // implementation was to start these just below CP1252 and UTF8 respectively in // overall liklihood, and allow 1252 and UTF8 to fall behind if mixtures are // found. // // The UTF8UTF8 encoding is a possible outcome from CED, but unfortunately the // UTF8CP1252 internal encoding was added late and not put into encodings.proto, // so at the final step it is mapped to UTF8UTF8 also. This was a bad idea and // is removed in this November 2011 CL. // // Mixed encoding detection never worked out as well as envisioned, so the // ced_allow_utf8utf8 flag normally disables all this. // // The effect is that CP-1252 and UTF-8 mixtures will usually be detected as // UTF8, and the inputconverter code for UTF8 normally will convert bare // CP-1252 bytes to UTF-8, instead of the less-helpful FFFD substitution. UTF-8 // and double-UTF-8 mixtures will be detected as UTF-8, and the double // conversion will stand. // // However, it is occasionally useful to use CED to detect double-converted // UTF-8 coming from third-party data feeds, so they can be fixed at the source. // For this purpose, the UTF8UTF8 encoding remains available under the // ced_allow_utf8utf8 flag. // // When UTF8UTF8 is detected, the inputconverter code will undo the double // conversion, giving good text. // Norbert Runge has noted these words in CP1252 that are mistakenly identified // as UTF-8 because of the last pair of characters: // NESTLÉ® 0xC9 0xAE U+00C9 U+00AE C9AE = U+026E;SMALL LEZH // drauß\u2019 0xDF 0x92 U+00DF U+2019 DF92 = U+07D2;NKO LETTER N // Mutterschoß\u201c 0xDF 0x93 U+00DF U+201C DF93 = U+07D3;NKO LETTER BA // Schoß\u201c 0xDF 0x93 U+00DF U+201C // weiß\u201c 0xDF 0x93 U+00DF U+00AB // Schnellfuß\u201c 0xDF 0x93 U+00DF U+201C // süß« 0xDF 0xAB U+00DF U+00AB DFAB = U+07EB;NKO HIGH TONE // These four byte combinations now explicitly boost Latin1/CP1252. // And for reference, here are a couple of Portuguese spellings // that may be mistaken as double-byte encodings. // informações 0xE7 0xF5 // traição 0xE7 0xE3 static const char* kVersion = "2.2"; DEFINE_bool(ced_allow_utf8utf8, false, "Allow the UTF8UTF8 encoding, " "to handle mixtures of CP1252 " "converted to UTF-8 zero, one, " "or two times"); DEFINE_int32(enc_detect_slow_max_kb, 16, "Maximum number of Kbytes to examine for " "7-bit-only (2022, Hz, UTF7) encoding detect. " "You are unlikely to want to change this."); DEFINE_int32(enc_detect_fast_max_kb, 256, "Maximum number of Kbytes to examine for encoding detect. " "You are unlikely to want to change this."); DEFINE_int32(ced_reliable_difference, 300, "30 * Bits of minimum probablility " "difference 1st - 2nd to be considered reliable \n" " 2 corresponds to min 4x difference\n" " 4 corresponds to min 16x difference\n" " 8 corresponds to min 256x difference\n" " 10 corresponds to min 1024x difference\n" " 20 corresponds to min 1Mx difference."); // Text debug output options DEFINE_bool(enc_detect_summary, false, "Print first 16 interesting pairs at exit."); DEFINE_bool(counts, false, "Count major-section usage"); // PostScript debug output options DEFINE_bool(enc_detect_detail, false, "Print PostScript of every update, to stderr."); DEFINE_bool(enc_detect_detail2, false, "More PostScript detail of every update, to stderr."); DEFINE_bool(enc_detect_source, false, "Include source text in detail"); // Encoding name must exactly match FIRST column of kI18NInfoByEncoding in // lang_enc.cc // Following flags are not in use. Replace them with constants to // avoid static initialization. //DEFINE_string(enc_detect_watch1, "", "Do detail2 about this encoding name."); //DEFINE_string(enc_detect_watch2, "", "Do detail2 about this encoding name."); static const char* const FLAGS_enc_detect_watch1 = ""; static const char* const FLAGS_enc_detect_watch2 = ""; // Only for experiments. Delete soon. DEFINE_bool(force127, false, "Force Latin1, Latin2, Latin7 based on trigrams"); // Demo-mode/debugging experiment DEFINE_bool(demo_nodefault, false, "Default to all equal; no boost for declared encoding."); DEFINE_bool(dirtsimple, false, "Just scan and count for all encodings"); DEFINE_bool(ced_echo_input, false, "Echo ced input to stderr"); static const int XDECILOG2 = 3; // Multiplier for log base 2 ** n/10 static const int XLOG2 = 30; // Multiplier for log base 2 ** n static const int kFinalPruneDifference = 10 * XLOG2; // Final bits of minimum // probability difference 1st-nth // to be pruned static const int kInititalPruneDifference = kFinalPruneDifference * 4; // Initial bits of minimum // probability difference 1st-nth // to be pruned // static const int kPruneDiffDecrement = kFinalPruneDifference; // Decrements bits of minimum // probability difference 1st-nth // to be pruned static const int kSmallInitDiff = 2 * XLOG2; // bits of minimum // probability difference, base to // superset encodings static const int kBoostInitial = 20 * XLOG2; // bits of boost for // initial byte patterns (BOM, 00) static const int kBadPairWhack = 20 * XLOG2; // bits of whack for // one bad pair static const int kBoostOnePair = 20 * XLOG2; // bits of boost for // one good pair in Hz, etc. static const int kGentleOnePair = 4 * XLOG2; // bits of boost for // one good sequence // static const int kGentlePairWhack = 2 * XLOG2; // bits of whack // for ill-formed sequence static const int kGentlePairBoost = 2 * XLOG2; // bits of boost // for well-formed sequence static const int kDeclaredEncBoost = 5 * XDECILOG2; // bits/10 of boost for // best declared encoding per bigram static const int kBestEncBoost = 5 * XDECILOG2; // bits/10 of boost for // best encoding per bigram static const int kTrigramBoost = 2 * XLOG2; // bits of boost for Latin127 tri static const int kMaxPairs = 48; // Max interesting pairs to look at // If you change this, // adjust *PruneDiff* static const int kPruneMask = 0x07; // Prune every 8 interesting pairs static const int kBestPairsCount = 16; // For first N pairs, do extra boost // based on most likely encoding // of pair over entire web static const int kDerateHintsBelow = 12; // If we have fewer than N bigrams, // weaken the hints enough that // unhinted encodings have a hope of // rising to the top static const int kMinRescanLength = 800; // Don't bother rescanning for // unreliable encoding if fewer // than this many bytes unscanned. // We will rescan at most last half // of this. static const int kStrongBinary = 12; // Make F_BINARY the only encoding static const int kWeakerBinary = 4; // Make F_BINARY likely encoding // These are byte counts from front of file static const int kBinaryHardAsciiLimit = 6 * 1024; // Not binary if all ASCII static const int kBinarySoftAsciiLimit = 8 * 1024; // " if mostly ASCII // We try here to avoid having title text dominate the encoding detection, // for the not-infrequent error case of title in encoding1, body in encoding2: // we want to bias toward encoding2 winning. // // kMaxBigramsTagTitleText should be a multiple of 2, 3, and 4, so that we // rarely cut off mid-character in the original (not-yet-detected) encoding. // This matters most for UTF-8 two- and three-byte codes and for // Shift-JIS three-byte codes. static const int kMaxBigramsTagTitleText = 12; // Keep only some tag text static const int kWeightshiftForTagTitleText = 4; // Give text in tags, etc. // 1/16 normal weight static const int kStrongPairs = 6; // Let reliable enc with this many // pairs overcome missing hint enum CEDInternalFlags { kCEDNone = 0, // The empty flag kCEDRescanning = 1, // Do not further recurse kCEDSlowscore = 2, // Do extra scoring kCEDForceTags = 4, // Always examine text inside tags }; // Forward declaration Encoding InternalDetectEncoding( CEDInternalFlags flags, const char* text, int text_length, const char* url_hint, const char* http_charset_hint, const char* meta_charset_hint, const int encoding_hint, const Language language_hint, // User interface lang const CompactEncDet::TextCorpusType corpus_type, bool ignore_7bit_mail_encodings, int* bytes_consumed, bool* is_reliable, Encoding* second_best_enc); typedef struct { const uint8* hires[4]; // Pointers to possible high-resolution bigram deltas uint8 x_bar; // Average byte2 value uint8 y_bar; // Average byte1 value uint8 x_stddev; // Standard deviation of byte2 value uint8 y_stddev; // Standard deviation of byte1 value int so; // Scaling offset -- add to probabilities below uint8 b1[256]; // Unigram probability for first byte of aligned bigram uint8 b2[256]; // Unigram probability for second byte of aligned bigram uint8 b12[256]; // Unigram probability for cross bytes of aligned bigram } UnigramEntry; //typedef struct { // uint8 b12[256*256]; // Bigram probability for aligned bigram //} FullBigramEntry; // Include all the postproc-generated tables here: // RankedEncoding // kMapToEncoding // unigram_table // kMostLIkelyEncoding // kTLDHintProbs // kCharsetHintProbs // HintEntry, kMaxTldKey kMaxTldVector, etc. // ============================================================================= #include "compact_enc_det/compact_enc_det_generated_tables.h" #define F_ASCII F_Latin1 // "ASCII" is a misnomer, so this code uses "Latin1" #define F_BINARY F_X_BINARYENC // We are mid-update for name change #define F_UTF8UTF8 F_X_UTF8UTF8 // We are mid-update for name change #define F_BIG5_CP950 F_BIG5 // We are mid-update for name change #define F_Unicode F_UTF_16LE // We are mid-update for name change // ============================================================================= // 7-bit encodings have at least one "interesting" byte value < 0x80 // (00 0E 1B + ~) // JIS 2022-cn 2022-kr hz utf7 // Unicode UTF-16 UTF-32 // 8-bit encodings have no interesting byte values < 0x80 static const uint32 kSevenBitActive = 0x00000001; // needs <80 to detect static const uint32 kUTF7Active = 0x00000002; // <80 and + static const uint32 kHzActive = 0x00000004; // <80 and ~ static const uint32 kIso2022Active = 0x00000008; // <80 and 1B 0E 0F static const uint32 kUTF8Active = 0x00000010; static const uint32 kUTF8UTF8Active = 0x00000020; static const uint32 kUTF1632Active = 0x00000040; // <80 and 00 static const uint32 kBinaryActive = 0x00000080; // <80 and 00 static const uint32 kTwobyteCode = 0x00000100; // Needs 8xxx static const uint32 kIsIndicCode = 0x00000200; // static const uint32 kHighAlphaCode = 0x00000400; // full alphabet in 8x-Fx static const uint32 kHighAccentCode = 0x00000800; // accents in 8x-Fx static const uint32 kEUCJPActive = 0x00001000; // Have to mess with phase // Debug only. not thread safe static int encdet_used = 0; static int rescore_used = 0; static int rescan_used = 0; static int robust_used = 0; static int looking_used = 0; static int doing_used = 0; // For debugging only -- about 256B/entry times about 500 = 128KB // TODO: only allocate this if being used typedef struct { int offset; int best_enc; // Best ranked encoding for this bigram, or // -1 for overhead entries string label; int detail_enc_prob[NUM_RANKEDENCODING]; } DetailEntry; static int watch1_rankedenc = -1; // Debug. not threadsafe static int watch2_rankedenc = -1; // Debug. not threadsafe ////static int next_detail_entry = 0; // Debug. not threadsafe ////static DetailEntry details[kMaxPairs * 10]; // Allow 10 details per bigram // End For debugging only // Must match kTestPrintableAsciiTildePlus exit codes, minus one enum PairSet {AsciiPair = 0, OtherPair = 1, NUM_PAIR_SETS = 2}; // The reasons for pruning enum PruneReason {PRUNE_NORMAL, PRUNE_SLOWEND, PRUNE_FINAL}; static const char* kWhatSetName[] = {"Ascii", "Other"}; // State for encodings that do shift-out/shift-in between one- and two-byte // regions (ISO-2022-xx, HZ) enum StateSoSi {SOSI_NONE, SOSI_ERROR, SOSI_ONEBYTE, SOSI_TWOBYTE}; typedef struct { const uint8* initial_src; // For calculating byte offsets const uint8* limit_src; // Range of input source const uint8* prior_src; // Source consumed by prior call to BoostPrune const uint8* last_pair; // Last pair inserted into interesting_pairs DetailEntry* debug_data; // Normally NULL. Ptr to debug data for // FLAGS_enc_detect_detail PostScript data int next_detail_entry; // Debug bool done; bool reliable; bool hints_derated; int declared_enc_1; // From http/meta hint int declared_enc_2; // from http/meta hint int prune_count; // Number of times we have pruned int trigram_highwater_mark; // Byte offset of last trigram processing bool looking_for_latin_trigrams; // True if we should test for doing // Latin1/2/7 trigram processing bool do_latin_trigrams; // True if we actually are scoring trigrams // Miscellaneous state variables for difficult encodings int binary_quadrants_count; // Number of four bigram quadrants seen: // 0xxxxxxx0xxxxxxx 0xxxxxxx1xxxxxx // 1xxxxxxx0xxxxxxx 1xxxxxxx1xxxxxx int binary_8x4_count; // Number of 8x4 buckets seen: uint32 binary_quadrants_seen; // Bit[i] set if bigram i.......i....... seen uint32 binary_8x4_seen; // Bit[i] set if bigram iii.....ii...... seen int utf7_starts; // Count of possible UTF-7 beginnings seen int prior_utf7_offset; // Source consumed by prior UTF-7 string int next_utf8_ministate; // Mini state for UTF-8 sequences int utf8_minicount[6]; // Number of correct 2- 3- 4-byte seq, errors int next_utf8utf8_ministate; // Mini state for UTF8UTF8 sequences int utf8utf8_odd_byte; // UTF8UTF8 seq has odd number of bytes int utf8utf8_minicount[6]; // Number of correct 2- 3- 4-byte seq, errors StateSoSi next_2022_state; // Mini state for 2022 sequences StateSoSi next_hz_state; // Mini state for HZ sequences bool next_eucjp_oddphase; // Mini state for EUC-JP sequences int byte32_count[8]; // Count of top 3 bits of byte1 of bigram // 0x1x 2x3x 4x5x 6x7x 8x9x AxBx CxDx ExFx uint32 active_special; // Bits showing which special cases are active Encoding tld_hint; // Top TLD encoding or UNKNOWN Encoding http_hint; // What the document says about itself or Encoding meta_hint; // UNKNOWN_ENCODING. BOM is initial byte Encoding bom_hint; // order mark for UTF-xx // small cache of previous interesting bigrams int next_prior_bigram; int prior_bigram[4]; int prior_binary[1]; int top_rankedencoding; // Top two probabilities and families int second_top_rankedencoding; int top_prob; int second_top_prob; int prune_difference; // Prune things this much below the top prob int rankedencoding_list_len; // Number of active encodings int rankedencoding_list[NUM_RANKEDENCODING]; // List of active encodings // int enc_prob[NUM_RANKEDENCODING]; // Cumulative probability per enc // This is where all the action is int hint_prob[NUM_RANKEDENCODING]; // Initial hint probabilities int hint_weight[NUM_RANKEDENCODING]; // Number of hints for this enc // Two sets -- one for printable ASCII, one for the rest int prior_interesting_pair[NUM_PAIR_SETS]; // Pairs consumed by prior call int next_interesting_pair[NUM_PAIR_SETS]; // Next pair to write char interesting_pairs[NUM_PAIR_SETS][kMaxPairs * 2]; // Two bytes per pair int interesting_offsets[NUM_PAIR_SETS][kMaxPairs]; // Src offset of pair int interesting_weightshift[NUM_PAIR_SETS][kMaxPairs]; // weightshift of pair } DetectEncodingState; // Record a debug event that changes probabilities void SetDetailsEncProb(DetectEncodingState* destatep, int offset, int best_enc, const char* label) { int next = destatep->next_detail_entry; destatep->debug_data[next].offset = offset; destatep->debug_data[next].best_enc = best_enc; destatep->debug_data[next].label = label; memcpy(&destatep->debug_data[next].detail_enc_prob, &destatep->enc_prob, sizeof(destatep->enc_prob)); ++destatep->next_detail_entry; } // Record a debug event that changes probabilities, copy offset void SetDetailsEncProbCopyOffset(DetectEncodingState* destatep, int best_enc, const char* label) { int next = destatep->next_detail_entry; destatep->debug_data[next].offset = destatep->debug_data[next - 1].offset; destatep->debug_data[next].best_enc = best_enc; destatep->debug_data[next].label = label; memcpy(&destatep->debug_data[next].detail_enc_prob, &destatep->enc_prob, sizeof(destatep->enc_prob)); ++destatep->next_detail_entry; } // Record a debug event that changes probs and has simple text label void SetDetailsEncLabel(DetectEncodingState* destatep, const char* label) { int next = destatep->next_detail_entry; destatep->debug_data[next].offset = destatep->debug_data[next - 1].offset; destatep->debug_data[next].best_enc = -1; destatep->debug_data[next].label = label; memcpy(&destatep->debug_data[next].detail_enc_prob, &destatep->enc_prob, sizeof(destatep->enc_prob)); ++destatep->next_detail_entry; } // Record a debug event that is just a text label, no change in probs void SetDetailsLabel(DetectEncodingState* destatep, const char* label) { int next = destatep->next_detail_entry; destatep->debug_data[next].offset = destatep->debug_data[next - 1].offset; destatep->debug_data[next].best_enc = -1; destatep->debug_data[next].label = label; memcpy(&destatep->debug_data[next].detail_enc_prob, &destatep->debug_data[next - 1].detail_enc_prob, sizeof(destatep->enc_prob)); ++destatep->next_detail_entry; } // Maps superset encodings to base, to see if 2 encodings are compatible // (Non-identity mappings are marked "-->" below.) static const Encoding kMapEncToBaseEncoding[] = { ISO_8859_1, // 0: Teragram ASCII ISO_8859_2, // 1: Teragram Latin2 ISO_8859_3, // 2: in BasisTech but not in Teragram ISO_8859_4, // 3: Teragram Latin4 ISO_8859_5, // 4: Teragram ISO-8859-5 ISO_8859_6, // 5: Teragram Arabic ISO_8859_7, // 6: Teragram Greek MSFT_CP1255, // 7: Teragram Hebrew --> 36 ISO_8859_9, // 8: in BasisTech but not in Teragram ISO_8859_10, // 9: in BasisTech but not in Teragram JAPANESE_EUC_JP, // 10: Teragram EUC_JP JAPANESE_SHIFT_JIS, // 11: Teragram SJS JAPANESE_JIS, // 12: Teragram JIS CHINESE_BIG5, // 13: Teragram BIG5 CHINESE_GB, // 14: Teragram GB CHINESE_EUC_CN, // 15: Teragram EUC-CN KOREAN_EUC_KR, // 16: Teragram KSC UNICODE, // 17: Teragram Unicode CHINESE_EUC_CN, // 18: Teragram EUC --> 15 CHINESE_EUC_CN, // 19: Teragram CNS --> 15 CHINESE_BIG5, // 20: Teragram BIG5_CP950 --> 13 JAPANESE_SHIFT_JIS, // 21: Teragram CP932 --> 11 UTF8, // 22 UNKNOWN_ENCODING, // 23 ISO_8859_1, // 24: ISO_8859_1 with all characters <= 127 --> 0 RUSSIAN_KOI8_R, // 25: Teragram KOI8R RUSSIAN_CP1251, // 26: Teragram CP1251 ISO_8859_1, // 27: CP1252 aka MSFT euro ascii --> 0 RUSSIAN_KOI8_RU, // 28: CP21866 aka KOI8_RU, used for Ukrainian MSFT_CP1250, // 29: CP1250 aka MSFT eastern european ISO_8859_1, // 30: aka ISO_8859_0 aka ISO_8859_1 euroized --> 0 ISO_8859_9, // 31: used for Turkish ISO_8859_13, // 32: used in Baltic countries --> 43 ISO_8859_11, // 33: aka TIS-620, used for Thai ISO_8859_11, // 34: used for Thai --> 33 MSFT_CP1256, // 35: used for Arabic MSFT_CP1255, // 36: Logical Hebrew Microsoft MSFT_CP1255, // 37: Iso Hebrew Logical --> 36 MSFT_CP1255, // 38: Iso Hebrew Visual --> 36 CZECH_CP852, // 39 ISO_8859_2, // 40: aka ISO_IR_139 aka KOI8_CS --> 1 MSFT_CP1253, // 41: used for Greek, but NOT a superset of 8859-7 RUSSIAN_CP866, // 42 ISO_8859_13, // 43 ISO_2022_KR, // 44 CHINESE_GB, // 45 GBK --> 14 CHINESE_GB, // 46 GB18030 --> 14 CHINESE_BIG5, // 47 BIG5_HKSCS --> 13 ISO_2022_KR, // 48 ISO_2022_CN --> 44 TSCII, // 49 Indic encoding TAMIL_MONO, // 50 Indic encoding - Tamil TAMIL_BI, // 51 Indic encoding - Tamil JAGRAN, // 52 Indic encoding - Devanagari MACINTOSH_ROMAN, // 53 UTF7, // 54 BHASKAR, // 55 Indic encoding - Devanagari HTCHANAKYA, // 56 Indic encoding - Devanagari UTF16BE, // 57 UTF16LE, // 58 UTF32BE, // 59 UTF32LE, // 60 BINARYENC, // 61 HZ_GB_2312, // 62 UTF8UTF8, // 63 TAM_ELANGO, // 64 Elango - Tamil TAM_LTTMBARANI, // 65 Barani - Tamil TAM_SHREE, // 66 Shree - Tamil TAM_TBOOMIS, // 67 TBoomis - Tamil TAM_TMNEWS, // 68 TMNews - Tamil TAM_WEBTAMIL, // 69 Webtamil - Tamil KDDI_SHIFT_JIS, // 70 KDDI Shift_JIS DOCOMO_SHIFT_JIS, // 71 DoCoMo Shift_JIS SOFTBANK_SHIFT_JIS, // 72 SoftBank Shift_JIS KDDI_ISO_2022_JP, // 73 KDDI ISO-2022-JP SOFTBANK_ISO_2022_JP, // 74 SOFTBANK ISO-2022-JP }; COMPILE_ASSERT(arraysize(kMapEncToBaseEncoding) == NUM_ENCODINGS, kMapEncToBaseEncoding_has_incorrect_size); // Maps base encodings to 0, supersets to 1+, undesired to -1 // (Non-identity mappings are marked "-->" below.) static const int kMapEncToSuperLevel[] = { 0, // 0: Teragram ASCII 0, // 1: Teragram Latin2 0, // 2: in BasisTech but not in Teragram 0, // 3: Teragram Latin4 0, // 4: Teragram ISO-8859-5 0, // 5: Teragram Arabic 0, // 6: Teragram Greek 0, // 7: Teragram Hebrew 0, // 8: in BasisTech but not in Teragram 0, // 9: in BasisTech but not in Teragram 0, // 10: Teragram EUC_JP 0, // 11: Teragram SJS 0, // 12: Teragram JIS 0, // 13: Teragram BIG5 0, // 14: Teragram GB 0, // 15: Teragram EUC-CN 0, // 16: Teragram KSC 0, // 17: Teragram Unicode -1, // 18: Teragram EUC --> 15 -1, // 19: Teragram CNS --> 15 1, // 20: Teragram BIG5_CP950 --> 13 1, // 21: Teragram CP932 --> 11 0, // 22 -1, // 23 -1, // 24: ISO_8859_1 with all characters <= 127 --> 0 0, // 25: Teragram KOI8R 0, // 26: Teragram CP1251 1, // 27: CP1252 aka MSFT euro ascii --> 0 0, // 28: CP21866 aka KOI8_RU, used for Ukrainian 0, // 29: CP1250 aka MSFT eastern european 1, // 30: aka ISO_8859_0 aka ISO_8859_1 euroized --> 0 0, // 31: used for Turkish 1, // 32: used in Baltic countries --> 43 0, // 33: aka TIS-620, used for Thai 1, // 34: used for Thai --> 33 0, // 35: used for Arabic 0, // 36: Logical Hebrew Microsoft -1, // 37: Iso Hebrew Logical --> 36 -1, // 38: Iso Hebrew Visual --> 7 0, // 39 1, // 40: aka ISO_IR_139 aka KOI8_CS --> 1 0, // 41: used for Greek, NOT superset of 8859-7 0, // 42 0, // 43 0, // 44 1, // 45 GBK --> 14 1, // 46 GB18030 --> 14 1, // 47 BIG5_HKSCS --> 13 1, // 48 ISO_2022_CN --> 44 0, // 49 Indic encoding 0, // 50 Indic encoding - Tamil 0, // 51 Indic encoding - Tamil 0, // 52 Indic encoding - Devanagari 0, // 53 0, // 54 0, // 55 Indic encoding - Devanagari 0, // 56 Indic encoding - Devanagari 0, // 57 0, // 58 0, // 59 0, // 60 0, // 61 0, // 62 2, // 63 0, 0, 0, 0, 0, 0, // add six more Tamil 0, 0, 0, 0, 0, // add five encodings with emoji }; COMPILE_ASSERT(arraysize(kMapEncToSuperLevel) == NUM_ENCODINGS, kMapEncToSuperLevel_has_incorrect_size); // Subscripted by Encoding enum value static const uint32 kSpecialMask[] = { kHighAccentCode, // 0 kHighAccentCode, kHighAccentCode, kHighAccentCode, kHighAlphaCode, // 4 kHighAlphaCode, kHighAlphaCode, kHighAlphaCode, kHighAccentCode, kHighAccentCode, kTwobyteCode + kEUCJPActive, // 10 euc-jp kTwobyteCode, kSevenBitActive + kIso2022Active, // jis kTwobyteCode, kTwobyteCode, kTwobyteCode, kTwobyteCode, kSevenBitActive + kUTF1632Active, // Unicode kTwobyteCode, kTwobyteCode, kTwobyteCode, // 20 kTwobyteCode, kUTF8Active, // UTF-8 0, 0, kHighAlphaCode, // 25 kHighAlphaCode, kHighAccentCode, kHighAlphaCode, kHighAccentCode, kHighAccentCode, // 30 kHighAccentCode, kHighAccentCode, kHighAlphaCode, kHighAlphaCode, kHighAlphaCode, // 35 kHighAlphaCode, kHighAlphaCode, kHighAlphaCode, 0, 0, // 40 kHighAlphaCode, kHighAlphaCode, kHighAccentCode, kSevenBitActive + kIso2022Active, // 2022-kr kTwobyteCode, kTwobyteCode, kTwobyteCode, kSevenBitActive + kIso2022Active, // 2022-cn kHighAlphaCode + kIsIndicCode, // 49 TSCII kHighAlphaCode + kIsIndicCode, // 50 TAMIL_MONO kHighAlphaCode + kIsIndicCode, // 51 TAMIL_BI kHighAlphaCode + kIsIndicCode, // 52 JAGRAN kHighAccentCode, // 53 MACINTOSH_ROMAN kSevenBitActive + kUTF7Active, // 54 UTF-7 kHighAlphaCode + kIsIndicCode, // 55 BHASKAR Indic encoding - Devanagari kHighAlphaCode + kIsIndicCode, // 56 HTCHANAKYA Indic encoding - Devanagari kSevenBitActive + kUTF1632Active, // 57 UTF16BE kSevenBitActive + kUTF1632Active, // 58 UTF16LE kSevenBitActive + kUTF1632Active, // 59 UTF32BE kSevenBitActive + kUTF1632Active, // 60 UTF32LE kSevenBitActive + kBinaryActive, // 61 BINARYENC kSevenBitActive + kHzActive, // 62 HZ_GB_2312 kHighAccentCode + kUTF8Active + kUTF8UTF8Active, // 63 UTF8UTF8 kHighAlphaCode + kIsIndicCode, // 64 Elango - Tamil kHighAlphaCode + kIsIndicCode, // 65 Barani - Tamil kHighAlphaCode + kIsIndicCode, // 66 Shree - Tamil kHighAlphaCode + kIsIndicCode, // 67 TBoomis - Tamil kHighAlphaCode + kIsIndicCode, // 68 TMNews - Tamil kHighAlphaCode + kIsIndicCode, // 69 Webtamil - Tamil kTwobyteCode, // 70 KDDI Shift_JIS kTwobyteCode, // 71 DoCoMo Shift_JIS kTwobyteCode, // 72 SoftBank Shift_JIS kSevenBitActive + kIso2022Active, // 73 KDDI-ISO-2022-JP kSevenBitActive + kIso2022Active, // 74 SOFTBANK-ISO-2022-JP }; COMPILE_ASSERT(arraysize(kSpecialMask) == NUM_ENCODINGS, kSpecialMask_has_incorrect_size); /*** kHighAlphaCode -- full alphabet in 8x-Fx range, not just accents ISO_8859_5, // 4: Teragram ISO-8859-5 Cyrl UL bd RUSSIAN_CP1251, // 26: Teragram CP1251 UL cdef RUSSIAN_KOI8_R, // 25: Teragram KOI8R LU cdef RUSSIAN_KOI8_RU, // 28: CP21866 aka KOI8_RU, LU cdef RUSSIAN_CP866, // 42 89ae ISO_8859_6, // 5: Teragram Arabic nocase cde MSFT_CP1256, // 35: used for Arabic nocase cde ISO_8859_7, // 6: Teragram Greek UL cdef MSFT_CP1253, // 41: used for Greek UL cdef ISO_8859_8, // 7: Teragram Hebrew nocase ef MSFT_CP1255, // 36: Logical Hebrew Microsoft nocase ef ISO_8859_8_I, // 37: Iso Hebrew Logical nocase ef HEBREW_VISUAL, // 38: Iso Hebrew Visual nocase ef ISO_8859_11, // 33: aka TIS-620, used for Thai nocase abcde MSFT_CP874, // 34: used for Thai nocase abcde TSCII, // 49 8-f TAMIL_MONO, // 50 TAMIL_BI, // 51 JAGRAN, // 52 BHASKAR, // 55 Indic encoding - Devanagari HTCHANAKYA, // 56 Indic encoding - Devanagari ***/ // We can scan bytes using this at about 500 MB/sec 2.8GHz P4 // Slow scan uses this, stopping on NUL ESC SO SI bad C0 and + ~ // We allow FF, 0x0C, here because it gives a better result for old // Ascii text formatted for a TTY // non-zero exits scan loop -- 1 for printable ASCII, 2 otherwise static const char kTestPrintableAsciiTildePlus[256] = { 2,2,2,2,2,2,2,2, 2,0,0,2,0,0,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,1,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, }; // We can scan bytes using this at about 550 MB/sec 2.8GHz P4 // Slow scan uses this, stopping on NUL ESC SO SI and bad C0 // after Hz and UTF7 are pruned away // We allow Form Feed, 0x0C, here static const char kTestPrintableAscii[256] = { 2,2,2,2,2,2,2,2, 2,0,0,2,0,0,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, }; // Used in first-four-byte testing static const char kIsPrintableAscii[256] = { 0,0,0,0,0,0,0,0, 0,1,1,0,0,1,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }; static const signed char kBase64Value[256] = { -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,62,-1,-1,-1,63, 52,53,54,55,56,57,58,59, 60,61,-1,-1,-1,-1,-1,-1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, 15,16,17,18,19,20,21,22, 23,24,25,-1,-1,-1,-1,-1, -1,26,27,28,29,30,31,32, 33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48, 49,50,51,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1, }; // Subscripted by // Accepts Cx->8x Dx->8x Ex->8x->8x Fx->8x->8x->8x // // Fixed Problem: GB has sequences like B2DB B8D6 BDE1 B9B9 // which we can mis-parse as an error byte followed by good UTF-8: // B2 DBB8 D6BD E1B9B9 // To counteract this, we now require an ASCII7 byte to resync out // of the error state // Next problem: good UTF-8 with bad byte // efbc a012 eea4 bee7 b280 c2b7 // efbca0 12 eea4be e7b280 c2b7 // ^^ bad byte // fix: change state0 byte 1x to be don't-care // // Short UTF-8 ending in ASCII7 byte should resync immediately: // E0 20 E0 A6 AA should give one error and resync at 2nd E0 // static const char kMiniUTF8State[8][16] = { {0,0,0,0,0,0,0,0, 7,7,7,7,1,1,2,4,}, // [0] start char (allow cr/lf/ht) {0,7,0,0,0,0,0,0, 0,0,0,0,7,7,7,7,}, // [1] continue 1 of 2 {0,7,0,0,0,0,0,0, 3,3,3,3,7,7,7,7,}, // [2] continue 1 of 3 {0,7,0,0,0,0,0,0, 0,0,0,0,7,7,7,7,}, // [3] continue 2 of 3 {0,7,0,0,0,0,0,0, 5,5,5,5,7,7,7,7,}, // [4] continue 1 of 4 {0,7,0,0,0,0,0,0, 6,6,6,6,7,7,7,7,}, // [5] continue 2 of 4 {0,7,0,0,0,0,0,0, 0,0,0,0,7,7,7,7,}, // [6] continue 3 of 4 {0,7,0,0,0,0,0,0, 7,7,7,7,7,7,7,7,}, // [7] error, soak up continues, // ONLY resync after Ascii char // then restart }; // Counter to increment: 0-don'tcare 1-error 2-good_2B 3-good_3B 4-good_4B static const char kMiniUTF8Count[8][16] = { {0,0,0,0,0,0,0,0, 1,1,1,1,0,0,0,0,}, // [0] start char (allow cr/lf/ht) {1,1,1,1,1,1,1,1, 2,2,2,2,1,1,1,1,}, // [1] continue 1 of 2 {1,1,1,1,1,1,1,1, 0,0,0,0,1,1,1,1,}, // [2] continue 1 of 3 {1,1,1,1,1,1,1,1, 3,3,3,3,1,1,1,1,}, // [3] continue 2 of 3 {1,1,1,1,1,1,1,1, 0,0,0,0,1,1,1,1,}, // [4] continue 1 of 4 {1,1,1,1,1,1,1,1, 0,0,0,0,1,1,1,1,}, // [5] continue 2 of 4 {1,1,1,1,1,1,1,1, 4,4,4,4,1,1,1,1,}, // [6] continue 3 of 4 {0,1,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,}, // [7] error, soak up continues, // then restart }; // Subscripted by // where f(x)= E2->4, Cx->8 and C3->12 and 0 otherwise // and g(x) = (x >> 4) & 3 8x->0 9x->1 Ax->2 Bx->3 Cx->0, etc. // (no checking for illegal bytes) // Here are example patterns of CP1252 converted to UTF-8 0/1/2 times. We want // to detect two, so we can back-convert to one. // zero one two pattern // ---- ------ ---------------- ----------------- // 81 C281 C382C281 C3->8x->C2->xx // 98 CB9C C38BC593 C3->8x->C5->xx // C3 C383 C383C692 C3->8x->C6->xx // C8 C388 C383CB86 C3->8x->CB->xx // 83 C692 C386E28099 C3->8x->E2->xx->8x // 80 E282AC C3A2E2809AC2AC C3->A2->E2->xx->xx->Cx->xx // 92 E28099 C3A2E282ACE284A2 C3->A2->E2->xx->xx->E2->xx->xx // // We also want to detect bare-byte extra UTF-8 conversions: // zero one two pattern // ---- ------ ---------------- ----------------- // C3 C3 C383 C3->8x->C2->xx // D3 D3 C393 C3->9x->C2->xx->C2->xx // E3 E3 C3A3 C3->Ax->C2->xx->C2->xx->C2->xx // F3 F3 C3B2 C3->Bx->C2->xx->C2->xx->C2->xx->C2->xx // /** CP1252 => UTF8 => UTF8UTF8 80 => E282AC => C3A2E2809AC2AC 81 => C281 => C382C281 82 => E2809A => C3A2E282ACC5A1 83 => C692 => C386E28099 84 => E2809E => C3A2E282ACC5BE 85 => E280A6 => C3A2E282ACC2A6 86 => E280A0 => C3A2E282ACC2A0 87 => E280A1 => C3A2E282ACC2A1 88 => CB86 => C38BE280A0 89 => E280B0 => C3A2E282ACC2B0 8A => C5A0 => C385C2A0 8B => E280B9 => C3A2E282ACC2B9 8C => C592 => C385E28099 8D => C28D => C382C28D 8E => C5BD => C385C2BD 8F => C28F => C382C28F 90 => C290 => C382C290 91 => E28098 => C3A2E282ACCB9C 92 => E28099 => C3A2E282ACE284A2 93 => E2809C => C3A2E282ACC593 94 => E2809D => C3A2E282ACC29D 95 => E280A2 => C3A2E282ACC2A2 96 => E28093 => C3A2E282ACE2809C 97 => E28094 => C3A2E282ACE2809D 98 => CB9C => C38BC593 99 => E284A2 => C3A2E2809EC2A2 9A => C5A1 => C385C2A1 9B => E280BA => C3A2E282ACC2BA 9C => C593 => C385E2809C 9D => C29D => C382C29D 9E => C5BE => C385C2BE 9F => C5B8 => C385C2B8 A0 => C2A0 => C382C2A0 A1 => C2A1 => C382C2A1 A2 => C2A2 => C382C2A2 A3 => C2A3 => C382C2A3 A4 => C2A4 => C382C2A4 A5 => C2A5 => C382C2A5 A6 => C2A6 => C382C2A6 A7 => C2A7 => C382C2A7 A8 => C2A8 => C382C2A8 A9 => C2A9 => C382C2A9 AA => C2AA => C382C2AA AB => C2AB => C382C2AB AC => C2AC => C382C2AC AD => C2AD => C382C2AD AE => C2AE => C382C2AE AF => C2AF => C382C2AF B0 => C2B0 => C382C2B0 B1 => C2B1 => C382C2B1 B2 => C2B2 => C382C2B2 B3 => C2B3 => C382C2B3 B4 => C2B4 => C382C2B4 B5 => C2B5 => C382C2B5 B6 => C2B6 => C382C2B6 B7 => C2B7 => C382C2B7 B8 => C2B8 => C382C2B8 B9 => C2B9 => C382C2B9 BA => C2BA => C382C2BA BB => C2BB => C382C2BB BC => C2BC => C382C2BC BD => C2BD => C382C2BD BE => C2BE => C382C2BE BF => C2BF => C382C2BF C0 => C380 => C383E282AC C1 => C381 => C383C281 C2 => C382 => C383E2809A C3 => C383 => C383C692 C4 => C384 => C383E2809E C5 => C385 => C383E280A6 C6 => C386 => C383E280A0 C7 => C387 => C383E280A1 C8 => C388 => C383CB86 C9 => C389 => C383E280B0 CA => C38A => C383C5A0 CB => C38B => C383E280B9 CC => C38C => C383C592 CD => C38D => C383C28D CE => C38E => C383C5BD CF => C38F => C383C28F D0 => C390 => C383C290 D1 => C391 => C383E28098 D2 => C392 => C383E28099 D3 => C393 => C383E2809C D4 => C394 => C383E2809D D5 => C395 => C383E280A2 D6 => C396 => C383E28093 D7 => C397 => C383E28094 D8 => C398 => C383CB9C D9 => C399 => C383E284A2 DA => C39A => C383C5A1 DB => C39B => C383E280BA DC => C39C => C383C593 DD => C39D => C383C29D DE => C39E => C383C5BE DF => C39F => C383C5B8 E0 => C3A0 => C383C2A0 E1 => C3A1 => C383C2A1 E2 => C3A2 => C383C2A2 E3 => C3A3 => C383C2A3 E4 => C3A4 => C383C2A4 E5 => C3A5 => C383C2A5 E6 => C3A6 => C383C2A6 E7 => C3A7 => C383C2A7 E8 => C3A8 => C383C2A8 E9 => C3A9 => C383C2A9 EA => C3AA => C383C2AA EB => C3AB => C383C2AB EC => C3AC => C383C2AC ED => C3AD => C383C2AD EE => C3AE => C383C2AE EF => C3AF => C383C2AF F0 => C3B0 => C383C2B0 F1 => C3B1 => C383C2B1 F2 => C3B2 => C383C2B2 F3 => C3B3 => C383C2B3 F4 => C3B4 => C383C2B4 F5 => C3B5 => C383C2B5 F6 => C3B6 => C383C2B6 F7 => C3B7 => C383C2B7 F8 => C3B8 => C383C2B8 F9 => C3B9 => C383C2B9 FA => C3BA => C383C2BA FB => C3BB => C383C2BB FC => C3BC => C383C2BC FD => C3BD => C383C2BD FE => C3BE => C383C2BE FF => C3BF => C383C2BF **/ // Subscripted by // where f(x)= E2->4, C2/5/6/B->8 and C3->12 and 0 otherwise // and g(x) = (x >> 4) & 3 8x->0 9x->1 Ax->2 Bx->3 Cx->0, etc. // 81 C281 C382C281 C3->8x->C2->xx // 98 CB9C C38BC593 C3->8x->C5->xx // C3 C383 C383C692 C3->8x->C6->xx // C8 C388 C383CB86 C3->8x->CB->xx // [0] [2] [0] // 83 C692 C386E28099 C3->8x->E2->xx->xx // odd_byte=0 [0] [2] [0+] odd_byte flipped // odd_byte=1 [0+] [2] [0] [0] odd_byte unflipped // 80 E282AC C3A2E2809AC2AC C3->A2->E2->xx->xx->Cx->xx // odd_byte=0 [0] [3] [4] [0+] // odd_byte=1 [0+] [3] [4] [4] [0] // 92 E28099 C3A2E282ACE284A2 C3->A2->E2->xx->xx->E2->xx->xx // odd_byte=0 [0] [3] [4] [0] [0] // odd_byte=1 [0+] [3] [4] [4] [0+] // // When an E2xxxx sequence is encountered, we absorb the two bytes E2xx and flip // the odd_byte state. If that goes from 0 to 1, the next pair is offset up // by one byte, picking up the two bytes just after E2xxxx. If odd_byte goes // from 1 to 0, the next two bytes picked up are the two bytes xxxx of E2xxxx. // These are absorbed with no error in state 0 or state 4 // // C3 C3 C383 C3->8x->C2->xx // D3 D3 C393 C3->9x->C2->xx->C2->xx // E3 E3 C3A3 C3->Ax->C2->xx->C2->xx->C2->xx // F3 F3 C3B2 C3->Bx->C2->xx->C2->xx->C2->xx->C2->xx // Counter3 for Fx Ex sequences is incremented at last C2 static const char kMiniUTF8UTF8State[8][16] = { // xxxx E2xx CXxx C3xx // 8 9 a b 8 9 a b 8 9 a b {0,0,0,0,1,1,1,1, 1,1,1,1,2,2,3,5,}, // [0] looking for C38x/C3Ax/2020/8x8x, or err {0,0,0,0,1,1,1,1, 1,1,1,1,2,2,3,5,}, // [1] error, back to looking {1,1,1,1,0,0,0,0, 0,0,0,0,1,1,1,1,}, // [2] C38x looking for CXxx/E2xxxx // + + + + // E2xxxx flips odd_byte {1,1,1,1,4,4,4,4, 7,7,7,7,1,1,1,1,}, // [3] C3Ax looking for E2xx or C2xxC2xx // + + + + // E2xxxx flips odd_byte {4,4,4,4,0,0,0,0, 0,0,0,0,1,1,1,1,}, // [4] C3AxE2xx-- looking for C2xx/E2xxxx // + + + + // E2xxxx flips odd_byte {1,1,1,1,1,1,1,1, 6,6,6,6,1,1,1,1,}, // [5] C3Bx -- looking for C2xxC2xxC2xx {1,1,1,1,1,1,1,1, 7,7,7,7,1,1,1,1,}, // [6] C3Bx -- looking for C2xxC2xx {1,1,1,1,1,1,1,1, 0,0,0,0,1,1,1,1,}, // [7] C3Bx -- looking for C2xx }; // Counter to increment: 0-don'tcare 1-error 2-good_2B 3-good_3B 4-good_4B static const char kMiniUTF8UTF8Count[8][16] = { // xxxx E2xx C2Xx C3xx // 8 9 a b 8 9 a b 8 9 a b {0,0,0,0,1,1,1,1, 1,1,1,1,0,0,0,0,}, // [0] looking for C38x/C3Ax/2020/8x8x, or err {0,0,0,0,1,1,1,1, 1,1,1,1,0,0,0,0,}, // [1] error, back to looking {1,1,1,1,3,3,3,3, 2,2,2,2,1,1,1,1,}, // [2] C38x looking for CXxx/E2xxxx // + + + + // E2xxxx flips odd_byte {1,1,1,1,0,0,0,0, 0,0,0,0,1,1,1,1,}, // [3] C3Ax looking for E2xx // + + + + // E2xxxx flips odd_byte {1,1,1,1,4,4,4,4, 4,4,4,4,1,1,1,1,}, // [4] C3AxE2xx-- looking for C2xx/E2xxxx // + + + + // E2xxxx flips odd_byte {1,1,1,1,1,1,1,1, 0,0,0,0,1,1,1,1,}, // [5] C3Bx -- looking for C2xxC2xxC2xx {1,1,1,1,1,1,1,1, 0,0,0,0,1,1,1,1,}, // [6] C3Bx -- looking for C2xxC2xx {1,1,1,1,1,1,1,1, 3,3,3,3,1,1,1,1,}, // [7] C3Bx -- looking for C2xx }; static const char kMiniUTF8UTF8Odd[8][16] = { // xxxx E2xx C2Xx C3xx // 8 9 a b 8 9 a b 8 9 a b {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,}, // [0] looking for C38x/C3Ax/2020/8x8x, or err {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,}, // [1] error, back to looking {0,0,0,0,1,1,1,1, 0,0,0,0,0,0,0,0,}, // [2] C38x looking for CXxx/E2xxxx // + + + + // E2xxxx flips odd_byte {0,0,0,0,1,1,1,1, 0,0,0,0,0,0,0,0,}, // [3] C3Ax looking for E2xx // + + + + // E2xxxx flips odd_byte {0,0,0,0,1,1,1,1, 0,0,0,0,0,0,0,0,}, // [4] C3AxE2xx-- looking for C2xx/E2xxxx // + + + + // E2xxxx flips odd_byte {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,}, // [5] C3Bx -- looking for C2xxC2xxC2xx {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,}, // [6] C3Bx -- looking for C2xxC2xx {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,}, // [7] C3Bx -- looking for C2xx }; // Turn a pair of bytes into the subscript for UTF8UTF8 tables above int UTF88Sub(char s0, char s1) { int sub = (s1 >> 4) & 0x03; uint8 u0 = static_cast(s0); if (u0 == 0xc3) { sub += 12; } else if ((u0 & 0xf0) == 0xc0) { if ((u0 == 0xc2) || (u0 == 0xc5) || (u0 == 0xc6) || (u0 == 0xcb)) { sub += 8; } } else if (u0 == 0xe2) { sub += 4; } return sub; } // Default probability for an encoding rankedencoding // Based on a scan of 55M web pages // These values are 255 - log base 2**1/10 (occurrences / total) // Large values are most likely. This the reverse of some Google code // 255 = 1.0, 245 = 1/2, 235 = 1/4, 15 = 1/2**24, 0 = 0 (< 1/50M) // // TODO change this to be per encoding, not permuted // // Support function for unit test program // Return ranked encoding corresponding to enc // (also exported to compact_enc_det_text.cc) int CompactEncDet::BackmapEncodingToRankedEncoding(Encoding enc) { for (int i = 0; i < NUM_RANKEDENCODING; ++i) { if (kMapToEncoding[i] == enc) { return i; } } return -1; } string DecodeActive(uint32 active) { string temp(""); if (active & kBinaryActive) { temp.append("Binary "); } if (active & kUTF1632Active) { temp.append("UTF1632 "); } if (active & kUTF8UTF8Active) { temp.append("UTF8UTF8 "); } if (active & kUTF8Active) { temp.append("UTF8 "); } if (active & kIso2022Active) { temp.append("Iso2022 "); } if (active & kHzActive) { temp.append("Hz "); } if (active & kUTF7Active) { temp.append("UTF7A "); } if (active & kSevenBitActive) { temp.append("SevenBit "); } if (active & kIsIndicCode) { temp.append("Indic "); } if (active & kHighAlphaCode) { temp.append("HighAlpha "); } if (active & kHighAccentCode) { temp.append("HighAccent "); } if (active & kEUCJPActive) { temp.append("EUCJP "); } return temp; } static inline bool SevenBitEncoding(int enc) { return ((kSpecialMask[enc] & kSevenBitActive) != 0); } static inline bool TwoByteEncoding(int enc) { return ((kSpecialMask[enc] & kTwobyteCode) != 0); } static inline bool IndicEncoding(int enc) { return ((kSpecialMask[enc] & kIsIndicCode) != 0); } static inline bool HighAlphaEncoding(int enc) { return ((kSpecialMask[enc] & kHighAlphaCode) != 0); } static inline bool HighAccentEncoding(int enc) { return ((kSpecialMask[enc] & kHighAccentCode) != 0); } static inline bool AnyActive(DetectEncodingState* destatep) { return (destatep->active_special != 0); } static inline bool SevenBitActive(DetectEncodingState* destatep) { return (destatep->active_special & kSevenBitActive) != 0; } static inline bool HzActive(DetectEncodingState* destatep) { return (destatep->active_special & kHzActive) != 0; } static inline bool Iso2022Active(DetectEncodingState* destatep) { return (destatep->active_special & kIso2022Active) != 0; } static inline bool UTF8Active(DetectEncodingState* destatep) { return (destatep->active_special & kUTF8Active) != 0; } static inline bool UTF8UTF8Active(DetectEncodingState* destatep) { return (destatep->active_special & kUTF8UTF8Active) != 0; } static inline bool UTF1632Active(DetectEncodingState* destatep) { return (destatep->active_special & kUTF1632Active) != 0; } static inline bool BinaryActive(DetectEncodingState* destatep) { return (destatep->active_special & kBinaryActive) != 0; } static inline bool UTF7OrHzActive(DetectEncodingState* destatep) { return (destatep->active_special & (kHzActive + kUTF7Active)) != 0; } static inline bool EUCJPActive(DetectEncodingState* destatep) { return ((destatep->active_special & kEUCJPActive) != 0); } static inline bool OtherActive(DetectEncodingState* destatep) { return (destatep->active_special & (kIso2022Active + kBinaryActive + kUTF8Active + kUTF8UTF8Active + kUTF1632Active + kEUCJPActive)) != 0; } static inline bool CEDFlagRescanning(CEDInternalFlags flags) { return (flags & kCEDRescanning) != 0; } static inline bool CEDFlagForceTags(CEDInternalFlags flags) { return (flags & kCEDForceTags) != 0; } static inline int maxint(int a, int b) {return (a > b) ? a : b;} static inline int minint(int a, int b) {return (a < b) ? a : b;} static inline const char* MyRankedEncName(int r_enc) { return MyEncodingName(kMapToEncoding[r_enc]); } // Only for debugging. not thread safe static const int kPsSourceWidth = 32; static int pssourcenext = 0; // debug only. not threadsafe. dump only >= this static int pssourcewidth = 0; // debug only. static char* pssource_mark_buffer = NULL; int next_do_src_line; int do_src_offset[16]; void PsSourceInit(int len) { pssourcenext = 0; pssourcewidth = len; delete[] pssource_mark_buffer; // Allocate 2 Ascii characters per input byte pssource_mark_buffer = new char[(pssourcewidth * 2) + 8]; // 8 = overscan memset(pssource_mark_buffer, ' ', pssourcewidth * 2); memset(pssource_mark_buffer + (pssourcewidth * 2), '\0', 8); next_do_src_line = 0; memset(do_src_offset, 0, sizeof(do_src_offset)); } void PsSourceFinish() { // Print preceding mark buffer int j = (pssourcewidth * 2) - 1; while ((0 <= j) && (pssource_mark_buffer[j] == ' ')) {--j;} // trim pssource_mark_buffer[j + 1] = '\0'; fprintf(stderr, "( %s) do-src\n", pssource_mark_buffer); memset(pssource_mark_buffer, ' ', pssourcewidth * 2); memset(pssource_mark_buffer + (pssourcewidth * 2), '\0', 8); delete[] pssource_mark_buffer; pssource_mark_buffer = NULL; } // Dump aligned len bytes src... if not already dumped void PsSource(const uint8* src, const uint8* isrc, const uint8* srclimit) { int offset = src - isrc; offset -= (offset % pssourcewidth); // round down to multiple of len bytes if (offset < pssourcenext) { return; } pssourcenext = offset + pssourcewidth; // Min offset for next dump // Print preceding mark buffer int j = (pssourcewidth * 2) - 1; while ((0 <= j) && (pssource_mark_buffer[j] == ' ')) {--j;} // trim pssource_mark_buffer[j + 1] = '\0'; fprintf(stderr, "( %s) do-src\n", pssource_mark_buffer); memset(pssource_mark_buffer, ' ', pssourcewidth * 2); memset(pssource_mark_buffer + (pssourcewidth * 2), '\0', 8); // Print source bytes const uint8* src_aligned = isrc + offset; int length = srclimit - src_aligned; length = minint(pssourcewidth, length); fprintf(stderr, "(%05x ", offset); for (int i = 0; i < length; ++i) { char c = src_aligned[i]; if (c == '\n') {c = ' ';} if (c == '\r') {c = ' ';} if (c == '\t') {c = ' ';} if (c == '(') { fprintf(stderr, "%s", "\\( "); } else if (c == ')') { fprintf(stderr, "%s", "\\) "); } else if (c == '\\') { fprintf(stderr, "%s", "\\\\ "); } else if ((0x20 <= c) && (c <= 0x7e)) { fprintf(stderr, "%c ", c); } else { fprintf(stderr, "%02x", c); } } fprintf(stderr, ") do-src\n"); // Remember which source offsets are where, mod 16 do_src_offset[next_do_src_line & 0x0f] = offset; ++next_do_src_line; } // Mark bytes in just-previous source bytes void PsMark(const uint8* src, int len, const uint8* isrc, int weightshift) { int offset = src - isrc; offset = (offset % pssourcewidth); // mod len bytes char mark = (weightshift == 0) ? '-' : 'x'; pssource_mark_buffer[(offset * 2)] = '='; pssource_mark_buffer[(offset * 2) + 1] = '='; for (int i = 1; i < len; ++i) { pssource_mark_buffer[(offset + i) * 2] = mark; pssource_mark_buffer[((offset + i) * 2) + 1] = mark; } } // Highlight trigram bytes in just-previous source bytes // Unfortunately, we have to skip back N lines since source was printed for // up to 8 bigrams before we get here. Match on src+1 to handle 0/31 better void PsHighlight(const uint8* src, const uint8* isrc, int trigram_val, int n) { int offset = (src + 1) - isrc; int offset32 = (offset % pssourcewidth); // mod len bytes offset -= offset32; // round down to multiple of len bytes for (int i = 1; i <= 16; ++i) { if (do_src_offset[(next_do_src_line - i) & 0x0f] == offset) { fprintf(stderr, "%d %d %d do-highlight%d\n", i, offset32 - 1, trigram_val, n); break; } } } void InitDetectEncodingState(DetectEncodingState* destatep) { destatep->initial_src = NULL; // Filled in by caller destatep->limit_src = NULL; destatep->prior_src = NULL; destatep->last_pair = NULL; destatep->debug_data = NULL; destatep->next_detail_entry = 0; destatep->done = false; destatep->reliable = false; destatep->hints_derated = false; //destatep->declared_enc_1 init in ApplyHints //destatep->declared_enc_2 init in ApplyHints destatep->prune_count = 0; destatep->trigram_highwater_mark = 0; destatep->looking_for_latin_trigrams = false; destatep->do_latin_trigrams = false; // Miscellaneous state variables for difficult encodings destatep->binary_quadrants_count = 0; destatep->binary_8x4_count = 0; destatep->binary_quadrants_seen = 0; destatep->binary_8x4_seen = 0; destatep->utf7_starts = 0; destatep->prior_utf7_offset = 0; destatep->next_utf8_ministate = 0; for (int i = 0; i < 6; i++) {destatep->utf8_minicount[i] = 0;} destatep->next_utf8utf8_ministate = 0; destatep->utf8utf8_odd_byte = 0; for (int i = 0; i < 6; i++) {destatep->utf8utf8_minicount[i] = 0;} destatep->next_2022_state = SOSI_NONE; destatep->next_hz_state = SOSI_NONE; destatep->next_eucjp_oddphase = false; for (int i = 0; i < 8; i++) {destatep->byte32_count[i] = 0;} destatep->active_special = 0xffffffff; destatep->tld_hint = UNKNOWN_ENCODING; destatep->http_hint = UNKNOWN_ENCODING; destatep->meta_hint = UNKNOWN_ENCODING; destatep->bom_hint = UNKNOWN_ENCODING; destatep->top_rankedencoding = 0; // ASCII [seven-bit] is the default destatep->second_top_rankedencoding = 0; // ASCII [seven-bit] is the default destatep->top_prob = -1; destatep->second_top_prob = -1; // This is wide for first pruning, shrinks for 2nd and later destatep->prune_difference = kInititalPruneDifference; destatep->next_prior_bigram = 0; destatep->prior_bigram[0] = -1; destatep->prior_bigram[1] = -1; destatep->prior_bigram[2] = -1; destatep->prior_bigram[3] = -1; destatep->prior_binary[0] = -1; // Initialize with all but Indic encodings, which we never detect int k = 0; for (int rankedencoding = 0; rankedencoding < NUM_RANKEDENCODING; rankedencoding++) { Encoding enc = kMapToEncoding[rankedencoding]; if (!IndicEncoding(enc)) { destatep->rankedencoding_list[k++] = rankedencoding; } } destatep->rankedencoding_list_len = k; // This is where all the action is memset(destatep->enc_prob, 0, sizeof(destatep->enc_prob)); memset(destatep->hint_prob, 0, sizeof(destatep->hint_prob)); memset(destatep->hint_weight, 0, sizeof(destatep->hint_weight)); destatep->prior_interesting_pair[AsciiPair] = 0; destatep->prior_interesting_pair[OtherPair] = 0; destatep->next_interesting_pair[AsciiPair] = 0; destatep->next_interesting_pair[OtherPair] = 0; // interesting_pairs/offsets/weightshifts not initialized; no need } // Probability strings are uint8, with zeros removed via simple run-length: // ( )* // skip-take: // 00 end // x0 skip 16 x locations, take 0 data values // xy skip x locations, take y data values // Multiply all the incoming values by 3 to account for 3x unigram sums // // {{0x77,0x69,0x6e,0x64,0x31,0x32,0x35,0x35, // 0x01,0xc2,0x10,0x41,0xfe,0x71,0xba,0x00,}}, // "wind1255" // // Weight is 0..100 percent // // Returns subscript of largest (most probable) value // // {{0x6e,0x6c,0x5f,0x5f, 0x05,0xb2,0xae,0xa0,0x32,0xa1,0x36,0x31,0x42,0x39,0x3b,0x33,0x45,0x11,0x6f,0x00,}}, // "nl__" // // ASCII-7-bit=178 Latin1=174 UTF8=160 GB=50 CP1252=161 BIG5=49 Latin2=66 CP1251=57 CP1256=59 CP1250=51 Latin5=69 ISO-8859-15=111 [top ASCII-7-bit] int ApplyCompressedProb(const char* iprob, int len, int weight, DetectEncodingState* destatep) { int* dst = &destatep->enc_prob[0]; int* dst2 = &destatep->hint_weight[0]; const uint8* prob = reinterpret_cast(iprob); const uint8* problimit = prob + len; int largest = -1; int subscript_of_largest = 0; // Continue with first byte and subsequent ones while (prob < problimit) { int skiptake = *prob++; int skip = (skiptake & 0xf0) >> 4; int take = skiptake & 0x0f; if (skiptake == 00) { break; } else if (take == 0) { dst += (skip << 4); dst2 += (skip << 4); } else { dst += skip; // Normal case dst2 += skip; // Normal case for (int i = 0; i < take; i++) { int enc = static_cast(dst - &destatep->enc_prob[0]) + i; if (largest < prob[i]) { largest = prob[i]; subscript_of_largest = enc; } int increment = prob[i] * 3; // The actual increment // Do maximum of previous hints plus this new one if (weight > 0) { increment = (increment * weight) / 100; dst[i] = maxint(dst[i], increment); dst2[i] = 1; // New total weight } } prob += take; dst += take; dst2 += take; } } return subscript_of_largest; } // Returns subscript of largest (most probable) value [for unit test] int TopCompressedProb(const char* iprob, int len) { const uint8* prob = reinterpret_cast(iprob); const uint8* problimit = prob + len; int next_prob_sub = 0; int topprob = 0; int toprankenc = 0; while (prob < problimit) { int skiptake = *prob++; int skip = (skiptake & 0xf0) >> 4; int take = skiptake & 0x0f; if (skiptake == 0) { break; } else if (take == 0) { next_prob_sub += (skip << 4); } else { next_prob_sub += skip; // Normal case for (int i = 0; i < take; i++) { if (topprob < prob[i]) { topprob = prob[i]; toprankenc = next_prob_sub + i; } } prob += take; next_prob_sub += take; } } return toprankenc; } // Find subscript of matching key in first 8 bytes of sorted hint array, or -1 int HintBinaryLookup8(const HintEntry* hintprobs, int hintprobssize, const char* norm_key) { // Key is always in range [lo..hi) int lo = 0; int hi = hintprobssize; while (lo < hi) { int mid = (lo + hi) >> 1; int comp = memcmp(&hintprobs[mid].key_prob[0], norm_key, 8); if (comp < 0) { lo = mid + 1; } else if (comp > 0) { hi = mid; } else { return mid; } } return -1; } // Find subscript of matching key in first 4 bytes of sorted hint array, or -1 int HintBinaryLookup4(const HintEntry* hintprobs, int hintprobssize, const char* norm_key) { // Key is always in range [lo..hi) int lo = 0; int hi = hintprobssize; while (lo < hi) { int mid = (lo + hi) >> 1; int comp = memcmp(&hintprobs[mid].key_prob[0], norm_key, 4); if (comp < 0) { lo = mid + 1; } else if (comp > 0) { hi = mid; } else { return mid; } } return -1; } static inline void Boost(DetectEncodingState* destatep, int r_enc, int boost) { destatep->enc_prob[r_enc] += boost; } static inline void Whack(DetectEncodingState* destatep, int r_enc, int whack) { destatep->enc_prob[r_enc] -= whack; } // Apply initial probability hint based on top level domain name // Weight is 0..100 percent // Return 1 if name match found int ApplyTldHint(const char* url_tld_hint, int weight, DetectEncodingState* destatep) { if (url_tld_hint[0] == '~') { return 0; } string normalized_tld = MakeChar4(string(url_tld_hint)); int n = HintBinaryLookup4(kTLDHintProbs, kTLDHintProbsSize, normalized_tld.c_str()); if (n >= 0) { // TLD is four bytes, probability table is ~12 bytes int best_sub = ApplyCompressedProb(&kTLDHintProbs[n].key_prob[kMaxTldKey], kMaxTldVector, weight, destatep); // Never boost ASCII7; do CP1252 instead if (best_sub == F_ASCII_7_bit) {best_sub = F_CP1252;} destatep->declared_enc_1 = best_sub; if (destatep->debug_data != NULL) { // Show TLD hint SetDetailsEncProb(destatep, 0, best_sub, url_tld_hint); } return 1; } return 0; } // Apply initial probability hint based on charset= name // Weight is 0..100 percent // Return 1 if name match found int ApplyCharsetHint(const char* charset_hint, int weight, DetectEncodingState* destatep) { if (charset_hint[0] == '~') { return 0; } string normalized_charset = MakeChar44(string(charset_hint)); int n = HintBinaryLookup8(kCharsetHintProbs, kCharsetHintProbsSize, normalized_charset.c_str()); if (n >= 0) { // Charset is eight bytes, probability table is ~eight bytes int best_sub = ApplyCompressedProb(&kCharsetHintProbs[n].key_prob[kMaxCharsetKey], kMaxCharsetVector, weight, destatep); // Never boost ASCII7; do CP1252 instead if (best_sub == F_ASCII_7_bit) {best_sub = F_CP1252;} destatep->declared_enc_1 = best_sub; // If first explicitly declared charset is confusable with Latin1/1252, put // both declared forms in declared_enc_*, displacing Latin1/1252. // This avoids a bit of Latin1 creep. // Also boost the declared encoding and its pair // TODO: This should all be folded into postproc-enc-detect.cc if ((destatep->http_hint == UNKNOWN_ENCODING) && (destatep->meta_hint == UNKNOWN_ENCODING)) { // This is the first charset=hint switch (best_sub) { case F_Latin2: // 8859-2 Latin2, east euro destatep->declared_enc_2 = F_CP1250; Boost(destatep, F_Latin2, kGentleOnePair); Boost(destatep, F_CP1250, kGentleOnePair); break; case F_CP1250: destatep->declared_enc_2 = F_Latin2; Boost(destatep, F_Latin2, kGentleOnePair); Boost(destatep, F_CP1250, kGentleOnePair); break; case F_Latin3: // 8859-3 Latin3, south euro, Esperanto destatep->declared_enc_2 = F_ASCII_7_bit; Boost(destatep, F_Latin3, kGentleOnePair); break; case F_Latin4: // 8859-4 Latin4, north euro destatep->declared_enc_2 = F_ASCII_7_bit; Boost(destatep, F_Latin4, kGentleOnePair); break; case F_ISO_8859_5: // 8859-5 Cyrillic destatep->declared_enc_2 = F_ASCII_7_bit; // Don't boost 1251 Boost(destatep, F_ISO_8859_5, kGentleOnePair); // (too different) break; case F_CP1251: destatep->declared_enc_2 = F_ASCII_7_bit; // Don't boost -5 Boost(destatep, F_CP1251, kGentleOnePair); // (too different) break; case F_Arabic: // 8859-6 Arabic destatep->declared_enc_2 = F_CP1256; Boost(destatep, F_Arabic, kGentleOnePair); Boost(destatep, F_CP1256, kGentleOnePair); break; case F_CP1256: destatep->declared_enc_2 = F_Arabic; Boost(destatep, F_Arabic, kGentleOnePair); Boost(destatep, F_CP1256, kGentleOnePair); break; case F_Greek: // 8859-7 Greek destatep->declared_enc_2 = F_CP1253; Boost(destatep, F_Greek, kGentleOnePair); Boost(destatep, F_CP1253, kGentleOnePair); break; case F_CP1253: destatep->declared_enc_2 = F_Greek; Boost(destatep, F_Greek, kGentleOnePair); Boost(destatep, F_CP1253, kGentleOnePair); break; case F_Hebrew: // 8859-8 Hebrew destatep->declared_enc_2 = F_CP1255; Boost(destatep, F_Hebrew, kGentleOnePair); Boost(destatep, F_CP1255, kGentleOnePair); break; case F_CP1255: destatep->declared_enc_2 = F_Hebrew; Boost(destatep, F_Hebrew, kGentleOnePair); Boost(destatep, F_CP1255, kGentleOnePair); break; case F_Latin5: // 8859-9 Latin5, Turkish destatep->declared_enc_2 = F_ASCII_7_bit; // Don't boost 1254 Boost(destatep, F_Latin5, kGentleOnePair); // (too different) break; case F_CP1254: destatep->declared_enc_2 = F_ASCII_7_bit; // Don't boost Latin5 Boost(destatep, F_CP1254, kGentleOnePair); // (too different) break; case F_Latin6: // 8859-10 Latin6, Nordic destatep->declared_enc_2 = F_ASCII_7_bit; Boost(destatep, F_Latin6, kGentleOnePair); break; case F_ISO_8859_11: // 8859-11 Thai, destatep->declared_enc_2 = F_CP874; Boost(destatep, F_ISO_8859_11, kGentleOnePair); Boost(destatep, F_CP874, kGentleOnePair); break; case F_CP874: destatep->declared_enc_2 = F_ISO_8859_11; Boost(destatep, F_ISO_8859_11, kGentleOnePair); Boost(destatep, F_CP874, kGentleOnePair); break; case F_ISO_8859_13: // 8859-13 Latin7, Baltic destatep->declared_enc_2 = F_CP1257; Boost(destatep, F_ISO_8859_13, kGentleOnePair); Boost(destatep, F_CP1257, kGentleOnePair); break; case F_CP1257: destatep->declared_enc_2 = F_ISO_8859_13; Boost(destatep, F_ISO_8859_13, kGentleOnePair); Boost(destatep, F_CP1257, kGentleOnePair); break; case F_ISO_8859_15: // 8859-15 Latin9, Latin0, Euro-ized Latin1 destatep->declared_enc_2 = F_ASCII_7_bit; Boost(destatep, F_ISO_8859_15, kGentleOnePair); break; // Greek all-caps is confusable with KOI8x all-lower and Hebrew. // This turns some Greek documents into Cyrillic, etc. by mistake. // Greek and Hebrew are boosted explicitly above; do KOI8x here. // Boosting the declared encodingmakes it harder for the wrong one to // creep up. case F_KOI8R: Boost(destatep, F_KOI8R, kGentleOnePair); break; case F_KOI8U: Boost(destatep, F_KOI8U, kGentleOnePair); break; default: break; } } if (destatep->debug_data != NULL) { // Show charset hint SetDetailsEncProb(destatep, 0, best_sub, charset_hint); } // // Some fix-ups for the declared encodings // // If non-UTF8, non-Latin1/1252 encoding declared, disable UTF8 combos // TODO: This should all be folded into postproc-enc-detect.cc if ((best_sub != F_UTF8) && (best_sub != F_Latin1) && (best_sub != F_CP1252)) { Whack(destatep, F_UTF8UTF8, kBadPairWhack * 4); // demote } // Latin2 and CP1250 differ in the overlap part, such as B1 or B9 // The initial probabilites for charset=Latin2 explicitly put CP1250 // down twice as far as normal, and vice versa. This is done in // postproc-enc-detect.cc // If charset=user-defined, treat as Binary -- // we can safely only do low ASCII, might be Indic if (normalized_charset.substr(0,4) == "user") { Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } return 1; } return 0; } // Apply initial probability hint based on caller-supplied encoding // Negative hint whacks ~encoding, non-negative boosts encoding // // Negative hints are an experiment to see if they might be useful. // Not operator used instead of unary minus to allow specifying not-zero int ApplyEncodingHint(const int encoding_hint, int weight, DetectEncodingState* destatep) { Encoding enc_hint = static_cast((encoding_hint < 0) ? ~encoding_hint : encoding_hint); // Map to the right internal subscript int rankedenc_hint = CompactEncDet::BackmapEncodingToRankedEncoding(enc_hint); // I'm not sure how strong this hint should be. Weight 100% = 1 bigram int increment = (kBoostOnePair * weight) / 100; if (encoding_hint < 0) { destatep->enc_prob[rankedenc_hint] -= increment; } else { destatep->enc_prob[rankedenc_hint] += increment; } if (destatep->debug_data != NULL) { // Show encoding hint SetDetailsEncProb(destatep, 0, -1, MyEncodingName(enc_hint)); } return 1; } // Apply initial probability hint based on user interface language // Weight is 0..100 percent // Return 1 if name match found int ApplyUILanguageHint(const Language language_hint, int weight, DetectEncodingState* destatep) { if (language_hint == UNKNOWN_LANGUAGE) { return 0; } string normalized_lang = MakeChar8(LanguageName(language_hint)); int n = HintBinaryLookup8(kLangHintProbs, kLangHintProbsSize, normalized_lang.c_str()); if (n >= 0) { // Language is eight bytes, probability table is ~eight bytes int best_sub = ApplyCompressedProb(&kLangHintProbs[n].key_prob[kMaxLangKey], kMaxLangVector, weight, destatep); // Never boost ASCII7; do CP1252 instead if (best_sub == F_ASCII_7_bit) {best_sub = F_CP1252;} destatep->declared_enc_1 = best_sub; if (destatep->debug_data != NULL) { // Show language hint SetDetailsEncProb(destatep, 0, best_sub, normalized_lang.c_str()); } return 1; } return 0; } // Apply initial probability hint based on corpus type (web, email, etc) // Return 1 if name match found int ApplyDefaultHint(const CompactEncDet::TextCorpusType corpus_type, DetectEncodingState* destatep) { for (int i = 0; i < NUM_RANKEDENCODING; i++) { // Set the default probability destatep->enc_prob[i] = kDefaultProb[i] * 3; // Deliberately set 2022 seven-bit encodings to zero, // so we can look for actual use // TODO: This should all be folded into postproc-enc-detect.cc if (SevenBitEncoding(kMapToEncoding[i])) { destatep->enc_prob[i] = 0; } } // A little corpus distinction switch (corpus_type) { case CompactEncDet::WEB_CORPUS: case CompactEncDet::XML_CORPUS: // Allow double-converted UTF-8 to start nearly equal to normal UTF-8 destatep->enc_prob[F_UTF8UTF8] = destatep->enc_prob[F_UTF8] - kSmallInitDiff; break; case CompactEncDet::QUERY_CORPUS: case CompactEncDet::EMAIL_CORPUS: default: break; } if (FLAGS_demo_nodefault) { // Demo, make initial probs all zero for (int i = 0; i < NUM_RANKEDENCODING; i++) { destatep->enc_prob[i] = 0; } } if (destatep->debug_data != NULL) { // Show default hint SetDetailsEncProb(destatep, 0, -1, "Default"); } return 1; } // Do reverse search for c in [str..str+len) // Note: initial pointer is to FRONT of string, not back const char* MyMemrchr(const char* str, char c, size_t len) { const char* ret = str + len; while (str <= --ret) { if (*ret == c) {return ret;} } return NULL; } // Minimum real URL is 11 bytes: "http://a.bc" -- shorter is assumed to be TLD // Now that we are no longer trying to do Indic font-based encodigns, we // don't need the full URL and can go back to simple TLD. This test remains for // backwards compatility with any caller using full URL. static const int kMinURLLength = 11; // Extract TLD from a full URL or just a TLD // Return hostname and length if a full URL void ExtractTLD(const char* url_hint, char* tld_hint, int tld_hint_len, const char** ret_host_start, int* ret_host_len) { // url_hint can either be a full URL (preferred) or just top-level domain name // Extract the TLD from a full URL and use it for // a normal TLD hint strncpy(tld_hint, "~", tld_hint_len); tld_hint[tld_hint_len - 1] = '\0'; *ret_host_start = NULL; *ret_host_len = 0; int url_len = (url_hint != NULL) ? strlen(url_hint) : 0; if (url_len == 0) { // Empty TLD return; } // Minimum real URL is 11 bytes: "http://a.bc" -- shorter is assumed to be TLD if (kMinURLLength <= url_len) { // See if it really is a URL const char* first_slash = strchr(url_hint, '/'); if ((first_slash != NULL) && (first_slash != url_hint) && (first_slash[-1] == ':') && (first_slash[1] == '/') && (memrchr(url_hint, '.', first_slash - url_hint) == NULL)) { // We found :// and no dot in front of it, so declare a real URL const char* hostname_start = first_slash + 2; const char* hostname_end = strchr(hostname_start, '/'); if (hostname_end == NULL) { // No slash; end is first byte off end of the URL string hostname_end = url_hint + url_len; } size_t hostname_len = hostname_end - hostname_start; const char* port_start = (const char*)memchr(hostname_start, ':', hostname_len); if (port_start != NULL) { // Port; shorten hostname hostname_end = port_start; hostname_len = hostname_end - hostname_start; } const char* tld_start = MyMemrchr(hostname_start, '.', hostname_len); if (tld_start != NULL) { // Remember the TLD we just found int tld_len = hostname_start + hostname_len - tld_start - 1; if (tld_len > (tld_hint_len - 1)) { tld_len = tld_hint_len - 1; } memcpy(tld_hint, tld_start + 1, tld_len); tld_hint[tld_len] = '\0'; } *ret_host_start = hostname_start; *ret_host_len = hostname_len; return; } } else { strncpy(tld_hint, url_hint, tld_hint_len); tld_hint[tld_hint_len - 1] = '\0'; } } // Apply hints, if any, to probabilities // NOTE: Encoding probabilites are all zero at this point void ApplyHints(const char* url_hint, const char* http_charset_hint, const char* meta_charset_hint, const int encoding_hint, const Language language_hint, const CompactEncDet::TextCorpusType corpus_type, DetectEncodingState* destatep) { int hint_count = 0; // url_hint can either be a full URL (preferred) or just top-level domain name // Extract the TLD from a full URL and use it for // a normal TLD hint char tld_hint[16]; const char* hostname_start = NULL; int hostname_len = 0; ExtractTLD(url_hint, tld_hint, sizeof(tld_hint), &hostname_start, &hostname_len); // Initial hints give slight boost to Ascii-7-bit and code page 1252 // ApplyXxx routines copy enc_1 to enc_2 then update declared_enc_1 // This gives a boost to 1252 if one of HTTP/META is specified, // but this could be the wrong thing to do if Latin2/3/4/etc. is specified destatep->declared_enc_1 = F_CP1252; destatep->declared_enc_2 = F_ASCII_7_bit; // Applying various hints takes max of new hint and any old hint. // This does better on multiple hints that a weighted average // Weight is 0..100 percent if ((http_charset_hint != NULL) && (http_charset_hint[0] != '~')) { destatep->declared_enc_2 = destatep->declared_enc_1; hint_count += ApplyCharsetHint(http_charset_hint, 100, destatep); destatep->http_hint = kMapToEncoding[destatep->declared_enc_1]; if ((destatep->declared_enc_1 == F_CP1252) || (destatep->declared_enc_1 == F_Latin1)) { destatep->looking_for_latin_trigrams = true; } } if ((meta_charset_hint != NULL) && (meta_charset_hint[0] != '~')) { destatep->declared_enc_2 = destatep->declared_enc_1; hint_count += ApplyCharsetHint(meta_charset_hint, 100, destatep); destatep->meta_hint = kMapToEncoding[destatep->declared_enc_1]; if ((destatep->declared_enc_1 == F_CP1252) || (destatep->declared_enc_1 == F_Latin1)) { destatep->looking_for_latin_trigrams = true; } } if (encoding_hint != UNKNOWN_ENCODING) { destatep->declared_enc_2 = destatep->declared_enc_1; hint_count += ApplyEncodingHint(encoding_hint, 50, destatep); } if (language_hint != UNKNOWN_LANGUAGE) { destatep->declared_enc_2 = destatep->declared_enc_1; hint_count += ApplyUILanguageHint(language_hint, 50, destatep); } // Use top level domain if not .com and <=1 other hint was available if (url_hint != NULL) { destatep->tld_hint = CompactEncDet::TopEncodingOfTLDHint(tld_hint); if (hint_count == 0) { // Apply with weight 100% destatep->declared_enc_2 = destatep->declared_enc_1; hint_count += ApplyTldHint(tld_hint, 100, destatep); if ((destatep->declared_enc_1 == F_CP1252) || (destatep->declared_enc_1 == F_Latin1)) { destatep->looking_for_latin_trigrams = true; } if (strcmp("hu", tld_hint) == 0) { // Hungarian is particularly difficult to separate Latin2 from Latin1, // so always look for trigram scanning if bare TLD=hu hint destatep->looking_for_latin_trigrams = true; } // Treat .com as no TLD hint at all } else if ((hint_count == 1) && (strcmp("com", tld_hint) != 0)) { // Either shift weighting or consider doing no TLD here -- seems to // distract from correct charset= hints. Or perhaps apply only if // charset = Latin1/1252... // Apply with weight 50% destatep->declared_enc_2 = destatep->declared_enc_1; hint_count += ApplyTldHint(tld_hint, 50, destatep); if ((destatep->declared_enc_1 == F_CP1252) || (destatep->declared_enc_1 == F_Latin1)) { destatep->looking_for_latin_trigrams = true; // These need trigrams } } // Else ignore TLD hint entirely } // Use all-web default distribution if not even a TLD hint if (hint_count == 0) { destatep->looking_for_latin_trigrams = true; // Default needs trigrams destatep->declared_enc_2 = destatep->declared_enc_1; hint_count += ApplyDefaultHint(corpus_type, destatep); } // ISO-Microsoft Pairs // F_Latin1, F_CP1252, // F_Latin2, F_CP1250, NOT really strict subset/superset pairs // F_Latin3, // F_Latin4, // F_ISO_8859_5, F_CP1251, // F_Arabic, F_CP1256, NOT // F_Greek, F_CP1253, NOT really pairs // (or upgrade incvt to make Greek use CP) // F_Hebrew, F_CP1255, NOT really pairs // F_Latin5, F_CP1254, // F_Latin6, // F_ISO_8859_11, // F_ISO_8859_13, F_CP1257, // F_ISO_8859_15, // ISO-Microsoft Pairs // Get important families started together // // This should fall out of the initializatoin vectors for charset, // but we need to get rid of families alltogetrher // // TODO make this more graceful // Add small bias for subsets // Subtract small bias for supersets destatep->enc_prob[F_CP932] = destatep->enc_prob[F_SJS] - kSmallInitDiff; destatep->enc_prob[F_GBK] = destatep->enc_prob[F_GB] - kSmallInitDiff; destatep->enc_prob[F_GB18030] = destatep->enc_prob[F_GB] - kSmallInitDiff; destatep->enc_prob[F_BIG5_CP950] = destatep->enc_prob[F_BIG5] - kSmallInitDiff; destatep->enc_prob[F_BIG5_HKSCS] = destatep->enc_prob[F_BIG5] - kSmallInitDiff; // Deliberate over-bias Ascii7 and underbias Binary [unneeded] // destatep->enc_prob[F_ASCII_7_bit] = destatep->enc_prob[F_ASCII_7_bit] + kSmallInitDiff; // destatep->enc_prob[F_BINARY] = destatep->enc_prob[F_BINARY] - (kBoostInitial / 2); if (destatep->debug_data != NULL) { // Show state at end of hints SetDetailsEncProb(destatep, 0, -1, "Endhints"); if(FLAGS_enc_detect_detail2) { // Add a line showing the watched encoding(s) if (watch1_rankedenc >= 0) { SetDetailsEncProb(destatep, 0, watch1_rankedenc, FLAGS_enc_detect_watch1); } if (watch2_rankedenc >= 0) { SetDetailsEncProb(destatep, 0, watch2_rankedenc, FLAGS_enc_detect_watch2); } } // End detail2 } // If duplicate hints, set second one to ASCII_7BIT to prevent double-boost if (destatep->declared_enc_1 == destatep->declared_enc_2) { destatep->declared_enc_2 = F_ASCII_7_bit; } if (FLAGS_force127) { destatep->do_latin_trigrams = true; if (FLAGS_enc_detect_source) { PsHighlight(0, destatep->initial_src, 0, 2); } } if (FLAGS_counts && destatep->looking_for_latin_trigrams) {++looking_used;} if (FLAGS_counts && destatep->do_latin_trigrams) {++doing_used;} // // At this point, destatep->enc_prob[] is an initial probability vector based // on the given hints/default. In general, it spreads out least-likely // encodings to be about 2**-25 below the most-likely encoding. // For input text with lots of bigrams, an unlikely encoding can rise to // the top at a rate of about 2**6 per bigram, and more commonly 2**2 per // bigram. So more than 4 bigrams and commonly more than 12 are // needed to overcome the initial hints when the least-likely encoding // is in fact the correct answer. So if the entire text has very few bigrams // (as a two-word query might), it can be impossible for the correct // encoding to win. // // To compensate for this, we take the initial hint vector and effectively // apply it at the rate of 1/16 every bigram for the first 16 bigrams. The // actual mechanism is done just before the last prune. // // Remember Initial hint probabilities memcpy(destatep->hint_prob, destatep->enc_prob, sizeof(destatep->enc_prob)); } // Look for specific high-value patterns in the first 4 bytes // Byte order marks (BOM) // EFBBBF UTF-8 // FEFF UTF-16 BE // FFFE UTF-16 LE // FFFE0000 UTF-32 BE // 0000FEFF UTF-32 LE // // Likely UTF-x of seven-bit ASCII // 00xx UTF-16 BE xx printable ASCII // xx00 UTF-16 LE // 000000xx UTF-32 BE // xx000000 UTF-32 LE // void InitialBytesBoost(const uint8* src, int text_length, DetectEncodingState* destatep) { if (text_length < 4) {return;} uint32 pair01 = (src[0] << 8) | src[1]; uint32 pair23 = (src[2] << 8) | src[3]; uint32 quad0123 = (pair01 << 16) | pair23; bool utf_16_indication = false; bool utf_32_indication = false; int best_enc = -1; // Byte order marks // UTF-8 if ((quad0123 & 0xffffff00) == 0xEFBBBF00) { destatep->bom_hint = UTF8; Boost(destatep, F_UTF8, kBoostInitial * 2); Boost(destatep, F_UTF8UTF8, kBoostInitial * 2); best_enc = F_UTF8; // UTF-32 (test before UTF-16) } else if (quad0123 == 0x0000FEFF) { destatep->bom_hint = UTF32BE; Boost(destatep, F_UTF_32BE, kBoostInitial * 2); best_enc = F_UTF_32BE; } else if (quad0123 == 0xFFFE0000) { destatep->bom_hint = UTF32LE; Boost(destatep, F_UTF_32LE, kBoostInitial * 2); best_enc = F_UTF_32LE; // UTF-16 } else if (pair01 == 0xFEFF) { destatep->bom_hint = UTF16BE; Boost(destatep, F_UTF_16BE, kBoostInitial * 3); best_enc = F_UTF_16BE; } else if (pair01 == 0xFFFE) { destatep->bom_hint = UTF16LE; Boost(destatep, F_UTF_16LE, kBoostInitial * 3); best_enc = F_UTF_16LE; // Possible seven-bit ASCII encoded as UTF-16/32 // UTF-32 (test before UTF-16) } else if (((quad0123 & 0xffffff00) == 0) && (kIsPrintableAscii[src[3]] != 0)) { Boost(destatep, F_UTF_32BE, kBoostInitial); Whack(destatep, F_UTF_32LE, kBadPairWhack); // Illegal char best_enc = F_UTF_32BE; } else if (((quad0123 & 0x00ffffff) == 0) && (kIsPrintableAscii[src[0]] != 0)) { Boost(destatep, F_UTF_32LE, kBoostInitial); Whack(destatep, F_UTF_32BE, kBadPairWhack); // Illegal char best_enc = F_UTF_32LE; } else if ((src[0] == 0x00) && (kIsPrintableAscii[src[1]] != 0)) { Boost(destatep, F_UTF_16BE, kBoostInitial); best_enc = F_UTF_16BE; } else if ((src[1] == 0x00) && (kIsPrintableAscii[src[0]] != 0)) { Boost(destatep, F_UTF_16LE, kBoostInitial); best_enc = F_UTF_16LE; // Whack if 0000 or FFFF // UTF-32 (test before UTF-16) } else if (quad0123 == 0x00000000) { Whack(destatep, F_UTF_32BE, kBadPairWhack); // Illegal char Whack(destatep, F_UTF_32LE, kBadPairWhack); Whack(destatep, F_UTF_16BE, kBadPairWhack); Whack(destatep, F_UTF_16LE, kBadPairWhack); best_enc = -1; } else if (quad0123 == 0xffffffff) { Whack(destatep, F_UTF_32BE, kBadPairWhack); // Illegal char Whack(destatep, F_UTF_32LE, kBadPairWhack); Whack(destatep, F_UTF_16BE, kBadPairWhack); Whack(destatep, F_UTF_16LE, kBadPairWhack); best_enc = -1; } else if (pair01 == 0x0000) { Whack(destatep, F_UTF_16BE, kBadPairWhack); // Illegal char Whack(destatep, F_UTF_16LE, kBadPairWhack); best_enc = -1; } else if (pair01 == 0xffff) { Whack(destatep, F_UTF_16BE, kBadPairWhack); // Illegal char Whack(destatep, F_UTF_16LE, kBadPairWhack); best_enc = -1; // These are the first four bytes of some known binary file formats // Boost BINARY bigtime if JPEG FFD8FFxx // Boost BINARY bigtime if png 89504E47 (.PNG) // Boost BINARY bigtime if gif 47494638 (GIF8) // Boost BINARY bigtime if zip 504B0304 (PK..) // Boost BINARY bigtime if gzip 1F8B08xx // Boost BINARY bigtime if gzip 78DAxxxx // Boost BINARY if PDF 25504446 (%PDF) // Boost BINARY if SWF (FWSx or CWSx where x <= 0x1f) } else if ((quad0123 & 0xffffff00) == 0xFFD8FF00) { // JPEG FFD8FFxx Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (quad0123 == 0x89504E47) { // Hex 89 P N G Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (quad0123 == 0x47494638) { // Hex GIF8 Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (quad0123 == 0x504B0304) { // Hex P K 03 04 Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if ((quad0123 & 0xffffff00) == 0x1F8B0800) { // gzip 1F8B08xx Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (pair01 == 0x78DA) { // gzip 78DAxxxx Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (quad0123 == 0x25504446) { // Hex %PDF Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if ((quad0123 & 0xffffff1f) == 0x66535700) { // Hex FWSx Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if ((quad0123 & 0xffffff1f) == 0x63535700) { // Hex CWSx Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); // More binary detect prefixes // 7F E L F Executable and linking format // M M 00 * TIFF (little-endian) // * 00 M M TIFF (big-endian) // 01 f c p Final cut pro } else if (quad0123 == 0x7F454C46) { // Hex 7F E L F Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (quad0123 == 0x4D4D002A) { // Hex M M 00 * Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (quad0123 == 0x2A004D4D) { // Hex * 00 M M Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (quad0123 == 0x01666370) { // Hex 01 f c p Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); // More binary detect prefixes; all-ASCII names; heavy weight to avoid ASCII // prefix overcoming binary // C C S D USGS ISIS 3-D cube files // S I M P FITS image header "SIMPLE " } else if (quad0123 == 0x43435344) { // Hex C C S D Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (quad0123 == 0x53494D50) { // Hex S I M P Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); // More binary detect prefixes; all-ASCII names; lighter weight // H W P Hangul word processor // 8 B P S Photoshop // P D S _ xx "PDS_VERSION_ID " } else if (quad0123 == 0x48575020) { // Hex H W P if ((19 <= text_length) && (memcmp(src, "HWP.Document.File.V", 19) == 0)) { Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if ((19 <= text_length) && (memcmp(src, "HWP Document File V", 19) == 0)) { Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else { Boost(destatep, F_BINARY, kBoostInitial * kWeakerBinary); } } else if (quad0123 == 0x38425053) { // Hex 8 B P S Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else if (quad0123 == 0x5044535F) { // Hex P D S _ if ((14 <= text_length) && (memcmp(src, "PDS_VERSION_ID", 14) == 0)) { Boost(destatep, F_BINARY, kBoostInitial * kStrongBinary); } else { Boost(destatep, F_BINARY, kBoostInitial * kWeakerBinary); } } // There are several main Windows EXE file formats. // Not examined here (prefix too short; never see them in Google pipeline) // M Z DOS .exe Mark Zbikowski // N E DOS 4.0 16-bit // L E OS/2 VxD drivers // L X OS/2 // P E Windows NT // More user-defined // http://www.freenet.am/armscii/ Armenian // If any hints or BOM, etc. keep UTF 16/32 around if ((destatep->enc_prob[F_UTF_16BE] > 0) || (destatep->enc_prob[F_UTF_16LE] > 0)) { utf_16_indication = true; } if ((destatep->enc_prob[F_UTF_32BE] > 0) || (destatep->enc_prob[F_UTF_32LE] > 0)) { utf_32_indication = true; } // Kill UTF16/32 right now if no positive indication of them // Otherwise, they tend to rise to the top in 7-bit files with an // occasional 0x02 byte in some comment or javascript if (!utf_16_indication) { Whack(destatep, F_UTF_16BE, kBadPairWhack * 8); Whack(destatep, F_UTF_16LE, kBadPairWhack * 8); Whack(destatep, F_Unicode, kBadPairWhack * 8); } if (!utf_32_indication) { Whack(destatep, F_UTF_32BE, kBadPairWhack * 8); Whack(destatep, F_UTF_32LE, kBadPairWhack * 8); } // Usually kill mixed encodings if (!FLAGS_ced_allow_utf8utf8) { Whack(destatep, F_UTF8UTF8, kBadPairWhack * 8); } // 2011.11.07 never use UTF8CP1252 -- answer will be UTF8 instead Whack(destatep, F_UTF8CP1252, kBadPairWhack * 8); if (destatep->debug_data != NULL) { // Show first four bytes of the input char buff[16]; snprintf(buff, sizeof(buff), "%04x%04x", pair01, pair23); SetDetailsEncProb(destatep, 0, best_enc, buff); } } // Descending order int IntCompare(const void* v1, const void* v2) { const int* p1 = reinterpret_cast(v1); const int* p2 = reinterpret_cast(v2); if (*p1 < *p2) {return 1;} if (*p1 > *p2) {return -1;} return 0; } bool Base64Char(uint8 c) { if (('A' <= c) && (c <= 'Z')) {return true;} if (('a' <= c) && (c <= 'z')) {return true;} if (('0' <= c) && (c <= '9')) {return true;} if ('+' == c) {return true;} if ('/' == c) {return true;} return false; } int Base64ScanLen(const uint8* start, const uint8* limit) { // We have a plausible beginning; scan entire base64 string const uint8* ib64str = start; const uint8* b64str = ib64str; const uint8* b64strlimit = limit; // if starts with + +++, assume it is drawing, so bogus if (((limit - start) > 3) && (start[0] == '+') && (start[1] == '+') && (start[2] == '+')) { return 81; } // Scan over base64 while ((b64str < b64strlimit) && (kBase64Value[*b64str++] >= 0)) { } b64str--; // We overshot by 1 return b64str - ib64str; } // Input is at least 8-character legal base64 string after +. // But might be say + "Presse+Termine" bool GoodUnicodeFromBase64(const uint8* start, const uint8* limit) { // Reject base64 string len N if density of '+' is > 1 + N/16 (expect 1/64) // Reject base64 string len N if density of A-Z is < 1 + N/16 (expect 26/64) // Reject base64 string len N if density of a-z is < 1 + N/16 (expect 26/64) // Reject base64 string len N if density of 0-9 is < 1 + N/32 (expect 10/64) // NOTE: this requires at least one lower AND one upper AND one digit to pass // int plus_count = 0; int lower_count = 0; int upper_count = 0; int digit_count = 0; int len = limit - start; for (const uint8* src = start; src < limit; ++src) { uint8 c = *src; if (('a' <= c) && (c <= 'z')) { ++lower_count; } else if (('A' <= c) && (c <= 'Z')) { ++upper_count; } else if (('0' <= c) && (c <= '0')) { ++digit_count; } else if (*src == '+') { ++plus_count; } } if (plus_count > (1 + (len >> 4))) {return false;} if (lower_count < (1 + (len >> 4))) {return false;} if (upper_count < (1 + (len >> 4))) {return false;} if (digit_count < (1 + (len >> 5))) {return false;} // checking the last character to reduce false positive // since the last character may be padded to 0 bits at the end. // refer to http://en.wikipedia.org/wiki/UTF-7 int nmod8 = len & 7; const uint8 last = *(start+len-1); // When UTF-7 string length%8=3, the last two bits must be padded as 0 if ((nmod8 == 3) && (kBase64Value[last] & 3)) {return false;} // When UTF-7 string length%8=6, the last four bits must be padded as 0 if ((nmod8 == 6) && (kBase64Value[last] & 15)) {return false;} return true; } // Prune here after N bytes // Boost here for seven-bit sequences (at every prune) // if (sevenbitrankedencoding) // + UTF7 scan and boost/demote len mod 8 = 0 3 6 // ~ Hz scan and boost/demote len mod 8 = 0 2 4 6 // 1B 2022 scan and boost/demote len mod 8 = 0 2 4 6 // 0E 2022 scan and boost/demote len mod 8 = 0 2 4 6 // [0F 2022 boost/demote] // 00 UTF16/32 scan and boost/demote offset = even/odd // // If still some seven-bit possibilities > pure ASCII, // scan each possibility for clearer prob, s.t. about // two good sequences is a clear win // A-Z 00-19 00xx-64xx (B = 04xx) // a-z 1A-33 68xx-CCxx (f = 7Cxx) // 0-9 34-3D D0xx-F4xx (1 = D4xx) // + 3E F8xx // / 3F FCxx // do another chunk with slow scan // Boost, whack, or leave alone UTF-7 probablilty void UTF7BoostWhack(DetectEncodingState* destatep, int next_pair, uint8 byte2) { int off = destatep->interesting_offsets[AsciiPair][next_pair]; if (off >= destatep->prior_utf7_offset) { // Not part of a previous successful UTF-7 string ++destatep->utf7_starts; if (byte2 == '-') { // +- encoding for '+' neutral } else if (!Base64Char(byte2)) { // Not base64 -- not UTF-7, whack Whack(destatep, F_UTF7, kBadPairWhack); // Illegal pair } else { // Starts with base64 byte, might be a good UTF7 sequence const uint8* start = destatep->initial_src + off + 1; // over the + int n = Base64ScanLen(start, destatep->limit_src); int nmod8 = n & 7; if ((n == 3) || (n == 6)) { // short but legal -- treat as neutral } else if ((nmod8 == 0) | (nmod8 == 3) | (nmod8 == 6)) { // Good length. Check for good Unicode. if (GoodUnicodeFromBase64(start, start + n)) { // Good length and Unicode, boost Boost(destatep, F_UTF7, kBoostOnePair); // Found good destatep->prior_utf7_offset = off + n + 1; } else { // Bad Unicode. Whack Whack(destatep, F_UTF7, kBadPairWhack); // Illegal length } } else { // Bad length. Whack Whack(destatep, F_UTF7, kBadPairWhack); // Illegal length } } } } // Boost, whack, or leave alone HZ probablilty void HzBoostWhack(DetectEncodingState* destatep, uint8 byte2) { if ((byte2 == '{') || (byte2 == '}')) { Boost(destatep, F_HZ_GB_2312, kBoostOnePair); // Found ~{ or ~} } else if ((byte2 == '~') || (byte2 == '\n')) { destatep->enc_prob[F_HZ_GB_2312] += 0; // neutral } else { Whack(destatep, F_HZ_GB_2312, kBadPairWhack); // Illegal pair } } // Boost, whack, or leave alone BINARY probablilty void BinaryBoostWhack(DetectEncodingState* destatep, uint8 byte1, uint8 byte2) { int quadrant = ((byte1 & 0x80) >> 6) | ((byte2 & 0x80) >> 7); int bucket8x4 = ((byte1 & 0xe0) >> 3) | ((byte2 & 0xc0) >> 6); uint32 quad_mask = 1 << quadrant; uint32 bucket8x4_mask = 1 << bucket8x4; if ((destatep->binary_quadrants_seen & quad_mask) == 0) { destatep->binary_quadrants_seen |= quad_mask; destatep->binary_quadrants_count += 1; if (destatep->binary_quadrants_count == 4) { Boost(destatep, F_BINARY, kBoostOnePair * 2); // Found all 4 quadrants, // boost 2 pairs } } if ((destatep->binary_8x4_seen & bucket8x4_mask) == 0) { destatep->binary_8x4_seen |= bucket8x4_mask; destatep->binary_8x4_count += 1; if (destatep->binary_8x4_count >= 11) { Boost(destatep, F_BINARY, kBoostOnePair * 4); // Found 11+/20 buckets, // boost 4 pairs each time } } } // Demote UTF-16/32 on 0000 or FFFF, favoring Binary void UTF1632BoostWhack(DetectEncodingState* destatep, int offset, uint8 byte1) { if (byte1 == 0) { // We have 0000 Whack(destatep, F_UTF_16BE, kBadPairWhack); // Illegal pair Whack(destatep, F_UTF_16LE, kBadPairWhack); // Illegal pair switch (offset & 3) { case 0: // We get called with 0 4 8, etc. for ASCII/BMP as UTF-32BE Whack(destatep, F_UTF_32LE, kBadPairWhack); // Illegal pair Boost(destatep, F_UTF_32BE, kSmallInitDiff); // Good pair break; case 1: // We get called with 1 5 9, etc. for ASCII as UTF-32LE case 2: // We get called with 2 6 10, etc. for BMP as UTF-32LE Whack(destatep, F_UTF_32BE, kBadPairWhack); // Illegal pair Boost(destatep, F_UTF_32LE, kSmallInitDiff); // Good pair break; case 3: // ambiguous break; } } else { // We have ffff Whack(destatep, F_UTF_32BE, kBadPairWhack); // Illegal pair Whack(destatep, F_UTF_32LE, kBadPairWhack); // Illegal pair Whack(destatep, F_UTF_16BE, kBadPairWhack); // Illegal pair Whack(destatep, F_UTF_16LE, kBadPairWhack); // Illegal pair } } // Make even offset void UTF16MakeEven(DetectEncodingState* destatep, int next_pair) { destatep->interesting_offsets[OtherPair][next_pair] &= ~1; } bool ConsecutivePair(DetectEncodingState* destatep, int i) { if (i <= 0) { return false; } return destatep->interesting_offsets[OtherPair][i] == (destatep->interesting_offsets[OtherPair][i - 1] + 2); } // boost, whack, or leave alone UTF-8 probablilty // Any whacks are also applied to UTF8UTF8; CheckUTF8UTF8Seq assumes good UTF8 // Returns total boost int CheckUTF8Seq(DetectEncodingState* destatep, int weightshift) { int startcount = destatep->prior_interesting_pair[OtherPair]; int endcount = destatep->next_interesting_pair[OtherPair]; int demotion_count = 0; for (int i = startcount; i < endcount; ++i) { int sub; char* s = &destatep->interesting_pairs[OtherPair][i * 2]; // Demote four byte patterns that are more likely Latin1 than UTF-8 // C9AE, DF92, DF93, DFAB. See note at top. // Demotion also boosts Latin1 and CP1252 uint8 s0 = static_cast(s[0]); uint8 s1 = static_cast(s[1]); if ((s0 == 0xc9) && (s1 == 0xae)) {++demotion_count;} if ((s0 == 0xdf) && (s1 == 0x92)) {++demotion_count;} if ((s0 == 0xdf) && (s1 == 0x93)) {++demotion_count;} if ((s0 == 0xdf) && (s1 == 0xab)) {++demotion_count;} if (!ConsecutivePair(destatep, i)) { // Insert a blank into the sequence; avoid wrong splices sub = (' ' >> 4) & 0x0f; ++destatep->utf8_minicount[ static_cast(kMiniUTF8Count[static_cast(destatep->next_utf8_ministate)][sub])]; destatep->next_utf8_ministate = kMiniUTF8State[destatep->next_utf8_ministate][sub]; } // Byte 0 sub = (s0 >> 4) & 0x0f; ++destatep->utf8_minicount[ static_cast(kMiniUTF8Count[static_cast(destatep->next_utf8_ministate)][sub])]; destatep->next_utf8_ministate = kMiniUTF8State[destatep->next_utf8_ministate][sub]; // Byte 1 sub = (s1 >> 4) & 0x0f; ++destatep->utf8_minicount[ static_cast(kMiniUTF8Count[static_cast(destatep->next_utf8_ministate)][sub])]; destatep->next_utf8_ministate = kMiniUTF8State[destatep->next_utf8_ministate][sub]; DCHECK((0 <= destatep->next_utf8_ministate) && (destatep->next_utf8_ministate < 8)); } // For the four specific byte combinations above, Latin1/CP1252 is more likely if (demotion_count > 0) { Boost(destatep, F_Latin1, kGentleOnePair * demotion_count); Boost(destatep, F_CP1252, kGentleOnePair * demotion_count); } // Boost UTF8 for completed good sequences int total_boost = 2 * destatep->utf8_minicount[2] + 3 * destatep->utf8_minicount[3] + 4 * destatep->utf8_minicount[4]; // But not so much for demoted bytes total_boost -= (3 * demotion_count); total_boost *= kGentleOnePair; total_boost >>= weightshift; // Design: boost both UTF8 and UTF8UTF8 for each good sequence Boost(destatep, F_UTF8, total_boost); Boost(destatep, F_UTF8UTF8, total_boost); destatep->utf8_minicount[5] += destatep->utf8_minicount[2]; // total chars destatep->utf8_minicount[5] += destatep->utf8_minicount[3]; // total chars destatep->utf8_minicount[5] += destatep->utf8_minicount[4]; // total chars destatep->utf8_minicount[2] = 0; destatep->utf8_minicount[3] = 0; destatep->utf8_minicount[4] = 0; // Whack (2 bytes) for errors int error_whack = 2 * destatep->utf8_minicount[1]; error_whack *= kGentlePairWhack; error_whack >>= weightshift; Whack(destatep, F_UTF8, error_whack); Whack(destatep, F_UTF8UTF8, error_whack); destatep->utf8_minicount[1] = 0; return total_boost - error_whack; } // Boost, whack, or leave alone UTF8UTF8 probablilty // // We are looking for // (1) chars ONLY in set UTF8(0080)..UTF8(00FF), including for 80..9F the // MS CP1252 mappings, and // (2) sequences of 2 or more such characters // // If so, we could be looking at some non-7-bit encoding extra-converted // to UTF-8. The most common observed is CP1252->UTF8 twice, // 1252=>UTF8 : 1252=>UTF8 // where the colon means "take those bytes and pretend that they are 1252". // We have a couple of examples of BIG5 bytes converted as though // they were 1252, // BIG5 : 1252=>UTF8 // // Of course, we don't want correctly converted 1252 to be flagged here // 1252=>UTF8 // So we want the input high bytes to be in pairs or longer, hence the // output UTF8 in groups of four bytes or more // // Good chars: C2xx, C3xx, // Good chars: C592, C593, C5A0, C5A1, C5B8, C5BD, C5BE, C692, CB86, CB9C // Good chars: E280xx E282AC E284A2 // C2xx 1100001x 10xxxxxx (128/128) // C5xx 11000101 10xx00xx (16/4) // C5xx 11000101 10111xxx (8/3) // C692 11000110 10010010 (1/1) // CBxx 11001011 100xx1x0 (8/2) // E28x 11100010 10000xx0 (4/3) // // Returns total boost int CheckUTF8UTF8Seq(DetectEncodingState* destatep, int weightshift) { int this_pair = destatep->prior_interesting_pair[OtherPair]; int startbyteoffset = this_pair * 2; int endbyteoffset = destatep->next_interesting_pair[OtherPair] * 2; char* startbyte = &destatep->interesting_pairs[OtherPair][startbyteoffset]; char* endbyte = &destatep->interesting_pairs[OtherPair][endbyteoffset]; int pair_number = this_pair; for (char* s = startbyte; s < endbyte; s += 2) { int next = destatep->next_utf8utf8_ministate; if (!ConsecutivePair(destatep, pair_number)) { // Insert two blanks into the sequence to avoid wrong splices // go back to no odd-byte offset destatep->utf8utf8_odd_byte = 0; int sub = UTF88Sub(' ', ' '); ++destatep->utf8utf8_minicount[static_cast(kMiniUTF8UTF8Count[next][sub])]; next = kMiniUTF8UTF8State[next][sub]; } int odd = destatep->utf8utf8_odd_byte; if (s + 1 + odd >= endbyte) continue; int sub = UTF88Sub(s[0 + odd], s[1 + odd]); destatep->utf8utf8_odd_byte ^= kMiniUTF8UTF8Odd[next][sub]; ++destatep->utf8utf8_minicount[ static_cast(kMiniUTF8UTF8Count[next][sub])]; destatep->next_utf8utf8_ministate = kMiniUTF8UTF8State[next][sub]; ++pair_number; } // Boost for completed good sequences; each count covers two chars. // Design: boost UTF8UTF8 above UTF8 for each good sequence int total_boost = (2) * destatep->utf8utf8_minicount[2] + (2) * destatep->utf8utf8_minicount[3] + (2) * destatep->utf8utf8_minicount[4]; total_boost *= kGentleOnePair; total_boost >>= weightshift; Boost(destatep, F_UTF8UTF8, total_boost); // Track total characters destatep->utf8utf8_minicount[5] += destatep->utf8utf8_minicount[2]; destatep->utf8utf8_minicount[5] += destatep->utf8utf8_minicount[3]; destatep->utf8utf8_minicount[5] += destatep->utf8utf8_minicount[4]; destatep->utf8utf8_minicount[2] = 0; destatep->utf8utf8_minicount[3] = 0; destatep->utf8utf8_minicount[4] = 0; // Design: Do not whack UTF8UTF8 below UTF8 for each bad sequence destatep->utf8utf8_minicount[1] = 0; return total_boost; } // We give a gentle boost for each paired SO ... SI, whack others void CheckIso2022ActiveSeq(DetectEncodingState* destatep) { int this_pair = destatep->prior_interesting_pair[OtherPair]; int startbyteoffset = this_pair * 2; int endbyteoffset = destatep->next_interesting_pair[OtherPair] * 2; char* startbyte = &destatep->interesting_pairs[OtherPair][startbyteoffset]; char* endbyte = &destatep->interesting_pairs[OtherPair][endbyteoffset]; // Initial char must precede SO/SI // HZ_GB_2312 has no alternation constraint on 1- and 2-byte segments // ISO-2022-JP (JIS) has no alternation constraint on 1- and 2-byte segments // ISO-2022-CN has no alternation constraint on 1- and 2-byte segments // ISO-2022-KR requires alternation between 1- and 2-byte segments // JIS: // ( B ISO-2022-JP [1b 28 42] SI to ASCII // ( J ISO-2022-JP [1b 28 4a] SI to X0201 // $ @ ISO-2022-JP [1b 24 40] SO to X0208-78 twobyte // $ B ISO-2022-JP [1b 24 42] SO to X0208-83 twobyte for (char* s = startbyte; s < endbyte; s += 2) { if (s[0] == 0x1b) { if (s[1] == 0x24) { // $ is SO destatep->next_2022_state = SOSI_TWOBYTE; // SO to two-byte } else if (s[1] == 0x28) { if (destatep->next_2022_state == SOSI_TWOBYTE) { Boost(destatep, F_JIS, kGentlePairBoost); } else if (destatep->next_2022_state == SOSI_ONEBYTE) { Whack(destatep, F_JIS, kGentlePairWhack); } destatep->next_2022_state = SOSI_ONEBYTE; // JIS SI to one-byte } else { Whack(destatep, F_JIS, kBadPairWhack); Whack(destatep, F_ISO_2022_CN, kBadPairWhack); Whack(destatep, F_ISO_2022_KR, kBadPairWhack); destatep->next_2022_state = SOSI_ERROR; // not 2022 } } else if (s[0] == 0x0e) { // Whack(destatep, F_JIS, kBadPairWhack); if (destatep->next_2022_state != SOSI_NONE) { destatep->next_2022_state = SOSI_TWOBYTE; // SO to two-byte } else { // ESC required before SO/SI Whack(destatep, F_ISO_2022_CN, kBadPairWhack * 4); Whack(destatep, F_ISO_2022_KR, kBadPairWhack * 4); destatep->next_2022_state = SOSI_ERROR; // SO not after SI } } else if (s[0] == 0x0f) { // Whack(destatep, F_JIS, kBadPairWhack); if (destatep->next_2022_state != SOSI_NONE) { if (destatep->next_2022_state == SOSI_TWOBYTE) { Boost(destatep, F_ISO_2022_CN, kGentlePairBoost); Boost(destatep, F_ISO_2022_KR, kGentlePairBoost); } else if (destatep->next_2022_state == SOSI_ONEBYTE) { Whack(destatep, F_ISO_2022_CN, kGentlePairWhack); Whack(destatep, F_ISO_2022_KR, kGentlePairWhack); } destatep->next_2022_state = SOSI_ONEBYTE; // SI to one-byte } else { // ESC required before SO/SI Whack(destatep, F_ISO_2022_CN, kBadPairWhack * 4); Whack(destatep, F_ISO_2022_KR, kBadPairWhack * 4); destatep->next_2022_state = SOSI_ERROR; // SI not after SO } } else if (s[0] <= 0x1f) { // Some other control code. Allow ht lf [ff] cr if ((s[0] != 0x09) && (s[0] != 0x0a) && (s[0] != 0x0c) && (s[0] != 0x0d)) { // Otherwise these can float to the top on bad bytes Whack(destatep, F_JIS, kBadPairWhack); Whack(destatep, F_ISO_2022_CN, kBadPairWhack); Whack(destatep, F_ISO_2022_KR, kBadPairWhack); } } } // If no start, keep the probability pinned at zero (or below) if (destatep->next_2022_state == SOSI_NONE) { destatep->enc_prob[F_ISO_2022_CN] = minint(0, destatep->enc_prob[F_ISO_2022_CN]); destatep->enc_prob[F_ISO_2022_KR] = minint(0, destatep->enc_prob[F_ISO_2022_KR]); destatep->enc_prob[F_JIS] = minint(0, destatep->enc_prob[F_JIS]); } } // We give a gentle boost for each paired ~{ ... ~}, whack others void CheckHzActiveSeq(DetectEncodingState* destatep) { int this_pair = destatep->prior_interesting_pair[AsciiPair]; int startbyteoffset = this_pair * 2; int endbyteoffset = destatep->next_interesting_pair[AsciiPair] * 2; char* startbyte = &destatep->interesting_pairs[AsciiPair][startbyteoffset]; char* endbyte = &destatep->interesting_pairs[AsciiPair][endbyteoffset]; for (char* s = startbyte; s < endbyte; s += 2) { // Look for initial ~{ pair if ((s[0] == '~') && (s[1] == '{')) { destatep->next_hz_state = SOSI_TWOBYTE; // SO to two-byte } // Also look for closing ~} pair if ((s[0] == '~') && (s[1] == '}')) { if (destatep->next_hz_state == SOSI_TWOBYTE) { Boost(destatep, F_HZ_GB_2312, kGentlePairBoost); } else if (destatep->next_hz_state == SOSI_ONEBYTE) { Whack(destatep, F_HZ_GB_2312, kGentlePairWhack); } destatep->next_hz_state = SOSI_ONEBYTE; // SI to one-byte } } // If no start, keep the probability pinned at zero (or below) if (destatep->next_hz_state == SOSI_NONE) { destatep->enc_prob[F_HZ_GB_2312] = minint(0, destatep->enc_prob[F_HZ_GB_2312]); } } // We give a gentle boost after an odd number of 8Fxxxx triples, which // put subsequent bigrams out of phase until a low byte or another 8Fxxxx void CheckEucJpSeq(DetectEncodingState* destatep) { int this_pair = destatep->prior_interesting_pair[OtherPair]; int startbyteoffset = this_pair * 2; int endbyteoffset = destatep->next_interesting_pair[OtherPair] * 2; char* startbyte = &destatep->interesting_pairs[OtherPair][startbyteoffset]; char* endbyte = &destatep->interesting_pairs[OtherPair][endbyteoffset]; for (char* s = startbyte; s < endbyte; s += 2) { // Boost if out of phase (otherwise, EUC-JP will score badly after 8Fxxxx) if (destatep->next_eucjp_oddphase) { //printf(" EucJp boost[%02x%02x]\n", s[0], s[1]); // TEMP Boost(destatep, F_EUC_JP, kGentlePairBoost * 2); } uint8 s0 = static_cast(s[0]); uint8 s1 = static_cast(s[1]); // Look for phase flip at 8F if ((s0 & 0x80) == 0x00) { destatep->next_eucjp_oddphase = false; } else if (s0 == 0x8f) { destatep->next_eucjp_oddphase = !destatep->next_eucjp_oddphase; } if ((s1 & 0x80) == 0x00) { destatep->next_eucjp_oddphase = false; } else if (s1 == 0x8f) { destatep->next_eucjp_oddphase = !destatep->next_eucjp_oddphase; } } } // Boost, whack, or leave alone BINARY probablilty // Also called if UTF 16/32 active void CheckBinaryDensity(const uint8* src, DetectEncodingState* destatep, int delta_otherpairs) { // No change if not much gathered information if (delta_otherpairs == 0) { // Only ASCII pairs this call return; } int next_pair = destatep->next_interesting_pair[OtherPair]; // Look at density of interesting pairs [0..src) int delta_offset = static_cast(src - destatep->initial_src); // actual // Look at density of interesting pairs [0..next_interesting) int low_byte = destatep->interesting_offsets[OtherPair][0]; //int high_byte = destatep->interesting_offsets[OtherPair][next_pair - 1] + 2; //int byte_span = high_byte - low_byte; int byte_span = delta_offset - low_byte; // If all ASCII for the first 4KB, reject // If mostly ASCII in the first 5KB, reject if ((low_byte >= kBinaryHardAsciiLimit) || (delta_offset >= kBinarySoftAsciiLimit)) { // Not binary early enough in text Whack(destatep, F_BINARY, kBadPairWhack * 4); Whack(destatep, F_UTF_32BE, kBadPairWhack * 4); Whack(destatep, F_UTF_32LE, kBadPairWhack * 4); Whack(destatep, F_UTF_16BE, kBadPairWhack * 4); Whack(destatep, F_UTF_16LE, kBadPairWhack * 4); return; } // Density 1.0 for N pairs takes 2*N bytes // Whack if < 1/16 after first non_ASCII pair if ((next_pair * 2 * 16) < byte_span) { // Not dense enough Whack(destatep, F_BINARY, kBadPairWhack * 4); Whack(destatep, F_UTF_32BE, kBadPairWhack * 4); Whack(destatep, F_UTF_32LE, kBadPairWhack * 4); Whack(destatep, F_UTF_16BE, kBadPairWhack * 4); Whack(destatep, F_UTF_16LE, kBadPairWhack * 4); } if (next_pair < 8) { // Fewer than 8 non-ASCII total; too soon to boost return; } // Density 1.0 for N pairs takes 2*N bytes // Boost if density >= 1/4, whack if < 1/16 if ((next_pair * 2 * 4) >= byte_span) { // Very dense // Only boost if at least 2 quadrants seen if (destatep->binary_quadrants_count >= 2) { Boost(destatep, F_BINARY, kSmallInitDiff); Boost(destatep, F_UTF_32BE, kSmallInitDiff); Boost(destatep, F_UTF_32LE, kSmallInitDiff); Boost(destatep, F_UTF_16BE, kSmallInitDiff); Boost(destatep, F_UTF_16LE, kSmallInitDiff); } } } // Look at a number of special-case encodings whose reliable detection depends // on sequencing or other properties // AsciiPair probibilities (UTF7 and HZ) are all done here void ActiveSpecialBoostWhack(const uint8* src, DetectEncodingState* destatep) { int delta_asciipairs = destatep->next_interesting_pair[AsciiPair] - destatep->prior_interesting_pair[AsciiPair]; int delta_otherpairs = destatep->next_interesting_pair[OtherPair] - destatep->prior_interesting_pair[OtherPair]; // The two pure ASCII encodings if (UTF7OrHzActive(destatep) && (delta_asciipairs > 0)) { // Adjust per pair for (int i = 0; i < delta_asciipairs; ++i) { int next_pair = destatep->prior_interesting_pair[AsciiPair] + i; uint8 byte1 = destatep->interesting_pairs[AsciiPair][next_pair * 2 + 0]; uint8 byte2 = destatep->interesting_pairs[AsciiPair][next_pair * 2 + 1]; if (byte1 == '+') { // Boost, whack, or leave alone UTF-7 probablilty UTF7BoostWhack(destatep, next_pair, byte2); if (destatep->debug_data != NULL) { // Show UTF7 entry char buff[16]; snprintf(buff, sizeof(buff), "%02x%02x+", byte1, byte2); SetDetailsEncProb(destatep, destatep->interesting_offsets[AsciiPair][next_pair], kMostLikelyEncoding[(byte1 << 8) + byte2], buff); } } else if (byte1 == '~') { // Boost, whack, or leave alone HZ probablilty HzBoostWhack(destatep, byte2); if (destatep->debug_data != NULL) { // Show Hz entry char buff[16]; snprintf(buff, sizeof(buff), "%02x%02x~", byte1, byte2); SetDetailsEncProb(destatep, destatep->interesting_offsets[AsciiPair][next_pair], kMostLikelyEncoding[(byte1 << 8) + byte2], buff); } } } // Kill UTF-7 now if at least 8 + pairs and not confirmed valid UTF-7 if ((destatep->utf7_starts >= 8) && (destatep->prior_utf7_offset == 0)) { Whack(destatep, F_UTF7, kBadPairWhack * 8); // flush } } // All the other encodings if (OtherActive(destatep) && (delta_otherpairs > 0)) { // Adjust per pair int biggest_weightshift = 0; for (int i = 0; i < delta_otherpairs; ++i) { int next_pair = destatep->prior_interesting_pair[OtherPair] + i; uint8 byte1 = destatep->interesting_pairs[OtherPair][next_pair * 2 + 0]; uint8 byte2 = destatep->interesting_pairs[OtherPair][next_pair * 2 + 1]; int off = destatep->interesting_offsets[OtherPair][next_pair]; int weightshift = destatep->interesting_weightshift[OtherPair][next_pair]; biggest_weightshift = maxint(biggest_weightshift, weightshift); if (byte1 == 0x00) { if (byte2 == 0x00) { UTF1632BoostWhack(destatep, off, byte1); } else if ((kIsPrintableAscii[byte2] != 0) && ((off & 1) != 0)) { // We have 00xx at an odd offset. Turn into preceding even offset // for possible Ascii text in UTF-16LE or UTF-32LE (vs BE) // This will cascade into caller's probability update // 00 is illegal for all other encodings, so it doesn't matter to them UTF16MakeEven(destatep, next_pair); } if (destatep->debug_data != NULL) { // Show 0000 detail entry for this bigram char buff[16]; snprintf(buff, sizeof(buff), "%02x%02xZ", byte1, byte2); SetDetailsEncProb(destatep, destatep->interesting_offsets[OtherPair][next_pair], kMostLikelyEncoding[(byte1 << 8) + byte2], buff); } } if (byte1 == 0xff) { if (byte2 == 0xff) { UTF1632BoostWhack(destatep, off, byte1); } if (destatep->debug_data != NULL) { // Show FFFF detail entry for this bigram char buff[16]; snprintf(buff, sizeof(buff), "%02x%02xF", byte1, byte2); SetDetailsEncProb(destatep, destatep->interesting_offsets[OtherPair][next_pair], kMostLikelyEncoding[(byte1 << 8) + byte2], buff); } } if (BinaryActive(destatep)) { BinaryBoostWhack(destatep, byte1, byte2); } } // End for i // Adjust per entire-pair-span if (UTF8Active(destatep)) { CheckUTF8Seq(destatep, biggest_weightshift); } if (UTF8UTF8Active(destatep)) { CheckUTF8UTF8Seq(destatep, biggest_weightshift); } if (Iso2022Active(destatep)) { CheckIso2022ActiveSeq(destatep); } if (HzActive(destatep)) { CheckHzActiveSeq(destatep); } if (EUCJPActive(destatep)) { CheckEucJpSeq(destatep); } if (BinaryActive(destatep) || UTF1632Active(destatep)) { CheckBinaryDensity(src, destatep, delta_otherpairs); } } // ISO-2022 do OK on their own, using stright probabilities? Not on bad bytes if (destatep->debug_data != NULL) { // Show sequencing result SetDetailsEncLabel(destatep, "seq"); } } void PrintTopEnc(DetectEncodingState* destatep, int n) { // Print top n or fewer int temp_sort[NUM_RANKEDENCODING]; for (int j = 0; j < destatep->rankedencoding_list_len; ++j) { int rankedencoding = destatep->rankedencoding_list[j]; temp_sort[j] = destatep->enc_prob[rankedencoding]; } qsort(temp_sort, destatep->rankedencoding_list_len, sizeof(temp_sort[0]), IntCompare); int top_n = minint(n, destatep->rankedencoding_list_len); int showme = temp_sort[top_n - 1]; // Print this value and above printf("rankedencodingList top %d: ", top_n); for (int j = 0; j < destatep->rankedencoding_list_len; ++j) { int rankedencoding = destatep->rankedencoding_list[j]; if (showme <= destatep->enc_prob[rankedencoding]) { printf("%s=%d ", MyEncodingName(kMapToEncoding[rankedencoding]), destatep->enc_prob[rankedencoding]); } } printf("\n\n"); } // If the same bigram repeats, don't boost its best encoding too much bool RepeatedBigram(DetectEncodingState* destatep, uint8 byte1, uint8 byte2) { int this_bigram = (byte1 << 8) | byte2; // If 00xx 01xx 02xx ... 1fxx, take out bottom 4 bits of xx. // This ignores parts of Yahoo 0255 0254 0243 0247 0245 0243 0250 0255 ... // It may screw up UTF-16BE // It may screw up ISO-2022 (1b24 suppresses 1b28) if (byte1 < 0x20) { this_bigram &= 0xfff0; } if (this_bigram == destatep->prior_bigram[0]) {return true;} if (this_bigram == destatep->prior_bigram[1]) {return true;} if (this_bigram == destatep->prior_bigram[2]) {return true;} if (this_bigram == destatep->prior_bigram[3]) {return true;} // Round-robin replacement destatep->prior_bigram[destatep->next_prior_bigram] = this_bigram; destatep->next_prior_bigram = (destatep->next_prior_bigram + 1) & 3; return false; } // Sometimes illegal bytes are used as markers between text that Javascript // is going to decode. Don't overboost the Binary encoding for markers 01-FF. // Just count first pair per 8x4 bucket bool RepeatedBinary(DetectEncodingState* destatep, uint8 byte1, uint8 byte2) { int bucket8x4 = ((byte1 & 0xe0) >> 3) | ((byte2 & 0xc0) >> 6); uint32 bucket8x4_mask = 1 << bucket8x4; if ((destatep->binary_8x4_seen & bucket8x4_mask) == 0) { destatep->binary_8x4_seen |= bucket8x4_mask; destatep->binary_8x4_count += 1; return false; } return true; } // Find current top two rankedencoding probabilities void ReRank(DetectEncodingState* destatep) { destatep->top_prob = -1; destatep->second_top_prob = -1; // Leave unchanged //destatep->top_rankedencoding = // destatep->rankedencoding_list[0]; // Just to make well-defined //destatep->second_top_rankedencoding = // destatep->rankedencoding_list[1]; // Just to make well-defined for (int j = 0; j < destatep->rankedencoding_list_len; j++) { int rankedencoding = destatep->rankedencoding_list[j]; if (destatep->top_prob < destatep->enc_prob[rankedencoding]) { // Make sure top 2 are in different superset groups if (kMapEncToBaseEncoding[kMapToEncoding[destatep->top_rankedencoding]] != kMapEncToBaseEncoding[kMapToEncoding[rankedencoding]]) { destatep->second_top_prob = destatep->top_prob; // old top to second destatep->second_top_rankedencoding = destatep->top_rankedencoding; // old top to second } destatep->top_prob = destatep->enc_prob[rankedencoding]; destatep->top_rankedencoding = rankedencoding; } else if (destatep->second_top_prob < destatep->enc_prob[rankedencoding]) { if (kMapEncToBaseEncoding[kMapToEncoding[destatep->top_rankedencoding]] != kMapEncToBaseEncoding[kMapToEncoding[rankedencoding]]) { destatep->second_top_prob = destatep->enc_prob[rankedencoding]; destatep->second_top_rankedencoding = rankedencoding; } } } } void SimplePrune(DetectEncodingState* destatep, int prune_diff) { // Prune the list of active encoding families int keep_prob = destatep->top_prob - prune_diff; destatep->active_special = 0; int k = 0; for (int j = 0; j < destatep->rankedencoding_list_len; j++) { bool keep = true; int rankedencoding = destatep->rankedencoding_list[j]; // If count is too low, ditch it if (destatep->enc_prob[rankedencoding] < keep_prob) {keep = false;} // Keep it. This will always keep at least top_prob rankedencoding if (keep) { destatep->active_special |= kSpecialMask[kMapToEncoding[rankedencoding]]; destatep->rankedencoding_list[k++] = rankedencoding; } } destatep->rankedencoding_list_len = k; } // Recalculate reliable void CalcReliable(DetectEncodingState* destatep) { // Encoding result is reliable if big difference in top two, or if // only Ascii7 ever encountered // Also reliable if exactly one OtherPair and it's best encoding matches top destatep->reliable = false; if (destatep->next_interesting_pair[OtherPair] == 0) { // Only 7-bit ASCII destatep->reliable = true; return; } if ((destatep->top_prob - destatep->second_top_prob) >= FLAGS_ced_reliable_difference) { destatep->reliable = true; return; } if (destatep->next_interesting_pair[OtherPair] == 1) { uint8 byte1 = destatep->interesting_pairs[OtherPair][0]; uint8 byte2 = destatep->interesting_pairs[OtherPair][1]; int best_enc = kMostLikelyEncoding[(byte1 << 8) + byte2]; if (best_enc == destatep->top_rankedencoding) { destatep->reliable = true; return; } } // If we pruned to one encoding, we are done if (destatep->rankedencoding_list_len == 1) { destatep->reliable = true; destatep->done = true; return; } // If we pruned to two or three encodings in the same *superset/subset // rankedencoding* and enough pairs, we are done. Else keep going if (destatep->rankedencoding_list_len == 2) { Encoding enc0 = kMapToEncoding[destatep->rankedencoding_list[0]]; Encoding enc1 = kMapToEncoding[destatep->rankedencoding_list[1]]; if (kMapEncToBaseEncoding[enc0] == kMapEncToBaseEncoding[enc1]) { if (destatep->prune_count >= 3) { destatep->reliable = true; destatep->done = true; return; } } } else if (destatep->rankedencoding_list_len == 3) { Encoding enc0 = kMapToEncoding[destatep->rankedencoding_list[0]]; Encoding enc1 = kMapToEncoding[destatep->rankedencoding_list[1]]; Encoding enc2 = kMapToEncoding[destatep->rankedencoding_list[2]]; Encoding base0 = kMapEncToBaseEncoding[enc0]; Encoding base1 = kMapEncToBaseEncoding[enc1]; Encoding base2 = kMapEncToBaseEncoding[enc2]; if ((base0 == base1) && (base0 == base2)) { if (destatep->prune_count >= 3) { destatep->reliable = true; destatep->done = true; return; } } } } // Find current top two rankedencoding probabilities void FindTop2(DetectEncodingState* destatep, int* first_renc, int* second_renc, int* first_prob, int* second_prob) { *first_prob = -1; *second_prob = -1; *first_renc = 0; *second_renc = 0; for (int j = 0; j < destatep->rankedencoding_list_len; j++) { int rankedencoding = destatep->rankedencoding_list[j]; if (*first_prob < destatep->enc_prob[rankedencoding]) { *second_prob = *first_prob; // old top to second *second_renc = *first_renc; // old top to second *first_prob = destatep->enc_prob[rankedencoding]; *first_renc = rankedencoding; } else if (*second_prob < destatep->enc_prob[rankedencoding]) { *second_prob = destatep->enc_prob[rankedencoding]; *second_renc = rankedencoding; } } } void PrintRankedEncodingList(DetectEncodingState* destatep, const char* str) { printf("Current ranked encoding list %s\n", str); for (int j = 0; j < destatep->rankedencoding_list_len; j++) { int rankedencoding = destatep->rankedencoding_list[j]; if ((rankedencoding < 0) || (rankedencoding > NUM_RANKEDENCODING)) { printf(" [%d] BOGUS rankedencoding = %d\n", j, rankedencoding); } else { printf(" [%d] rankedencoding = %d %-12.12s enc_prob = %d\n", j, rankedencoding, MyRankedEncName(rankedencoding), destatep->enc_prob[rankedencoding]); } } printf("End current ranked encoding list\n\n"); } // Map unencoded bytes down to five bits, largely preserving letters // This design struggles to put 33 values into 5 bits. #define XX 0 // Punctuation (00-7F range) #define HA 27 // High vowel a in Latin1/2/sometimes7 #define HE 28 // High vowel e #define HI 29 // High vowel i #define HO 30 // High vowel o #define HU 30 // High vowel u on top of HO #define Hc 31 // High consonant (80-FF range) static const char kMapToFiveBits[256] = { XX,XX,XX,XX,XX,XX,XX,XX, XX,XX,XX,XX,XX,XX,XX,XX, XX,XX,XX,XX,XX,XX,XX,XX, XX,XX,XX,XX,XX,XX,XX,XX, XX,XX,XX,XX,XX,XX,XX,XX, XX,XX,XX,XX,XX,XX,XX,XX, XX,XX,XX,XX,XX,XX,XX,XX, XX,XX,XX,XX,XX,XX,XX,XX, XX, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, 16,17,18,19,20,21,22,23, 24,25,26,XX,XX,XX,XX,XX, XX, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15, 16,17,18,19,20,21,22,23, 24,25,26,XX,XX,XX,XX,XX, Hc,HA,Hc,Hc,Hc,Hc,Hc,Hc, HO,Hc,Hc,Hc,Hc,Hc,Hc,Hc, Hc,HA,Hc,Hc,Hc,Hc,Hc,Hc, HO,Hc,Hc,Hc,Hc,Hc,Hc,Hc, Hc,HA,Hc,Hc,Hc,Hc,Hc,Hc, HO,Hc,Hc,Hc,Hc,Hc,Hc,Hc, Hc,HA,Hc,Hc,Hc,Hc,Hc,Hc, HO,Hc,Hc,Hc,Hc,Hc,Hc,Hc, Hc,HA,HA,HA,HA,Hc,Hc,Hc, Hc,HE,HE,HE,HI,HI,HI,Hc, Hc,Hc,Hc,HO,HO,HO,HO,Hc, Hc,HU,HU,HU,HU,Hc,Hc,Hc, Hc,HA,HA,HA,HA,Hc,Hc,Hc, Hc,HE,HE,HE,HI,HI,HI,Hc, Hc,Hc,Hc,HO,HO,HO,HO,Hc, Hc,HU,HU,HU,HU,Hc,Hc,Hc, }; #undef XX #undef HA #undef HE #undef HI #undef HO #undef HU #undef Hc static const int kTriLatin1Likely = 1; static const int kTriLatin2Likely = 2; static const int kTriLatin7Likely = 3; // Each table entry has 32 times two bits, selected by byte[2] // Entry subscript is selected by byte[0] and byte[1] // Latin1/2/7 boost vector, generated 2007.09.26 by postproc-enc-detect-short.cc static const uint64 kLatin127Trigrams[1024] = { 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x304080c0402c3330ULL, 0x0008400004000000ULL, 0x082800000c200000ULL, 0x23a0000420800030ULL, 0x00000000000ccc00ULL, 0x0500100100100000ULL, 0x0388400000200010ULL, 0x0000000000000c00ULL, 0xd0f0300740f0cf00ULL, 0x2aa0a2a22882a2acULL, 0x081d800000000080ULL, 0x0c82000020000000ULL, 0x200a03c000a00000ULL, 0x0008400400290000ULL, 0x0400870000000000ULL, 0x00f040c00000c080ULL, 0x0008004000000410ULL, 0x0020300000000030ULL, 0x00a030002c300000ULL, 0x0c8030c020a00000ULL, 0x15410030f0f4c000ULL, 0x3000000300a00000ULL, 0xa2880980a0880a88ULL, 0x0900300000000000ULL, 0x0000040100300000ULL, 0x0888820020a00000ULL, 0xc044002242010000ULL, 0x000000121d300040ULL, 0x40100040440c0d54ULL, 0x00008423102f8144ULL, 0x0b40808400000280ULL, 0x0000000000000000ULL, 0x0680a000000c0000ULL, 0x0880008020aa0000ULL, 0x2aaa0141010a4940ULL, 0xcb80000000010000ULL, 0x2280000000000000ULL, 0x5248000001800000ULL, 0x8000401004040010ULL, 0x1540010201001010ULL, 0x0080080400000000ULL, 0x5a00044040000108ULL, 0x0288000282080008ULL, 0x4800008002200000ULL, 0x4a00000000010100ULL, 0x8a88040080000800ULL, 0x0140800000000400ULL, 0x40010050000c0000ULL, 0x0000008000000000ULL, 0x0028000020140040ULL, 0x8620401401005308ULL, 0xc082000000000400ULL, 0x05c0b004c0240600ULL, 0x0288000080000000ULL, 0x0000014000000000ULL, 0x00000000040000c0ULL, 0x8001861008004280ULL, 0x0200000000000300ULL, 0x0000240242288620ULL, 0x801000c05434c200ULL, 0x9020162040a2d2b4ULL, 0x0021840000240704ULL, 0x2a80280080084908ULL, 0x0000000000000000ULL, 0x0500004000000040ULL, 0x0080000000040000ULL, 0x0108058104440000ULL, 0x0900000000040000ULL, 0x00c0000000208008ULL, 0x2000005000000000ULL, 0x0080000000050000ULL, 0x0808000000001080ULL, 0x9880810100308000ULL, 0x2285480080081a08ULL, 0x8a80000080080000ULL, 0x1450000000600010ULL, 0x2210000100000000ULL, 0x8a88000100011000ULL, 0x1541804000000010ULL, 0xc084011140040100ULL, 0x0000000000000800ULL, 0x0400000000000030ULL, 0x2a800000a0890128ULL, 0x1140a00054000104ULL, 0x1440000101200404ULL, 0x028800400400d800ULL, 0x0000000000000000ULL, 0x0000000000002330ULL, 0x0020820228a02280ULL, 0xa2888a02aa8008a8ULL, 0xd0040a0044202500ULL, 0x8000044104a29424ULL, 0xc000100178b2c5b4ULL, 0x0000810100241504ULL, 0xd040030000380008ULL, 0x0000000000000000ULL, 0x26c08c0000200130ULL, 0x4a08000110080000ULL, 0x2aa0004001080800ULL, 0x0aac000000004000ULL, 0x2000000000200000ULL, 0x4240000100020000ULL, 0x4100000080000000ULL, 0x4900040000000000ULL, 0x0800000400300040ULL, 0x6a80000000040800ULL, 0x2a08182000588008ULL, 0x0a00000c81000008ULL, 0x0a000c0010000000ULL, 0x8a88001080280808ULL, 0x0020000200300600ULL, 0xaac00000900a0000ULL, 0x0000100004000000ULL, 0x0020081020000000ULL, 0x8220105010084110ULL, 0x4a80800000004000ULL, 0x050000c0c0200000ULL, 0x288c000084000000ULL, 0xa048082280000000ULL, 0x0000000000000000ULL, 0x8000900000032080ULL, 0xee889e81b8880820ULL, 0xc2200a8142800424ULL, 0xc020141543361010ULL, 0x10a000204a801634ULL, 0x3a808800802a00a0ULL, 0x28808b00803d0800ULL, 0x0000000000000000ULL, 0x0020000000000030ULL, 0x0808400121010040ULL, 0x0c28240100200040ULL, 0x2008200028800000ULL, 0xc10004c80f30c030ULL, 0x0400440114100000ULL, 0x2208200280a22220ULL, 0x0600000030c01000ULL, 0x1201001040c00000ULL, 0x0aa02ea22aa22aa0ULL, 0x30008000000200a0ULL, 0x20c8400400800000ULL, 0x08280b0420800000ULL, 0x0800100000210000ULL, 0x10000300c0100400ULL, 0xc8c0000420000000ULL, 0x1000000010000000ULL, 0x0420000400000000ULL, 0x0220000500204000ULL, 0x2200000420000000ULL, 0x0000540400000000ULL, 0x0000000020000000ULL, 0x00080c00a0810080ULL, 0x1540000000043000ULL, 0x0000000000100000ULL, 0x2e88a22220200a20ULL, 0xc06030e34ea503a0ULL, 0x0001100204048500ULL, 0x000000e0000c0d54ULL, 0x3000820310a31400ULL, 0x13088c0320e00280ULL, 0x0000000000000000ULL, 0x0480000000200000ULL, 0x4000200100000000ULL, 0x0000300040040000ULL, 0x4400000000000000ULL, 0x0401000002240000ULL, 0x0540000000040000ULL, 0x4004010000000000ULL, 0x4001111001100000ULL, 0x2880000000300040ULL, 0x4040004040002404ULL, 0x0200000000000000ULL, 0x0140040000100000ULL, 0x4040010040040080ULL, 0x0a00140000041004ULL, 0x0000a00400808000ULL, 0x1010200000430040ULL, 0x0010000000000000ULL, 0x0540000000104000ULL, 0x1400114005000000ULL, 0x0000204000440010ULL, 0x0500000000004400ULL, 0x4500000018000400ULL, 0x0000400000000000ULL, 0x000000300000cc00ULL, 0x0100001011300000ULL, 0x0040000000000000ULL, 0xc0e0000248a00444ULL, 0x0000040020340144ULL, 0x0000046445105454ULL, 0x32a0a80280880128ULL, 0x0880040000100100ULL, 0x0000000000000000ULL, 0x14003000030c0004ULL, 0x4a04001100000000ULL, 0x0a00108010000000ULL, 0x28a8004000200248ULL, 0x0100040000b00000ULL, 0x42000000000008c0ULL, 0x6008044010550010ULL, 0x0800401000010400ULL, 0x080080040cf80000ULL, 0x5080000001001010ULL, 0x2a80100000000000ULL, 0xcc8010010d401100ULL, 0x0200000001001000ULL, 0x0480001004001000ULL, 0x8d00800040b40210ULL, 0x6200800000300000ULL, 0x0000010000000000ULL, 0x0428004100010000ULL, 0x4320105141501100ULL, 0xe28c0000000c1000ULL, 0xd5c000c3c0e00300ULL, 0x0001000000100200ULL, 0x1004010202400008ULL, 0x0000000000003000ULL, 0x2aa038a0800aab08ULL, 0x2a88038000000000ULL, 0xc220040242f09720ULL, 0x8020200200ba0420ULL, 0x0020106105101004ULL, 0x0480800000220400ULL, 0x2280100080000008ULL, 0x0000000000000000ULL, 0x9000000000200000ULL, 0x0001000000100000ULL, 0x2aa40c0000080800ULL, 0x0040000040010000ULL, 0x0040000000c01000ULL, 0x4000000040000400ULL, 0x0000001000200000ULL, 0x0000010000000000ULL, 0x05808004000c0000ULL, 0x50400c0000000400ULL, 0x020040008f000040ULL, 0x0800000000100000ULL, 0x0000000000000000ULL, 0x0a08440000004000ULL, 0x0064000400008200ULL, 0x0010010010034170ULL, 0x0000000010000000ULL, 0x0100204021000000ULL, 0x022000d000010100ULL, 0x0840300000c00000ULL, 0x1400000040204400ULL, 0x09800c0040000000ULL, 0x0209708000000000ULL, 0x000000000000c040ULL, 0x90000c50204040a0ULL, 0x0000000000000000ULL, 0x00e1500040200004ULL, 0x8020260540204494ULL, 0x0020026150201054ULL, 0x0281800380105634ULL, 0x0884900481105000ULL, 0x0000000000000000ULL, 0x84203c00002c0200ULL, 0xc089040000000000ULL, 0xc2a8100040200004ULL, 0xe00c1c0000000000ULL, 0x0ce1330080200080ULL, 0x0000000000200000ULL, 0xc400110000404010ULL, 0x0088400000000000ULL, 0x00083cc00c00c00cULL, 0xcac01c00c000580cULL, 0xe300b0f000100000ULL, 0x0300000000000000ULL, 0xc0000f0000000000ULL, 0xc3c01c0400000000ULL, 0x81008004c0f40000ULL, 0xc3d8003000000440ULL, 0x0000000000000000ULL, 0xc430000000000000ULL, 0x0060000000001000ULL, 0x0800000000000000ULL, 0x00c03300f0fc0008ULL, 0x3000000400200010ULL, 0xa2a80892a0880a28ULL, 0x0500000040000004ULL, 0x0000000000000000ULL, 0xc80032070c200020ULL, 0x0220820060a296a0ULL, 0x802084021db486a0ULL, 0x00000d60080c0080ULL, 0xb281803313a32428ULL, 0x1808300320300000ULL, 0x0000000000000000ULL, 0x85208cc0ccac1f20ULL, 0x2081000186100808ULL, 0x22a80880000a0808ULL, 0xaaa8086880000000ULL, 0x802084800a2e9200ULL, 0xa280000000002008ULL, 0xa000000080080400ULL, 0x2080010000000008ULL, 0x802020c00c028c80ULL, 0x2080000000140810ULL, 0x2a80086080080008ULL, 0x2a800000a8000800ULL, 0xaa881800a2080800ULL, 0xaa98004080280808ULL, 0x004483d0c0300000ULL, 0xa280002080080000ULL, 0x0000000000300000ULL, 0x22a1030000000008ULL, 0xa8a0301088880880ULL, 0xaa80002080222808ULL, 0x85400c03fc030400ULL, 0x8a88000000000008ULL, 0xa008008010080008ULL, 0x0000000000010000ULL, 0x0040100000301040ULL, 0x28800000a0002008ULL, 0x122482306cbc0eacULL, 0x8020224222b8c6a0ULL, 0x802002004a82c284ULL, 0x0aa08fc440a41c80ULL, 0x888080d181385098ULL, 0x0000000000000000ULL, 0x00c0b000000c0080ULL, 0x2208001000000800ULL, 0x0a28000000200000ULL, 0x0000000300000000ULL, 0x00c1040000200000ULL, 0x0203020000000000ULL, 0x0248000000020000ULL, 0x0000840000100000ULL, 0x0a808c00c000008cULL, 0x5200040040000004ULL, 0x02000c00000080a0ULL, 0x0b0c000020000000ULL, 0x0b04000001000000ULL, 0x088c0010002000c0ULL, 0x80e08b00c0030c20ULL, 0x0280000200014040ULL, 0x0000000000000000ULL, 0x0e20a0a008000020ULL, 0x0e280fd03f00111cULL, 0x200080c020001000ULL, 0x8cc00c02c02f0400ULL, 0x480c0001000c404cULL, 0x0208014281080808ULL, 0x000000000000fcfcULL, 0x004403300cf00030ULL, 0x2200000000004400ULL, 0x02202000c08c0c20ULL, 0x02202022683a80a0ULL, 0x4020228028008c00ULL, 0x32208cc0002c0200ULL, 0x3ec00c0080304008ULL, 0x0000000000000000ULL, 0x34000c00002c0000ULL, 0x0b00000100100030ULL, 0x0823018000000000ULL, 0x0e8c001c01e00000ULL, 0x1200800600330000ULL, 0x4000110000000000ULL, 0x0080000300000000ULL, 0x0800000000000000ULL, 0x08c08c04000c0000ULL, 0x0080400000880000ULL, 0x0a08000080c00008ULL, 0x0800000304400000ULL, 0x0208000000c00000ULL, 0x2888300080400800ULL, 0x8dc0204400000000ULL, 0xc0000000c0800000ULL, 0x0000c10000000000ULL, 0x24000c4010c00000ULL, 0x272000541d811000ULL, 0x0200400000001000ULL, 0x0400000400001004ULL, 0xc08c007004001000ULL, 0x2048004000000000ULL, 0x000000000003fcfcULL, 0x2aa030000cf8c800ULL, 0xe280000000000000ULL, 0x0a21008142000340ULL, 0x0021002000b61040ULL, 0x800004064006d444ULL, 0x3aa0800300230008ULL, 0x0b00030000300000ULL, 0x0000000000000000ULL, 0x01c080000000040cULL, 0x0100000000004000ULL, 0x0aa8018010001000ULL, 0x0800000000100000ULL, 0x3000000000008c00ULL, 0x5400000013000000ULL, 0x02c0c00004004010ULL, 0x5241100010000c00ULL, 0x0e00080000000808ULL, 0x5281000000000800ULL, 0x0a08108020000800ULL, 0x0a80000000005210ULL, 0x0100000041000000ULL, 0x2a88000002080110ULL, 0x8520800000c00080ULL, 0x01000010108c0100ULL, 0x0000000000000000ULL, 0x42a0420080000000ULL, 0x0020001004010010ULL, 0xc4000000000c0000ULL, 0x01000c00c0200400ULL, 0x4600000100000000ULL, 0x0000000000000000ULL, 0x0010001000000010ULL, 0x910400900820d030ULL, 0x2280000000000000ULL, 0xc2212004400040e4ULL, 0x8001000000b61420ULL, 0xa00002a248e810b4ULL, 0x32008000002c0008ULL, 0x0c010034803c5010ULL, 0x0000000000000000ULL, 0x85008002002c0000ULL, 0x0204001000004010ULL, 0x0120008000200000ULL, 0x000010000c2000c0ULL, 0xccc0000000200000ULL, 0x0400000c00100040ULL, 0x0003300100004100ULL, 0x4000551040000004ULL, 0x0e0080000c820808ULL, 0xc000000000080800ULL, 0xc803000000000000ULL, 0x0a4000c000200000ULL, 0x0040000000c00000ULL, 0x0918145000405000ULL, 0x81400000c0300400ULL, 0x0050000000000000ULL, 0xd000045000000000ULL, 0x0400004000400000ULL, 0x0420104010000110ULL, 0x0700000000203000ULL, 0x34800300c0e00704ULL, 0x4440100044000400ULL, 0x0040000040000000ULL, 0x0030000044000000ULL, 0xeaaca0008808c880ULL, 0x0a01000000200000ULL, 0x1220a300403ccf20ULL, 0x002024c200b61044ULL, 0x802014346aa2d434ULL, 0x30008c00c0820c44ULL, 0x0a000000000c4800ULL, 0x0000000000000000ULL, 0x0000404000340c90ULL, 0x08a8a10820800280ULL, 0x8128009022201000ULL, 0x0020808228a000a0ULL, 0x0020400100410000ULL, 0x0400000110000000ULL, 0xa609000000200000ULL, 0x8008330000d00000ULL, 0x8060100040404010ULL, 0xeaa00ea0ea00808cULL, 0x200c8020a0000020ULL, 0x0408800020200000ULL, 0x0189001403200000ULL, 0xc00800000000c000ULL, 0x200430c00c300000ULL, 0x0100300100004000ULL, 0x0000040000000000ULL, 0x2420000400001000ULL, 0x89a1200400000000ULL, 0x20c8a000208c0000ULL, 0x8080000000000000ULL, 0x28a0108020210080ULL, 0xa2a84800a0880988ULL, 0x258008000400c000ULL, 0x0140000000100000ULL, 0xa028a222a0aa0228ULL, 0xc060012054044040ULL, 0x0010010400000000ULL, 0x00000050150c0114ULL, 0x0000008010c20010ULL, 0xaa088000a0200880ULL, 0x0000000000000000ULL, 0x0700b0c0000c0000ULL, 0x2200040000080030ULL, 0x2aa8808040240800ULL, 0x08b0500000000100ULL, 0x1000830400200000ULL, 0x4204000010000000ULL, 0x40c2200050040050ULL, 0x0104404001010000ULL, 0x1a808c8103c00030ULL, 0x30900010c0000b00ULL, 0x200812b283000008ULL, 0x000c000020e00000ULL, 0x2140000000400000ULL, 0x0288000080200000ULL, 0x8060a200c8a20280ULL, 0x0400114010215000ULL, 0x0000000000000000ULL, 0x082b200002000010ULL, 0x22a0030000031000ULL, 0x008100001000000cULL, 0x05400c00c0230400ULL, 0xca3000003c080100ULL, 0x0000000020000004ULL, 0x0000000100000000ULL, 0x8004320813f5c000ULL, 0xa280080200000800ULL, 0xc22000044e334c20ULL, 0x000004146e361024ULL, 0x800126806aa0d584ULL, 0xb000a0040023c41cULL, 0x0a083000803053d8ULL, 0x0000000000000000ULL, 0x0000100000020000ULL, 0x0000000010000010ULL, 0x0000000045040004ULL, 0x0000000000100000ULL, 0x0000020400000010ULL, 0x0003015000000000ULL, 0x0400000000000000ULL, 0x0000000400000000ULL, 0x0100000000000800ULL, 0x0000001000000000ULL, 0x0000000000000000ULL, 0x0000000040000000ULL, 0x0000000000000000ULL, 0x0004001000000000ULL, 0x0008001000000000ULL, 0x0010000000000004ULL, 0x0000010100001000ULL, 0x0004000000000004ULL, 0x0000014040050014ULL, 0x0014000000000040ULL, 0x5540000000041000ULL, 0x0000000000000000ULL, 0x0000040000000d00ULL, 0x0000000000000000ULL, 0x0000000000100000ULL, 0x0001000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x4500000000040400ULL, 0x0000800000000400ULL, 0x0000000000000000ULL, 0x13e080000020000cULL, 0xcf00001005100000ULL, 0x04a8008000200300ULL, 0x00280100100000c0ULL, 0x1c8c000040200000ULL, 0x0600005000100000ULL, 0x050800000c104000ULL, 0x4c10101000110000ULL, 0x0c00000000300000ULL, 0x22040c00100000c0ULL, 0x0800700010100000ULL, 0x0000000000001000ULL, 0x0a08000010000040ULL, 0x0800034004210010ULL, 0x04e0000400000000ULL, 0x0800030020000000ULL, 0x0000005000000000ULL, 0x0400110101304110ULL, 0x0428000010a01000ULL, 0x060b000000800010ULL, 0x35810c00c020c000ULL, 0x00800c4321800000ULL, 0x4208088020000080ULL, 0x040000111003ff00ULL, 0x0020900020202080ULL, 0x22888180a8000888ULL, 0x0225200542005420ULL, 0x2020040400340020ULL, 0x10300424500cc444ULL, 0x3081a00400e00200ULL, 0x33001300c0300000ULL, 0x0000000000000000ULL, 0x04003c0000000000ULL, 0x0a04001000100100ULL, 0x1408000001000000ULL, 0x1800000044100000ULL, 0x3400040400000300ULL, 0x5000040801000040ULL, 0x4088401040000040ULL, 0x1010110130100000ULL, 0xca800c3000300000ULL, 0x5a01000000080100ULL, 0x020280000cd01300ULL, 0x0302000410200010ULL, 0x0000102000300000ULL, 0x0b09000000000000ULL, 0x20008004c4800004ULL, 0x28c0410010000000ULL, 0x0004015041000050ULL, 0x0a01006000200200ULL, 0x0020d00000100040ULL, 0x0010a00100900000ULL, 0x3500bf00c0030300ULL, 0x080c010000200d00ULL, 0x2248000004020010ULL, 0x0000c00000000000ULL, 0x8044b00200e08000ULL, 0xaaa82aa2aa8a2aa8ULL, 0x0220002241c08604ULL, 0x4200260440328444ULL, 0x68001226103008b4ULL, 0x3a0080c0b0000400ULL, 0x2a804804803c4008ULL, 0x0000000000000000ULL, 0x04008c0300000400ULL, 0x008000c0000c0000ULL, 0x088001000000001cULL, 0x0840000001000010ULL, 0x0400000000200c00ULL, 0x4244000101040000ULL, 0x4238007011100000ULL, 0x1000d00100000010ULL, 0x1d00800400300000ULL, 0x4204080c00000000ULL, 0x2a88080080000008ULL, 0x08001c0200001000ULL, 0x0a00000400000000ULL, 0x8a88003080080000ULL, 0x0521800400300000ULL, 0x3200051000201000ULL, 0x0000000000000000ULL, 0x0020801404000000ULL, 0x322010401c0c101cULL, 0x0c01100013000000ULL, 0x04003000c0204000ULL, 0x088c0020a0cc0000ULL, 0x2200000080000018ULL, 0x0404000044000000ULL, 0x82a0b000008820b0ULL, 0x0000040020440000ULL, 0xc2650004403f1420ULL, 0x0021340241b64464ULL, 0x8020040242c2d474ULL, 0x32018c0480288000ULL, 0x00800b0080300000ULL, 0x0000000000000000ULL, 0x05008c0000040130ULL, 0xc0d8000000800000ULL, 0x0020000020200200ULL, 0x23a2000120204000ULL, 0x5052100550104150ULL, 0x1000101100040000ULL, 0xc40001c301000000ULL, 0x8288000000c00000ULL, 0x5150040144d01404ULL, 0xea8c0ea028ae088cULL, 0xc31010c000000c80ULL, 0x0002000060000000ULL, 0xc80800f030000000ULL, 0x0000000400300000ULL, 0xc00080c00ff0c344ULL, 0x00080001200c0000ULL, 0x0000050080000000ULL, 0x0328000300300000ULL, 0x082030000cc01040ULL, 0xeb08800100004000ULL, 0x8030003300c80f00ULL, 0xfb0d0000e4ac0000ULL, 0x0020006080000008ULL, 0x0500100100040000ULL, 0x1140000000000000ULL, 0xcb883330a0e00000ULL, 0xc000010050000080ULL, 0x0010104005b54150ULL, 0x40111d5155001554ULL, 0x80000070140f0004ULL, 0x0b0830c3a0003380ULL, 0x0000000000000000ULL, 0x04c13000000f830cULL, 0x2808000000000000ULL, 0x2810000000000800ULL, 0x08c0080004400000ULL, 0x04c0240300801c20ULL, 0x4040000080000004ULL, 0x0000400100100010ULL, 0x020001008000c0c0ULL, 0x1d008c000c3c0000ULL, 0x0080003000000800ULL, 0x2288080080000008ULL, 0x0a84004020220000ULL, 0x0800080000100000ULL, 0xaa80004080400008ULL, 0x8024000400c01660ULL, 0x80841c2001000104ULL, 0x0001000000000000ULL, 0x0020028020020280ULL, 0x0860404011900100ULL, 0xec80080200000000ULL, 0x010103c100200400ULL, 0x0200004000000000ULL, 0x0000000000400400ULL, 0x000010000003fcfcULL, 0x8040083238c20000ULL, 0x08800220a0920a00ULL, 0x08210004483c0c24ULL, 0xc020240740b0a200ULL, 0x802006014a201494ULL, 0x3201233070ac0e00ULL, 0x08002806033a48a0ULL, 0x0000000000000000ULL, 0x8020820028a00680ULL, 0x2000002000000104ULL, 0x22a80801100a0808ULL, 0xa2a8002080000000ULL, 0xa000800008a08000ULL, 0x0000100000400000ULL, 0x8000002100000000ULL, 0x0000010000004404ULL, 0xa2a0088080000888ULL, 0x0000000010400800ULL, 0xa280082080080008ULL, 0x2280000080010008ULL, 0x2000000000000000ULL, 0x228800008c080808ULL, 0x8021828002a98200ULL, 0xa200002000080000ULL, 0x0000040000000000ULL, 0x22a0000080000000ULL, 0x202882c200800080ULL, 0xa000000001004000ULL, 0x000000c808a00600ULL, 0x0000000010000000ULL, 0x000001000000040cULL, 0x0000000000000000ULL, 0x802002a2a8aa82a0ULL, 0x20000024a8088228ULL, 0x8020820001000000ULL, 0x8020000000808280ULL, 0x8000000000000000ULL, 0x0020800000200280ULL, 0x2080082280a00888ULL, 0x0000000000000000ULL, 0x0000015000000040ULL, 0x0000040000040000ULL, 0x0100010010001000ULL, 0x0000003210008000ULL, 0x0000000404000000ULL, 0x0000000000000400ULL, 0x0200000000000000ULL, 0x0000000000000100ULL, 0x5180014400004050ULL, 0x1000000014000000ULL, 0x4200000000000000ULL, 0x0040200000000000ULL, 0x0201004000000000ULL, 0x0a00000000000010ULL, 0x0040200000800000ULL, 0x0040051000000500ULL, 0x0000000100800400ULL, 0x6000000000000000ULL, 0x0000000000000000ULL, 0x280000c1400040ccULL, 0x4180001000000000ULL, 0x00000000c1000104ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0080000000c00000ULL, 0x0004006066004000ULL, 0x0000005000040440ULL, 0x0000106005804044ULL, 0x0000a10511004440ULL, 0x0000000000000110ULL, 0x0000000000000000ULL, 0x0000000000080000ULL, 0xeb0808a020800080ULL, 0x29a80081002a1800ULL, 0x0b2c000202100100ULL, 0x0001000000888000ULL, 0x2280102010000000ULL, 0x020000602a004110ULL, 0x8a800160a6108100ULL, 0x0280000000000020ULL, 0x8a8000a0a8808208ULL, 0x0280882080500308ULL, 0x0b18010020804100ULL, 0xeb080000c0080080ULL, 0x2b08000000810130ULL, 0x0000000008040020ULL, 0xaa0a08e082894140ULL, 0x0000000000000000ULL, 0x202081409010001cULL, 0x8aa8805082806000ULL, 0xeb082900289c0000ULL, 0x0000000000008000ULL, 0xf80c2e20002e0000ULL, 0xa288080420880888ULL, 0x0000010000000000ULL, 0x0000000000102000ULL, 0x22880000a8a80808ULL, 0x022022a22aa880a0ULL, 0x0000222222aa0620ULL, 0x0000022002800000ULL, 0x208080004028a000ULL, 0x2b888800801c0828ULL, 0x0000000000000000ULL, 0x22e0828280a08028ULL, 0xaa88002082080308ULL, 0x0ea80080410a0040ULL, 0x2a28222000a00000ULL, 0x8aa2808028a0a2a0ULL, 0x0200001000000000ULL, 0x82080000a0000000ULL, 0x8800000082000808ULL, 0x2a008a0000300888ULL, 0x0a80080080080808ULL, 0xaa882800840b0808ULL, 0x0a80000080000040ULL, 0xea080820a0000000ULL, 0xaa88080080080808ULL, 0x8040a2800a8024a0ULL, 0xaa800020a0080808ULL, 0x0000040000000000ULL, 0x2a280a0080080880ULL, 0x2a20081080008a00ULL, 0x2a88882088aa0008ULL, 0x81800202c0a01480ULL, 0xea88082082200000ULL, 0xaa88002080080008ULL, 0x0000100000000000ULL, 0x802082a22aa0a2a0ULL, 0x2e80000000000000ULL, 0x0220a2a26aa0a2a8ULL, 0x800022a2228a22a0ULL, 0x880002212e82c0b0ULL, 0x02a0aa0002a82228ULL, 0x2d808b0080380008ULL, 0x0000000000000000ULL, 0x000407551c154244ULL, 0x2a00208088a02228ULL, 0x12a82182a2402a88ULL, 0xe32821e020826d00ULL, 0x801130100ccc1330ULL, 0x028010c000841008ULL, 0x88a08002a0a664a0ULL, 0x0048270080000100ULL, 0x00001f010cd10f30ULL, 0xe2242ce22aaea2a0ULL, 0xc2c00cc20ae22460ULL, 0xe208003128021c10ULL, 0x2a2021c010821080ULL, 0x2a88202082202020ULL, 0x4010111104941410ULL, 0xc80c02c182b00080ULL, 0x0000040000000000ULL, 0xe28030068002c300ULL, 0x2aa02024a2a22228ULL, 0xe20889328aa22080ULL, 0x0000000000210100ULL, 0xaa0028e0a9b221a0ULL, 0x2000008080400000ULL, 0x0000010041150404ULL, 0x0000105114410100ULL, 0xeaa82aa6aaaaaaa8ULL, 0x000000f44300c434ULL, 0x0000222222b00020ULL, 0x0000002000000000ULL, 0x0000004014000000ULL, 0x0039b3f73fbcd3fcULL, 0x0000000000000000ULL, 0x0000104015045040ULL, 0x20a80490a08800a0ULL, 0x40a8258410a909a0ULL, 0xe0a8a2022aa2e2a0ULL, 0xc111010014000500ULL, 0x2080044041840004ULL, 0x28a8200220a2aba0ULL, 0x008400a0a2840800ULL, 0x0101015451009464ULL, 0x20000ea0e02c2c2cULL, 0xe2a828a2aca2aaa8ULL, 0x682020a228a222a0ULL, 0xe8882ae22aa2a2a0ULL, 0xe9a80e6022a24140ULL, 0x0011055005001040ULL, 0x2aa8208229a0aaa4ULL, 0x0000040000000000ULL, 0x28a0228026a62260ULL, 0xe2a020a422a2a020ULL, 0xe808a0022aa1a220ULL, 0x0000010014000100ULL, 0x28ac22802aa2a020ULL, 0x0020000000000000ULL, 0x0100010100040000ULL, 0x0000000000000000ULL, 0x22a822a22a8aaaa0ULL, 0x0000000000000000ULL, 0x0000102410800100ULL, 0x0000000000000000ULL, 0x0000000002000000ULL, 0x00000fb2a08c0aa8ULL, 0x0000000000000000ULL, 0x4010005015440140ULL, 0x18c81c00b180001cULL, 0x2800048021820800ULL, 0x8ab820c06a802580ULL, 0x00100170f4040000ULL, 0x4000144041041404ULL, 0x0ac800d0002e440cULL, 0x20880820a2000808ULL, 0x400000f03f300c00ULL, 0xaa000ea22aa22aa0ULL, 0xa2880ac0a8942a20ULL, 0xaa880a81a1804188ULL, 0xeea022a0aaa02080ULL, 0xaaa820a2aaa66120ULL, 0x0000005115800150ULL, 0x2a880920a0840040ULL, 0x0000040000000000ULL, 0xaea82222aaa22a28ULL, 0x8a28041260055150ULL, 0xa28824008aa28880ULL, 0x0000025014019000ULL, 0xea882ae02aa200a0ULL, 0x0000000000000000ULL, 0x0000000040000400ULL, 0x0000000000000000ULL, 0xaaa82aa22aaaaaa0ULL, 0x0000000000000000ULL, 0x0000000000000000ULL, 0x002003003c80c000ULL, 0x0000020014000000ULL, 0x00200010a0980a20ULL, 0x0000000000000000ULL, 0x0020001200801240ULL, 0x0a88000089800020ULL, 0xcaa00080a1000000ULL, 0x0a200c0020a04080ULL, 0x4002034003840880ULL, 0x4690500190000050ULL, 0x2228004000601000ULL, 0x0a803f00803f400cULL, 0x400033e24dd0cf34ULL, 0xaa80a2a229a220a0ULL, 0x0a224000002c0000ULL, 0x028000202000008cULL, 0x0a08000070000030ULL, 0x00800c040020000cULL, 0x0000000002850000ULL, 0x02881cc310200000ULL, 0x0000040004000000ULL, 0xcba8000400000080ULL, 0xcaa02c0680000000ULL, 0xcc880002008c4080ULL, 0x300000f007f0cf0cULL, 0x0a80001080a00000ULL, 0x820880802a880a80ULL, 0x0000050001040004ULL, 0x0000011000000000ULL, 0x0a8020a2a0202000ULL, 0x0000022202008000ULL, 0x0000222212808000ULL, 0x0020226010000000ULL, 0x000033f33ff3c33cULL, 0x00288002a08c02a8ULL, 0x0000000000000000ULL, 0x04408e0000008200ULL, 0x0808004000900000ULL, 0x0aa8200010ca00c0ULL, 0x0ba80101005d4010ULL, 0x00018604802c8288ULL, 0x00049400101c0000ULL, 0x000c101110505010ULL, 0x0000000000100000ULL, 0x30000c00c022000cULL, 0xd0c00dd0d51d431cULL, 0x0008000010100000ULL, 0x000c1001a0280000ULL, 0x0bc80000c0000000ULL, 0x0a00000080280000ULL, 0x8000a00220308420ULL, 0x0808000010301000ULL, 0x0000040000000000ULL, 0x0d00031480100000ULL, 0x07200000108c0300ULL, 0x0bc0a0c000004000ULL, 0x8000b002c0208480ULL, 0x340c0100118c111cULL, 0x8008008020890000ULL, 0x0000000000040010ULL, 0x0020b00320c1d0b0ULL, 0x00002000000c0000ULL, 0x0020be226e2008a0ULL, 0x002010c03fb0a6a0ULL, 0x00202e222aaec284ULL, 0x00008f0000208400ULL, 0x0000000000300000ULL, }; // Latin1 6%, Latin2 11%, Latin7 3% // Just for debugging. not thread-safe static char tri_string[4]; char* Latin127Str(int trisub) { tri_string[0] = "_abcdefghijklmnopqrstuvwxyzAEIOC"[(trisub >> 10) & 0x1f]; tri_string[1] = "_abcdefghijklmnopqrstuvwxyzAEIOC"[(trisub >> 5) & 0x1f]; tri_string[2] = "_abcdefghijklmnopqrstuvwxyzAEIOC"[(trisub >> 0) & 0x1f]; tri_string[3] = '\0'; return tri_string; } // Returns two bits per three-byte trigram, indicating // dont-care, Latin1 likely, Latin2 likely, and Latin7 (ISO-8859-13) likely int TrigramValue(const uint8* trisrc) { int byte0_p = kMapToFiveBits[trisrc[0]]; int byte1_p = kMapToFiveBits[trisrc[1]]; int byte2_p = kMapToFiveBits[trisrc[2]]; int subscr = ((byte0_p) << 5) | byte1_p; int temp = static_cast((kLatin127Trigrams[subscr] >> (byte2_p * 2))); //printf("%s=%d ", Latin127Str((subscr << 5) | byte2_p), temp & 3); return temp & 3; } // Put out trigrams for surrounding 32 bytes for Latin encodings // Return true if more Latin2 & 7 than Latin1 bool BoostLatin127Trigrams(int tri_block_offset, DetectEncodingState* destatep) { //printf("BoostLatin127Trigrams[%06x]\n", tri_block_offset); int excess_latin27 = 0; int srclen = destatep->limit_src - destatep->initial_src; int hi_limit = minint(tri_block_offset + 32, srclen - 2); const uint8* trisrc = &destatep->initial_src[tri_block_offset]; const uint8* trisrclimit = &destatep->initial_src[hi_limit]; while (trisrc < trisrclimit) { // Selectively boost Latin1, Latin2, or Latin7 and friends int trigram_val = TrigramValue(trisrc); if (trigram_val != 0) { if (FLAGS_enc_detect_source) { PsHighlight(trisrc, destatep->initial_src, trigram_val, 1); } if (trigram_val == kTriLatin1Likely) { Boost(destatep, F_Latin1, kTrigramBoost); Boost(destatep, F_CP1252, kTrigramBoost); // We don't want to upset the relative rank of a declared 8859-15 Boost(destatep, F_ISO_8859_15, kTrigramBoost); --excess_latin27; } else if (trigram_val == kTriLatin2Likely) { Boost(destatep, F_Latin2, kTrigramBoost); Boost(destatep, F_CP1250, kTrigramBoost); ++excess_latin27; } else if (trigram_val == kTriLatin7Likely) { Boost(destatep, F_ISO_8859_13, kTrigramBoost); Boost(destatep, F_CP1257, kTrigramBoost); // We don't want to upset the relative rank of a declared 8859-4 or -6 // for Estonian Boost(destatep, F_Latin4, kTrigramBoost); Boost(destatep, F_Latin6, kTrigramBoost); ++excess_latin27; } } ++trisrc; } //printf("\n"); return (0 < excess_latin27); } // Boost any encodings that need extra detection help, then prune // src is first unscanned byte // slowend means extra pruning when dropping out of initial slow scan // final means last call -- no bigram at src void BoostPrune(const uint8* src, DetectEncodingState* destatep, int prunereason) { int delta_asciipairs = destatep->next_interesting_pair[AsciiPair] - destatep->prior_interesting_pair[AsciiPair]; int delta_otherpairs = destatep->next_interesting_pair[OtherPair] - destatep->prior_interesting_pair[OtherPair]; if (prunereason == PRUNE_FINAL) { // We are about done // If we get here with very little accumulated data, the initial hints // were too strong, so we derate them to n+1 / 12 for n bigrams if (!destatep->hints_derated && (destatep->next_interesting_pair[OtherPair] < kDerateHintsBelow)) { int n = destatep->next_interesting_pair[OtherPair]; // Map N pairs to (N+1)/12 portions of the initial hints, etc. // Floor of 3/12 -- 1/12 and 2/12 are too easy to overcome int m = maxint(3, (n + 1)); for (int i = 0; i < NUM_RANKEDENCODING; ++i) { int original_delta = destatep->hint_prob[i]; int scaled_delta = (original_delta * m) / kDerateHintsBelow; destatep->enc_prob[i] -= original_delta; destatep->enc_prob[i] += scaled_delta; } destatep->hints_derated = true; if (destatep->debug_data != NULL) { // Show derated-hint result char buff[32]; snprintf(buff, sizeof(buff), "Hints %d/%d", m, kDerateHintsBelow); SetDetailsEncLabel(destatep, buff); } } } ++destatep->prune_count; if (prunereason != PRUNE_FINAL) { // Early outs if (destatep->rankedencoding_list_len <= 1) { // nothing to prune destatep->done = true; return; } if ((destatep->prune_count > 0) && (delta_asciipairs + delta_otherpairs) == 0) { // Nothing to do; must have just been called earlier return; } } // INCREMENT // ==================== // Accumulate OtherPair probibilities over all active families // AsciiPair probibilities are all done in ActiveSpecialBoostWhack uint8 prior_bad_byte1 = ' '; // won't match first bad pair uint8 prior_bad_byte2 = ' '; // won't match first bad pair uint8 or_byte1 = 0; // Track if any current pair has a high bit int counted_otherpairs = 0; uint8 prior_byte1x2x = 0; for (int i = 0; i < delta_otherpairs; ++i) { int watch1_incr = 0; int watch2_incr = 0; int next_pair = destatep->prior_interesting_pair[OtherPair] + i; uint8 byte1 = destatep->interesting_pairs[OtherPair][next_pair * 2 + 0]; uint8 byte2 = destatep->interesting_pairs[OtherPair][next_pair * 2 + 1]; uint8 byte1x2x = (byte1 & 0xf0) | ((byte2 >> 4) & 0x0f); int weightshift = destatep->interesting_weightshift[OtherPair][next_pair]; int offset_byte12 = destatep->interesting_offsets[OtherPair][next_pair]; // To help distinguish some Cyrillic, Arabic, Greek, Hebrew, Thai // Remember if this is a CDEF pair immediately following the previous pair // 8xxx CxCx or CxCx 8xxx bool next_pair_consec_hi = false; if (ConsecutivePair(destatep, next_pair)) { if ((byte1x2x & 0xcc) == 0xcc) { // 8xxx CxCx next_pair_consec_hi = true; } else if ((prior_byte1x2x & 0xcc) == 0xcc) { // CxCx 8xxx next_pair_consec_hi = true; } } //printf("prior/cur/consec %02x %02x %d\n", // prior_byte1x2x, byte1x2x, next_pair_consec_hi); prior_byte1x2x = byte1x2x; or_byte1 |= byte1; uint8 byte1f = byte1; // Flip top bit of subscript to better separate quadrant 4 (esp. for Hebrew) byte1f ^= (byte2 & 0x80); // If the same bigram occurred recently, don't increment again bool pair_used = false; if (!RepeatedBigram(destatep, byte1, byte2)) { ++counted_otherpairs; pair_used = true; // Boost both charset= declared encodings, so // Nearly-same probability nearby encoding doesn't drift to the top if (!FLAGS_demo_nodefault) { destatep->enc_prob[destatep->declared_enc_1] += kDeclaredEncBoost >> weightshift; destatep->enc_prob[destatep->declared_enc_2] += kDeclaredEncBoost >> weightshift; } bool was_bad_pair = false; for (int j = 0; j < destatep->rankedencoding_list_len; j++) { int incr_shift = 0; int rankedencoding = destatep->rankedencoding_list[j]; Encoding enc = kMapToEncoding[rankedencoding]; // For binary, Skip over repeated marker bytes, such as 02, FF, etc. if ((rankedencoding == F_BINARY) && RepeatedBinary(destatep, byte1, byte2)) { incr_shift = 2; // count 1/4 as much if repeated } // If byte 1x2x for this encoding is exactly zero, illegal byte pair // Don't increment, but instead penalize const UnigramEntry* ue = &unigram_table[rankedencoding]; if (ue->b12[byte1x2x] == 0) { // Don't whack consecutive duplicate bad pairs -- overkill if ((byte1 != prior_bad_byte1) || (byte2 != prior_bad_byte2)) { // Extra whack for illegal pair in this encoding Whack(destatep, rankedencoding, kBadPairWhack >> weightshift); was_bad_pair = true; } } else { // OK to do the real increment int incr = ue->b1[byte1f] + ue->b2[byte2] + ue->b12[byte1x2x]; if ((ue->b12[byte1x2x] & 0x01) != 0) { // Use a more-precise table int byte32x32 = ((byte1 & 0x1f) << 5) | (byte2 & 0x1f); int hiressub = (byte2 & 0x60) >> 5; // select w/bits 5&6 of byte 2 DCHECK(ue->hires[hiressub] != NULL); incr += ue->hires[hiressub][byte32x32]; } else { // Default final offset incr += ue->so; } incr >>= incr_shift; incr >>= weightshift; destatep->enc_prob[rankedencoding] += incr; // The actual increment if (FLAGS_enc_detect_detail2) { if (watch1_rankedenc == rankedencoding) {watch1_incr = incr;} if (watch2_rankedenc == rankedencoding) {watch2_incr = incr;} } } // If consecutive pair of high bytes, give slight boost to one-byte // encodings that have a full alphabet in the high bytes if (next_pair_consec_hi && HighAlphaEncoding(enc)) { Boost(destatep, rankedencoding, kDeclaredEncBoost >> weightshift); } } // End for j < rankedencoding_list_len if (was_bad_pair) { prior_bad_byte1 = byte1; prior_bad_byte2 = byte2; } // Fold in per-bigram most likely encoding for first N bigrams if (next_pair < kBestPairsCount) { int best_enc = kMostLikelyEncoding[(byte1 << 8) + byte2]; Boost(destatep, best_enc, kBestEncBoost >> weightshift); } // Possibly score 32 trigrams around a bigram to better separate // Latin1 from Latin2 and Latin7. Especially helpful for detecting // mis-labelled Hungarian latin2. // If looking and at bigram 0,8,16,... do full scoring, else just 1 tri if (destatep->do_latin_trigrams || destatep->looking_for_latin_trigrams) { // If just looking, do full scan every 8 times // Just look up one trigram the other 7 and do full scan if Latin2,7 bool scan32 = false; const uint8* trisrc = &destatep->initial_src[offset_byte12 - 1]; if (!destatep->do_latin_trigrams) { if ((i & 7) == 0 || trisrc + 3 > destatep->limit_src) { scan32 = true; } else { scan32 = (kTriLatin1Likely < TrigramValue(trisrc)); } } if (destatep->do_latin_trigrams || scan32) { // Just score each block of 32 bytes once int tri_block_offset = offset_byte12 & ~0x1f; if (destatep->trigram_highwater_mark <= tri_block_offset) { bool turnon = BoostLatin127Trigrams(tri_block_offset, destatep); if (FLAGS_counts && !destatep->do_latin_trigrams && turnon) { ++doing_used; // First time } if (FLAGS_enc_detect_source) { if (!destatep->do_latin_trigrams && turnon) { // First time PsHighlight(trisrc, destatep->initial_src, 0, 2); } } destatep->do_latin_trigrams |= turnon; destatep->trigram_highwater_mark = tri_block_offset + 32; } } } } // end if RepeatedBigram() // Keep track of initial byte high 3 bits ++destatep->byte32_count[byte1 >> 5]; // TODO: boost subset/superset also // Boost(destatep, kRelatedEncoding[best_enc], kBestEncBoost); if (destatep->debug_data != NULL) { // Show detail entry for this bigram char buff[16]; snprintf(buff, sizeof(buff), "%c%02x%02x%c%c", pair_used ? ' ' : '[', byte1, byte2, pair_used ? ' ' : ']', (weightshift == 0) ? ' ' : '-'); SetDetailsEncProb(destatep, destatep->interesting_offsets[OtherPair][next_pair], kMostLikelyEncoding[(byte1 << 8) + byte2], buff); } if (FLAGS_enc_detect_detail2) { if ((watch1_incr != 0) || (watch2_incr != 0)) { // Show increment detail for this encoding char buff[32]; snprintf(buff, sizeof(buff), "%c%d %c%d", (watch1_incr < 0) ? '-' : '+', watch1_incr, (watch2_incr < 0) ? '-' : '+', watch2_incr); SetDetailsEncLabel(destatep, buff); } } } // End for i // If no high bit on, demote all the two-byte codes // WAS BUG. This was inside the loop above and should be outside if ((counted_otherpairs > 0) && ((or_byte1 & 0x80) == 0)) { // No high bit in this group (just 02xx, etc.). Whack 2-byte codes // This keeps SJS from creeping past Latin1 on illegal C0 bytes for (int j = 0; j < destatep->rankedencoding_list_len; j++) { int rankedencoding = destatep->rankedencoding_list[j]; Encoding enc = kMapToEncoding[rankedencoding]; if (TwoByteEncoding(enc)) { Whack(destatep, rankedencoding, kGentlePairWhack * counted_otherpairs); } } } // BOOST // ==================== if (AnyActive(destatep)) { ActiveSpecialBoostWhack(src, destatep); } // Update for next time destatep->prior_src = src; destatep->prior_interesting_pair[AsciiPair] = destatep->next_interesting_pair[AsciiPair]; destatep->prior_interesting_pair[OtherPair] = destatep->next_interesting_pair[OtherPair]; // Do any pre-prune final adjustments // ==================== if (prunereason == PRUNE_FINAL) { // If UTF8 not in base state, whack if (destatep->next_utf8_ministate != 0) { Whack(destatep, F_UTF8, kGentlePairWhack * 2 * 1); } // If UTF8UTF8 not in base state, whack if (destatep->next_utf8utf8_ministate != 0) { Whack(destatep, F_UTF8UTF8, kGentlePairWhack * 2 * 1); } // If no valid UTF-8 char ever seen, whack if (destatep->utf8_minicount[5] == 0) { Whack(destatep, F_UTF8, kBadPairWhack * 8); // No sequence Whack(destatep, F_UTF8UTF8, kBadPairWhack * 8); // No sequence } // If no valid UTF8UTF8 char ever seen, whack if (destatep->utf8utf8_minicount[5] == 0) { Whack(destatep, F_UTF8UTF8, kBadPairWhack * 8); // No sequence } // If not all four binary quadrants, whack BINARY; // worth 2 pair if 3 quads, 4 pair if 1 or 2 quads if (destatep->binary_quadrants_count < 4) { if (destatep->binary_quadrants_count == 3) { Whack(destatep, F_BINARY, kBadPairWhack * 2); } else { Whack(destatep, F_BINARY, kBadPairWhack * 4); } } // If 1st pair is 1b24, choose between ISO-2022-xx // $ ) C ISO-2022-KR [1b 24 29 43] // $ ) A ISO-2022-CN [1b 24 29 41] // $ ) G ISO-2022-CN [1b 24 29 47] // $ * H ISO-2022-CN [1b 24 2a 48] // ( B ISO-2022-JP [1b 28 42] to ASCII // ( J ISO-2022-JP [1b 28 4a] to X0201 // $ @ ISO-2022-JP [1b 24 40] to X0208-78 twobyte // $ B ISO-2022-JP [1b 24 42] to X0208-83 twobyte if ((destatep->next_interesting_pair[OtherPair] >= 1) && Iso2022Active(destatep)) { if ((destatep->interesting_pairs[OtherPair][0] == 0x1b) && (destatep->interesting_pairs[OtherPair][1] == 0x24)) { int offset = destatep->interesting_offsets[OtherPair][0]; const uint8* esc_src = destatep->initial_src + offset; if ((destatep->initial_src + offset) < (destatep->limit_src - 3)) { if ((esc_src[2] == ')') && (esc_src[3] == 'C')) { Boost(destatep, F_ISO_2022_KR, kBoostOnePair); Whack(destatep, F_ISO_2022_CN, kBadPairWhack); Whack(destatep, F_JIS, kBadPairWhack); } else if ((esc_src[2] == ')') && ((esc_src[3] == 'A') || (esc_src[3] == 'G'))) { Boost(destatep, F_ISO_2022_CN, kBoostOnePair); Whack(destatep, F_ISO_2022_KR, kBadPairWhack); Whack(destatep, F_JIS, kBadPairWhack); } else if ((esc_src[2] == '@') || (esc_src[2] == 'B')) { Boost(destatep, F_JIS, kBoostOnePair); Whack(destatep, F_ISO_2022_CN, kBadPairWhack); Whack(destatep, F_ISO_2022_KR, kBadPairWhack); } } else { // Incomplete escape sequence. Whack them all Whack(destatep, F_JIS, kBadPairWhack); Whack(destatep, F_ISO_2022_CN, kBadPairWhack); Whack(destatep, F_ISO_2022_KR, kBadPairWhack); } } } if (destatep->debug_data != NULL) { SetDetailsEncLabel(destatep, "pre-final"); } } // PRUNE // ==================== // Find current top two rankedencoding probabilities ReRank(destatep); if (prunereason == PRUNE_SLOWEND) { if (destatep->debug_data != NULL) { SetDetailsEncLabel(destatep, "slow-end"); } } // Keep every rankedencoding with probablity >= top_prob - prune_difference int prune_diff = destatep->prune_difference; // If the top encoding is BINARY, it might be overstated, and we might // therefore prune away the real encoding. Make the pruning delta // twice as big. if (destatep->top_rankedencoding == F_BINARY) { prune_diff *= 2; } int keep_prob = destatep->top_prob - prune_diff; // Tighten pruning difference (we start wide) for next time if (destatep->prune_difference > kFinalPruneDifference) { int decrement = kPruneDiffDecrement; // If only ASCII pairs, small tighten; if some non-ASCII, full tighten if (counted_otherpairs == 0) { decrement >>= 1; } destatep->prune_difference -= decrement; } // Prune the list of active encoding families destatep->active_special = 0; int k = 0; for (int j = 0; j < destatep->rankedencoding_list_len; j++) { bool keep = true; int rankedencoding = destatep->rankedencoding_list[j]; // If count is too low, ditch it if (destatep->enc_prob[rankedencoding] < keep_prob) { keep = false; } // If at end of slow section, ditch any 7-bit with zero evidence so far if ((prunereason == PRUNE_SLOWEND) && SevenBitEncoding(kMapToEncoding[rankedencoding]) && (destatep->enc_prob[rankedencoding] <= 0) && (rankedencoding != destatep->top_rankedencoding)) { keep = false; } // Keep it. This will always keep at least top_prob rankedencoding if (keep) { destatep->active_special |= kSpecialMask[kMapToEncoding[rankedencoding]]; destatep->rankedencoding_list[k++] = rankedencoding; } } if (destatep->debug_data != NULL) { char buff[32]; snprintf(buff, sizeof(buff), "%d prune", prune_diff / XLOG2); SetDetailsEncLabel(destatep, buff); } destatep->rankedencoding_list_len = k; // Force final result in some cases // Do any post-prune final adjustments if (prunereason == PRUNE_FINAL) { // If no high-byte pairs, result is ASCII7, BINARY, UTF7, 2022, or HZ if (destatep->next_interesting_pair[OtherPair] == 0) { if ((destatep->top_rankedencoding != F_BINARY) && (destatep->top_rankedencoding != F_UTF7) && (destatep->top_rankedencoding != F_ISO_2022_CN) && (destatep->top_rankedencoding != F_ISO_2022_KR) && (destatep->top_rankedencoding != F_JIS) && (destatep->top_rankedencoding != F_HZ_GB_2312)) { destatep->top_rankedencoding = F_ASCII_7_bit; Boost(destatep, F_ASCII_7_bit, kBoostOnePair * 2); } } // If some 89 pairs, not ISO_8859_x and vice versa if (destatep->byte32_count[4] > 0) { switch (destatep->top_rankedencoding) { case F_ASCII: // ISO-8859-1 destatep->top_rankedencoding = F_CP1252; // Better: destatep->enc_prob[F_ASCII] <==> destatep->enc_prob[F_CP1252] Boost(destatep, F_CP1252, kBoostOnePair * 2); break; case F_Latin2: // ISO-8859-2 // Don't swap back; not superset //destatep->top_rankedencoding = F_CP1250; //Boost(destatep, F_CP1250, kBoostOnePair * 2); break; case F_Arabic: // ISO-8859-6 destatep->top_rankedencoding = F_CP1256; Boost(destatep, F_CP1256, kBoostOnePair * 2); break; case F_Greek: // ISO-8859-7 // Don't swap -- not proper superset // Capital Alpha tonos at 0xB6 in ISO-8859-7, 0xA2 in CP1253 //destatep->top_rankedencoding = F_CP1253; //Boost(destatep, F_CP1253, kBoostOnePair * 2); break; case F_Hebrew: // ISO-8859-8 // Don't swap -- visual vs. logical //destatep->top_rankedencoding = F_CP1255; //Boost(destatep, F_CP1255, kBoostOnePair * 2); break; case F_Latin5: // ISO-8859-9 destatep->top_rankedencoding = F_CP1254; Boost(destatep, F_CP1254, kBoostOnePair * 2); break; case F_ISO_8859_11: // ISO-8859-11 destatep->top_rankedencoding = F_CP874; Boost(destatep, F_CP874, kBoostOnePair * 2); break; } } else { switch (destatep->top_rankedencoding) { case F_CP1252: // ISO-8859-1 destatep->top_rankedencoding = F_ASCII; Boost(destatep, F_ASCII, kBoostOnePair * 2); break; case F_CP1250: // ISO-8859-2 // Don't swap back; not superset //destatep->top_rankedencoding = F_Latin2; //Boost(destatep, F_Latin2, kBoostOnePair * 2); break; case F_CP1256: // ISO-8859-6 // Don't swap back -- not proper superset //destatep->top_rankedencoding = F_Arabic; //Boost(destatep, F_Arabic, kBoostOnePair * 2); break; case F_CP1253: // ISO-8859-7 // Don't swap back -- not proper superset //destatep->top_rankedencoding = F_Greek; //Boost(destatep, F_Greek, kBoostOnePair * 2); break; case F_CP1255: // ISO-8859-8 // Don't swap back -- not proper superset //destatep->top_rankedencoding = F_Hebrew; //Boost(destatep, F_Hebrew, kBoostOnePair * 2); break; case F_CP1254: // ISO-8859-9 destatep->top_rankedencoding = F_Latin5; Boost(destatep, F_Latin5, kBoostOnePair * 2); break; case F_CP874: // ISO-8859-11 destatep->top_rankedencoding = F_ISO_8859_11; Boost(destatep, F_ISO_8859_11, kBoostOnePair * 2); break; } } if (destatep->debug_data != NULL) { char buff[32]; snprintf(buff, sizeof(buff), "final %d", static_cast(src - destatep->initial_src)); SetDetailsEncLabel(destatep, buff); // Show winning encoding and its delta log base2 from 2nd-best // Divide delta by XLOG2 to get log base 2 int delta = destatep->top_prob - destatep->second_top_prob; if (delta < (2 * XLOG2)) { delta /= XDECILOG2; snprintf(buff, sizeof(buff), "+%d.%d %s ", delta / 10, delta % 10, MyEncodingName(kMapToEncoding[destatep->top_rankedencoding])); } else if (delta < (50 * XLOG2)) { delta /= XLOG2; snprintf(buff, sizeof(buff), "+%d %s", delta, MyEncodingName(kMapToEncoding[destatep->top_rankedencoding])); } else { snprintf(buff, sizeof(buff), "%s", MyEncodingName(kMapToEncoding[destatep->top_rankedencoding])); } SetDetailsEncProbCopyOffset(destatep, destatep->top_rankedencoding, buff); } } // FINISH // ==================== // Eventual encoding result is reliable if big difference in top two, or if // only Ascii7 ever encountered // Also reliable if exactly one OtherPair and it's best encoding matches top destatep->reliable = false; if (destatep->next_interesting_pair[OtherPair] == 0) { // Only 7-bit ASCII destatep->reliable = true; } if ((destatep->top_prob - destatep->second_top_prob) >= FLAGS_ced_reliable_difference) { destatep->reliable = true; } if (destatep->next_interesting_pair[OtherPair] == 1) { uint8 byte1 = destatep->interesting_pairs[OtherPair][0]; uint8 byte2 = destatep->interesting_pairs[OtherPair][1]; int best_enc = kMostLikelyEncoding[(byte1 << 8) + byte2]; if (best_enc == destatep->top_rankedencoding) { destatep->reliable = true; } } // If we pruned to one encoding, we are done if (destatep->rankedencoding_list_len == 1) { destatep->reliable = true; destatep->done = true; } // If we pruned to two or three encodings in the same *superset/subset // rankedencoding* and enough pairs, we are done. Else keep going if (destatep->rankedencoding_list_len == 2) { Encoding enc0 = kMapToEncoding[destatep->rankedencoding_list[0]]; Encoding enc1 = kMapToEncoding[destatep->rankedencoding_list[1]]; if (kMapEncToBaseEncoding[enc0] == kMapEncToBaseEncoding[enc1]) { if (destatep->prune_count >= 3) { destatep->reliable = true; destatep->done = true; } } } else if (destatep->rankedencoding_list_len == 3) { Encoding enc0 = kMapToEncoding[destatep->rankedencoding_list[0]]; Encoding enc1 = kMapToEncoding[destatep->rankedencoding_list[1]]; Encoding enc2 = kMapToEncoding[destatep->rankedencoding_list[2]]; Encoding base0 = kMapEncToBaseEncoding[enc0]; Encoding base1 = kMapEncToBaseEncoding[enc1]; Encoding base2 = kMapEncToBaseEncoding[enc2]; if ((base0 == base1) && (base0 == base2)) { if (destatep->prune_count >= 3) { destatep->reliable = true; destatep->done = true; } } } } // Accumulate aligned byte-pair at src // Occasionally, calc boost for some encodings and then prune the active list // weightshift is used to give low weight some text, such as inside tags // Returns true if pruning occurred bool IncrementAndBoostPrune(const uint8* src, int remaining_length, DetectEncodingState* destatep, int weightshift, int exit_reason) { destatep->last_pair = src; // Pick up byte pair, or very last byte plus 0x20 uint8 byte1 = src[0]; uint8 byte2 = 0x20; if (1 < remaining_length) {byte2 = src[1];} // whatset=0 for Ascii + ~, 1 for all others; see kTestPrintableAsciiTildePlus int whatset = exit_reason - 1; int next_pair = destatep->next_interesting_pair[whatset]; if (next_pair > 16) { // If not clear by 16 bigrams, stop accumulating + ~ 00 if (byte1 == '+') {return false;} if (byte1 == '~') {return false;} if (byte1 == 0x00) {return false;} } // Remember pair in appropriate list if (next_pair >= kMaxPairs) { // We have filled up our alloted space for interesting pairs with no // decision. If ASCII pairs full, just skip until end of slow loop; if // non-Ascii pairs full, force done if (whatset == OtherPair) { destatep->done = true; } } else { int offset = static_cast(src - destatep->initial_src); destatep->interesting_pairs[whatset][next_pair * 2 + 0] = byte1; destatep->interesting_pairs[whatset][next_pair * 2 + 1] = byte2; destatep->interesting_offsets[whatset][next_pair] = offset; destatep->interesting_weightshift[whatset][next_pair] = weightshift; ++destatep->next_interesting_pair[whatset]; ++next_pair; } // Prune now and then , but always if forced to be done if (destatep->done || ((next_pair & kPruneMask) == 0)) { // Prune every M BoostPrune(src + 2, destatep, PRUNE_NORMAL); // src+2 first unscanned byte // may be off end of input return true; } return false; } void DumpSummary(DetectEncodingState* destatep, int whatset, int n) { printf(" %sSummary[%2d]: ", kWhatSetName[whatset], destatep->next_interesting_pair[whatset]); int limit = minint(n, destatep->next_interesting_pair[whatset]); for (int i = 0; i < limit; ++i) { printf("%02x%02x ", destatep->interesting_pairs[whatset][i * 2 + 0], destatep->interesting_pairs[whatset][i * 2 + 1]); if ((i & 7) == 7) {printf(" ");} } printf("\n"); } void BeginDetail(DetectEncodingState* destatep) { fprintf(stderr, "%d [", NUM_RANKEDENCODING); for (int e = 0; e < NUM_RANKEDENCODING; ++e) { fprintf(stderr, "(%s)", MyRankedEncName(e)); if ((e % 10) == 9) {fprintf(stderr, "\n ");} } fprintf(stderr, "] size-detail\n"); destatep->next_detail_entry = 0; } // Single character to represent (printable ASCII) gap between bigrams char DetailOffsetChar(int delta) { if (delta == 0) {return ' ';} if (delta <= 2) {return '=';} if (delta <= 15) {return '_';} if (delta <= 31) {return '+';} {return ' ';} } void DumpDetail(DetectEncodingState* destatep) { // Turn all counts into delta from previous entry fprintf(stderr, "%d count-detail\n", destatep->next_detail_entry); // Rewrite, recording deltas for (int z = destatep->next_detail_entry - 1; z > 0; --z) { destatep->debug_data[z].offset -= destatep->debug_data[z - 1].offset; for (int e = 0; e < NUM_RANKEDENCODING; ++e) { destatep->debug_data[z].detail_enc_prob[e] -= destatep->debug_data[z - 1].detail_enc_prob[e]; } } // Now print for (int z = 0; z < destatep->next_detail_entry; ++z) { // Highlight some entries ending in '!' with light red underbar int len = destatep->debug_data[z].label.size(); if (destatep->debug_data[z].label[len - 1] == '!') { fprintf(stderr, "1 0.9 0.9 do-flag\n"); } fprintf(stderr, "(%c%s) %d [", DetailOffsetChar(destatep->debug_data[z].offset), destatep->debug_data[z].label.c_str(), destatep->debug_data[z].best_enc); for (int e = 0; e < NUM_RANKEDENCODING; ++e) { fprintf(stderr, "%d ", destatep->debug_data[z].detail_enc_prob[e]); if ((e % 10) == 9) {fprintf(stderr, " ");} } fprintf(stderr, "] do-detail-e\n"); } // Get ready for next time,if any destatep->next_detail_entry = 0; } void PsRecurse(const char* buff) { fprintf(stderr, "() end-detail (%s) start-detail\n\n", buff); } void DumpReliable(DetectEncodingState* destatep) { printf("Not reliable: "); // Find center of gravity of OtherPair list int x_sum = 0; int y_sum = 0; int count = destatep->next_interesting_pair[OtherPair]; for (int i = 0; i < count; ++i) { uint8 byte1 = destatep->interesting_pairs[OtherPair][i * 2 + 0]; uint8 byte2 = destatep->interesting_pairs[OtherPair][i * 2 + 1]; x_sum += byte2; y_sum += byte1; } if (count == 0) {count = 1;} // adoid zdiv int x_bar = x_sum / count; int y_bar = y_sum / count; printf("center %02X,%02X\n", x_bar, y_bar); double closest_dist = 999.0; int closest = 0; for (int j = 0; j < destatep->rankedencoding_list_len; j++) { int rankedencoding = destatep->rankedencoding_list[j]; const UnigramEntry* ue = &unigram_table[rankedencoding]; printf(" %8s = %4d at %02x,%02x +/- %02X,%02X ", MyEncodingName(kMapToEncoding[rankedencoding]), destatep->enc_prob[rankedencoding], ue->x_bar, ue->y_bar, ue->x_stddev, ue->y_stddev); double x_diff = x_bar - ue->x_bar; double y_diff = y_bar - ue->y_bar; double dist = sqrt((x_diff * x_diff) + (y_diff * y_diff)); printf("(%3.1f)\n", dist); if (closest_dist > dist) { closest_dist = dist; closest = rankedencoding; } } printf("Closest=%s (%3.1f)\n", MyEncodingName(kMapToEncoding[closest]), closest_dist); for (int i = 0; i < 8; ++i) { // Demote by distance to CG and see if that helps, or just quit } } // Scan short single lines quickly for all printable ASCII // Return true if all bytes are in [20..7F], false otherwise bool QuickPrintableAsciiScan(const char* text, int text_length) { const uint8* src = reinterpret_cast(text); const uint8* srclimit = src + text_length; const uint8* srclimit8 = srclimit - 7; while (src < srclimit8) { // Exits on any byte outside [0x20..0x7E] range (HT LF CR exit) uint8 mask = 0; for (int i = 0; i < 8; ++i) mask |= (src[i]-0x20)|(src[i]+0x01); if ((mask & 0x80) != 0) break; src += 8; } while (src < srclimit) { uint8 uc = *src++; if (kIsPrintableAscii[uc] == 0) {return false;} } return true; } static const int kMaxScanBack = 192; // Return true if text is inside a tag or JS comment bool TextInsideTag(const uint8* isrc, const uint8* src, const uint8* srclimit) { const uint8* srcbacklimit = src - kMaxScanBack; if (srcbacklimit < isrc) { srcbacklimit = isrc; } const uint8* ss = src - 1; while (srcbacklimit <= ss) { uint8 c = *ss--; if ((c & ~0x02) == '<') { // We found preceding < 3C or > 3E nearby // Even cheaper: if inside a tag, we don't care what tag; return true if (c == '<') { return true; } // See if we are just after ... if ((c == '>') && (isrc <= (ss - 5)) && (ss[-5] == '<') && ((ss[-4] | 0x20) == 't') && ((ss[-3] | 0x20) == 'i') && ((ss[-2] | 0x20) == 't') && ((ss[-1] | 0x20) == 'l') && ((ss[-0] | 0x20) == 'e')) { return true; } // See if we are just after <SCRIPT language=javascript>... if ((c == '>') && (isrc <= (ss - 5)) && (ss[-5] == 's') && ((ss[-4] | 0x20) == 'c') && ((ss[-3] | 0x20) == 'r') && ((ss[-2] | 0x20) == 'i') && ((ss[-1] | 0x20) == 'p') && ((ss[-0] | 0x20) == 't')) { return true; } // Not in a tag return false; // See if we are just after JavaScript comment /* ... } else if (c == '/') { if (((ss + 2) < srclimit) && (ss[2] == '*')) { // We backscanned to /* return true; } } } return false; } const uint8* SkipToTagEnd(const uint8* src, const uint8* srclimit) { const uint8* ss = src + 1; while (ss <= srclimit) { uint8 c = *ss++; if ((c == '<') || (c == '>')) { return ss; } } return src + 2; // Always make progress, Otherwise we get an infinite loop } // Take a watch string and map to a ranked encoding. If no match, return -1 int LookupWatchEnc(const string& watch_str) { int watchval = -1; // Mixed encoding maps to enc=UTF8UTF8 if (watch_str == "UTF8UTF8") { watchval = F_UTF8UTF8; } else { Encoding enc; if (EncodingFromName(watch_str.c_str(), &enc)) { watchval = CompactEncDet::BackmapEncodingToRankedEncoding(enc); } } return watchval; } // Return true if enc and enc2 are equal or one is a subset of the other // or either is UNKNOWN // also UTF8UTF8 is compatible with both Latin1 and UTF8 bool CompatibleEnc(Encoding enc, Encoding enc2) { if (enc < 0) {return false;} if (NUM_ENCODINGS <= enc) {return false;} if (enc2 < 0) {return false;} if (NUM_ENCODINGS <= enc2) {return false;} if (enc == enc2) {return true;} if (kMapEncToBaseEncoding[enc] == kMapEncToBaseEncoding[enc2]) {return true;} if (enc == ASCII_7BIT) {return true;} if (enc2 == ASCII_7BIT) {return true;} if (enc == UNKNOWN_ENCODING) {return true;} if (enc2 == UNKNOWN_ENCODING) {return true;} if (enc == UTF8UTF8) { if (enc2 == UTF8) {return true;} if (kMapEncToBaseEncoding[enc2] == ISO_8859_1) {return true;} } if (enc2 == UTF8UTF8) { if (enc == UTF8) {return true;} if (kMapEncToBaseEncoding[enc] == ISO_8859_1) {return true;} } return false; } // Return superset of enc and enc2, which must be compatible Encoding SupersetEnc(Encoding enc, Encoding enc2) { //printf(" SupersetEnc (%s, ", MyEncodingName(enc)); // TEMP //printf("%s) ", MyEncodingName(enc2)); //printf("= %s\n", // MyEncodingName(kMapEncToSuperLevel[enc] >= kMapEncToSuperLevel[enc2] ? // enc :enc2)); if (kMapEncToSuperLevel[enc] >= kMapEncToSuperLevel[enc2]) { return enc; } return enc2; } // If unreliable, try rescoring to separate some encodings Encoding Rescore(Encoding enc, const uint8* isrc, const uint8* srctextlimit, DetectEncodingState* destatep) { if (FLAGS_counts) {++rescore_used;} Encoding new_enc = enc; bool rescore_change = false; int count = destatep->next_interesting_pair[OtherPair]; int text_length = srctextlimit - isrc; for (int i = 0; i < count; ++i) { int bigram_offset = destatep->interesting_offsets[OtherPair][i]; uint8 byte0 = (0 < bigram_offset) ? isrc[bigram_offset - 1] : 0x20; uint8 byte1 = isrc[bigram_offset + 0]; // Known to have high bit on uint8 byte2 = ((bigram_offset + 1) < text_length) ? isrc[bigram_offset + 1] : 0x20; uint8 byte3 = ((bigram_offset + 2) < text_length) ? isrc[bigram_offset + 2] : 0x20; int high_hash = ((byte0 & 0xc0) >> 0) | ((byte1 & 0xc0) >> 1) | ((byte2 & 0xc0) >> 4) | ((byte3 & 0xc0) >> 6); // 00112233 // Boost HighAccent encodings for Ascii bit patterns // 0x1x 0x0x // 1010 1010 // 0010 0000 // if ((high_hash & 0xaa) == 0x20) { for (int j = 0; j < destatep->rankedencoding_list_len; j++) { int rankedencoding = destatep->rankedencoding_list[j]; if (HighAccentEncoding(kMapToEncoding[rankedencoding])) { // TODO: also want to boost Shift-JIS here if byte1 is Ax..Dx // TEMP //printf(" Rescore[%02x] %s +%d\n", // high_hash, MyRankedEncName(rankedencoding), kGentlePairBoost); Boost(destatep, rankedencoding, kGentlePairBoost); rescore_change = true; } } } // Whack HighAccent encodings for high bit patterns // 1x1x 1x1x // 1010 1010 // 1010 1010 // if ((high_hash & 0xaa) == 0xaa) { for (int j = 0; j < destatep->rankedencoding_list_len; j++) { int rankedencoding = destatep->rankedencoding_list[j]; if (HighAccentEncoding(kMapToEncoding[rankedencoding])) { // TEMP //printf(" Rescore[%02x] %s -%d\n", // high_hash, MyRankedEncName(rankedencoding), kGentlePairBoost); Whack(destatep, rankedencoding, kGentlePairBoost); rescore_change = true; } } } } if (rescore_change) { ReRank(destatep); new_enc = kMapToEncoding[destatep->top_rankedencoding]; if (destatep->debug_data != NULL) { char buff[32]; snprintf(buff, sizeof(buff), "=Rescore %s", MyEncodingName(new_enc)); SetDetailsEncProb(destatep, 0, CompactEncDet::BackmapEncodingToRankedEncoding(new_enc), buff); //// DumpDetail(destatep); } SimplePrune(destatep, kFinalPruneDifference); CalcReliable(destatep); } //if (new_enc != enc) { // // TEMP // printf(" Rescore new top encoding = %s\n", // MyRankedEncName(destatep->top_rankedencoding)); //} return new_enc; } // Given an encoding, add its corresponding ranked encoding to the set void AddToSet(Encoding enc, int* list_len, int* list) { // TEMP print int item = CompactEncDet::BackmapEncodingToRankedEncoding(enc); for (int i = 0; i < *list_len; ++i) { if (list[i] == item) { return; // Already in the set; don't add again } } list[(*list_len)++] = item; } static const int kMinRobustBigramCount = 1000; static const int kMinKBToRobustScan = 64; static const int kMaxKBToRobustScan = 256; // Scan the first 64K or so, just doing raw bigram increments on given // probability list. // No fancy duplicate filtering or anything else here. // Returns number of bigrams counted int RobustScan(const char* text, int text_length, int robust_renc_list_len, int* robust_renc_list, int* robust_renc_probs) { if (FLAGS_counts) {++robust_used;} // Zero all the result probabilities for (int i = 0; i < robust_renc_list_len; ++i) { robust_renc_probs[i] = 0; } int max_fast_len = minint(text_length, (kMaxKBToRobustScan << 10)); const uint8* isrc = reinterpret_cast<const uint8*>(text); const uint8* src = isrc; const uint8* srclimitfast2 = isrc + max_fast_len - 1; const uint8* srclimitfast4 = isrc + max_fast_len - 3; int min_fast_len = minint(text_length, (kMinKBToRobustScan << 10)); const uint8* srclimitmin = isrc + min_fast_len - 1; int bigram_count = 0; if (FLAGS_enc_detect_source) { PsSourceInit(kPsSourceWidth); fprintf(stderr, "(RobustScan) do-src\n"); } // Sum over a big chunk of the input // Faster loop, no 7-bit-encodings possible, approx 3000 GB/sec //==================================== while (src < srclimitfast2) { // Skip to next interesting bigram while (src < srclimitfast4) { if (((src[0] | src[1] | src[2] | src[3]) & 0x80) != 0) break; src += 4; } while (src < srclimitfast2) { if ((src[0] & 0x80) != 0) break; src++; } if (src < srclimitfast2) { // We found a bigram with high bit on // Next 5 lines commented out so we don't show all the source. //const uint8* srctextlimit = isrc + text_length; //if (FLAGS_enc_detect_source) { // PsSource(src, isrc, srctextlimit); // PsMark(src, 2, isrc, 0); //} uint8 byte1 = src[0]; uint8 byte2 = src[1]; uint8 byte1x2x = (byte1 & 0xf0) | ((byte2 >> 4) & 0x0f); uint8 byte1f = byte1; // Flip top bit of subscript to better separate quadrant 4 (esp. for Hebrew) byte1f ^= (byte2 & 0x80); // The real increments for (int j = 0; j < robust_renc_list_len; ++j) { int rankedencoding = robust_renc_list[j]; const UnigramEntry* ue = &unigram_table[rankedencoding]; int incr = ue->b1[byte1f] + ue->b2[byte2] + ue->b12[byte1x2x]; if ((ue->b12[byte1x2x] & 0x01) != 0) { // Use a more-precise table int byte32x32 = ((byte1 & 0x1f) << 5) | (byte2 & 0x1f); int hiressub = (byte2 & 0x60) >> 5; // select w/bits 5&6 of byte 2 DCHECK(ue->hires[hiressub] != NULL); incr += ue->hires[hiressub][byte32x32]; } else { // Default final offset incr += ue->so; } robust_renc_probs[j] += incr; } src += 2; // Continue after this bigram ++bigram_count; // Stop after 1000 bigrams reached, if at least 64KB scanned if ((bigram_count > kMinRobustBigramCount) && (src > srclimitmin)) { break; } } } if (FLAGS_enc_detect_source) { fprintf(stderr, "( bigram_count = %d) do-src\n", bigram_count); if (bigram_count == 0) {bigram_count = 1;} // zdiv for (int i = 0; i < robust_renc_list_len; ++i) { fprintf(stderr, "( enc[%-12.12s] = %7d (avg %d)) do-src\n", MyRankedEncName(robust_renc_list[i]), robust_renc_probs[i], robust_renc_probs[i] / bigram_count); } PsSourceFinish(); } return bigram_count; } // If unreliable, rescan middle of document to see if we can get a better // answer. Rescan is only worthwhile if there are ~200 bytes or more left, // since the detector takes as much as 96 bytes of bigrams to decide. Encoding Rescan(Encoding enc, const uint8* isrc, const uint8* src, const uint8* srctextlimit, const char* url_hint, const char* http_charset_hint, const char* meta_charset_hint, const int encoding_hint, const Language language_hint, const CompactEncDet::TextCorpusType corpus_type, bool ignore_7bit_mail_encodings, DetectEncodingState* destatep) { bool enc_is_reliable = destatep->reliable; Encoding new_enc = enc; Encoding second_best_enc = kMapToEncoding[destatep->second_top_rankedencoding]; if (FLAGS_counts) {++rescan_used;} int scanned_bytes = src - isrc; int unscanned_bytes = srctextlimit - src; int text_length = srctextlimit - isrc; bool empty_rescan = true; // See if enough bytes left to bother doing rescan if (kMinRescanLength < unscanned_bytes) { const char* text = reinterpret_cast<const char*>(isrc); Encoding one_hint = destatep->http_hint; if ((one_hint == UNKNOWN_ENCODING) && (destatep->meta_hint != UNKNOWN_ENCODING)) { one_hint = destatep->meta_hint; } if ((one_hint == UNKNOWN_ENCODING) && (destatep->bom_hint != UNKNOWN_ENCODING)) { one_hint = destatep->bom_hint; } // Go to an even offset to keep UTF-16 in synch int middle_offset = (scanned_bytes + (unscanned_bytes / 2)) & ~1; CHECK(middle_offset <= text_length); // Look back a bit for a low byte to synchronize, else hope for the best. const uint8* srcbacklimit = isrc + middle_offset - kMaxScanBack; if (srcbacklimit < src) { srcbacklimit = src; } const uint8* ss = isrc + middle_offset - 1; while (srcbacklimit <= ss) { if ((*ss & 0x80) == 0) {break;} --ss; } // Leave middle offset unchanged unless we found a low byte if (srcbacklimit <= ss) { // Align to low byte or high byte just after it, whichever is even middle_offset = (ss - isrc + 1) & ~1; // Even to keep UTF-16 in sync } CHECK(middle_offset <= text_length); if (destatep->debug_data != NULL) { SetDetailsEncLabel(destatep, ">> Rescan"); // Print the current chart before recursive call DumpDetail(destatep); char buff[32]; snprintf(buff, sizeof(buff), ">> Rescan[%d..%d]", middle_offset, text_length); PsRecurse(buff); } int mid_bytes_consumed; bool mid_is_reliable; Encoding mid_second_best_enc; CEDInternalFlags newflags = static_cast<CEDInternalFlags>( kCEDRescanning + kCEDForceTags); // Recursive call for rescan of half of remaining Encoding mid_enc = InternalDetectEncoding( newflags, text + middle_offset, text_length - middle_offset, url_hint, http_charset_hint, meta_charset_hint, encoding_hint, language_hint, // User interface lang corpus_type, ignore_7bit_mail_encodings, &mid_bytes_consumed, &mid_is_reliable, &mid_second_best_enc); destatep->reliable = mid_is_reliable; empty_rescan = (mid_enc == ASCII_7BIT); // Not the right decision if, e.g. enc=Greek, mid=ASCII7, one=KSC // hence the !empty_rescan term if (!empty_rescan && CompatibleEnc(one_hint, mid_enc)) { // Encoding we just found is compatible with the // single hint (if any); return superset new_enc = SupersetEnc(one_hint, mid_enc); } // If original and mid are compatible, and both reliable, // return new_enc = SupersetEnc(enc, mid_enc) // // This avoids too much weight on a bogus hint causing a RobustScan // that gets the wrong answer if (!empty_rescan && mid_is_reliable && enc_is_reliable && CompatibleEnc(enc, mid_enc)) { new_enc = SupersetEnc(enc, mid_enc); return new_enc; } // if mid unreliable, robustscan // if mid empty, robustscan // if original and mid not compatible, robustscan // if mid and one_hint not compatible, robustscan // If we found conflicting data, drop back and do a robust scan of a big // chunk of the input over a set of candidate encodings // if (!mid_is_reliable || empty_rescan || !CompatibleEnc(enc, mid_enc) || !CompatibleEnc(one_hint, mid_enc)) { int robust_renc_list_len; // Number of active encodings int robust_renc_list[NUM_RANKEDENCODING]; // List of ranked encodings int robust_renc_probs[NUM_RANKEDENCODING]; // List of matching probs robust_renc_list_len = 0; AddToSet(enc, &robust_renc_list_len, robust_renc_list); AddToSet(second_best_enc, &robust_renc_list_len, robust_renc_list); AddToSet(mid_enc, &robust_renc_list_len, robust_renc_list); AddToSet(mid_second_best_enc, &robust_renc_list_len, robust_renc_list); if (destatep->http_hint != UNKNOWN_ENCODING) { AddToSet(destatep->http_hint, &robust_renc_list_len, robust_renc_list); } if (destatep->meta_hint != UNKNOWN_ENCODING) { AddToSet(destatep->meta_hint, &robust_renc_list_len, robust_renc_list); } if (destatep->bom_hint != UNKNOWN_ENCODING) { AddToSet(destatep->bom_hint, &robust_renc_list_len, robust_renc_list); } if (destatep->tld_hint != UNKNOWN_ENCODING) { AddToSet(destatep->tld_hint, &robust_renc_list_len, robust_renc_list); } // Separate simple scan // ===================== if (destatep->debug_data != NULL) { SetDetailsEncLabel(destatep, ">> RobustScan"); // Print the current chart before recursive call DumpDetail(destatep); char buff[32]; snprintf(buff, sizeof(buff), ">> RobustScan[0..%d]", text_length); PsRecurse(buff); } int bigram_count = RobustScan(text, text_length, robust_renc_list_len, robust_renc_list, robust_renc_probs); // Default to new_enc and update if something better was found int best_prob = -1; // TEMP print for (int i = 0; i < robust_renc_list_len; ++i) { if (best_prob < robust_renc_probs[i]) { best_prob = robust_renc_probs[i]; new_enc = kMapToEncoding[robust_renc_list[i]]; } } if (destatep->debug_data != NULL) { char buff[32]; snprintf(buff, sizeof(buff), "=Robust[%d] %s", bigram_count, MyEncodingName(new_enc)); SetDetailsEncProb(destatep, 0, CompactEncDet::BackmapEncodingToRankedEncoding(new_enc), buff); } } } // End if enough bytes return new_enc; } // With no hints at all, and perhaps on rescan, we relax our pickiness // and go ahead and accept the top multibyte encodings, even though // strictly their web pages should have declared an explicit encoding to // avoid the HTML standard's default ISO-8859-1. bool NoHintsCloseEnoughCompatible(Encoding top_enc) { // First test accepts degenerate cases plus UTF8 and UTF8UTF8 if (CompatibleEnc(UTF8, top_enc)) {return true;} // The rest look for exact match of base encoding Encoding base_enc = kMapEncToBaseEncoding[top_enc]; if (base_enc == JAPANESE_EUC_JP) {return true;} if (base_enc == JAPANESE_SHIFT_JIS) {return true;} if (base_enc == CHINESE_BIG5) {return true;} if (base_enc == CHINESE_GB) {return true;} if (base_enc == KOREAN_EUC_KR) {return true;} return false; } // Scan raw bytes and detect most likely encoding // Design goals: // Skip over big initial stretches of seven-bit ASCII bytes very quickly // Thread safe // Works equally well on // 50-byte queries, // 5000-byte email and // 50000-byte web pages // Length 0 input returns ISO_8859_1 (ASCII) encoding // Setting ignore_7bit_mail_encodings effectively turns off detection of // UTF-7, HZ, and ISO-2022-xx Encoding InternalDetectEncoding( CEDInternalFlags flags, const char* text, int text_length, const char* url_hint, const char* http_charset_hint, const char* meta_charset_hint, const int encoding_hint, const Language language_hint, // User interface lang const CompactEncDet::TextCorpusType corpus_type, bool ignore_7bit_mail_encodings, int* bytes_consumed, bool* is_reliable, Encoding* second_best_enc) { *bytes_consumed = 0; *is_reliable = false; *second_best_enc = ASCII_7BIT; if (text_length == 0) { // Follow the spec. Text might be NULL. *is_reliable = true; return ISO_8859_1; } // For very short (20-50 byte) input strings that are highly likely to be // all printable ASCII, our startup overhead might dominate. We have to do the // full detection if the ISO-2022-xx, HZ, or UTF-7 encodings are possible. // Otherwise, we can do a quick scan for printable ASCII. if ((text_length <= 500) && ignore_7bit_mail_encodings && QuickPrintableAsciiScan(text, text_length)) { *is_reliable = true; return ASCII_7BIT; } // Go for the full boat detection DetectEncodingState destate; InitDetectEncodingState(&destate); std::unique_ptr<DetailEntry[]> scoped_debug_data; if (FLAGS_enc_detect_detail) { // Allocate max 10 details per bigram scoped_debug_data.reset(new DetailEntry[kMaxPairs * 10]); destate.debug_data = scoped_debug_data.get(); // NOTE: destate and scoped_debug_data have exactly the same scope // All other FLAGS_enc_detect_detail tests use destate.debug_data != NULL } // Get text length limits // Typically, we scan the first 16KB looking for all encodings, then // scan the rest (up to 256KB) a bit faster by no longer looking for // interesting bytes below 0x80. This allows us to skip over runs of // 7-bit-ASCII much more quickly. int slow_len = minint(text_length, (FLAGS_enc_detect_slow_max_kb << 10)); int fast_len = minint(text_length, (FLAGS_enc_detect_fast_max_kb << 10)); // Initialize pointers. // In general, we do not look at last 3 bytes of input in the fast scan // We do, however want to look at the last byte or so in the slow scan, // especilly in the case of a very short text whose only interesting // information is a 3-byte UTF-8 character in the last three bytes. // If necessary, we fake a last bigram with 0x20 space as a pad byte. const uint8* isrc = reinterpret_cast<const uint8*>(text); const uint8* src = isrc; const uint8* srctextlimit = isrc + text_length; const uint8* srclimitslow2 = isrc + slow_len - 1; const uint8* srclimitfast2 = isrc + fast_len - 1; const uint8* srclimitfast4 = isrc + fast_len - 3; if (srclimitslow2 > srclimitfast2) { srclimitslow2 = srclimitfast2; } destate.initial_src = isrc; destate.limit_src = srclimitfast2 + 1; // May include last byte destate.prior_src = isrc; destate.last_pair = isrc - 2; const char* scan_table = kTestPrintableAsciiTildePlus; if (ignore_7bit_mail_encodings) { // Caller wants to ignore UTF-7, HZ, ISO-2022-xx // Don't stop on + (for UTF-7), nor on ~ (for HZ) scan_table = kTestPrintableAscii; } int exit_reason = 0; if (destate.debug_data != NULL) { BeginDetail(&destate); // Take any incoming watch encoding name and backmap to the corresponding // ranked enum value watch1_rankedenc = LookupWatchEnc(FLAGS_enc_detect_watch1); if (watch1_rankedenc >= 0) { fprintf(stderr, "/track-me %d def\n", watch1_rankedenc); } watch2_rankedenc = LookupWatchEnc(FLAGS_enc_detect_watch2); if (watch2_rankedenc >= 0) { fprintf(stderr, "/track-me2 %d def\n", watch2_rankedenc); } fprintf(stderr, "%% kDerateHintsBelow = %d\n", kDerateHintsBelow); } if (FLAGS_enc_detect_source) { PsSourceInit(kPsSourceWidth); PsSource(src, isrc, srctextlimit); PsMark(src, 4, isrc, 0); } // Apply hints, if any, to probabilities // NOTE: Encoding probabilites are all zero at this point ApplyHints(url_hint, http_charset_hint, meta_charset_hint, encoding_hint, language_hint, corpus_type, &destate); // NOTE: probabilities up to this point are subject to derating for // small numbers of bigrams. // Probability changes after this point are not derated. // Do first 4 bytes to pick off strong markers InitialBytesBoost(isrc, text_length, &destate); bool ignored_some_tag_text = false; int tag_text_bigram_count = 0; // Slower loop, approx 500 MB/sec (2.8 GHz P4) // ASSERT(srclimitslow2 <= srclimitfast2); //==================================== DoMoreSlowLoop: while (src < srclimitslow2) { // Skip to next interesting byte (this is the slower part) while (src < srclimitslow2) { uint8 uc = *src++; if (scan_table[uc] != 0) {exit_reason = scan_table[uc]; src--; break;} } if (src < srclimitslow2) { if (FLAGS_enc_detect_source) { PsSource(src, isrc, srctextlimit); // don't mark yet } int weightshift = 0; // In the first 16KB, derate new text run inside <title>... and // inside if (////((destate.last_pair + 6) <= src) && // if beyond last one ////(tag_text_bigram_count < kMaxBigramsTagTitleText) && (corpus_type == CompactEncDet::WEB_CORPUS) && // and web page !CEDFlagForceTags(flags)) { // and OK to skip ////if (TextInsideTag(destate.last_pair + 2, src, srclimitslow2)) { if (TextInsideTag(isrc, src, srclimitslow2)) { if (tag_text_bigram_count >= kMaxBigramsTagTitleText) { ignored_some_tag_text = true; src = SkipToTagEnd(src, srclimitslow2); continue; } else { weightshift = kWeightshiftForTagTitleText; ++tag_text_bigram_count; } } } if (FLAGS_enc_detect_source) { PsMark(src, 2, isrc, weightshift); } // Saves byte pair and offset bool pruned = IncrementAndBoostPrune(src, srctextlimit - src, &destate, weightshift, exit_reason); // Advance; if inside tag, advance to end of tag if (weightshift == 0) { src += exit_reason; // 1 Ascii, 2 other } else { src += exit_reason; // 1 Ascii, 2 other //// src = SkipToTagEnd(src, srclimitslow2); } if (pruned) { // Scoring and active encodings have been updated if (destate.done) {break;} // Check if all the reasons for the slow loop have been pruned // If so, go to fast loop if (!SevenBitActive(&destate)) {break;} } } } //==================================== // We reached the end of a slow scan, possibly because no more SevenBitActive, // or possibly are at end of source. // If we are exactly at the end of the source, make sure we look at the very // last byte. bool very_last_byte_incremented = false; if (src == (srctextlimit - 1)) { exit_reason = scan_table[*src]; if (exit_reason != 0) { // The very last byte is an interesting byte // Saves byte pair and offset //printf("Interesting very last slow byte = 0x%02x\n", *src); IncrementAndBoostPrune(src, srctextlimit - src, &destate, 0, exit_reason); very_last_byte_incremented = true; } } if (FLAGS_enc_detect_source) { PsSource(src, isrc, srctextlimit); PsMark(src, 2, isrc, 0); } // Force a pruning based on whatever we have // Delete the seven-bit encodings if there is no evidence of them so far BoostPrune(src, &destate, PRUNE_SLOWEND); if (!destate.done) { // If not clear yet on 7-bit-encodings and more bytes, do more slow if (SevenBitActive(&destate) && (src < srclimitfast2)) { // Increment limit by another xxxK slow_len += (FLAGS_enc_detect_slow_max_kb << 10); srclimitslow2 = isrc + slow_len - 1; if (srclimitslow2 > srclimitfast2) { srclimitslow2 = srclimitfast2; } if (!UTF7OrHzActive(&destate)) { // We can switch to table that does not stop on + ~ scan_table = kTestPrintableAscii; } goto DoMoreSlowLoop; } exit_reason = 2; // Faster loop, no 7-bit-encodings possible, approx 3000 GB/sec //==================================== while (src < srclimitfast2) { // Skip to next interesting byte (this is the faster part) while (src < srclimitfast4) { if (((src[0] | src[1] | src[2] | src[3]) & 0x80) != 0) break; src += 4; } while (src < srclimitfast2) { if ((src[0] & 0x80) != 0) break; src++; } if (src < srclimitfast2) { if (FLAGS_enc_detect_source) { PsSource(src, isrc, srctextlimit); PsMark(src, 2, isrc, 0); } // saves byte pair and offset bool pruned = IncrementAndBoostPrune(src, srctextlimit - src, &destate, 0, exit_reason); src += exit_reason; // 1 Ascii, 2 other if (pruned) { // Scoring and active encodings have been updated if (destate.done) {break;} } } } //==================================== // We reached the end of fast scan // If we are exactly at the end of the source, make sure we look at the very // last byte. if (src == (srctextlimit - 1) && !very_last_byte_incremented) { exit_reason = scan_table[*src]; if (exit_reason != 0) { // The very last byte is an interesting byte // Saves byte pair and offset //printf("Interesting very last fast byte = 0x%02x\n", *src); IncrementAndBoostPrune(src, srctextlimit - src, &destate, 0, exit_reason); very_last_byte_incremented = true; } } } // End if !done if (FLAGS_enc_detect_source) { PsSource(src, isrc, srctextlimit); PsMark(src, 2, isrc, 0); } // Force a pruning based on whatever we have BoostPrune(src, &destate, PRUNE_FINAL); if (FLAGS_enc_detect_summary) { DumpSummary(&destate, AsciiPair, 32); DumpSummary(&destate, OtherPair, 32); } if (FLAGS_enc_detect_source) { PsSourceFinish(); } if (destate.debug_data != NULL) { //// DumpDetail(&destate); } if (ignored_some_tag_text && (kMapToEncoding[destate.top_rankedencoding] == ASCII_7BIT)) { // There were some interesting bytes, but only in tag text. // Recursive call to reprocess looking at the tags this time. if (destate.debug_data != NULL) { SetDetailsEncLabel(&destate, ">> Recurse/tags"); // Print the current chart before recursive call DumpDetail(&destate); char buff[32]; snprintf(buff, sizeof(buff), ">> Recurse for tags"); PsRecurse(buff); } // Recursive call for high bytes in tags [no longer used, 1/16 tag score] Encoding enc2 = InternalDetectEncoding( kCEDForceTags, // force text, text_length, url_hint, http_charset_hint, meta_charset_hint, encoding_hint, language_hint, corpus_type, ignore_7bit_mail_encodings, bytes_consumed, is_reliable, second_best_enc); if (destate.debug_data != NULL) { // Show winning encoding and dump PostScript char buff[32]; snprintf(buff, sizeof(buff), "=2 %s", MyEncodingName(enc2)); SetDetailsEncProb(&destate, 0, CompactEncDet::BackmapEncodingToRankedEncoding(enc2), buff); DumpDetail(&destate); } return enc2; } // If the detected encoding does not match default/hints, or if the hints // conflict with each other, mark as unreliable. This can be used to trigger // further scoring. // Three buckets of input documents; // ~19% of the web no hints, and top == 7bit, Latin1, or CP1252 // ~79% of the web one or more hints, all same encoding X and top == X // ~ 2% of the web one or more hints that are inconsistent Encoding top_enc = kMapToEncoding[destate.top_rankedencoding]; Encoding one_hint = destate.http_hint; if ((one_hint == UNKNOWN_ENCODING) && (destate.meta_hint != UNKNOWN_ENCODING)) { one_hint = destate.meta_hint; } if ((one_hint == UNKNOWN_ENCODING) && (destate.bom_hint != UNKNOWN_ENCODING)) { one_hint = destate.bom_hint; } bool found_compatible_encoding = true; if (one_hint == UNKNOWN_ENCODING) { // [~14% of the web] No hints, and top == 7bit, Latin1, or CP1252 if (!CompatibleEnc(ISO_8859_1, top_enc)) { found_compatible_encoding = false; // If there is nothing but a TLD hint and its top encoding matches, OK if ((destate.tld_hint != UNKNOWN_ENCODING) && CompatibleEnc(destate.tld_hint, top_enc)) { found_compatible_encoding = true; } } } else if (CompatibleEnc(one_hint, destate.http_hint) && CompatibleEnc(one_hint, destate.meta_hint) && CompatibleEnc(one_hint, destate.bom_hint)) { // [~83% of the web] One or more hints, all same encoding X and top == X if (!CompatibleEnc(one_hint, top_enc)) { // [~ 2% of the web] Oops, not the declared encoding found_compatible_encoding = false; } } else { // [~ 3% of the web] Two or more hints that are inconsistent one_hint = UNKNOWN_ENCODING; found_compatible_encoding = false; } // If we turned Latin1 into Latin2 or 7 via trigrams, don't fail it here if (destate.do_latin_trigrams) { if (CompatibleEnc(kMapToEncoding[F_Latin1], top_enc) || CompatibleEnc(kMapToEncoding[F_Latin2], top_enc) || CompatibleEnc(kMapToEncoding[F_CP1250], top_enc) || CompatibleEnc(kMapToEncoding[F_ISO_8859_13], top_enc)) { found_compatible_encoding = true; destate.reliable = true; } } // If top encoding is not compatible with the hints, but it is reliably // UTF-8, accept it anyway. // This will perform badly with mixed UTF-8 prefix plus another encoding in // the body if done too early, so we want to be rescanning. if (!found_compatible_encoding && destate.reliable && NoHintsCloseEnoughCompatible(top_enc) && (destate.next_interesting_pair[OtherPair] >= kStrongPairs) && CEDFlagRescanning(flags)) { found_compatible_encoding = true; } // Hold off on this so Rescan() can see if the original encoding was reliable //if (!found_compatible_encoding) { // destate.reliable = false; //} // If unreliable, try rescoring to separate some encodings if (!destate.reliable || !found_compatible_encoding) { top_enc = Rescore(top_enc, isrc, srctextlimit, &destate); } *second_best_enc = kMapToEncoding[destate.second_top_rankedencoding]; // If unreliable, and not already rescanning, // rescan middle of document to see if we can get a better // answer. Rescan is only worthwhile if there are ~200 bytes or more left, // since the detector takes as much as 96 bytes of bigrams to decide. // // CANNOT retry ISO-2022-xx HZ etc. because no declaration escape at the front // or we may land in the middle of some partial state. Skip them all. // if ((!destate.reliable || !found_compatible_encoding) && !CEDFlagRescanning(flags) && !SevenBitEncoding(top_enc)) { top_enc = Rescan(top_enc, isrc, src, srctextlimit, url_hint, http_charset_hint, meta_charset_hint, encoding_hint, language_hint, corpus_type, ignore_7bit_mail_encodings, &destate); } else { if (!found_compatible_encoding) { destate.reliable = false; } } if (destate.debug_data != NULL) { // Dump PostScript DumpDetail(&destate); } *bytes_consumed = src - isrc + 1; // We looked 1 byte beyond src *is_reliable = destate.reliable; return top_enc; } Encoding CompactEncDet::DetectEncoding( const char* text, int text_length, const char* url_hint, const char* http_charset_hint, const char* meta_charset_hint, const int encoding_hint, const Language language_hint, // User interface lang const TextCorpusType corpus_type, bool ignore_7bit_mail_encodings, int* bytes_consumed, bool* is_reliable) { if (FLAGS_ced_echo_input) { string temp(text, text_length); fprintf(stderr, "CompactEncDet::DetectEncoding()\n%s\n\n", temp.c_str()); } if (FLAGS_counts) { encdet_used = 0; rescore_used = 0; rescan_used = 0; robust_used = 0; looking_used = 0; doing_used = 0; ++encdet_used; } if (FLAGS_dirtsimple) { // Just count first 64KB bigram encoding probabilities for each encoding int robust_renc_list_len; // Number of active encodings int robust_renc_list[NUM_RANKEDENCODING]; // List of ranked encodings int robust_renc_probs[NUM_RANKEDENCODING]; // List of matching probs for (int i = 0; i < NUM_RANKEDENCODING; ++i) { robust_renc_list[i] = i; } robust_renc_list_len = NUM_RANKEDENCODING; RobustScan(text, text_length, robust_renc_list_len, robust_renc_list, robust_renc_probs); // Pick off best encoding int best_prob = -1; Encoding enc = UNKNOWN_ENCODING; for (int i = 0; i < robust_renc_list_len; ++i) { if (best_prob < robust_renc_probs[i]) { best_prob = robust_renc_probs[i]; enc = kMapToEncoding[robust_renc_list[i]]; } } *bytes_consumed = minint(text_length, (kMaxKBToRobustScan << 10)); *is_reliable = true; if (FLAGS_counts) { printf("CEDcounts "); while (encdet_used--) {printf("encdet ");} while (rescore_used--) {printf("rescore ");} while (rescan_used--) {printf("rescan ");} while (robust_used--) {printf("robust ");} while (looking_used--) {printf("looking ");} while (doing_used--) {printf("doing ");} printf("\n"); } return enc; } Encoding second_best_enc; Encoding enc = InternalDetectEncoding(kCEDNone, text, text_length, url_hint, http_charset_hint, meta_charset_hint, encoding_hint, language_hint, // User interface lang corpus_type, ignore_7bit_mail_encodings, bytes_consumed, is_reliable, &second_best_enc); if (FLAGS_counts) { printf("CEDcounts "); while (encdet_used--) {printf("encdet ");} while (rescore_used--) {printf("rescore ");} while (rescan_used--) {printf("rescan ");} while (robust_used--) {printf("robust ");} while (looking_used--) {printf("looking ");} while (doing_used--) {printf("doing ");} printf("\n"); } #if defined(HTML5_MODE) // Map all the Shift-JIS variants to Shift-JIS when used in Japanese locale. if (language_hint == JAPANESE && IsShiftJisOrVariant(enc)) { enc = JAPANESE_SHIFT_JIS; } // 7-bit encodings (except ISO-2022-JP), and some obscure encodings not // supported in WHATWG encoding standard are marked as ASCII to keep the raw // bytes intact. switch (enc) { case ISO_2022_KR: case ISO_2022_CN: case HZ_GB_2312: case UTF7: case UTF16LE: case UTF16BE: case CHINESE_EUC_DEC: case CHINESE_CNS: case CHINESE_BIG5_CP950: case JAPANESE_CP932: case MSFT_CP874: case TSCII: case TAMIL_MONO: case TAMIL_BI: case JAGRAN: case BHASKAR: case HTCHANAKYA: case BINARYENC: case UTF8UTF8: case TAM_ELANGO: case TAM_LTTMBARANI: case TAM_SHREE: case TAM_TBOOMIS: case TAM_TMNEWS: case TAM_WEBTAMIL: case KDDI_SHIFT_JIS: case DOCOMO_SHIFT_JIS: case SOFTBANK_SHIFT_JIS: case KDDI_ISO_2022_JP: case SOFTBANK_ISO_2022_JP: enc = ASCII_7BIT; break; default: break; } #endif return enc; } // Return top encoding hint for given string Encoding CompactEncDet::TopEncodingOfLangHint(const char* name) { string normalized_lang = MakeChar8(string(name)); int n = HintBinaryLookup8(kLangHintProbs, kLangHintProbsSize, normalized_lang.c_str()); if (n < 0) {return UNKNOWN_ENCODING;} // Charset is eight bytes, probability table is eight bytes int toprankenc = TopCompressedProb(&kLangHintProbs[n].key_prob[kMaxLangKey], kMaxLangVector); return kMapToEncoding[toprankenc]; } // Return top encoding hint for given string Encoding CompactEncDet::TopEncodingOfTLDHint(const char* name) { string normalized_tld = MakeChar4(string(name)); int n = HintBinaryLookup4(kTLDHintProbs, kTLDHintProbsSize, normalized_tld.c_str()); if (n < 0) {return UNKNOWN_ENCODING;} // TLD is four bytes, probability table is 12 bytes int toprankenc = TopCompressedProb(&kTLDHintProbs[n].key_prob[kMaxTldKey], kMaxTldVector); return kMapToEncoding[toprankenc]; } // Return top encoding hint for given string Encoding CompactEncDet::TopEncodingOfCharsetHint(const char* name) { string normalized_charset = MakeChar44(string(name)); int n = HintBinaryLookup8(kCharsetHintProbs, kCharsetHintProbsSize, normalized_charset.c_str()); if (n < 0) {return UNKNOWN_ENCODING;} // Charset is eight bytes, probability table is eight bytes int toprankenc = TopCompressedProb(&kCharsetHintProbs[n].key_prob[kMaxCharsetKey], kMaxCharsetVector); return kMapToEncoding[toprankenc]; } const char* CompactEncDet::Version(void) { return kVersion; } ================================================ FILE: third_party/ced/compact_enc_det/compact_enc_det.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef COMPACT_ENC_DET_COMPACT_ENC_DET_H_ #define COMPACT_ENC_DET_COMPACT_ENC_DET_H_ #include "util/encodings/encodings.h" // for Encoding #include "util/languages/languages.h" // for Language #include namespace CompactEncDet { // We may want different statistics, depending on whether the text being // identfied is from the web, from email, etc. This is currently ignored, // except WEB_CORPUS enables ignoring chars inside tags. enum TextCorpusType { WEB_CORPUS, XML_CORPUS, QUERY_CORPUS, // Use this for vanilla plaintext EMAIL_CORPUS, NUM_CORPA, // always last }; // Scan raw bytes and detect most likely encoding // Design goals: // Skip over big initial stretches of seven-bit ASCII bytes very quickly // Thread safe // Works equally well on // 50-byte queries, // 5000-byte email and // 50000-byte web pages // Length 0 input returns ASCII (aka ISO-8859-1 or Latin1) // // Inputs: text and text_length // web page's url (preferred) or just // top-level domain name (e.g. "com") or NULL as a hint // web page's HTTPheader charset= string (e.g. "Latin1") or NULL as a hint // web page's tag charset= string (e.g. "utf-8") or NULL as a hint // an Encoding or UNKNOWN_ENCODING as a hint // a Language or UNKNOWN_LANGUAGE as a hint // corpus type from the list above. Currently ignored; may select // different probability tables in the future // ignore_7bit if true says to NOT return the pure seven-bit encodings // ISO-2022-JP (aka JIS), ISO-2022-CN, ISO-2022-KR, HZ, and UTF-7. // This may save a little scoring time on pure printable ASCII input text // Outputs: bytes_consumed says how much of text_length was actually examined // is_reliable set true if the returned encoding is at least 2**10 time more // probable then the second-best encoding // Return value: the most likely encoding for the input text // // Setting ignore_7bit_mail_encodings effectively turns off detection of // UTF-7, HZ, and ISO-2022-xx. It is recommended that this flag be true // when corpus_type is QUERY_CORPUS. Encoding DetectEncoding( const char* text, int text_length, const char* url_hint, const char* http_charset_hint, const char* meta_charset_hint, const int encoding_hint, const Language language_hint, // User interface lang const TextCorpusType corpus_type, bool ignore_7bit_mail_encodings, int* bytes_consumed, bool* is_reliable); // Support functions for unit test program int BackmapEncodingToRankedEncoding(Encoding enc); Encoding TopEncodingOfLangHint(const char* name); Encoding TopEncodingOfTLDHint(const char* name); Encoding TopEncodingOfCharsetHint(const char* name); const char* Version(void); } // End namespace CompactEncDet #endif // COMPACT_ENC_DET_COMPACT_ENC_DET_H_ ================================================ FILE: third_party/ced/compact_enc_det/compact_enc_det_fuzz_test.cc ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #include #include #include #include "compact_enc_det/compact_enc_det.h" #include "util/encodings/encodings.h" #include "util/languages/languages.h" #include "util/port.h" #include "gtest/gtest.h" namespace { class CompactEncDetFuzzTest : public testing::Test {}; TEST_F(CompactEncDetFuzzTest, TestRandom) { for (size_t i = 0; i < 16384; ++i) { unsigned int seed = i; srand(seed); size_t length = static_cast(rand()) % 1024; std::unique_ptr text(new char[length]); for (size_t j = 0; j < length; ++j) text[j] = rand(); int bytes_consumed; bool is_reliable; CompactEncDet::DetectEncoding(text.get(), length, nullptr, // URL hint nullptr, // HTTP hint nullptr, // Meta hint UNKNOWN_ENCODING, UNKNOWN_LANGUAGE, CompactEncDet::WEB_CORPUS, false, // Include 7-bit encodings? &bytes_consumed, &is_reliable); } } } // namespace ================================================ FILE: third_party/ced/compact_enc_det/compact_enc_det_generated_tables.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef COMPACT_ENC_DET_COMPACT_ENC_DET_GENERATED_TABLES_H_ #define COMPACT_ENC_DET_COMPACT_ENC_DET_GENERATED_TABLES_H_ #include "compact_enc_det/compact_enc_det.h" #include "compact_enc_det/compact_enc_det_generated_tables2.h" #include "util/basictypes.h" #include "util/encodings/encodings.pb.h" enum RankedEncoding { F_ASCII_7_bit, // [0] encoding 24 F_Latin1, // [1] encoding 0 F_UTF8, // [2] encoding 22 F_GB, // [3] encoding 14 F_CP1252, // [4] encoding 27 F_KSC, // [5] encoding 16 F_SJS, // [6] encoding 11 F_EUC_JP, // [7] encoding 10 F_BIG5, // [8] encoding 13 F_Latin2, // [9] encoding 1 F_CP1251, // [10] encoding 26 F_CP1256, // [11] encoding 35 F_CP1250, // [12] encoding 29 F_Latin5, // [13] encoding 8 F_ISO_8859_11, // [14] encoding 33 F_ISO_8859_15, // [15] encoding 30 F_CP1257, // [16] encoding 32 F_CP1255, // [17] encoding 36 F_KOI8R, // [18] encoding 25 F_GBK, // [19] encoding 45 F_Greek, // [20] encoding 6 F_JIS, // [21] encoding 12 F_CP1254, // [22] encoding 31 F_CP1253, // [23] encoding 41 F_CP932, // [24] encoding 21 F_Hebrew, // [25] encoding 7 F_KOI8U, // [26] encoding 28 F_ISO_8859_5, // [27] encoding 4 F_CP874, // [28] encoding 34 F_ISO_8859_13, // [29] encoding 43 F_Latin4, // [30] encoding 3 F_MACINTOSH, // [31] encoding 53 F_GB18030, // [32] encoding 46 F_CP852, // [33] encoding 39 F_Arabic, // [34] encoding 5 F_BIG5_HKSCS, // [35] encoding 47 F_CP866, // [36] encoding 42 F_UTF_16BE, // [37] encoding 57 F_Latin3, // [38] encoding 2 F_UTF_16LE, // [39] encoding 58 F_HZ_GB_2312, // [40] encoding 62 F_CSN_369103, // [41] encoding 40 F_ISO_2022_KR, // [42] encoding 44 F_Latin6, // [43] encoding 9 F_UTF7, // [44] encoding 54 F_ISO_2022_CN, // [45] encoding 48 F_BIG5_CP950, // [46] encoding 20 F_JAGRAN, // [47] encoding 52 F_BHASKAR, // [48] encoding 55 F_HTCHANAKYA, // [49] encoding 56 F_TSCII, // [50] encoding 49 F_TAM, // [51] encoding 50 F_TAB, // [52] encoding 51 F_EUC_CN, // [53] encoding 15 F_EUC, // [54] encoding 18 F_CNS, // [55] encoding 19 F_UTF_32BE, // [56] encoding 59 F_UTF_32LE, // [57] encoding 60 F_X_BINARYENC, // [58] encoding 61 F_X_UTF8UTF8, // [59] encoding 63 F_X_TAM_ELANGO, // [60] encoding 64 F_X_TAM_LTTMBARANI, // [61] encoding 65 F_X_TAM_SHREE, // [62] encoding 66 F_X_TAM_TBOOMIS, // [63] encoding 67 F_X_TAM_TMNEWS, // [64] encoding 68 F_X_TAM_WEBTAMIL, // [65] encoding 69 F_UTF8CP1252, // [66] encoding 63 NUM_RANKEDENCODING }; static const Encoding kMapToEncoding[NUM_RANKEDENCODING] = { ASCII_7BIT, // encoding 24 ISO_8859_1, // encoding 0 UTF8, // encoding 22 CHINESE_GB, // encoding 14 MSFT_CP1252, // encoding 27 KOREAN_EUC_KR, // encoding 16 JAPANESE_SHIFT_JIS, // encoding 11 JAPANESE_EUC_JP, // encoding 10 CHINESE_BIG5, // encoding 13 ISO_8859_2, // encoding 1 RUSSIAN_CP1251, // encoding 26 MSFT_CP1256, // encoding 35 MSFT_CP1250, // encoding 29 ISO_8859_9, // encoding 8 ISO_8859_11, // encoding 33 ISO_8859_15, // encoding 30 MSFT_CP1257, // encoding 32 MSFT_CP1255, // encoding 36 RUSSIAN_KOI8_R, // encoding 25 GBK, // encoding 45 ISO_8859_7, // encoding 6 JAPANESE_JIS, // encoding 12 MSFT_CP1254, // encoding 31 MSFT_CP1253, // encoding 41 JAPANESE_CP932, // encoding 21 ISO_8859_8, // encoding 7 RUSSIAN_KOI8_RU, // encoding 28 ISO_8859_5, // encoding 4 MSFT_CP874, // encoding 34 ISO_8859_13, // encoding 43 ISO_8859_4, // encoding 3 MACINTOSH_ROMAN, // encoding 53 GB18030, // encoding 46 CZECH_CP852, // encoding 39 ISO_8859_6, // encoding 5 BIG5_HKSCS, // encoding 47 RUSSIAN_CP866, // encoding 42 UTF16BE, // encoding 57 ISO_8859_3, // encoding 2 UTF16LE, // encoding 58 HZ_GB_2312, // encoding 62 CZECH_CSN_369103, // encoding 40 ISO_2022_KR, // encoding 44 ISO_8859_10, // encoding 9 UTF7, // encoding 54 ISO_2022_CN, // encoding 48 CHINESE_BIG5_CP950, // encoding 20 JAGRAN, // encoding 52 BHASKAR, // encoding 55 HTCHANAKYA, // encoding 56 TSCII, // encoding 49 TAMIL_MONO, // encoding 50 TAMIL_BI, // encoding 51 CHINESE_EUC_CN, // encoding 15 CHINESE_EUC_DEC, // encoding 18 CHINESE_CNS, // encoding 19 UTF32BE, // encoding 59 UTF32LE, // encoding 60 BINARYENC, // encoding 61 UTF8UTF8, // encoding 63 TAM_ELANGO, // encoding 64 TAM_LTTMBARANI, // encoding 65 TAM_SHREE, // encoding 66 TAM_TBOOMIS, // encoding 67 TAM_TMNEWS, // encoding 68 TAM_WEBTAMIL, // encoding 69 UTF8UTF8, // encoding 63 }; // Massaged TLD or charset, followed by packed encoding probs typedef struct { char key_prob[20]; } HintEntry; static const HintEntry kLangHintProbs[] = { // MaxRange 192 {{(char)0x61,(char)0x62,(char)0x6b,(char)0x68,(char)0x61,(char)0x7a,(char)0x69,(char)0x61, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "abkhazia" // UTF8=191 [top UTF8] {{(char)0x61,(char)0x66,(char)0x61,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "afar____" // UTF8=191 [top UTF8] {{(char)0x61,(char)0x66,(char)0x72,(char)0x69,(char)0x6b,(char)0x61,(char)0x61,(char)0x6e, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "afrikaan" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x61,(char)0x6c,(char)0x62,(char)0x61,(char)0x6e,(char)0x69,(char)0x61,(char)0x6e, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "albanian" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x61,(char)0x6d,(char)0x68,(char)0x61,(char)0x72,(char)0x69,(char)0x63,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "amharic_" // UTF8=191 [top UTF8] {{(char)0x61,(char)0x72,(char)0x61,(char)0x62,(char)0x69,(char)0x63,(char)0x5f,(char)0x5f, (char)0x03,(char)0x84,(char)0x53,(char)0xa2,(char)0x11,(char)0x3b,(char)0x62,(char)0xbc,(char)0x34,(char)0x10,(char)0x51,(char)0x83,}}, // "arabic__" // ASCII-7-bit=132 Latin1=83 UTF8=162 CP1252=59 CP1256=188 CP1250=52 Arabic=131 [top CP1256] {{(char)0x61,(char)0x72,(char)0x6d,(char)0x65,(char)0x6e,(char)0x69,(char)0x61,(char)0x6e, (char)0x01,(char)0x5f,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "armenian" // ASCII-7-bit=95 UTF8=190 [top UTF8] {{(char)0x61,(char)0x73,(char)0x73,(char)0x61,(char)0x6d,(char)0x65,(char)0x73,(char)0x65, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "assamese" // UTF8=191 [top UTF8] {{(char)0x61,(char)0x79,(char)0x6d,(char)0x61,(char)0x72,(char)0x61,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "aymara__" // UTF8=191 [top UTF8] {{(char)0x61,(char)0x7a,(char)0x65,(char)0x72,(char)0x62,(char)0x61,(char)0x69,(char)0x6a, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "azerbaij" // UTF8=191 [top UTF8] {{(char)0x62,(char)0x61,(char)0x73,(char)0x68,(char)0x6b,(char)0x69,(char)0x72,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bashkir_" // UTF8=191 [top UTF8] {{(char)0x62,(char)0x61,(char)0x73,(char)0x71,(char)0x75,(char)0x65,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "basque__" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x62,(char)0x65,(char)0x6c,(char)0x61,(char)0x72,(char)0x75,(char)0x73,(char)0x69, (char)0xa1,(char)0xb5,(char)0x71,(char)0xa1,(char)0x72,(char)0x97,(char)0xab,(char)0x81,(char)0x8d,(char)0x00,(char)0x00,(char)0x00,}}, // "belarusi" // CP1251=181 KOI8R=161 KOI8U=151 ISO-8859-5=171 CP866=141 [top CP1251] {{(char)0x62,(char)0x65,(char)0x6e,(char)0x67,(char)0x61,(char)0x6c,(char)0x69,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bengali_" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x62,(char)0x69,(char)0x68,(char)0x61,(char)0x72,(char)0x69,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bihari__" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x62,(char)0x69,(char)0x73,(char)0x6c,(char)0x61,(char)0x6d,(char)0x61,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bislama_" // UTF8=191 [top UTF8] {{(char)0x62,(char)0x6f,(char)0x73,(char)0x6e,(char)0x69,(char)0x61,(char)0x6e,(char)0x5f, (char)0x91,(char)0xaf,(char)0x21,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bosnian_" // Latin2=175 CP1250=185 [top CP1250] {{(char)0x62,(char)0x72,(char)0x65,(char)0x74,(char)0x6f,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb5,(char)0x21,(char)0x97,(char)0x81,(char)0xab,(char)0x11,(char)0xa1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "breton__" // Latin1=181 CP1252=151 Latin5=171 ISO-8859-15=161 [top Latin1] {{(char)0x62,(char)0x75,(char)0x6c,(char)0x67,(char)0x61,(char)0x72,(char)0x69,(char)0x61, (char)0x03,(char)0x70,(char)0x47,(char)0xad,(char)0x11,(char)0x45,(char)0x51,(char)0xb5,(char)0x71,(char)0x95,(char)0x81,(char)0x9f,}}, // "bulgaria" // ASCII-7-bit=112 Latin1=71 UTF8=173 CP1252=69 CP1251=181 KOI8R=149 ISO-8859-5=159 [top CP1251] {{(char)0x62,(char)0x75,(char)0x72,(char)0x6d,(char)0x65,(char)0x73,(char)0x65,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "burmese_" // UTF8=191 [top UTF8] {{(char)0x63,(char)0x61,(char)0x74,(char)0x61,(char)0x6c,(char)0x61,(char)0x6e,(char)0x5f, (char)0x03,(char)0x8b,(char)0xb8,(char)0xa0,(char)0x11,(char)0xa4,(char)0xa1,(char)0x96,(char)0x10,(char)0x61,(char)0x31,(char)0x00,}}, // "catalan_" // ASCII-7-bit=139 Latin1=184 UTF8=160 CP1252=164 ISO-8859-15=150 Latin3=49 [top Latin1] {{(char)0x63,(char)0x68,(char)0x65,(char)0x72,(char)0x6f,(char)0x6b,(char)0x65,(char)0x65, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cherokee" // UTF8=191 [top UTF8] {{(char)0x63,(char)0x68,(char)0x69,(char)0x6e,(char)0x65,(char)0x73,(char)0x65,(char)0x5f, (char)0x01,(char)0x5c,(char)0x12,(char)0xa8,(char)0xbb,(char)0x11,(char)0x74,(char)0x21,(char)0x6d,(char)0xa1,(char)0x7d,(char)0x00,}}, // "chinese_" // ASCII-7-bit=92 UTF8=168 GB=187 KSC=116 BIG5=109 GBK=125 [top GB] {{(char)0x63,(char)0x68,(char)0x69,(char)0x6e,(char)0x65,(char)0x73,(char)0x65,(char)0x74, (char)0x06,(char)0x73,(char)0x5f,(char)0xad,(char)0x59,(char)0x43,(char)0x36,(char)0x21,(char)0xb9,(char)0x10,(char)0xa1,(char)0x38,}}, // "chineset" // ASCII-7-bit=115 Latin1=95 UTF8=173 GB=89 CP1252=67 KSC=54 BIG5=185 BIG5_HKSCS=56 [top BIG5] {{(char)0x63,(char)0x6f,(char)0x72,(char)0x73,(char)0x69,(char)0x63,(char)0x61,(char)0x6e, (char)0x12,(char)0xaf,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "corsican" // Latin1=175 UTF8=185 [top UTF8] {{(char)0x63,(char)0x72,(char)0x65,(char)0x6f,(char)0x6c,(char)0x65,(char)0x73,(char)0x61, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "creolesa" // UTF8=191 [top UTF8] {{(char)0x63,(char)0x72,(char)0x6f,(char)0x61,(char)0x74,(char)0x69,(char)0x61,(char)0x6e, (char)0x03,(char)0x91,(char)0x7b,(char)0xa6,(char)0x11,(char)0x86,(char)0x41,(char)0xac,(char)0x21,(char)0xb4,(char)0x31,(char)0x4d,}}, // "croatian" // ASCII-7-bit=145 Latin1=123 UTF8=166 CP1252=134 Latin2=172 CP1250=180 CP1257=77 [top CP1250] {{(char)0x63,(char)0x7a,(char)0x65,(char)0x63,(char)0x68,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x89,(char)0x11,(char)0xb1,(char)0x61,(char)0x98,(char)0x21,(char)0xb5,(char)0x10,(char)0x41,(char)0x7d,(char)0x00,}}, // "czech___" // ASCII-7-bit=137 UTF8=177 Latin2=152 CP1250=181 CP852=125 [top CP1250] {{(char)0x64,(char)0x61,(char)0x6e,(char)0x69,(char)0x73,(char)0x68,(char)0x5f,(char)0x5f, (char)0x03,(char)0x99,(char)0xb8,(char)0xa6,(char)0x11,(char)0x9a,(char)0x41,(char)0x38,(char)0x21,(char)0x32,(char)0x21,(char)0x84,}}, // "danish__" // ASCII-7-bit=153 Latin1=184 UTF8=166 CP1252=154 Latin2=56 CP1250=50 ISO-8859-15=132 [top Latin1] {{(char)0x64,(char)0x68,(char)0x69,(char)0x76,(char)0x65,(char)0x68,(char)0x69,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "dhivehi_" // UTF8=191 [top UTF8] {{(char)0x64,(char)0x75,(char)0x74,(char)0x63,(char)0x68,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb1,(char)0xae,(char)0xa3,(char)0x11,(char)0xa1,(char)0x41,(char)0x41,(char)0x21,(char)0x44,(char)0x21,(char)0x7f,}}, // "dutch___" // ASCII-7-bit=177 Latin1=174 UTF8=163 CP1252=161 Latin2=65 CP1250=68 ISO-8859-15=127 [top ASCII-7-bit] {{(char)0x64,(char)0x7a,(char)0x6f,(char)0x6e,(char)0x67,(char)0x6b,(char)0x68,(char)0x61, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "dzongkha" // UTF8=191 [top UTF8] {{(char)0x65,(char)0x6e,(char)0x67,(char)0x6c,(char)0x69,(char)0x73,(char)0x68,(char)0x5f, (char)0x06,(char)0xb9,(char)0xa0,(char)0xa2,(char)0x5d,(char)0x94,(char)0x55,(char)0x21,(char)0x56,(char)0x61,(char)0x69,(char)0x00,}}, // "english_" // ASCII-7-bit=185 Latin1=160 UTF8=162 GB=93 CP1252=148 KSC=85 BIG5=86 ISO-8859-15=105 [top ASCII-7-bit] {{(char)0x65,(char)0x73,(char)0x70,(char)0x65,(char)0x72,(char)0x61,(char)0x6e,(char)0x74, (char)0x03,(char)0x89,(char)0xb4,(char)0xa2,(char)0x12,(char)0xaa,(char)0x45,(char)0x61,(char)0x4c,(char)0x21,(char)0xa0,(char)0x00,}}, // "esperant" // ASCII-7-bit=137 Latin1=180 UTF8=162 CP1252=170 KSC=69 CP1250=76 ISO-8859-15=160 [top Latin1] {{(char)0x65,(char)0x73,(char)0x74,(char)0x6f,(char)0x6e,(char)0x69,(char)0x61,(char)0x6e, (char)0x03,(char)0x90,(char)0xab,(char)0xb1,(char)0x11,(char)0x91,(char)0xa2,(char)0x7e,(char)0xa3,(char)0xc2,(char)0x8e,(char)0x98,}}, // "estonian" // ASCII-7-bit=144 Latin1=171 UTF8=177 CP1252=145 ISO-8859-15=126 CP1257=163 ISO-8859-13=142 Latin4=152 [top UTF8] {{(char)0x66,(char)0x61,(char)0x72,(char)0x6f,(char)0x65,(char)0x73,(char)0x65,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "faroese_" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x66,(char)0x69,(char)0x6a,(char)0x69,(char)0x61,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "fijian__" // UTF8=191 [top UTF8] {{(char)0x66,(char)0x69,(char)0x6e,(char)0x6e,(char)0x69,(char)0x73,(char)0x68,(char)0x5f, (char)0x03,(char)0x96,(char)0xb7,(char)0xa9,(char)0x11,(char)0x9c,(char)0x71,(char)0x42,(char)0x22,(char)0x8b,(char)0x39,(char)0x00,}}, // "finnish_" // ASCII-7-bit=150 Latin1=183 UTF8=169 CP1252=156 CP1250=66 ISO-8859-15=139 CP1257=57 [top Latin1] {{(char)0x66,(char)0x72,(char)0x65,(char)0x6e,(char)0x63,(char)0x68,(char)0x5f,(char)0x5f, (char)0x03,(char)0x99,(char)0xb6,(char)0xaa,(char)0x11,(char)0xa0,(char)0x62,(char)0x4f,(char)0x46,(char)0x21,(char)0x86,(char)0x00,}}, // "french__" // ASCII-7-bit=153 Latin1=182 UTF8=170 CP1252=160 CP1256=79 CP1250=70 ISO-8859-15=134 [top Latin1] {{(char)0x66,(char)0x72,(char)0x69,(char)0x73,(char)0x69,(char)0x61,(char)0x6e,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "frisian_" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x67,(char)0x61,(char)0x6c,(char)0x69,(char)0x63,(char)0x69,(char)0x61,(char)0x6e, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "galician" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x67,(char)0x61,(char)0x6e,(char)0x64,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ganda___" // UTF8=191 [top UTF8] {{(char)0x67,(char)0x65,(char)0x6f,(char)0x72,(char)0x67,(char)0x69,(char)0x61,(char)0x6e, (char)0x01,(char)0x6c,(char)0x11,(char)0xbe,(char)0x11,(char)0x1c,(char)0x10,(char)0x21,(char)0x1c,(char)0x00,(char)0x00,(char)0x00,}}, // "georgian" // ASCII-7-bit=108 UTF8=190 CP1252=28 CP1253=28 [top UTF8] {{(char)0x67,(char)0x65,(char)0x72,(char)0x6d,(char)0x61,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa2,(char)0xb7,(char)0xa6,(char)0x11,(char)0x9b,(char)0x41,(char)0x56,(char)0x21,(char)0x5d,(char)0x21,(char)0x7c,}}, // "german__" // ASCII-7-bit=162 Latin1=183 UTF8=166 CP1252=155 Latin2=86 CP1250=93 ISO-8859-15=124 [top Latin1] {{(char)0x67,(char)0x72,(char)0x65,(char)0x65,(char)0x6b,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x03,(char)0x81,(char)0x54,(char)0xad,(char)0x11,(char)0x52,(char)0xd1,(char)0x31,(char)0x11,(char)0xb4,(char)0x21,(char)0xa6,}}, // "greek___" // ASCII-7-bit=129 Latin1=84 UTF8=173 CP1252=82 KOI8R=49 Greek=180 CP1253=166 [top Greek] {{(char)0x67,(char)0x72,(char)0x65,(char)0x65,(char)0x6e,(char)0x6c,(char)0x61,(char)0x6e, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "greenlan" // UTF8=191 [top UTF8] {{(char)0x67,(char)0x75,(char)0x61,(char)0x72,(char)0x61,(char)0x6e,(char)0x69,(char)0x5f, (char)0x11,(char)0xb9,(char)0x20,(char)0x91,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "guarani_" // Latin1=185 Latin6=175 [top Latin1] {{(char)0x67,(char)0x75,(char)0x6a,(char)0x61,(char)0x72,(char)0x61,(char)0x74,(char)0x69, (char)0x03,(char)0x79,(char)0xb6,(char)0x76,(char)0x11,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gujarati" // ASCII-7-bit=121 Latin1=182 UTF8=118 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x68,(char)0x61,(char)0x69,(char)0x74,(char)0x69,(char)0x61,(char)0x6e,(char)0x63, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "haitianc" // UTF8=191 [top UTF8] {{(char)0x68,(char)0x61,(char)0x75,(char)0x73,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "hausa___" // UTF8=191 [top UTF8] {{(char)0x68,(char)0x65,(char)0x62,(char)0x72,(char)0x65,(char)0x77,(char)0x5f,(char)0x5f, (char)0x03,(char)0x76,(char)0x46,(char)0xab,(char)0x11,(char)0x3b,(char)0x51,(char)0x32,(char)0x61,(char)0xb8,(char)0x71,(char)0x9f,}}, // "hebrew__" // ASCII-7-bit=118 Latin1=70 UTF8=171 CP1252=59 CP1251=50 CP1255=184 Hebrew=159 [top CP1255] {{(char)0x68,(char)0x69,(char)0x6e,(char)0x64,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb5,(char)0x21,(char)0xab,(char)0xa1,(char)0xa1,(char)0x10,(char)0xf3,(char)0x97,(char)0x8d,(char)0x83,(char)0x00,}}, // "hindi___" // Latin1=181 CP1252=171 ISO-8859-15=161 JAGRAN=151 BHASKAR=141 HTCHANAKYA=131 [top Latin1] {{(char)0x68,(char)0x75,(char)0x6e,(char)0x67,(char)0x61,(char)0x72,(char)0x69,(char)0x61, (char)0x03,(char)0x93,(char)0x9f,(char)0xad,(char)0x11,(char)0x6f,(char)0x41,(char)0xae,(char)0x21,(char)0xa9,(char)0x21,(char)0x40,}}, // "hungaria" // ASCII-7-bit=147 Latin1=159 UTF8=173 CP1252=111 Latin2=174 CP1250=169 ISO-8859-15=64 [top Latin2] {{(char)0x69,(char)0x63,(char)0x65,(char)0x6c,(char)0x61,(char)0x6e,(char)0x64,(char)0x69, (char)0x03,(char)0x7f,(char)0xb8,(char)0x9c,(char)0x11,(char)0xa4,(char)0x11,(char)0x1d,(char)0x51,(char)0x2f,(char)0x21,(char)0x99,}}, // "icelandi" // ASCII-7-bit=127 Latin1=184 UTF8=156 CP1252=164 SJS=29 CP1250=47 ISO-8859-15=153 [top Latin1] {{(char)0x69,(char)0x6e,(char)0x64,(char)0x6f,(char)0x6e,(char)0x65,(char)0x73,(char)0x69, (char)0x03,(char)0xb2,(char)0xae,(char)0x99,(char)0x11,(char)0xa2,(char)0x11,(char)0x5b,(char)0x41,(char)0x70,(char)0x31,(char)0x91,}}, // "indonesi" // ASCII-7-bit=178 Latin1=174 UTF8=153 CP1252=162 SJS=91 CP1256=112 ISO-8859-15=145 [top ASCII-7-bit] {{(char)0x69,(char)0x6e,(char)0x74,(char)0x65,(char)0x72,(char)0x6c,(char)0x69,(char)0x6e, (char)0x12,(char)0xb0,(char)0xb0,(char)0x11,(char)0xa6,(char)0xa1,(char)0x9c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "interlin" // Latin1=176 UTF8=176 CP1252=166 ISO-8859-15=156 [top Latin1] {{(char)0x69,(char)0x6e,(char)0x75,(char)0x6b,(char)0x74,(char)0x69,(char)0x74,(char)0x75, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "inuktitu" // UTF8=191 [top UTF8] {{(char)0x69,(char)0x6e,(char)0x75,(char)0x70,(char)0x69,(char)0x61,(char)0x6b,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "inupiak_" // UTF8=191 [top UTF8] {{(char)0x69,(char)0x72,(char)0x69,(char)0x73,(char)0x68,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "irish___" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x69,(char)0x74,(char)0x61,(char)0x6c,(char)0x69,(char)0x61,(char)0x6e,(char)0x5f, (char)0x03,(char)0xa7,(char)0xb4,(char)0xa4,(char)0x11,(char)0xa4,(char)0x41,(char)0x4d,(char)0x21,(char)0x55,(char)0x21,(char)0x78,}}, // "italian_" // ASCII-7-bit=167 Latin1=180 UTF8=164 CP1252=164 Latin2=77 CP1250=85 ISO-8859-15=120 [top Latin1] {{(char)0x6a,(char)0x61,(char)0x70,(char)0x61,(char)0x6e,(char)0x65,(char)0x73,(char)0x65, (char)0x01,(char)0x68,(char)0x11,(char)0xa7,(char)0x32,(char)0xb4,(char)0xad,(char)0xd1,(char)0x78,(char)0x21,(char)0x62,(char)0x00,}}, // "japanese" // ASCII-7-bit=104 UTF8=167 SJS=180 EUC-JP=173 JIS=120 CP932=98 [top SJS] {{(char)0x6a,(char)0x61,(char)0x76,(char)0x61,(char)0x6e,(char)0x65,(char)0x73,(char)0x65, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "javanese" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x6b,(char)0x61,(char)0x6e,(char)0x6e,(char)0x61,(char)0x64,(char)0x61,(char)0x5f, (char)0x03,(char)0x65,(char)0xb6,(char)0x81,(char)0x11,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kannada_" // ASCII-7-bit=101 Latin1=182 UTF8=129 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x6b,(char)0x61,(char)0x73,(char)0x68,(char)0x6d,(char)0x69,(char)0x72,(char)0x69, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kashmiri" // UTF8=191 [top UTF8] {{(char)0x6b,(char)0x61,(char)0x7a,(char)0x61,(char)0x6b,(char)0x68,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kazakh__" // UTF8=191 [top UTF8] {{(char)0x6b,(char)0x68,(char)0x61,(char)0x73,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "khasi___" // UTF8=191 [top UTF8] {{(char)0x6b,(char)0x68,(char)0x6d,(char)0x65,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "khmer___" // UTF8=191 [top UTF8] {{(char)0x6b,(char)0x69,(char)0x6e,(char)0x79,(char)0x61,(char)0x72,(char)0x77,(char)0x61, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kinyarwa" // UTF8=191 [top UTF8] {{(char)0x6b,(char)0x6f,(char)0x72,(char)0x65,(char)0x61,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x06,(char)0x5d,(char)0x34,(char)0x9d,(char)0x20,(char)0x1a,(char)0xbd,(char)0x11,(char)0x0c,(char)0x20,(char)0x21,(char)0x76,}}, // "korean__" // ASCII-7-bit=93 Latin1=52 UTF8=157 GB=32 CP1252=26 KSC=189 EUC-JP=12 ISO-2022-KR=118 [top KSC] {{(char)0x6b,(char)0x75,(char)0x72,(char)0x64,(char)0x69,(char)0x73,(char)0x68,(char)0x5f, (char)0xb1,(char)0xb9,(char)0x10,(char)0x61,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kurdish_" // CP1256=185 Arabic=175 [top CP1256] {{(char)0x6b,(char)0x79,(char)0x72,(char)0x67,(char)0x79,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x10,(char)0x61,(char)0xaf,(char)0x41,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kyrgyz__" // CP1254=175 ISO-8859-5=185 [top ISO-8859-5] {{(char)0x6c,(char)0x61,(char)0x6f,(char)0x74,(char)0x68,(char)0x69,(char)0x61,(char)0x6e, (char)0x01,(char)0x40,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "laothian" // ASCII-7-bit=64 UTF8=190 [top UTF8] {{(char)0x6c,(char)0x61,(char)0x74,(char)0x69,(char)0x6e,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "latin___" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x6c,(char)0x61,(char)0x74,(char)0x76,(char)0x69,(char)0x61,(char)0x6e,(char)0x5f, (char)0x03,(char)0x80,(char)0x55,(char)0xac,(char)0x11,(char)0x64,(char)0xb1,(char)0xb4,(char)0xc2,(char)0x99,(char)0xa3,(char)0x00,}}, // "latvian_" // ASCII-7-bit=128 Latin1=85 UTF8=172 CP1252=100 CP1257=180 ISO-8859-13=153 Latin4=163 [top CP1257] {{(char)0x6c,(char)0x69,(char)0x6d,(char)0x62,(char)0x75,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "limbu___" // UTF8=191 [top UTF8] {{(char)0x6c,(char)0x69,(char)0x6e,(char)0x67,(char)0x61,(char)0x6c,(char)0x61,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lingala_" // UTF8=191 [top UTF8] {{(char)0x6c,(char)0x69,(char)0x74,(char)0x68,(char)0x75,(char)0x61,(char)0x6e,(char)0x69, (char)0x03,(char)0x7c,(char)0x5d,(char)0xaa,(char)0x11,(char)0x73,(char)0xb1,(char)0xb7,(char)0xc2,(char)0x94,(char)0x9d,(char)0x00,}}, // "lithuani" // ASCII-7-bit=124 Latin1=93 UTF8=170 CP1252=115 CP1257=183 ISO-8859-13=148 Latin4=157 [top CP1257] {{(char)0x6c,(char)0x75,(char)0x78,(char)0x65,(char)0x6d,(char)0x62,(char)0x6f,(char)0x75, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "luxembou" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x6d,(char)0x61,(char)0x63,(char)0x65,(char)0x64,(char)0x6f,(char)0x6e,(char)0x69, (char)0x03,(char)0x7a,(char)0x54,(char)0xa9,(char)0x11,(char)0x4b,(char)0x51,(char)0xb3,(char)0x71,(char)0x9e,(char)0x81,(char)0xa8,}}, // "macedoni" // ASCII-7-bit=122 Latin1=84 UTF8=169 CP1252=75 CP1251=179 KOI8R=158 ISO-8859-5=168 [top CP1251] {{(char)0x6d,(char)0x61,(char)0x6c,(char)0x61,(char)0x67,(char)0x61,(char)0x73,(char)0x79, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "malagasy" // UTF8=191 [top UTF8] {{(char)0x6d,(char)0x61,(char)0x6c,(char)0x61,(char)0x79,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "malay___" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x6d,(char)0x61,(char)0x6c,(char)0x61,(char)0x79,(char)0x61,(char)0x6c,(char)0x61, (char)0x03,(char)0x48,(char)0xb6,(char)0x81,(char)0x11,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "malayala" // ASCII-7-bit=72 Latin1=182 UTF8=129 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x6d,(char)0x61,(char)0x6c,(char)0x74,(char)0x65,(char)0x73,(char)0x65,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "maltese_" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x6d,(char)0x61,(char)0x6e,(char)0x78,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "manx____" // UTF8=191 [top UTF8] {{(char)0x6d,(char)0x61,(char)0x6f,(char)0x72,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "maori___" // UTF8=191 [top UTF8] {{(char)0x6d,(char)0x61,(char)0x72,(char)0x61,(char)0x74,(char)0x68,(char)0x69,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "marathi_" // UTF8=191 [top UTF8] {{(char)0x6d,(char)0x6f,(char)0x6c,(char)0x64,(char)0x61,(char)0x76,(char)0x69,(char)0x61, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "moldavia" // UTF8=191 [top UTF8] {{(char)0x6d,(char)0x6f,(char)0x6e,(char)0x67,(char)0x6f,(char)0x6c,(char)0x69,(char)0x61, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mongolia" // CP1251=191 [top CP1251] {{(char)0x6e,(char)0x61,(char)0x75,(char)0x72,(char)0x75,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "nauru___" // UTF8=191 [top UTF8] {{(char)0x6e,(char)0x65,(char)0x70,(char)0x61,(char)0x6c,(char)0x69,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "nepali__" // UTF8=191 [top UTF8] {{(char)0x6e,(char)0x6f,(char)0x72,(char)0x77,(char)0x65,(char)0x67,(char)0x69,(char)0x61, (char)0x03,(char)0x92,(char)0xb8,(char)0xa8,(char)0x11,(char)0x9c,(char)0x41,(char)0x30,(char)0x31,(char)0x24,(char)0x11,(char)0x8e,}}, // "norwegia" // ASCII-7-bit=146 Latin1=184 UTF8=168 CP1252=156 Latin2=48 Latin5=36 ISO-8859-15=142 [top Latin1] {{(char)0x6f,(char)0x63,(char)0x63,(char)0x69,(char)0x74,(char)0x61,(char)0x6e,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "occitan_" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x6f,(char)0x72,(char)0x69,(char)0x79,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "oriya___" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x6f,(char)0x72,(char)0x6f,(char)0x6d,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "oromo___" // UTF8=191 [top UTF8] {{(char)0x70,(char)0x61,(char)0x73,(char)0x68,(char)0x74,(char)0x6f,(char)0x5f,(char)0x5f, (char)0xb1,(char)0xb9,(char)0x10,(char)0x61,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "pashto__" // CP1256=185 Arabic=175 [top CP1256] {{(char)0x70,(char)0x65,(char)0x72,(char)0x73,(char)0x69,(char)0x61,(char)0x6e,(char)0x5f, (char)0x12,(char)0x44,(char)0xb6,(char)0x11,(char)0x33,(char)0x62,(char)0xae,(char)0x19,(char)0x10,(char)0x51,(char)0x9f,(char)0x00,}}, // "persian_" // Latin1=68 UTF8=182 CP1252=51 CP1256=174 CP1250=25 Arabic=159 [top UTF8] {{(char)0x70,(char)0x6f,(char)0x6c,(char)0x69,(char)0x73,(char)0x68,(char)0x5f,(char)0x5f, (char)0x05,(char)0x85,(char)0x6c,(char)0xa8,(char)0x26,(char)0x57,(char)0x41,(char)0xb9,(char)0x21,(char)0x99,(char)0x31,(char)0x23,}}, // "polish__" // ASCII-7-bit=133 Latin1=108 UTF8=168 GB=38 CP1252=87 Latin2=185 CP1250=153 CP1257=35 [top Latin2] {{(char)0x70,(char)0x6f,(char)0x72,(char)0x74,(char)0x75,(char)0x67,(char)0x75,(char)0x65, (char)0x03,(char)0x96,(char)0xb9,(char)0xa6,(char)0x11,(char)0x9a,(char)0x11,(char)0x30,(char)0x51,(char)0x36,(char)0x21,(char)0x86,}}, // "portugue" // ASCII-7-bit=150 Latin1=185 UTF8=166 CP1252=154 SJS=48 CP1250=54 ISO-8859-15=134 [top Latin1] {{(char)0x70,(char)0x75,(char)0x6e,(char)0x6a,(char)0x61,(char)0x62,(char)0x69,(char)0x5f, (char)0x03,(char)0x42,(char)0xb6,(char)0x7b,(char)0x11,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "punjabi_" // ASCII-7-bit=66 Latin1=182 UTF8=123 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x71,(char)0x75,(char)0x65,(char)0x63,(char)0x68,(char)0x75,(char)0x61,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "quechua_" // UTF8=191 [top UTF8] {{(char)0x72,(char)0x68,(char)0x61,(char)0x65,(char)0x74,(char)0x6f,(char)0x72,(char)0x6f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "rhaetoro" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x72,(char)0x6f,(char)0x6d,(char)0x61,(char)0x6e,(char)0x69,(char)0x61,(char)0x6e, (char)0x03,(char)0xb2,(char)0x9d,(char)0xa5,(char)0x11,(char)0x92,(char)0x42,(char)0xa7,(char)0x51,(char)0x11,(char)0x99,(char)0x00,}}, // "romanian" // ASCII-7-bit=178 Latin1=157 UTF8=165 CP1252=146 Latin2=167 CP1251=81 CP1250=153 [top ASCII-7-bit] {{(char)0x72,(char)0x75,(char)0x6e,(char)0x64,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "rundi___" // UTF8=191 [top UTF8] {{(char)0x72,(char)0x75,(char)0x73,(char)0x73,(char)0x69,(char)0x61,(char)0x6e,(char)0x5f, (char)0x01,(char)0x74,(char)0x11,(char)0xa9,(char)0x71,(char)0xb9,(char)0x71,(char)0x99,(char)0x81,(char)0x82,(char)0x81,(char)0x6d,}}, // "russian_" // ASCII-7-bit=116 UTF8=169 CP1251=185 KOI8R=153 ISO-8859-5=130 CP866=109 [top CP1251] {{(char)0x73,(char)0x61,(char)0x6d,(char)0x6f,(char)0x61,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "samoan__" // UTF8=191 [top UTF8] {{(char)0x73,(char)0x61,(char)0x6e,(char)0x67,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sango___" // UTF8=191 [top UTF8] {{(char)0x73,(char)0x61,(char)0x6e,(char)0x73,(char)0x6b,(char)0x72,(char)0x69,(char)0x74, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sanskrit" // UTF8=191 [top UTF8] {{(char)0x73,(char)0x63,(char)0x6f,(char)0x74,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "scots___" // UTF8=191 [top UTF8] {{(char)0x73,(char)0x63,(char)0x6f,(char)0x74,(char)0x73,(char)0x67,(char)0x61,(char)0x65, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "scotsgae" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x73,(char)0x65,(char)0x72,(char)0x62,(char)0x69,(char)0x61,(char)0x6e,(char)0x5f, (char)0x03,(char)0x93,(char)0x77,(char)0xad,(char)0x11,(char)0x85,(char)0x42,(char)0xad,(char)0x52,(char)0x12,(char)0xae,(char)0x4a,}}, // "serbian_" // ASCII-7-bit=147 Latin1=119 UTF8=173 CP1252=133 Latin2=173 CP1251=82 CP1250=174 Latin5=74 [top CP1250] {{(char)0x73,(char)0x65,(char)0x72,(char)0x62,(char)0x6f,(char)0x63,(char)0x72,(char)0x6f, (char)0x91,(char)0xaf,(char)0x21,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "serbocro" // Latin2=175 CP1250=185 [top CP1250] {{(char)0x73,(char)0x65,(char)0x73,(char)0x6f,(char)0x74,(char)0x68,(char)0x6f,(char)0x5f, (char)0x11,(char)0xb9,(char)0x21,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sesotho_" // Latin1=185 CP1252=175 [top Latin1] {{(char)0x73,(char)0x68,(char)0x6f,(char)0x6e,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "shona___" // UTF8=191 [top UTF8] {{(char)0x73,(char)0x69,(char)0x6e,(char)0x64,(char)0x68,(char)0x69,(char)0x5f,(char)0x5f, (char)0xb1,(char)0xb9,(char)0x10,(char)0x61,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sindhi__" // CP1256=185 Arabic=175 [top CP1256] {{(char)0x73,(char)0x69,(char)0x6e,(char)0x68,(char)0x61,(char)0x6c,(char)0x65,(char)0x73, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sinhales" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x73,(char)0x69,(char)0x73,(char)0x77,(char)0x61,(char)0x6e,(char)0x74,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "siswant_" // UTF8=191 [top UTF8] {{(char)0x73,(char)0x6c,(char)0x6f,(char)0x76,(char)0x61,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x03,(char)0x88,(char)0x6e,(char)0xaf,(char)0x11,(char)0x67,(char)0x41,(char)0xa5,(char)0x21,(char)0xb3,(char)0x00,(char)0x00,}}, // "slovak__" // ASCII-7-bit=136 Latin1=110 UTF8=175 CP1252=103 Latin2=165 CP1250=179 [top CP1250] {{(char)0x73,(char)0x6c,(char)0x6f,(char)0x76,(char)0x65,(char)0x6e,(char)0x69,(char)0x61, (char)0x03,(char)0x8e,(char)0x71,(char)0xb2,(char)0x11,(char)0x80,(char)0x42,(char)0xaa,(char)0x39,(char)0x11,(char)0xad,(char)0x00,}}, // "slovenia" // ASCII-7-bit=142 Latin1=113 UTF8=178 CP1252=128 Latin2=170 CP1251=57 CP1250=173 [top UTF8] {{(char)0x73,(char)0x6f,(char)0x6d,(char)0x61,(char)0x6c,(char)0x69,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb9,(char)0x21,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "somali__" // Latin1=185 CP1252=175 [top Latin1] {{(char)0x73,(char)0x70,(char)0x61,(char)0x6e,(char)0x69,(char)0x73,(char)0x68,(char)0x5f, (char)0x03,(char)0x9b,(char)0xb8,(char)0xa7,(char)0x11,(char)0x98,(char)0x41,(char)0x45,(char)0x21,(char)0x45,(char)0x21,(char)0x77,}}, // "spanish_" // ASCII-7-bit=155 Latin1=184 UTF8=167 CP1252=152 Latin2=69 CP1250=69 ISO-8859-15=119 [top Latin1] {{(char)0x73,(char)0x75,(char)0x6e,(char)0x64,(char)0x61,(char)0x6e,(char)0x65,(char)0x73, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sundanes" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x73,(char)0x77,(char)0x61,(char)0x68,(char)0x69,(char)0x6c,(char)0x69,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "swahili_" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x73,(char)0x77,(char)0x65,(char)0x64,(char)0x69,(char)0x73,(char)0x68,(char)0x5f, (char)0x03,(char)0x90,(char)0xba,(char)0xa4,(char)0x11,(char)0x8d,(char)0x41,(char)0x2c,(char)0x21,(char)0x2c,(char)0x21,(char)0x7a,}}, // "swedish_" // ASCII-7-bit=144 Latin1=186 UTF8=164 CP1252=141 Latin2=44 CP1250=44 ISO-8859-15=122 [top Latin1] {{(char)0x73,(char)0x79,(char)0x72,(char)0x69,(char)0x61,(char)0x63,(char)0x5f,(char)0x5f, (char)0x01,(char)0x6a,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "syriac__" // ASCII-7-bit=106 UTF8=190 [top UTF8] {{(char)0x74,(char)0x61,(char)0x67,(char)0x61,(char)0x6c,(char)0x6f,(char)0x67,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tagalog_" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x74,(char)0x61,(char)0x6a,(char)0x69,(char)0x6b,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tajik___" // UTF8=191 [top UTF8] {{(char)0x74,(char)0x61,(char)0x6d,(char)0x69,(char)0x6c,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x12,(char)0xb4,(char)0x8e,(char)0x11,(char)0xaa,(char)0xa1,(char)0xa0,(char)0x20,(char)0x23,(char)0x96,(char)0x8c,(char)0x82,}}, // "tamil___" // Latin1=180 UTF8=142 CP1252=170 ISO-8859-15=160 TSCII=150 TAM=140 TAB=130 [top Latin1] {{(char)0x74,(char)0x61,(char)0x74,(char)0x61,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tatar___" // UTF8=191 [top UTF8] {{(char)0x74,(char)0x65,(char)0x6c,(char)0x75,(char)0x67,(char)0x75,(char)0x5f,(char)0x5f, (char)0x03,(char)0x66,(char)0xb6,(char)0x90,(char)0x11,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "telugu__" // ASCII-7-bit=102 Latin1=182 UTF8=144 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x74,(char)0x68,(char)0x61,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x05,(char)0x7a,(char)0x53,(char)0xa2,(char)0x24,(char)0x46,(char)0x91,(char)0xba,(char)0xd1,(char)0x9e,(char)0x21,(char)0x29,}}, // "thai____" // ASCII-7-bit=122 Latin1=83 UTF8=162 GB=36 CP1252=70 ISO-8859-11=186 CP874=158 MACINTOSH=41 [top ISO-8859-11] {{(char)0x74,(char)0x69,(char)0x62,(char)0x65,(char)0x74,(char)0x61,(char)0x6e,(char)0x5f, (char)0x01,(char)0x42,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tibetan_" // ASCII-7-bit=66 UTF8=190 [top UTF8] {{(char)0x74,(char)0x69,(char)0x67,(char)0x72,(char)0x69,(char)0x6e,(char)0x79,(char)0x61, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tigrinya" // UTF8=191 [top UTF8] {{(char)0x74,(char)0x6f,(char)0x6e,(char)0x67,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tonga___" // UTF8=191 [top UTF8] {{(char)0x74,(char)0x73,(char)0x6f,(char)0x6e,(char)0x67,(char)0x61,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tsonga__" // UTF8=191 [top UTF8] {{(char)0x74,(char)0x73,(char)0x77,(char)0x61,(char)0x6e,(char)0x61,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tswana__" // UTF8=191 [top UTF8] {{(char)0x74,(char)0x75,(char)0x72,(char)0x6b,(char)0x69,(char)0x73,(char)0x68,(char)0x5f, (char)0x03,(char)0x81,(char)0x7f,(char)0xa5,(char)0x11,(char)0x6e,(char)0x81,(char)0xba,(char)0x11,(char)0x3d,(char)0x61,(char)0x95,}}, // "turkish_" // ASCII-7-bit=129 Latin1=127 UTF8=165 CP1252=110 Latin5=186 ISO-8859-15=61 CP1254=149 [top Latin5] {{(char)0x74,(char)0x75,(char)0x72,(char)0x6b,(char)0x6d,(char)0x65,(char)0x6e,(char)0x5f, (char)0x91,(char)0xb9,(char)0x21,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "turkmen_" // Latin2=185 CP1250=175 [top Latin2] {{(char)0x74,(char)0x77,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xac,(char)0x21,(char)0xb6,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "twi_____" // Latin1=172 CP1252=182 ISO-8859-15=162 [top CP1252] {{(char)0x75,(char)0x69,(char)0x67,(char)0x68,(char)0x75,(char)0x72,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "uighur__" // UTF8=191 [top UTF8] {{(char)0x75,(char)0x6b,(char)0x72,(char)0x61,(char)0x69,(char)0x6e,(char)0x69,(char)0x61, (char)0x21,(char)0xa0,(char)0x71,(char)0xb7,(char)0x71,(char)0x91,(char)0x72,(char)0x98,(char)0xa2,(char)0x81,(char)0x84,(char)0x00,}}, // "ukrainia" // UTF8=160 CP1251=183 KOI8R=145 KOI8U=152 ISO-8859-5=162 CP866=132 [top CP1251] {{(char)0x75,(char)0x72,(char)0x64,(char)0x75,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0xb1,(char)0xb9,(char)0x10,(char)0x61,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "urdu____" // CP1256=185 Arabic=175 [top CP1256] {{(char)0x75,(char)0x7a,(char)0x62,(char)0x65,(char)0x6b,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "uzbek___" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x76,(char)0x69,(char)0x65,(char)0x74,(char)0x6e,(char)0x61,(char)0x6d,(char)0x65, (char)0x03,(char)0x81,(char)0xa8,(char)0xb7,(char)0x11,(char)0x9e,(char)0xa1,(char)0x94,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "vietname" // ASCII-7-bit=129 Latin1=168 UTF8=183 CP1252=158 ISO-8859-15=148 [top UTF8] {{(char)0x76,(char)0x6f,(char)0x6c,(char)0x61,(char)0x70,(char)0x75,(char)0x6b,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "volapuk_" // UTF8=191 [top UTF8] {{(char)0x77,(char)0x65,(char)0x6c,(char)0x73,(char)0x68,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "welsh___" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x77,(char)0x6f,(char)0x6c,(char)0x6f,(char)0x66,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wolof___" // UTF8=191 [top UTF8] {{(char)0x78,(char)0x68,(char)0x6f,(char)0x73,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "xhosa___" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] {{(char)0x79,(char)0x69,(char)0x64,(char)0x64,(char)0x69,(char)0x73,(char)0x68,(char)0x5f, (char)0x10,(char)0x11,(char)0xb9,(char)0x71,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "yiddish_" // CP1255=185 Hebrew=175 [top CP1255] {{(char)0x79,(char)0x6f,(char)0x72,(char)0x75,(char)0x62,(char)0x61,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "yoruba__" // UTF8=191 [top UTF8] {{(char)0x7a,(char)0x68,(char)0x75,(char)0x61,(char)0x6e,(char)0x67,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "zhuang__" // UTF8=191 [top UTF8] {{(char)0x7a,(char)0x75,(char)0x6c,(char)0x75,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xb6,(char)0x21,(char)0xac,(char)0xa1,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "zulu____" // Latin1=182 CP1252=172 ISO-8859-15=162 [top Latin1] }; static const int kLangHintProbsSize = 151; static const HintEntry kTLDHintProbs[] = { // MaxRange 192 {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x0f,(char)0xa8,(char)0xa1,(char)0xa3,(char)0xa0,(char)0x8e,(char)0x8e,(char)0x8a,(char)0x7e,(char)0xa8,(char)0x77,(char)0x7b,(char)0x8b,(char)0x75,(char)0x79,(char)0x7e,}}, // "____" // ASCII-7-bit=168 Latin1=161 UTF8=163 GB=160 CP1252=142 KSC=142 SJS=138 EUC-JP=126 BIG5=168 Latin2=119 CP1251=123 CP1256=139 CP1250=117 Latin5=121 ISO-8859-11=126 [top ASCII-7-bit] {{(char)0x61,(char)0x63,(char)0x5f,(char)0x5f, (char)0x08,(char)0xa0,(char)0x9a,(char)0xa1,(char)0x65,(char)0x92,(char)0x8f,(char)0xb1,(char)0xa2,(char)0x22,(char)0x56,(char)0x8a,(char)0x21,(char)0x56,(char)0x61,(char)0x87,}}, // "ac__" // ASCII-7-bit=160 Latin1=154 UTF8=161 GB=101 CP1252=146 KSC=143 SJS=177 EUC-JP=162 CP1251=86 CP1256=138 ISO-8859-11=86 JIS=135 [top SJS] {{(char)0x61,(char)0x64,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa6,(char)0xb6,(char)0x93,(char)0x11,(char)0xa8,(char)0x11,(char)0x74,(char)0x81,(char)0x5d,(char)0x81,(char)0x5d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ad__" // ASCII-7-bit=166 Latin1=182 UTF8=147 CP1252=168 SJS=116 ISO-8859-15=93 CP932=93 [top Latin1] {{(char)0x61,(char)0x65,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa4,(char)0x81,(char)0xac,(char)0x42,(char)0x86,(char)0x11,(char)0x5b,(char)0x25,(char)0x4f,(char)0x4a,(char)0xb5,(char)0x3b,(char)0x52,(char)0x00,(char)0x00,}}, // "ae__" // ASCII-7-bit=164 Latin1=129 UTF8=172 GB=66 CP1252=134 SJS=91 Latin2=79 CP1251=74 CP1256=181 CP1250=59 Latin5=82 [top CP1256] {{(char)0x61,(char)0x65,(char)0x72,(char)0x6f, (char)0x03,(char)0xaf,(char)0xab,(char)0xab,(char)0x12,(char)0x98,(char)0x6a,(char)0x11,(char)0x6a,(char)0x21,(char)0x96,(char)0x21,(char)0x6a,(char)0x00,(char)0x00,(char)0x00,}}, // "aero" // ASCII-7-bit=175 Latin1=171 UTF8=171 CP1252=152 KSC=106 EUC-JP=106 CP1251=150 Latin5=106 [top ASCII-7-bit] {{(char)0x61,(char)0x66,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb6,(char)0x95,(char)0xaf,(char)0x11,(char)0x8c,(char)0x61,(char)0x80,(char)0x11,(char)0x62,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "af__" // ASCII-7-bit=182 Latin1=149 UTF8=175 CP1252=140 CP1256=128 Latin5=98 [top ASCII-7-bit] {{(char)0x61,(char)0x67,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa8,(char)0xb4,(char)0xa2,(char)0x11,(char)0x9a,(char)0x12,(char)0x95,(char)0x86,(char)0x21,(char)0x60,(char)0x41,(char)0x7a,(char)0x00,(char)0x00,(char)0x00,}}, // "ag__" // ASCII-7-bit=168 Latin1=180 UTF8=162 CP1252=154 SJS=149 EUC-JP=134 CP1251=96 ISO-8859-15=122 [top Latin1] {{(char)0x61,(char)0x69,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb8,(char)0x8f,(char)0x9b,(char)0x11,(char)0x9d,(char)0x12,(char)0x8c,(char)0x97,(char)0x11,(char)0x90,(char)0xb1,(char)0x67,(char)0x00,(char)0x00,(char)0x00,}}, // "ai__" // ASCII-7-bit=184 Latin1=143 UTF8=155 CP1252=157 SJS=140 EUC-JP=151 Latin2=144 JIS=103 [top ASCII-7-bit] {{(char)0x61,(char)0x6c,(char)0x5f,(char)0x5f, (char)0x03,(char)0xac,(char)0x99,(char)0xae,(char)0x11,(char)0xa1,(char)0x31,(char)0x57,(char)0x41,(char)0x57,(char)0x21,(char)0xa7,(char)0x31,(char)0x57,(char)0x00,(char)0x00,}}, // "al__" // ASCII-7-bit=172 Latin1=153 UTF8=174 CP1252=161 BIG5=87 Latin5=87 CP1257=167 Greek=87 [top UTF8] {{(char)0x61,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x08,(char)0xac,(char)0x9a,(char)0xab,(char)0x68,(char)0x9d,(char)0x58,(char)0x82,(char)0x56,(char)0x22,(char)0xac,(char)0x5a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "am__" // ASCII-7-bit=172 Latin1=154 UTF8=171 GB=104 CP1252=157 KSC=88 SJS=130 EUC-JP=86 CP1251=172 CP1256=90 [top ASCII-7-bit] {{(char)0x61,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb6,(char)0xad,(char)0x94,(char)0x11,(char)0x99,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "an__" // ASCII-7-bit=182 Latin1=173 UTF8=148 CP1252=153 [top ASCII-7-bit] {{(char)0x61,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9f,(char)0xb5,(char)0xab,(char)0x11,(char)0x9f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ao__" // ASCII-7-bit=159 Latin1=181 UTF8=171 CP1252=159 [top Latin1] {{(char)0x61,(char)0x71,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb7,(char)0xa9,(char)0x9c,(char)0x11,(char)0x8a,(char)0x51,(char)0x97,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "aq__" // ASCII-7-bit=183 Latin1=169 UTF8=156 CP1252=138 CP1251=151 [top ASCII-7-bit] {{(char)0x61,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa0,(char)0xb9,(char)0x9e,(char)0x13,(char)0x98,(char)0x55,(char)0x2c,(char)0x13,(char)0x28,(char)0x26,(char)0x27,(char)0x11,(char)0x2e,(char)0x21,(char)0x42,}}, // "ar__" // ASCII-7-bit=160 Latin1=185 UTF8=158 CP1252=152 KSC=85 SJS=44 BIG5=40 Latin2=38 CP1251=39 CP1250=46 ISO-8859-15=66 [top Latin1] {{(char)0x61,(char)0x73,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa9,(char)0xb7,(char)0x9f,(char)0x11,(char)0x94,(char)0x11,(char)0x52,(char)0x22,(char)0x64,(char)0x52,(char)0x12,(char)0x7d,(char)0x74,(char)0x21,(char)0x52,}}, // "as__" // ASCII-7-bit=169 Latin1=183 UTF8=159 CP1252=148 SJS=82 Latin2=100 CP1251=82 CP1250=125 Latin5=116 CP1257=82 [top Latin1] {{(char)0x61,(char)0x74,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa1,(char)0xb8,(char)0xa5,(char)0x11,(char)0x9a,(char)0x11,(char)0x48,(char)0x21,(char)0x51,(char)0x13,(char)0x45,(char)0x53,(char)0x4a,(char)0x11,(char)0x62,}}, // "at__" // ASCII-7-bit=161 Latin1=184 UTF8=165 CP1252=154 SJS=72 Latin2=81 CP1256=69 CP1250=83 Latin5=74 ISO-8859-15=98 [top Latin1] {{(char)0x61,(char)0x75,(char)0x5f,(char)0x5f, (char)0x09,(char)0xb8,(char)0xa3,(char)0x9f,(char)0x4e,(char)0x9a,(char)0x55,(char)0x54,(char)0x3e,(char)0x5e,(char)0x22,(char)0x30,(char)0x3d,(char)0x21,(char)0x36,(char)0x00,}}, // "au__" // ASCII-7-bit=184 Latin1=163 UTF8=159 GB=78 CP1252=154 KSC=85 SJS=84 EUC-JP=62 BIG5=94 CP1256=48 CP1250=61 ISO-8859-15=54 [top ASCII-7-bit] {{(char)0x61,(char)0x77,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb6,(char)0xa2,(char)0xaa,(char)0x11,(char)0x99,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "aw__" // ASCII-7-bit=182 Latin1=162 UTF8=170 CP1252=153 [top ASCII-7-bit] {{(char)0x61,(char)0x78,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9d,(char)0xba,(char)0xa2,(char)0x11,(char)0x90,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ax__" // ASCII-7-bit=157 Latin1=186 UTF8=162 CP1252=144 [top Latin1] {{(char)0x61,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9a,(char)0x7d,(char)0xb8,(char)0x11,(char)0x86,(char)0x54,(char)0xa8,(char)0x54,(char)0x54,(char)0x91,(char)0x41,(char)0x4c,(char)0x31,(char)0x6c,(char)0x00,}}, // "az__" // ASCII-7-bit=154 Latin1=125 UTF8=184 CP1252=134 CP1251=168 CP1256=84 CP1250=84 Latin5=145 KOI8R=76 CP1254=108 [top UTF8] {{(char)0x62,(char)0x61,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa0,(char)0x7e,(char)0xb2,(char)0x11,(char)0x78,(char)0x44,(char)0x89,(char)0x66,(char)0x49,(char)0xb1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ba__" // ASCII-7-bit=160 Latin1=126 UTF8=178 CP1252=120 Latin2=137 CP1251=102 CP1256=73 CP1250=177 [top UTF8] {{(char)0x62,(char)0x62,(char)0x5f,(char)0x5f, (char)0x03,(char)0xba,(char)0xa0,(char)0x7f,(char)0x11,(char)0xa0,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bb__" // ASCII-7-bit=186 Latin1=160 UTF8=127 CP1252=160 [top ASCII-7-bit] {{(char)0x62,(char)0x64,(char)0x5f,(char)0x5f, (char)0x03,(char)0xbd,(char)0x94,(char)0x8c,(char)0x11,(char)0x8a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bd__" // ASCII-7-bit=189 Latin1=148 UTF8=140 CP1252=138 [top ASCII-7-bit] {{(char)0x62,(char)0x65,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb1,(char)0xb0,(char)0xa1,(char)0x11,(char)0x9d,(char)0x11,(char)0x5f,(char)0x22,(char)0x4e,(char)0x50,(char)0x12,(char)0x4d,(char)0x59,(char)0x11,(char)0x5f,}}, // "be__" // ASCII-7-bit=177 Latin1=176 UTF8=161 CP1252=157 SJS=95 Latin2=78 CP1251=80 CP1250=77 Latin5=89 ISO-8859-15=95 [top ASCII-7-bit] {{(char)0x62,(char)0x66,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9f,(char)0xb9,(char)0x63,(char)0x11,(char)0xa6,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bf__" // ASCII-7-bit=159 Latin1=185 UTF8=99 CP1252=166 [top Latin1] {{(char)0x62,(char)0x67,(char)0x5f,(char)0x5f, (char)0x05,(char)0x96,(char)0x70,(char)0xab,(char)0x4a,(char)0x74,(char)0x51,(char)0xb9,(char)0x11,(char)0x4f,(char)0x51,(char)0x44,(char)0x31,(char)0x45,(char)0x41,(char)0x54,}}, // "bg__" // ASCII-7-bit=150 Latin1=112 UTF8=171 GB=74 CP1252=116 CP1251=185 CP1250=79 KOI8R=68 CP1254=69 ISO-8859-5=84 [top CP1251] {{(char)0x62,(char)0x68,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9f,(char)0x94,(char)0xa5,(char)0x11,(char)0x84,(char)0x11,(char)0x53,(char)0x41,(char)0xb8,(char)0x10,(char)0x61,(char)0x70,(char)0x00,(char)0x00,(char)0x00,}}, // "bh__" // ASCII-7-bit=159 Latin1=148 UTF8=165 CP1252=132 SJS=83 CP1256=184 Arabic=112 [top CP1256] {{(char)0x62,(char)0x69,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa4,(char)0xa5,(char)0xb8,(char)0x12,(char)0x82,(char)0x65,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bi__" // ASCII-7-bit=164 Latin1=165 UTF8=184 CP1252=130 KSC=101 [top UTF8] {{(char)0x62,(char)0x69,(char)0x7a,(char)0x5f, (char)0x0e,(char)0xae,(char)0xa5,(char)0xa1,(char)0x77,(char)0x96,(char)0x7f,(char)0x95,(char)0x9c,(char)0x7a,(char)0x8e,(char)0x8b,(char)0x80,(char)0x80,(char)0x92,(char)0x00,}}, // "biz_" // ASCII-7-bit=174 Latin1=165 UTF8=161 GB=119 CP1252=150 KSC=127 SJS=149 EUC-JP=156 BIG5=122 Latin2=142 CP1251=139 CP1256=128 CP1250=128 Latin5=146 [top ASCII-7-bit] {{(char)0x62,(char)0x6a,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9b,(char)0xb6,(char)0x8a,(char)0x11,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bj__" // ASCII-7-bit=155 Latin1=182 UTF8=138 CP1252=175 [top Latin1] {{(char)0x62,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x05,(char)0xbb,(char)0x95,(char)0xa0,(char)0x5a,(char)0x95,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bm__" // ASCII-7-bit=187 Latin1=149 UTF8=160 GB=90 CP1252=149 [top ASCII-7-bit] {{(char)0x62,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb8,(char)0x98,(char)0xa6,(char)0x6d,(char)0xa0,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bn__" // ASCII-7-bit=184 Latin1=152 UTF8=166 GB=109 CP1252=160 [top ASCII-7-bit] {{(char)0x62,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9a,(char)0xba,(char)0x9f,(char)0x11,(char)0x9c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bo__" // ASCII-7-bit=154 Latin1=186 UTF8=159 CP1252=156 [top Latin1] {{(char)0x62,(char)0x72,(char)0x5f,(char)0x5f, (char)0x07,(char)0x9c,(char)0xba,(char)0x9c,(char)0x1f,(char)0x95,(char)0x21,(char)0x43,(char)0x15,(char)0x1c,(char)0x20,(char)0x17,(char)0x0e,(char)0x2b,(char)0x21,(char)0x5a,}}, // "br__" // ASCII-7-bit=156 Latin1=186 UTF8=156 GB=31 CP1252=149 KSC=33 SJS=67 BIG5=28 Latin2=32 CP1251=23 CP1256=14 CP1250=43 ISO-8859-15=90 [top Latin1] {{(char)0x62,(char)0x73,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb2,(char)0xb4,(char)0x9c,(char)0x11,(char)0x76,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bs__" // ASCII-7-bit=178 Latin1=180 UTF8=156 CP1252=118 [top Latin1] {{(char)0x62,(char)0x74,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb9,(char)0x96,(char)0xa7,(char)0x11,(char)0x94,(char)0x11,(char)0x6f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bt__" // ASCII-7-bit=185 Latin1=150 UTF8=167 CP1252=148 SJS=111 [top ASCII-7-bit] {{(char)0x62,(char)0x77,(char)0x5f,(char)0x5f, (char)0x03,(char)0xbb,(char)0x9b,(char)0x88,(char)0x11,(char)0x9d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bw__" // ASCII-7-bit=187 Latin1=155 UTF8=136 CP1252=157 [top ASCII-7-bit] {{(char)0x62,(char)0x79,(char)0x5f,(char)0x5f, (char)0x03,(char)0x8a,(char)0x7b,(char)0xa4,(char)0x11,(char)0x74,(char)0x42,(char)0x5d,(char)0xb6,(char)0x11,(char)0x4b,(char)0x21,(char)0x5f,(char)0x21,(char)0xa9,(char)0x00,}}, // "by__" // ASCII-7-bit=138 Latin1=123 UTF8=164 CP1252=116 Latin2=93 CP1251=182 CP1250=75 ISO-8859-15=95 KOI8R=169 [top CP1251] {{(char)0x62,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x03,(char)0xaf,(char)0x9f,(char)0xa1,(char)0x19,(char)0x90,(char)0x89,(char)0xa4,(char)0x9e,(char)0x8c,(char)0x65,(char)0x8d,(char)0x64,(char)0x70,(char)0x51,(char)0x7e,}}, // "bz__" // ASCII-7-bit=175 Latin1=159 UTF8=161 CP1252=144 KSC=137 SJS=164 EUC-JP=158 BIG5=140 Latin2=101 CP1251=141 CP1256=100 CP1250=112 KOI8R=126 [top ASCII-7-bit] {{(char)0x63,(char)0x61,(char)0x5f,(char)0x5f, (char)0x07,(char)0xb3,(char)0xac,(char)0xa0,(char)0x5b,(char)0x9b,(char)0x5f,(char)0x49,(char)0x15,(char)0x56,(char)0x3c,(char)0x5d,(char)0x48,(char)0x42,(char)0x21,(char)0x94,}}, // "ca__" // ASCII-7-bit=179 Latin1=172 UTF8=160 GB=91 CP1252=155 KSC=95 SJS=73 BIG5=86 Latin2=60 CP1251=93 CP1256=72 CP1250=66 ISO-8859-15=148 [top ASCII-7-bit] {{(char)0x63,(char)0x61,(char)0x74,(char)0x5f, (char)0x03,(char)0x9a,(char)0xb4,(char)0xad,(char)0x11,(char)0x9f,(char)0x11,(char)0x30,(char)0x31,(char)0x30,(char)0x32,(char)0x30,(char)0x6e,(char)0x00,(char)0x00,(char)0x00,}}, // "cat_" // ASCII-7-bit=154 Latin1=180 UTF8=173 CP1252=159 SJS=48 CP1251=48 ISO-8859-11=48 ISO-8859-15=110 [top Latin1] {{(char)0x63,(char)0x63,(char)0x5f,(char)0x5f, (char)0x09,(char)0x9d,(char)0xab,(char)0xad,(char)0x9b,(char)0x86,(char)0x80,(char)0x90,(char)0x9e,(char)0x92,(char)0x21,(char)0x8a,(char)0x11,(char)0x7a,(char)0x51,(char)0x75,}}, // "cc__" // ASCII-7-bit=157 Latin1=171 UTF8=173 GB=155 CP1252=134 KSC=128 SJS=144 EUC-JP=158 BIG5=146 CP1256=138 Latin5=122 GBK=117 [top UTF8] {{(char)0x63,(char)0x64,(char)0x5f,(char)0x5f, (char)0x09,(char)0xae,(char)0xa2,(char)0xb2,(char)0x5a,(char)0x95,(char)0x5a,(char)0x8f,(char)0x64,(char)0x5a,(char)0x11,(char)0x7d,(char)0x11,(char)0x74,(char)0x11,(char)0x5a,}}, // "cd__" // ASCII-7-bit=174 Latin1=162 UTF8=178 GB=90 CP1252=149 KSC=90 SJS=143 EUC-JP=100 BIG5=90 CP1251=125 CP1250=116 ISO-8859-11=90 [top UTF8] {{(char)0x63,(char)0x67,(char)0x5f,(char)0x5f, (char)0x03,(char)0x83,(char)0x8d,(char)0xbe,(char)0x11,(char)0x83,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cg__" // ASCII-7-bit=131 Latin1=141 UTF8=190 CP1252=131 [top UTF8] {{(char)0x63,(char)0x68,(char)0x5f,(char)0x5f, (char)0x05,(char)0xaa,(char)0xb6,(char)0xa1,(char)0x4c,(char)0x9a,(char)0x11,(char)0x46,(char)0x25,(char)0x49,(char)0x3e,(char)0x41,(char)0x44,(char)0x43,(char)0x11,(char)0x66,}}, // "ch__" // ASCII-7-bit=170 Latin1=182 UTF8=161 GB=76 CP1252=154 SJS=70 Latin2=73 CP1251=62 CP1256=65 CP1250=68 Latin5=67 ISO-8859-15=102 [top Latin1] {{(char)0x63,(char)0x69,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9c,(char)0xae,(char)0xb3,(char)0x11,(char)0xa1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ci__" // ASCII-7-bit=156 Latin1=174 UTF8=179 CP1252=161 [top UTF8] {{(char)0x63,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x03,(char)0xba,(char)0x9c,(char)0x9e,(char)0x11,(char)0x9a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ck__" // ASCII-7-bit=186 Latin1=156 UTF8=158 CP1252=154 [top ASCII-7-bit] {{(char)0x63,(char)0x6c,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa4,(char)0xb9,(char)0x9c,(char)0x11,(char)0x97,(char)0x11,(char)0x3e,(char)0x27,(char)0x1b,(char)0x1b,(char)0x2d,(char)0x34,(char)0x2b,(char)0x21,(char)0x3b,}}, // "cl__" // ASCII-7-bit=164 Latin1=185 UTF8=156 CP1252=151 SJS=62 Latin2=27 CP1251=27 CP1256=45 CP1250=52 Latin5=43 ISO-8859-11=33 ISO-8859-15=59 [top Latin1] {{(char)0x63,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0x93,(char)0xbd,(char)0x64,(char)0x11,(char)0x97,(char)0xa1,(char)0x6c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cm__" // ASCII-7-bit=147 Latin1=189 UTF8=100 CP1252=151 ISO-8859-15=108 [top Latin1] {{(char)0x63,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x09,(char)0x8c,(char)0x5c,(char)0xa7,(char)0xba,(char)0x4f,(char)0x48,(char)0x57,(char)0x3c,(char)0x8d,(char)0x12,(char)0x4e,(char)0x4f,(char)0x71,(char)0x64,(char)0x00,}}, // "cn__" // ASCII-7-bit=140 Latin1=92 UTF8=167 GB=186 CP1252=79 KSC=72 SJS=87 EUC-JP=60 BIG5=141 CP1251=78 CP1256=79 GBK=100 [top GB] {{(char)0x63,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa8,(char)0xb7,(char)0xa3,(char)0x12,(char)0x91,(char)0x27,(char)0x31,(char)0x3f,(char)0x13,(char)0x2f,(char)0x2a,(char)0x2a,(char)0x61,(char)0x27,(char)0x00,}}, // "co__" // ASCII-7-bit=168 Latin1=183 UTF8=163 CP1252=145 KSC=39 Latin2=63 CP1256=47 CP1250=42 Latin5=42 Greek=39 [top Latin1] {{(char)0x63,(char)0x6f,(char)0x6d,(char)0x5f, (char)0x09,(char)0xb2,(char)0xa5,(char)0xa7,(char)0x94,(char)0x94,(char)0x87,(char)0x87,(char)0x7d,(char)0x82,(char)0x12,(char)0x6e,(char)0x89,(char)0x12,(char)0x7f,(char)0x70,}}, // "com_" // ASCII-7-bit=178 Latin1=165 UTF8=167 GB=148 CP1252=148 KSC=135 SJS=135 EUC-JP=125 BIG5=130 CP1251=110 CP1256=137 Latin5=127 ISO-8859-11=112 [top ASCII-7-bit] {{(char)0x63,(char)0x6f,(char)0x6f,(char)0x70, (char)0x03,(char)0xaf,(char)0xa8,(char)0xa0,(char)0x14,(char)0x9c,(char)0x75,(char)0xa7,(char)0x86,(char)0x71,(char)0x78,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "coop" // ASCII-7-bit=175 Latin1=168 UTF8=160 CP1252=156 KSC=117 SJS=167 EUC-JP=134 ISO-8859-15=120 [top ASCII-7-bit] {{(char)0x63,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0x99,(char)0xb7,(char)0xad,(char)0x11,(char)0x84,(char)0x81,(char)0x28,(char)0x11,(char)0x28,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cr__" // ASCII-7-bit=153 Latin1=183 UTF8=173 CP1252=132 Latin5=40 ISO-8859-15=40 [top Latin1] {{(char)0x63,(char)0x75,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa0,(char)0xb7,(char)0x9f,(char)0x11,(char)0xa6,(char)0x53,(char)0x31,(char)0x45,(char)0x45,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cu__" // ASCII-7-bit=160 Latin1=183 UTF8=159 CP1252=166 CP1251=49 CP1256=69 CP1250=69 [top Latin1] {{(char)0x63,(char)0x76,(char)0x5f,(char)0x5f, (char)0x03,(char)0x90,(char)0xbc,(char)0x8f,(char)0x11,(char)0x98,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cv__" // ASCII-7-bit=144 Latin1=188 UTF8=143 CP1252=152 [top Latin1] {{(char)0x63,(char)0x78,(char)0x5f,(char)0x5f, (char)0x03,(char)0xae,(char)0xa2,(char)0xa5,(char)0x15,(char)0x87,(char)0x76,(char)0x9f,(char)0x9a,(char)0x83,(char)0x41,(char)0x85,(char)0x11,(char)0x7e,(char)0x51,(char)0x99,}}, // "cx__" // ASCII-7-bit=174 Latin1=162 UTF8=165 CP1252=135 KSC=118 SJS=159 EUC-JP=154 BIG5=131 Latin5=133 ISO-8859-15=126 JIS=153 [top ASCII-7-bit] {{(char)0x63,(char)0x79,(char)0x5f,(char)0x5f, (char)0x03,(char)0xaa,(char)0x88,(char)0xac,(char)0x11,(char)0x86,(char)0x51,(char)0x63,(char)0x21,(char)0x5c,(char)0x61,(char)0x9e,(char)0x12,(char)0x52,(char)0xae,(char)0x00,}}, // "cy__" // ASCII-7-bit=170 Latin1=136 UTF8=172 CP1252=134 CP1251=99 Latin5=92 Greek=158 CP1254=82 CP1253=174 [top CP1253] {{(char)0x63,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x03,(char)0x8f,(char)0x74,(char)0xb2,(char)0x11,(char)0x56,(char)0x42,(char)0x8c,(char)0x4a,(char)0x11,(char)0xb5,(char)0x10,(char)0x21,(char)0x3f,(char)0x11,(char)0x41,}}, // "cz__" // ASCII-7-bit=143 Latin1=116 UTF8=178 CP1252=86 Latin2=140 CP1251=74 CP1250=181 MACINTOSH=63 CP852=65 [top CP1250] {{(char)0x64,(char)0x65,(char)0x5f,(char)0x5f, (char)0x06,(char)0xa4,(char)0xb7,(char)0xa4,(char)0x40,(char)0x9a,(char)0x36,(char)0x35,(char)0x4b,(char)0x4d,(char)0x43,(char)0x4d,(char)0x4f,(char)0x11,(char)0x79,(char)0x00,}}, // "de__" // ASCII-7-bit=164 Latin1=183 UTF8=164 GB=64 CP1252=154 KSC=54 Latin2=75 CP1251=77 CP1256=67 CP1250=77 Latin5=79 ISO-8859-15=121 [top Latin1] {{(char)0x64,(char)0x6a,(char)0x5f,(char)0x5f, (char)0x08,(char)0xa3,(char)0xad,(char)0xa9,(char)0x90,(char)0xa2,(char)0x7d,(char)0x7a,(char)0x68,(char)0x21,(char)0xa0,(char)0x11,(char)0x5e,(char)0xb1,(char)0x5e,(char)0x00,}}, // "dj__" // ASCII-7-bit=163 Latin1=173 UTF8=169 GB=144 CP1252=162 KSC=125 SJS=122 EUC-JP=104 CP1251=160 CP1250=94 CP932=94 [top Latin1] {{(char)0x64,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9d,(char)0xb8,(char)0xa7,(char)0x11,(char)0x93,(char)0x11,(char)0x39,(char)0x25,(char)0x38,(char)0x34,(char)0x57,(char)0x43,(char)0x3d,(char)0x11,(char)0x54,}}, // "dk__" // ASCII-7-bit=157 Latin1=184 UTF8=167 CP1252=147 SJS=57 Latin2=56 CP1251=52 CP1256=87 CP1250=67 Latin5=61 ISO-8859-15=84 [top Latin1] {{(char)0x64,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0xbc,(char)0x76,(char)0xa3,(char)0x11,(char)0x83,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "dm__" // ASCII-7-bit=188 Latin1=118 UTF8=163 CP1252=131 [top ASCII-7-bit] {{(char)0x64,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa4,(char)0xb6,(char)0xa9,(char)0x6b,(char)0x93,(char)0x31,(char)0x43,(char)0x61,(char)0x57,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "do__" // ASCII-7-bit=164 Latin1=182 UTF8=169 GB=107 CP1252=147 BIG5=67 ISO-8859-15=87 [top Latin1] {{(char)0x64,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9e,(char)0xb6,(char)0x8d,(char)0x11,(char)0xa1,(char)0x62,(char)0xa6,(char)0x4e,(char)0x10,(char)0x51,(char)0x58,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "dz__" // ASCII-7-bit=158 Latin1=182 UTF8=141 CP1252=161 CP1256=166 CP1250=78 Arabic=88 [top Latin1] {{(char)0x65,(char)0x63,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa2,(char)0xba,(char)0x9c,(char)0x11,(char)0x96,(char)0x35,(char)0x3c,(char)0x32,(char)0x5a,(char)0x32,(char)0x3c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ec__" // ASCII-7-bit=162 Latin1=186 UTF8=156 CP1252=150 BIG5=60 Latin2=50 CP1251=90 CP1256=50 CP1250=60 [top Latin1] {{(char)0x65,(char)0x64,(char)0x75,(char)0x5f, (char)0x07,(char)0xbb,(char)0x97,(char)0x99,(char)0x51,(char)0x94,(char)0x6b,(char)0x49,(char)0x11,(char)0x4e,(char)0x21,(char)0x4f,(char)0x13,(char)0x4c,(char)0x41,(char)0x44,}}, // "edu_" // ASCII-7-bit=187 Latin1=151 UTF8=153 GB=81 CP1252=148 KSC=107 SJS=73 BIG5=78 CP1256=79 Latin5=76 ISO-8859-11=65 ISO-8859-15=68 [top ASCII-7-bit] {{(char)0x65,(char)0x65,(char)0x5f,(char)0x5f, (char)0x03,(char)0x97,(char)0xaf,(char)0xb4,(char)0x11,(char)0x95,(char)0x42,(char)0x6f,(char)0x78,(char)0x42,(char)0x82,(char)0x87,(char)0xc2,(char)0x5e,(char)0x65,(char)0x00,}}, // "ee__" // ASCII-7-bit=151 Latin1=175 UTF8=180 CP1252=149 Latin2=111 CP1251=120 ISO-8859-15=130 CP1257=135 ISO-8859-13=94 Latin4=101 [top UTF8] {{(char)0x65,(char)0x67,(char)0x5f,(char)0x5f, (char)0x05,(char)0x9f,(char)0x7a,(char)0xa7,(char)0x55,(char)0x7d,(char)0x61,(char)0xb9,(char)0x32,(char)0x28,(char)0x28,(char)0x61,(char)0x28,(char)0x00,(char)0x00,(char)0x00,}}, // "eg__" // ASCII-7-bit=159 Latin1=122 UTF8=167 GB=85 CP1252=125 CP1256=185 ISO-8859-15=40 CP1257=40 CP1253=40 [top CP1256] {{(char)0x65,(char)0x73,(char)0x5f,(char)0x5f, (char)0x05,(char)0x9f,(char)0xb8,(char)0xa8,(char)0x22,(char)0x91,(char)0x11,(char)0x2b,(char)0x15,(char)0x18,(char)0x33,(char)0x4d,(char)0x31,(char)0x23,(char)0x21,(char)0x6c,}}, // "es__" // ASCII-7-bit=159 Latin1=184 UTF8=168 GB=34 CP1252=145 SJS=43 BIG5=24 Latin2=51 CP1251=77 CP1256=49 CP1250=35 ISO-8859-15=108 [top Latin1] {{(char)0x65,(char)0x74,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb5,(char)0x9a,(char)0xa8,(char)0x11,(char)0xa6,(char)0x11,(char)0x7e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "et__" // ASCII-7-bit=181 Latin1=154 UTF8=168 CP1252=166 SJS=126 [top ASCII-7-bit] {{(char)0x65,(char)0x75,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa8,(char)0xa4,(char)0xb5,(char)0x11,(char)0x91,(char)0x42,(char)0x8d,(char)0x69,(char)0x12,(char)0x8b,(char)0x6a,(char)0x11,(char)0x78,(char)0x41,(char)0x78,}}, // "eu__" // ASCII-7-bit=168 Latin1=164 UTF8=181 CP1252=145 Latin2=141 CP1251=105 CP1250=139 Latin5=106 ISO-8859-15=120 Greek=120 [top UTF8] {{(char)0x66,(char)0x69,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9e,(char)0xb7,(char)0xaa,(char)0x11,(char)0x96,(char)0x51,(char)0x46,(char)0x11,(char)0x31,(char)0x22,(char)0x69,(char)0x31,(char)0x00,(char)0x00,(char)0x00,}}, // "fi__" // ASCII-7-bit=158 Latin1=183 UTF8=170 CP1252=150 CP1251=70 CP1250=49 ISO-8859-15=105 CP1257=49 [top Latin1] {{(char)0x66,(char)0x6a,(char)0x5f,(char)0x5f, (char)0x05,(char)0xba,(char)0x8b,(char)0x9f,(char)0x59,(char)0xa0,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "fj__" // ASCII-7-bit=186 Latin1=139 UTF8=159 GB=89 CP1252=160 [top ASCII-7-bit] {{(char)0x66,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x02,(char)0xba,(char)0xa6,(char)0x21,(char)0x96,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "fk__" // ASCII-7-bit=186 Latin1=166 CP1252=150 [top ASCII-7-bit] {{(char)0x66,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0x91,(char)0x92,(char)0xbc,(char)0x11,(char)0x82,(char)0x12,(char)0x7d,(char)0x6d,(char)0x12,(char)0x86,(char)0x6a,(char)0x51,(char)0x67,(char)0x00,(char)0x00,}}, // "fm__" // ASCII-7-bit=145 Latin1=146 UTF8=188 CP1252=130 SJS=125 EUC-JP=109 Latin2=134 CP1251=106 CP1257=103 [top UTF8] {{(char)0x66,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x03,(char)0x93,(char)0xbc,(char)0x9c,(char)0x11,(char)0x8c,(char)0x71,(char)0x57,(char)0x21,(char)0x51,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "fo__" // ASCII-7-bit=147 Latin1=188 UTF8=156 CP1252=140 CP1250=87 ISO-8859-15=81 [top Latin1] {{(char)0x66,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9f,(char)0xb3,(char)0xaf,(char)0x11,(char)0x99,(char)0x17,(char)0x37,(char)0x32,(char)0x32,(char)0x35,(char)0x41,(char)0x4f,(char)0x35,(char)0x21,(char)0x77,}}, // "fr__" // ASCII-7-bit=159 Latin1=179 UTF8=175 CP1252=153 SJS=55 EUC-JP=50 BIG5=50 Latin2=53 CP1251=65 CP1256=79 CP1250=53 ISO-8859-15=119 [top Latin1] {{(char)0x67,(char)0x61,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa8,(char)0xb6,(char)0xa5,(char)0x11,(char)0x95,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ga__" // ASCII-7-bit=168 Latin1=182 UTF8=165 CP1252=149 [top Latin1] {{(char)0x67,(char)0x64,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb5,(char)0xac,(char)0x9a,(char)0x80,(char)0x8a,(char)0x81,(char)0x97,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gd__" // ASCII-7-bit=181 Latin1=172 UTF8=154 GB=128 CP1252=138 Latin5=151 [top ASCII-7-bit] {{(char)0x67,(char)0x65,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa5,(char)0x7d,(char)0xba,(char)0x11,(char)0x8d,(char)0x21,(char)0x58,(char)0x21,(char)0x8b,(char)0x11,(char)0x71,(char)0x21,(char)0x4f,(char)0xb1,(char)0x4c,}}, // "ge__" // ASCII-7-bit=165 Latin1=125 UTF8=186 CP1252=141 EUC-JP=88 CP1251=139 CP1250=113 ISO-8859-15=79 ISO-8859-5=76 [top UTF8] {{(char)0x67,(char)0x67,(char)0x5f,(char)0x5f, (char)0x03,(char)0xad,(char)0xa9,(char)0xb0,(char)0x11,(char)0x95,(char)0x11,(char)0x60,(char)0x81,(char)0x93,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gg__" // ASCII-7-bit=173 Latin1=169 UTF8=176 CP1252=149 SJS=96 ISO-8859-15=147 [top UTF8] {{(char)0x67,(char)0x68,(char)0x5f,(char)0x5f, (char)0x03,(char)0xac,(char)0xb3,(char)0x99,(char)0x11,(char)0xa6,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gh__" // ASCII-7-bit=172 Latin1=179 UTF8=153 CP1252=166 [top Latin1] {{(char)0x67,(char)0x69,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb3,(char)0xa1,(char)0xa1,(char)0x11,(char)0x9c,(char)0xa1,(char)0xa8,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gi__" // ASCII-7-bit=179 Latin1=161 UTF8=161 CP1252=156 ISO-8859-15=168 [top ASCII-7-bit] {{(char)0x67,(char)0x6c,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa7,(char)0xb2,(char)0xaa,(char)0x11,(char)0xa1,(char)0x11,(char)0x43,(char)0x11,(char)0x4d,(char)0x61,(char)0x70,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gl__" // ASCII-7-bit=167 Latin1=178 UTF8=170 CP1252=161 SJS=67 BIG5=77 ISO-8859-15=112 [top Latin1] {{(char)0x67,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb8,(char)0x89,(char)0xa0,(char)0x11,(char)0xa7,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gm__" // ASCII-7-bit=184 Latin1=137 UTF8=160 CP1252=167 [top ASCII-7-bit] {{(char)0x67,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x03,(char)0xaa,(char)0xb8,(char)0x89,(char)0x11,(char)0x9d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gn__" // ASCII-7-bit=170 Latin1=184 UTF8=137 CP1252=157 [top Latin1] {{(char)0x67,(char)0x6f,(char)0x76,(char)0x5f, (char)0x05,(char)0xbd,(char)0x92,(char)0x94,(char)0x22,(char)0x87,(char)0x11,(char)0x2e,(char)0x33,(char)0x36,(char)0x15,(char)0x2e,(char)0x13,(char)0x14,(char)0x1f,(char)0x0e,}}, // "gov_" // ASCII-7-bit=189 Latin1=146 UTF8=148 GB=34 CP1252=135 SJS=46 CP1251=54 CP1256=21 CP1250=46 ISO-8859-11=20 ISO-8859-15=31 CP1257=14 [top ASCII-7-bit] {{(char)0x67,(char)0x70,(char)0x5f,(char)0x5f, (char)0x03,(char)0x98,(char)0x9f,(char)0xbb,(char)0x11,(char)0x83,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gp__" // ASCII-7-bit=152 Latin1=159 UTF8=187 CP1252=131 [top UTF8] {{(char)0x67,(char)0x72,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa1,(char)0x7f,(char)0xa8,(char)0x45,(char)0x80,(char)0x42,(char)0x49,(char)0x54,(char)0x12,(char)0x44,(char)0x45,(char)0x61,(char)0xb5,(char)0x21,(char)0x9e,}}, // "gr__" // ASCII-7-bit=161 Latin1=127 UTF8=168 GB=69 CP1252=128 Latin2=73 CP1251=84 CP1250=68 Latin5=69 Greek=181 CP1253=158 [top Greek] {{(char)0x67,(char)0x73,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb0,(char)0x93,(char)0x98,(char)0x68,(char)0x88,(char)0x13,(char)0xa2,(char)0xa7,(char)0x75,(char)0x42,(char)0x99,(char)0x98,(char)0x91,(char)0x66,(char)0x00,}}, // "gs__" // ASCII-7-bit=176 Latin1=147 UTF8=152 GB=104 CP1252=136 SJS=162 EUC-JP=167 BIG5=117 Latin5=153 ISO-8859-11=152 CP932=102 [top ASCII-7-bit] {{(char)0x67,(char)0x74,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa3,(char)0xb6,(char)0xa9,(char)0x12,(char)0x95,(char)0x3d,(char)0x91,(char)0x3d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gt__" // ASCII-7-bit=163 Latin1=182 UTF8=169 CP1252=149 KSC=61 ISO-8859-15=61 [top Latin1] {{(char)0x67,(char)0x75,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb9,(char)0xa0,(char)0x7d,(char)0x11,(char)0xa5,(char)0x11,(char)0x7d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gu__" // ASCII-7-bit=185 Latin1=160 UTF8=125 CP1252=165 SJS=125 [top ASCII-7-bit] {{(char)0x67,(char)0x79,(char)0x5f,(char)0x5f, (char)0x03,(char)0xbc,(char)0x82,(char)0xa2,(char)0x11,(char)0x87,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gy__" // ASCII-7-bit=188 Latin1=130 UTF8=162 CP1252=135 [top ASCII-7-bit] {{(char)0x68,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x07,(char)0xa6,(char)0x6c,(char)0xa3,(char)0xa0,(char)0x6b,(char)0x38,(char)0x53,(char)0x11,(char)0xb5,(char)0xa1,(char)0x73,(char)0xc1,(char)0x3d,(char)0x21,(char)0x49,}}, // "hk__" // ASCII-7-bit=166 Latin1=108 UTF8=163 GB=160 CP1252=107 KSC=56 SJS=83 BIG5=181 GBK=115 GB18030=61 BIG5_HKSCS=73 [top BIG5] {{(char)0x68,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa8,(char)0x9e,(char)0xaa,(char)0x67,(char)0x67,(char)0x13,(char)0xac,(char)0x9f,(char)0x95,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "hm__" // ASCII-7-bit=168 Latin1=158 UTF8=170 GB=103 CP1252=103 SJS=172 EUC-JP=159 BIG5=149 [top SJS] {{(char)0x68,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa1,(char)0xb7,(char)0xa6,(char)0x11,(char)0x9c,(char)0x51,(char)0x4d,(char)0x31,(char)0x4d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "hn__" // ASCII-7-bit=161 Latin1=183 UTF8=166 CP1252=156 CP1251=77 ISO-8859-11=77 [top Latin1] {{(char)0x68,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0x99,(char)0x67,(char)0xa7,(char)0x11,(char)0x67,(char)0x42,(char)0x9d,(char)0x20,(char)0x11,(char)0xb8,(char)0x10,(char)0x21,(char)0x26,(char)0x11,(char)0x32,}}, // "hr__" // ASCII-7-bit=153 Latin1=103 UTF8=167 CP1252=103 Latin2=157 CP1251=32 CP1250=184 MACINTOSH=38 CP852=50 [top CP1250] {{(char)0x68,(char)0x74,(char)0x5f,(char)0x5f, (char)0x03,(char)0x95,(char)0x97,(char)0xbc,(char)0x11,(char)0x92,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ht__" // ASCII-7-bit=149 Latin1=151 UTF8=188 CP1252=146 [top UTF8] {{(char)0x68,(char)0x75,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa2,(char)0xa4,(char)0xad,(char)0x33,(char)0x76,(char)0x11,(char)0x3d,(char)0x25,(char)0xa7,(char)0x4a,(char)0x40,(char)0xa7,(char)0x35,(char)0x11,(char)0x3a,}}, // "hu__" // ASCII-7-bit=162 Latin1=164 UTF8=173 GB=51 CP1252=118 SJS=61 Latin2=167 CP1251=74 CP1256=64 CP1250=167 Latin5=53 ISO-8859-15=58 [top UTF8] {{(char)0x69,(char)0x64,(char)0x5f,(char)0x5f, (char)0x07,(char)0xb8,(char)0xab,(char)0x8c,(char)0x24,(char)0x97,(char)0x33,(char)0x46,(char)0x14,(char)0x2c,(char)0x1f,(char)0x1f,(char)0x7b,(char)0x22,(char)0x29,(char)0x4b,}}, // "id__" // ASCII-7-bit=184 Latin1=171 UTF8=140 GB=36 CP1252=151 KSC=51 SJS=70 BIG5=44 Latin2=31 CP1251=31 CP1256=123 ISO-8859-11=41 ISO-8859-15=75 [top ASCII-7-bit] {{(char)0x69,(char)0x65,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb3,(char)0xa6,(char)0xa0,(char)0x45,(char)0x9d,(char)0x11,(char)0x46,(char)0x21,(char)0x67,(char)0x12,(char)0x32,(char)0x4a,(char)0x22,(char)0xa3,(char)0x36,}}, // "ie__" // ASCII-7-bit=179 Latin1=166 UTF8=160 GB=69 CP1252=157 SJS=70 Latin2=103 CP1256=50 CP1250=74 ISO-8859-15=163 CP1257=54 [top ASCII-7-bit] {{(char)0x69,(char)0x6c,(char)0x5f,(char)0x5f, (char)0x03,(char)0x94,(char)0x74,(char)0xa9,(char)0x11,(char)0x6e,(char)0x21,(char)0x3b,(char)0x23,(char)0x79,(char)0x83,(char)0x3d,(char)0x41,(char)0xb8,(char)0x71,(char)0x90,}}, // "il__" // ASCII-7-bit=148 Latin1=116 UTF8=169 CP1252=110 EUC-JP=59 CP1251=121 CP1256=131 CP1250=61 CP1255=184 Hebrew=144 [top CP1255] {{(char)0x69,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb7,(char)0x8e,(char)0xaf,(char)0x89,(char)0x7e,(char)0x51,(char)0x48,(char)0x21,(char)0x71,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "im__" // ASCII-7-bit=183 Latin1=142 UTF8=175 GB=137 CP1252=126 CP1251=72 Latin5=113 [top ASCII-7-bit] {{(char)0x69,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x08,(char)0xbb,(char)0x95,(char)0x9c,(char)0x5e,(char)0x99,(char)0x61,(char)0x6f,(char)0x67,(char)0x21,(char)0x60,(char)0x22,(char)0x69,(char)0x4d,(char)0x11,(char)0x4c,}}, // "in__" // ASCII-7-bit=187 Latin1=149 UTF8=156 GB=94 CP1252=153 KSC=97 SJS=111 EUC-JP=103 CP1251=96 Latin5=105 ISO-8859-11=77 CP1257=76 [top ASCII-7-bit] {{(char)0x69,(char)0x6e,(char)0x66,(char)0x6f, (char)0x05,(char)0xac,(char)0xa7,(char)0xa7,(char)0x76,(char)0x94,(char)0x18,(char)0x93,(char)0x82,(char)0x70,(char)0x90,(char)0x91,(char)0x82,(char)0x9c,(char)0x78,(char)0x00,}}, // "info" // ASCII-7-bit=172 Latin1=167 UTF8=167 GB=118 CP1252=148 SJS=147 EUC-JP=130 BIG5=112 Latin2=144 CP1251=145 CP1256=130 CP1250=156 Latin5=120 [top ASCII-7-bit] {{(char)0x69,(char)0x6e,(char)0x74,(char)0x5f, (char)0x05,(char)0xb2,(char)0xa7,(char)0xb0,(char)0x3a,(char)0x84,(char)0x53,(char)0x62,(char)0x55,(char)0x54,(char)0x71,(char)0x45,(char)0x21,(char)0x39,(char)0x31,(char)0x50,}}, // "int_" // ASCII-7-bit=178 Latin1=167 UTF8=176 GB=58 CP1252=132 CP1251=98 CP1256=85 CP1250=84 Greek=69 CP1253=57 ISO-8859-5=80 [top ASCII-7-bit] {{(char)0x69,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x09,(char)0xaf,(char)0x98,(char)0xac,(char)0xa8,(char)0x85,(char)0x77,(char)0x83,(char)0x7b,(char)0x67,(char)0x12,(char)0x88,(char)0x71,(char)0x22,(char)0x77,(char)0x67,}}, // "io__" // ASCII-7-bit=175 Latin1=152 UTF8=172 GB=168 CP1252=133 KSC=119 SJS=131 EUC-JP=123 BIG5=103 CP1251=136 CP1256=113 ISO-8859-11=119 ISO-8859-15=103 [top ASCII-7-bit] {{(char)0x69,(char)0x72,(char)0x5f,(char)0x5f, (char)0x07,(char)0x9e,(char)0x8c,(char)0xb5,(char)0x55,(char)0x7e,(char)0x22,(char)0x3c,(char)0x25,(char)0x32,(char)0x32,(char)0xae,(char)0x36,(char)0x3e,(char)0x81,(char)0x52,}}, // "ir__" // ASCII-7-bit=158 Latin1=140 UTF8=181 GB=85 CP1252=126 KSC=34 SJS=60 Latin2=50 CP1251=50 CP1256=174 CP1250=54 Latin5=62 CP1254=82 [top UTF8] {{(char)0x69,(char)0x73,(char)0x5f,(char)0x5f, (char)0x05,(char)0x8f,(char)0xbc,(char)0xa0,(char)0x1b,(char)0x84,(char)0x15,(char)0x3b,(char)0x1b,(char)0x2f,(char)0x1b,(char)0x25,(char)0x11,(char)0x32,(char)0x21,(char)0x1b,}}, // "is__" // ASCII-7-bit=143 Latin1=188 UTF8=160 GB=27 CP1252=132 SJS=59 EUC-JP=27 BIG5=47 Latin2=27 CP1251=37 CP1250=50 ISO-8859-15=27 [top Latin1] {{(char)0x69,(char)0x74,(char)0x5f,(char)0x5f, (char)0x03,(char)0xac,(char)0xb4,(char)0x9e,(char)0x11,(char)0xa2,(char)0x11,(char)0x35,(char)0x21,(char)0x44,(char)0x21,(char)0x3e,(char)0x21,(char)0x60,(char)0x51,(char)0x55,}}, // "it__" // ASCII-7-bit=172 Latin1=180 UTF8=158 CP1252=162 SJS=53 Latin2=68 CP1250=62 ISO-8859-15=96 JIS=85 [top Latin1] {{(char)0x6a,(char)0x65,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb7,(char)0x8e,(char)0xab,(char)0x11,(char)0x9e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "je__" // ASCII-7-bit=183 Latin1=142 UTF8=171 CP1252=158 [top ASCII-7-bit] {{(char)0x6a,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb8,(char)0xa6,(char)0x93,(char)0x11,(char)0xa0,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "jm__" // ASCII-7-bit=184 Latin1=166 UTF8=147 CP1252=160 [top ASCII-7-bit] {{(char)0x6a,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa5,(char)0x73,(char)0xb0,(char)0x11,(char)0x82,(char)0x52,(char)0x3c,(char)0xb2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "jo__" // ASCII-7-bit=165 Latin1=115 UTF8=176 CP1252=130 CP1251=60 CP1256=178 [top CP1256] {{(char)0x6a,(char)0x6f,(char)0x62,(char)0x73, (char)0x03,(char)0xb7,(char)0xa1,(char)0xa5,(char)0x11,(char)0xa0,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "jobs" // ASCII-7-bit=183 Latin1=161 UTF8=165 CP1252=160 [top ASCII-7-bit] {{(char)0x6a,(char)0x70,(char)0x5f,(char)0x5f, (char)0x09,(char)0x9b,(char)0x48,(char)0xa4,(char)0x45,(char)0x42,(char)0x4b,(char)0xb3,(char)0xad,(char)0x48,(char)0x51,(char)0x1e,(char)0x61,(char)0x73,(char)0x21,(char)0x63,}}, // "jp__" // ASCII-7-bit=155 Latin1=72 UTF8=164 GB=69 CP1252=66 KSC=75 SJS=179 EUC-JP=173 BIG5=72 ISO-8859-11=30 JIS=115 CP932=99 [top SJS] {{(char)0x6b,(char)0x65,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb9,(char)0x9a,(char)0xa1,(char)0x13,(char)0x9e,(char)0x4b,(char)0x5b,(char)0x11,(char)0x4b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ke__" // ASCII-7-bit=185 Latin1=154 UTF8=161 CP1252=158 KSC=75 SJS=91 BIG5=75 [top ASCII-7-bit] {{(char)0x6b,(char)0x67,(char)0x5f,(char)0x5f, (char)0x05,(char)0x94,(char)0x71,(char)0x9f,(char)0x67,(char)0x83,(char)0x11,(char)0xa8,(char)0x31,(char)0xb7,(char)0x12,(char)0x57,(char)0x57,(char)0x41,(char)0x6f,(char)0x00,}}, // "kg__" // ASCII-7-bit=148 Latin1=113 UTF8=159 GB=103 CP1252=131 SJS=168 CP1251=183 CP1250=87 Latin5=87 KOI8R=111 [top CP1251] {{(char)0x6b,(char)0x68,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb6,(char)0xa1,(char)0xa1,(char)0x53,(char)0xa5,(char)0x12,(char)0x74,(char)0x73,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kh__" // ASCII-7-bit=182 Latin1=161 UTF8=161 GB=83 CP1252=165 SJS=116 EUC-JP=115 [top ASCII-7-bit] {{(char)0x6b,(char)0x69,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb8,(char)0xac,(char)0x98,(char)0x11,(char)0x82,(char)0x81,(char)0x61,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ki__" // ASCII-7-bit=184 Latin1=172 UTF8=152 CP1252=130 Latin5=97 [top ASCII-7-bit] {{(char)0x6b,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x01,(char)0xba,(char)0x11,(char)0x89,(char)0x11,(char)0xaa,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kn__" // ASCII-7-bit=186 UTF8=137 CP1252=170 [top ASCII-7-bit] {{(char)0x6b,(char)0x72,(char)0x5f,(char)0x5f, (char)0x09,(char)0x80,(char)0x39,(char)0x92,(char)0x43,(char)0x2e,(char)0xbe,(char)0x5f,(char)0x3a,(char)0x3d,(char)0x31,(char)0x0c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kr__" // ASCII-7-bit=128 Latin1=57 UTF8=146 GB=67 CP1252=46 KSC=190 SJS=95 EUC-JP=58 BIG5=61 CP1250=12 [top KSC] {{(char)0x6b,(char)0x77,(char)0x5f,(char)0x5f, (char)0x03,(char)0x91,(char)0x69,(char)0xb2,(char)0x11,(char)0x71,(char)0x61,(char)0xb5,(char)0x11,(char)0x40,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kw__" // ASCII-7-bit=145 Latin1=105 UTF8=178 CP1252=113 CP1256=181 Latin5=64 [top CP1256] {{(char)0x6b,(char)0x79,(char)0x5f,(char)0x5f, (char)0x03,(char)0xab,(char)0x9d,(char)0xb6,(char)0x11,(char)0x9a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ky__" // ASCII-7-bit=171 Latin1=157 UTF8=182 CP1252=154 [top UTF8] {{(char)0x6b,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x03,(char)0x8d,(char)0x7b,(char)0xb1,(char)0x12,(char)0x74,(char)0x3d,(char)0x41,(char)0xb5,(char)0x21,(char)0x4a,(char)0x41,(char)0x8b,(char)0x81,(char)0x4a,(char)0x00,}}, // "kz__" // ASCII-7-bit=141 Latin1=123 UTF8=177 CP1252=116 KSC=61 CP1251=181 Latin5=74 KOI8R=139 ISO-8859-5=74 [top CP1251] {{(char)0x6c,(char)0x61,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa8,(char)0x8e,(char)0xab,(char)0xab,(char)0x71,(char)0x13,(char)0x9f,(char)0x6a,(char)0x99,(char)0x41,(char)0x77,(char)0x51,(char)0x64,(char)0x41,(char)0x7e,}}, // "la__" // ASCII-7-bit=168 Latin1=142 UTF8=171 GB=171 CP1252=113 SJS=159 EUC-JP=106 BIG5=153 Latin5=119 GBK=100 CP932=126 [top UTF8] {{(char)0x6c,(char)0x62,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb3,(char)0x95,(char)0xaf,(char)0x11,(char)0x90,(char)0x11,(char)0x35,(char)0x41,(char)0x9f,(char)0x10,(char)0x61,(char)0x3f,(char)0x00,(char)0x00,(char)0x00,}}, // "lb__" // ASCII-7-bit=179 Latin1=149 UTF8=175 CP1252=144 SJS=53 CP1256=159 Arabic=63 [top ASCII-7-bit] {{(char)0x6c,(char)0x63,(char)0x5f,(char)0x5f, (char)0x02,(char)0xab,(char)0xa8,(char)0x21,(char)0xb5,(char)0x11,(char)0x7f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lc__" // ASCII-7-bit=171 Latin1=168 CP1252=181 SJS=127 [top CP1252] {{(char)0x6c,(char)0x69,(char)0x5f,(char)0x5f, (char)0x05,(char)0xad,(char)0xb5,(char)0x9d,(char)0x72,(char)0x93,(char)0x12,(char)0x5f,(char)0x53,(char)0x22,(char)0x89,(char)0x64,(char)0x11,(char)0x5f,(char)0x51,(char)0x53,}}, // "li__" // ASCII-7-bit=173 Latin1=181 UTF8=157 GB=114 CP1252=147 SJS=95 EUC-JP=83 CP1251=137 CP1256=100 Latin5=95 GBK=83 [top Latin1] {{(char)0x6c,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb9,(char)0x9e,(char)0x9d,(char)0x11,(char)0xa1,(char)0x12,(char)0x47,(char)0x47,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lk__" // ASCII-7-bit=185 Latin1=158 UTF8=157 CP1252=161 SJS=71 EUC-JP=71 [top ASCII-7-bit] {{(char)0x6c,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0xad,(char)0xac,(char)0x8a,(char)0x11,(char)0xb1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lr__" // ASCII-7-bit=173 Latin1=172 UTF8=138 CP1252=177 [top CP1252] {{(char)0x6c,(char)0x73,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb7,(char)0xa3,(char)0x97,(char)0x11,(char)0xa8,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ls__" // ASCII-7-bit=183 Latin1=163 UTF8=151 CP1252=168 [top ASCII-7-bit] {{(char)0x6c,(char)0x74,(char)0x5f,(char)0x5f, (char)0x06,(char)0x8c,(char)0x64,(char)0xae,(char)0x3b,(char)0x6d,(char)0x5d,(char)0x32,(char)0x48,(char)0x71,(char)0x11,(char)0x55,(char)0x31,(char)0xb8,(char)0xc1,(char)0x6e,}}, // "lt__" // ASCII-7-bit=140 Latin1=100 UTF8=174 GB=59 CP1252=109 KSC=93 Latin2=72 CP1251=113 CP1250=85 CP1257=184 ISO-8859-13=110 [top CP1257] {{(char)0x6c,(char)0x75,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa6,(char)0xb2,(char)0xad,(char)0x47,(char)0x9f,(char)0x41,(char)0x42,(char)0x22,(char)0x54,(char)0x3f,(char)0x11,(char)0x53,(char)0x10,(char)0x51,(char)0x3b,}}, // "lu__" // ASCII-7-bit=166 Latin1=178 UTF8=173 GB=71 CP1252=159 Latin2=66 CP1250=84 Latin5=63 ISO-8859-15=83 UTF-16BE=59 [top Latin1] {{(char)0x6c,(char)0x76,(char)0x5f,(char)0x5f, (char)0x03,(char)0x97,(char)0x6d,(char)0xb5,(char)0x11,(char)0x6b,(char)0x51,(char)0x92,(char)0x51,(char)0xb0,(char)0x11,(char)0x4e,(char)0xa2,(char)0x5f,(char)0x52,(char)0x00,}}, // "lv__" // ASCII-7-bit=151 Latin1=109 UTF8=181 CP1252=107 CP1251=146 CP1257=176 KOI8R=78 ISO-8859-13=95 Latin4=82 [top UTF8] {{(char)0x6c,(char)0x79,(char)0x5f,(char)0x5f, (char)0x07,(char)0xa4,(char)0x77,(char)0xb0,(char)0x59,(char)0x8c,(char)0x92,(char)0x59,(char)0x32,(char)0x59,(char)0xb1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ly__" // ASCII-7-bit=164 Latin1=119 UTF8=176 GB=89 CP1252=140 KSC=146 SJS=89 CP1251=89 CP1256=177 [top CP1256] {{(char)0x6d,(char)0x61,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa2,(char)0xb3,(char)0xa6,(char)0x11,(char)0xa0,(char)0x62,(char)0x9e,(char)0x5d,(char)0x22,(char)0x7d,(char)0x4b,(char)0x10,(char)0x11,(char)0x47,(char)0x00,}}, // "ma__" // ASCII-7-bit=162 Latin1=179 UTF8=166 CP1252=160 CP1256=158 CP1250=93 ISO-8859-15=125 CP1257=75 Arabic=71 [top Latin1] {{(char)0x6d,(char)0x63,(char)0x5f,(char)0x5f, (char)0x03,(char)0x87,(char)0xbe,(char)0x73,(char)0x11,(char)0x89,(char)0xa1,(char)0x47,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mc__" // ASCII-7-bit=135 Latin1=190 UTF8=115 CP1252=137 ISO-8859-15=71 [top Latin1] {{(char)0x6d,(char)0x64,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa4,(char)0x82,(char)0xad,(char)0x11,(char)0x86,(char)0x11,(char)0x61,(char)0x15,(char)0x61,(char)0x74,(char)0xae,(char)0x6e,(char)0x99,(char)0x51,(char)0x9d,}}, // "md__" // ASCII-7-bit=164 Latin1=130 UTF8=173 CP1252=134 SJS=97 BIG5=97 Latin2=116 CP1251=174 CP1256=110 CP1250=153 KOI8R=157 [top CP1251] {{(char)0x6d,(char)0x67,(char)0x5f,(char)0x5f, (char)0x03,(char)0x99,(char)0xba,(char)0x85,(char)0x11,(char)0xa6,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mg__" // ASCII-7-bit=153 Latin1=186 UTF8=133 CP1252=166 [top Latin1] {{(char)0x6d,(char)0x69,(char)0x6c,(char)0x5f, (char)0x03,(char)0xba,(char)0x9a,(char)0x9a,(char)0x13,(char)0x9a,(char)0x44,(char)0x50,(char)0x11,(char)0x24,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mil_" // ASCII-7-bit=186 Latin1=154 UTF8=154 CP1252=154 KSC=68 SJS=80 BIG5=36 [top ASCII-7-bit] {{(char)0x6d,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x03,(char)0x95,(char)0x72,(char)0xab,(char)0x11,(char)0x73,(char)0x42,(char)0x3f,(char)0xa0,(char)0x11,(char)0x66,(char)0x51,(char)0xb6,(char)0x81,(char)0x56,(char)0x00,}}, // "mk__" // ASCII-7-bit=149 Latin1=114 UTF8=171 CP1252=115 Latin2=63 CP1251=160 CP1250=102 KOI8R=182 ISO-8859-5=86 [top KOI8R] {{(char)0x6d,(char)0x6c,(char)0x5f,(char)0x5f, (char)0x03,(char)0x85,(char)0xbd,(char)0x85,(char)0x11,(char)0x96,(char)0x81,(char)0x59,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ml__" // ASCII-7-bit=133 Latin1=189 UTF8=133 CP1252=150 Latin5=89 [top Latin1] {{(char)0x6d,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb5,(char)0xa1,(char)0x7d,(char)0x11,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mm__" // ASCII-7-bit=181 Latin1=161 UTF8=125 CP1252=175 [top ASCII-7-bit] {{(char)0x6d,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x07,(char)0x9f,(char)0x7f,(char)0xb8,(char)0x79,(char)0x7d,(char)0x4f,(char)0x5f,(char)0x11,(char)0x56,(char)0x11,(char)0xa7,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mn__" // ASCII-7-bit=159 Latin1=127 UTF8=184 GB=121 CP1252=125 KSC=79 SJS=95 BIG5=86 CP1251=167 [top UTF8] {{(char)0x6d,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa0,(char)0x9e,(char)0xaa,(char)0x9e,(char)0x86,(char)0x11,(char)0x4a,(char)0x11,(char)0xb2,(char)0xa1,(char)0x59,(char)0xc1,(char)0x36,(char)0x00,(char)0x00,}}, // "mo__" // ASCII-7-bit=160 Latin1=158 UTF8=170 GB=158 CP1252=134 SJS=74 BIG5=178 GBK=89 GB18030=54 [top BIG5] {{(char)0x6d,(char)0x6f,(char)0x62,(char)0x69, (char)0x08,(char)0xb6,(char)0x95,(char)0xaa,(char)0x7f,(char)0x7d,(char)0x53,(char)0xa0,(char)0x71,(char)0x13,(char)0x65,(char)0x6d,(char)0x78,(char)0xc1,(char)0x73,(char)0x00,}}, // "mobi" // ASCII-7-bit=182 Latin1=149 UTF8=170 GB=127 CP1252=125 KSC=83 SJS=160 EUC-JP=113 Latin2=101 CP1251=109 CP1256=120 CP932=115 [top ASCII-7-bit] {{(char)0x6d,(char)0x70,(char)0x5f,(char)0x5f, (char)0x03,(char)0xbe,(char)0x5a,(char)0x54,(char)0x11,(char)0x5c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mp__" // ASCII-7-bit=190 Latin1=90 UTF8=84 CP1252=92 [top ASCII-7-bit] {{(char)0x6d,(char)0x71,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa3,(char)0xb8,(char)0x95,(char)0x11,(char)0xa5,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mq__" // ASCII-7-bit=163 Latin1=184 UTF8=149 CP1252=165 [top Latin1] {{(char)0x6d,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9b,(char)0xab,(char)0x8d,(char)0x11,(char)0x96,(char)0x61,(char)0xb6,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mr__" // ASCII-7-bit=155 Latin1=171 UTF8=141 CP1252=150 CP1256=182 [top CP1256] {{(char)0x6d,(char)0x73,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb4,(char)0xae,(char)0x9c,(char)0x18,(char)0x8a,(char)0x73,(char)0x86,(char)0x6f,(char)0x53,(char)0x56,(char)0x6c,(char)0x75,(char)0x11,(char)0x85,(char)0x00,}}, // "ms__" // ASCII-7-bit=180 Latin1=174 UTF8=156 CP1252=138 KSC=115 SJS=134 EUC-JP=111 BIG5=83 Latin2=86 CP1251=108 CP1256=117 Latin5=133 [top ASCII-7-bit] {{(char)0x6d,(char)0x74,(char)0x5f,(char)0x5f, (char)0x05,(char)0xbc,(char)0x87,(char)0x9b,(char)0x5c,(char)0x8b,(char)0x42,(char)0x2c,(char)0x40,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mt__" // ASCII-7-bit=188 Latin1=135 UTF8=155 GB=92 CP1252=139 Latin2=44 CP1251=64 [top ASCII-7-bit] {{(char)0x6d,(char)0x75,(char)0x5f,(char)0x5f, (char)0x09,(char)0xb4,(char)0xa4,(char)0xa9,(char)0x57,(char)0x9f,(char)0x4d,(char)0x7e,(char)0x70,(char)0x4d,(char)0x11,(char)0x4d,(char)0x21,(char)0x57,(char)0x11,(char)0x4d,}}, // "mu__" // ASCII-7-bit=180 Latin1=164 UTF8=169 GB=87 CP1252=159 KSC=77 SJS=126 EUC-JP=112 BIG5=77 CP1251=77 Latin5=87 ISO-8859-15=77 [top ASCII-7-bit] {{(char)0x6d,(char)0x75,(char)0x73,(char)0x65, (char)0x07,(char)0xb3,(char)0xa9,(char)0xa6,(char)0x76,(char)0x90,(char)0x56,(char)0x88,(char)0x13,(char)0x8e,(char)0x6a,(char)0x7a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "muse" // ASCII-7-bit=179 Latin1=169 UTF8=166 GB=118 CP1252=144 KSC=86 SJS=136 BIG5=142 Latin2=106 CP1251=122 [top ASCII-7-bit] {{(char)0x6d,(char)0x76,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb6,(char)0x98,(char)0xab,(char)0x11,(char)0x9f,(char)0x61,(char)0x53,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mv__" // ASCII-7-bit=182 Latin1=152 UTF8=171 CP1252=159 CP1256=83 [top ASCII-7-bit] {{(char)0x6d,(char)0x77,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb7,(char)0xa3,(char)0xa8,(char)0x7f,(char)0x8d,(char)0x11,(char)0x7f,(char)0xc1,(char)0x6b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mw__" // ASCII-7-bit=183 Latin1=163 UTF8=168 GB=127 CP1252=141 SJS=127 GBK=107 [top ASCII-7-bit] {{(char)0x6d,(char)0x78,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa7,(char)0xba,(char)0x94,(char)0x45,(char)0x93,(char)0x11,(char)0x1d,(char)0x12,(char)0x25,(char)0x29,(char)0x21,(char)0x27,(char)0x21,(char)0x3c,(char)0x00,}}, // "mx__" // ASCII-7-bit=167 Latin1=186 UTF8=148 GB=69 CP1252=147 SJS=29 BIG5=37 Latin2=41 CP1250=39 ISO-8859-15=60 [top Latin1] {{(char)0x6d,(char)0x79,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb3,(char)0xb3,(char)0x8d,(char)0x6b,(char)0x8f,(char)0x13,(char)0x4d,(char)0x50,(char)0x7f,(char)0x12,(char)0x3f,(char)0x6b,(char)0x12,(char)0x4b,(char)0x3e,}}, // "my__" // ASCII-7-bit=179 Latin1=179 UTF8=141 GB=107 CP1252=143 SJS=77 EUC-JP=80 BIG5=127 CP1251=63 CP1256=107 Latin5=75 ISO-8859-11=62 [top ASCII-7-bit] {{(char)0x6d,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x03,(char)0x8e,(char)0xaf,(char)0xb7,(char)0x11,(char)0x8f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mz__" // ASCII-7-bit=142 Latin1=175 UTF8=183 CP1252=143 [top UTF8] {{(char)0x6e,(char)0x61,(char)0x5f,(char)0x5f, (char)0x03,(char)0xba,(char)0xa1,(char)0x97,(char)0x11,(char)0x9c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "na__" // ASCII-7-bit=186 Latin1=161 UTF8=151 CP1252=156 [top ASCII-7-bit] {{(char)0x6e,(char)0x61,(char)0x6d,(char)0x65, (char)0x08,(char)0xb2,(char)0xa4,(char)0xa9,(char)0x8a,(char)0x90,(char)0x7d,(char)0x7c,(char)0x6b,(char)0x15,(char)0x80,(char)0x94,(char)0x6b,(char)0x8b,(char)0x77,(char)0x00,}}, // "name" // ASCII-7-bit=178 Latin1=164 UTF8=169 GB=138 CP1252=144 KSC=125 SJS=124 EUC-JP=107 Latin2=128 CP1251=148 CP1256=107 CP1250=139 Latin5=119 [top ASCII-7-bit] {{(char)0x6e,(char)0x63,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa7,(char)0xb9,(char)0x8c,(char)0x11,(char)0x9e,(char)0x11,(char)0x72,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "nc__" // ASCII-7-bit=167 Latin1=185 UTF8=140 CP1252=158 SJS=114 [top Latin1] {{(char)0x6e,(char)0x65,(char)0x5f,(char)0x5f, (char)0x03,(char)0xad,(char)0xb9,(char)0x80,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ne__" // ASCII-7-bit=173 Latin1=185 UTF8=128 [top Latin1] {{(char)0x6e,(char)0x65,(char)0x74,(char)0x5f, (char)0x0f,(char)0xac,(char)0xa6,(char)0xa4,(char)0x93,(char)0x93,(char)0x94,(char)0x97,(char)0x83,(char)0x86,(char)0x7e,(char)0x80,(char)0x96,(char)0x7a,(char)0x89,(char)0x73,}}, // "net_" // ASCII-7-bit=172 Latin1=166 UTF8=164 GB=147 CP1252=147 KSC=148 SJS=151 EUC-JP=131 BIG5=134 Latin2=126 CP1251=128 CP1256=150 CP1250=122 Latin5=137 ISO-8859-11=115 [top ASCII-7-bit] {{(char)0x6e,(char)0x66,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb5,(char)0xa9,(char)0xa8,(char)0x11,(char)0x87,(char)0xa1,(char)0x77,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "nf__" // ASCII-7-bit=181 Latin1=169 UTF8=168 CP1252=135 ISO-8859-15=119 [top ASCII-7-bit] {{(char)0x6e,(char)0x67,(char)0x5f,(char)0x5f, (char)0x03,(char)0xbd,(char)0x95,(char)0x89,(char)0x11,(char)0x92,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ng__" // ASCII-7-bit=189 Latin1=149 UTF8=137 CP1252=146 [top ASCII-7-bit] {{(char)0x6e,(char)0x69,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9d,(char)0xb3,(char)0xa9,(char)0x11,(char)0xa8,(char)0x81,(char)0x40,(char)0x11,(char)0x36,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ni__" // ASCII-7-bit=157 Latin1=179 UTF8=169 CP1252=168 Latin5=64 ISO-8859-15=54 [top Latin1] {{(char)0x6e,(char)0x6c,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb2,(char)0xae,(char)0xa0,(char)0x32,(char)0xa1,(char)0x36,(char)0x31,(char)0x42,(char)0x39,(char)0x3b,(char)0x33,(char)0x45,(char)0x11,(char)0x6f,(char)0x00,}}, // "nl__" // ASCII-7-bit=178 Latin1=174 UTF8=160 GB=50 CP1252=161 BIG5=49 Latin2=66 CP1251=57 CP1256=59 CP1250=51 Latin5=69 ISO-8859-15=111 [top ASCII-7-bit] {{(char)0x6e,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x05,(char)0x99,(char)0xb8,(char)0xaa,(char)0x47,(char)0x8d,(char)0x11,(char)0x31,(char)0x22,(char)0x34,(char)0x3e,(char)0x42,(char)0x70,(char)0x33,(char)0x00,(char)0x00,}}, // "no__" // ASCII-7-bit=153 Latin1=184 UTF8=170 GB=71 CP1252=141 SJS=49 Latin2=52 CP1251=62 ISO-8859-15=112 CP1257=51 [top Latin1] {{(char)0x6e,(char)0x70,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb2,(char)0x9f,(char)0xa5,(char)0x11,(char)0xac,(char)0x11,(char)0x61,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "np__" // ASCII-7-bit=178 Latin1=159 UTF8=165 CP1252=172 SJS=97 [top ASCII-7-bit] {{(char)0x6e,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0xbe,(char)0x77,(char)0x7a,(char)0x11,(char)0x62,(char)0x71,(char)0x44,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "nr__" // ASCII-7-bit=190 Latin1=119 UTF8=122 CP1252=98 CP1250=68 [top ASCII-7-bit] {{(char)0x6e,(char)0x75,(char)0x5f,(char)0x5f, (char)0x03,(char)0xae,(char)0xb4,(char)0x9e,(char)0x11,(char)0x96,(char)0x12,(char)0x7c,(char)0x76,(char)0x22,(char)0x75,(char)0x62,(char)0xa1,(char)0x65,(char)0x00,(char)0x00,}}, // "nu__" // ASCII-7-bit=174 Latin1=180 UTF8=158 CP1252=150 SJS=124 EUC-JP=118 CP1251=117 CP1256=98 CP1254=101 [top Latin1] {{(char)0x6e,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x0d,(char)0xba,(char)0x97,(char)0xa2,(char)0x5f,(char)0x97,(char)0x5c,(char)0x5a,(char)0x4b,(char)0x4a,(char)0x30,(char)0x47,(char)0x36,(char)0x34,(char)0x21,(char)0x2b,}}, // "nz__" // ASCII-7-bit=186 Latin1=151 UTF8=162 GB=95 CP1252=151 KSC=92 SJS=90 EUC-JP=75 BIG5=74 Latin2=48 CP1251=71 CP1256=54 CP1250=52 ISO-8859-15=43 [top ASCII-7-bit] {{(char)0x6f,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9a,(char)0x8a,(char)0x89,(char)0x11,(char)0x87,(char)0x61,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "om__" // ASCII-7-bit=154 Latin1=138 UTF8=137 CP1252=135 CP1256=188 [top CP1256] {{(char)0x6f,(char)0x72,(char)0x67,(char)0x5f, (char)0x0e,(char)0xb5,(char)0x9f,(char)0xac,(char)0x76,(char)0x90,(char)0x7e,(char)0x6e,(char)0x69,(char)0x71,(char)0x6d,(char)0x6a,(char)0x78,(char)0x60,(char)0x73,(char)0x00,}}, // "org_" // ASCII-7-bit=181 Latin1=159 UTF8=172 GB=118 CP1252=144 KSC=126 SJS=110 EUC-JP=105 BIG5=113 Latin2=109 CP1251=106 CP1256=120 CP1250=96 Latin5=115 [top ASCII-7-bit] {{(char)0x70,(char)0x61,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa3,(char)0xb8,(char)0xa7,(char)0x11,(char)0x87,(char)0x71,(char)0x31,(char)0x21,(char)0x41,(char)0x21,(char)0x31,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "pa__" // ASCII-7-bit=163 Latin1=184 UTF8=167 CP1252=135 CP1250=49 ISO-8859-15=65 KOI8R=49 [top Latin1] {{(char)0x70,(char)0x65,(char)0x5f,(char)0x5f, (char)0x05,(char)0xa8,(char)0xb8,(char)0x9d,(char)0x3a,(char)0x99,(char)0x11,(char)0x2e,(char)0x13,(char)0x2e,(char)0x1e,(char)0x1e,(char)0x11,(char)0x32,(char)0x00,(char)0x00,}}, // "pe__" // ASCII-7-bit=168 Latin1=184 UTF8=157 GB=58 CP1252=153 SJS=46 BIG5=46 Latin2=30 CP1251=30 CP1250=50 [top Latin1] {{(char)0x70,(char)0x66,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa2,(char)0xb5,(char)0xa3,(char)0x11,(char)0xa7,(char)0x11,(char)0x63,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "pf__" // ASCII-7-bit=162 Latin1=181 UTF8=163 CP1252=167 SJS=99 [top Latin1] {{(char)0x70,(char)0x67,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb8,(char)0xa6,(char)0x81,(char)0x6a,(char)0xa5,(char)0x11,(char)0x70,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "pg__" // ASCII-7-bit=184 Latin1=166 UTF8=129 GB=106 CP1252=165 SJS=112 [top ASCII-7-bit] {{(char)0x70,(char)0x68,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb5,(char)0x9e,(char)0x99,(char)0x15,(char)0xac,(char)0x57,(char)0x65,(char)0x4f,(char)0x51,(char)0x31,(char)0x31,(char)0x11,(char)0x4b,(char)0xd1,(char)0x29,}}, // "ph__" // ASCII-7-bit=181 Latin1=158 UTF8=153 CP1252=172 KSC=87 SJS=101 EUC-JP=79 BIG5=81 CP1250=49 ISO-8859-11=75 CP874=41 [top ASCII-7-bit] {{(char)0x70,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb9,(char)0x9b,(char)0x8c,(char)0x11,(char)0xa3,(char)0x11,(char)0x33,(char)0x11,(char)0x99,(char)0x21,(char)0x29,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "pk__" // ASCII-7-bit=185 Latin1=155 UTF8=140 CP1252=163 SJS=51 BIG5=153 CP1256=41 [top ASCII-7-bit] {{(char)0x70,(char)0x6c,(char)0x5f,(char)0x5f, (char)0x03,(char)0x89,(char)0x62,(char)0xa8,(char)0x11,(char)0x4b,(char)0x42,(char)0xba,(char)0x40,(char)0x11,(char)0x92,(char)0xe1,(char)0x3e,(char)0x00,(char)0x00,(char)0x00,}}, // "pl__" // ASCII-7-bit=137 Latin1=98 UTF8=168 CP1252=75 Latin2=186 CP1251=64 CP1250=146 ISO-8859-5=62 [top Latin2] {{(char)0x70,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x06,(char)0xbb,(char)0xa1,(char)0x99,(char)0x66,(char)0x66,(char)0x66,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "pn__" // ASCII-7-bit=187 Latin1=161 UTF8=153 GB=102 CP1252=102 KSC=102 [top ASCII-7-bit] {{(char)0x70,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9b,(char)0xb5,(char)0xaf,(char)0x11,(char)0x94,(char)0x41,(char)0x65,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "pr__" // ASCII-7-bit=155 Latin1=181 UTF8=175 CP1252=148 Latin2=101 [top Latin1] {{(char)0x70,(char)0x72,(char)0x6f,(char)0x5f, (char)0x03,(char)0xb3,(char)0x9e,(char)0xad,(char)0x11,(char)0x87,(char)0x13,(char)0x65,(char)0x6f,(char)0x65,(char)0x11,(char)0x9f,(char)0x21,(char)0x79,(char)0x00,(char)0x00,}}, // "pro_" // ASCII-7-bit=179 Latin1=158 UTF8=173 CP1252=135 SJS=101 EUC-JP=111 BIG5=101 CP1251=159 Latin5=121 [top ASCII-7-bit] {{(char)0x70,(char)0x73,(char)0x5f,(char)0x5f, (char)0x03,(char)0x99,(char)0x8f,(char)0x9d,(char)0x11,(char)0x9f,(char)0x61,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ps__" // ASCII-7-bit=153 Latin1=143 UTF8=157 CP1252=159 CP1256=185 [top CP1256] {{(char)0x70,(char)0x74,(char)0x5f,(char)0x5f, (char)0x05,(char)0x99,(char)0xb5,(char)0xad,(char)0x1d,(char)0x95,(char)0x11,(char)0x21,(char)0x52,(char)0x36,(char)0x40,(char)0x12,(char)0x90,(char)0x23,(char)0x51,(char)0x1d,}}, // "pt__" // ASCII-7-bit=153 Latin1=181 UTF8=173 GB=29 CP1252=149 SJS=33 CP1250=54 Latin5=64 ISO-8859-15=144 CP1257=35 CP1254=29 [top Latin1] {{(char)0x70,(char)0x79,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9f,(char)0xbb,(char)0x90,(char)0x13,(char)0x97,(char)0x49,(char)0x35,(char)0x21,(char)0x35,(char)0x51,(char)0x5a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "py__" // ASCII-7-bit=159 Latin1=187 UTF8=144 CP1252=151 KSC=73 SJS=53 Latin2=53 ISO-8859-15=90 [top Latin1] {{(char)0x71,(char)0x61,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9a,(char)0x89,(char)0xb0,(char)0x11,(char)0x82,(char)0x61,(char)0xb5,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "qa__" // ASCII-7-bit=154 Latin1=137 UTF8=176 CP1252=130 CP1256=181 [top CP1256] {{(char)0x72,(char)0x65,(char)0x5f,(char)0x5f, (char)0x03,(char)0x8a,(char)0xb4,(char)0xb1,(char)0x11,(char)0x97,(char)0xa1,(char)0x8a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "re__" // ASCII-7-bit=138 Latin1=180 UTF8=177 CP1252=151 ISO-8859-15=138 [top Latin1] {{(char)0x72,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x08,(char)0xb4,(char)0xa0,(char)0xa4,(char)0x3c,(char)0x94,(char)0x57,(char)0x2e,(char)0x29,(char)0x14,(char)0xa2,(char)0x3a,(char)0x33,(char)0x8b,(char)0x21,(char)0x37,}}, // "ro__" // ASCII-7-bit=180 Latin1=160 UTF8=164 GB=60 CP1252=148 KSC=87 SJS=46 EUC-JP=41 Latin2=162 CP1251=58 CP1256=51 CP1250=139 ISO-8859-15=55 [top ASCII-7-bit] {{(char)0x72,(char)0x75,(char)0x5f,(char)0x5f, (char)0x05,(char)0x8d,(char)0x6d,(char)0xa1,(char)0x56,(char)0x67,(char)0x31,(char)0x43,(char)0x12,(char)0xba,(char)0x46,(char)0x61,(char)0x9b,(char)0x72,(char)0x46,(char)0x48,}}, // "ru__" // ASCII-7-bit=141 Latin1=109 UTF8=161 GB=86 CP1252=103 BIG5=67 CP1251=186 CP1256=70 KOI8R=155 KOI8U=70 ISO-8859-5=72 [top CP1251] {{(char)0x72,(char)0x77,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb7,(char)0xa2,(char)0xa4,(char)0x11,(char)0xa0,(char)0x61,(char)0x5e,(char)0x31,(char)0x6e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "rw__" // ASCII-7-bit=183 Latin1=162 UTF8=164 CP1252=160 CP1256=94 ISO-8859-15=110 [top ASCII-7-bit] {{(char)0x73,(char)0x61,(char)0x5f,(char)0x5f, (char)0x05,(char)0x91,(char)0x5b,(char)0xac,(char)0x3f,(char)0x69,(char)0x11,(char)0x1f,(char)0x41,(char)0xb9,(char)0x11,(char)0x1f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sa__" // ASCII-7-bit=145 Latin1=91 UTF8=172 GB=63 CP1252=105 SJS=31 CP1256=185 Latin5=31 [top CP1256] {{(char)0x73,(char)0x62,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb8,(char)0x8a,(char)0xad,(char)0x11,(char)0x8b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sb__" // ASCII-7-bit=184 Latin1=138 UTF8=173 CP1252=139 [top ASCII-7-bit] {{(char)0x73,(char)0x63,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb5,(char)0x9e,(char)0xad,(char)0x11,(char)0x85,(char)0x12,(char)0x8d,(char)0x88,(char)0x23,(char)0x57,(char)0x4d,(char)0x5c,(char)0x00,(char)0x00,(char)0x00,}}, // "sc__" // ASCII-7-bit=181 Latin1=158 UTF8=173 CP1252=133 SJS=141 EUC-JP=136 CP1251=87 CP1256=77 CP1250=92 [top ASCII-7-bit] {{(char)0x73,(char)0x64,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9b,(char)0x77,(char)0x8a,(char)0x11,(char)0x6d,(char)0x61,(char)0xbd,(char)0x10,(char)0x61,(char)0x73,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sd__" // ASCII-7-bit=155 Latin1=119 UTF8=138 CP1252=109 CP1256=189 Arabic=115 [top CP1256] {{(char)0x73,(char)0x65,(char)0x5f,(char)0x5f, (char)0x05,(char)0x96,(char)0xbb,(char)0xa0,(char)0x23,(char)0x82,(char)0x36,(char)0x23,(char)0x2e,(char)0x25,(char)0x3b,(char)0x43,(char)0x22,(char)0x11,(char)0x4c,(char)0x00,}}, // "se__" // ASCII-7-bit=150 Latin1=187 UTF8=160 GB=35 CP1252=130 BIG5=35 Latin2=46 CP1251=37 CP1256=59 CP1250=67 Latin5=34 ISO-8859-15=76 [top Latin1] {{(char)0x73,(char)0x67,(char)0x5f,(char)0x5f, (char)0x09,(char)0xb8,(char)0x9c,(char)0xa6,(char)0x84,(char)0x94,(char)0x4c,(char)0x6e,(char)0x50,(char)0x71,(char)0x31,(char)0x41,(char)0x11,(char)0x48,(char)0xd1,(char)0x3a,}}, // "sg__" // ASCII-7-bit=184 Latin1=156 UTF8=166 GB=132 CP1252=148 KSC=76 SJS=110 EUC-JP=80 BIG5=113 CP1250=65 ISO-8859-11=72 CP874=58 [top ASCII-7-bit] {{(char)0x73,(char)0x68,(char)0x5f,(char)0x5f, (char)0x0a,(char)0xaa,(char)0x9b,(char)0xa1,(char)0xa9,(char)0x84,(char)0x77,(char)0xa1,(char)0x98,(char)0x9b,(char)0x5d,(char)0x51,(char)0x6d,(char)0x31,(char)0x6f,(char)0x00,}}, // "sh__" // ASCII-7-bit=170 Latin1=155 UTF8=161 GB=169 CP1252=132 KSC=119 SJS=161 EUC-JP=152 BIG5=155 Latin2=93 ISO-8859-15=109 GBK=111 [top ASCII-7-bit] {{(char)0x73,(char)0x69,(char)0x5f,(char)0x5f, (char)0x03,(char)0x95,(char)0x6b,(char)0xb7,(char)0x11,(char)0x6e,(char)0x42,(char)0x9f,(char)0x3d,(char)0x11,(char)0xa9,(char)0x21,(char)0x17,(char)0x10,(char)0x11,(char)0x24,}}, // "si__" // ASCII-7-bit=149 Latin1=107 UTF8=183 CP1252=110 Latin2=159 CP1251=61 CP1250=169 ISO-8859-15=23 CP852=36 [top UTF8] {{(char)0x73,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x03,(char)0x95,(char)0x74,(char)0xb0,(char)0x11,(char)0x60,(char)0x36,(char)0x53,(char)0x92,(char)0x55,(char)0x47,(char)0xb5,(char)0x3f,(char)0x10,(char)0x11,(char)0x3a,}}, // "sk__" // ASCII-7-bit=149 Latin1=116 UTF8=176 CP1252=96 BIG5=83 Latin2=146 CP1251=85 CP1256=71 CP1250=181 Latin5=63 MACINTOSH=58 [top CP1250] {{(char)0x73,(char)0x6c,(char)0x5f,(char)0x5f, (char)0x03,(char)0xac,(char)0x85,(char)0x8f,(char)0x11,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sl__" // ASCII-7-bit=172 Latin1=133 UTF8=143 CP1252=185 [top CP1252] {{(char)0x73,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa8,(char)0xa7,(char)0xb1,(char)0x11,(char)0xa8,(char)0x91,(char)0x6f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sm__" // ASCII-7-bit=168 Latin1=167 UTF8=177 CP1252=168 ISO-8859-11=111 [top UTF8] {{(char)0x73,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9d,(char)0xb8,(char)0x9f,(char)0x11,(char)0xa2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sn__" // ASCII-7-bit=157 Latin1=184 UTF8=159 CP1252=162 [top Latin1] {{(char)0x73,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa6,(char)0xad,(char)0xb2,(char)0x12,(char)0x9d,(char)0x6a,(char)0x61,(char)0x84,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sr__" // ASCII-7-bit=166 Latin1=173 UTF8=178 CP1252=157 KSC=106 CP1250=132 [top UTF8] {{(char)0x73,(char)0x74,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb4,(char)0xab,(char)0x9d,(char)0x15,(char)0x88,(char)0x79,(char)0x99,(char)0x94,(char)0x7e,(char)0x31,(char)0x61,(char)0x81,(char)0x4e,(char)0x21,(char)0x6d,}}, // "st__" // ASCII-7-bit=180 Latin1=171 UTF8=157 CP1252=136 KSC=121 SJS=153 EUC-JP=148 BIG5=126 CP1250=97 JIS=78 CP932=109 [top ASCII-7-bit] {{(char)0x73,(char)0x75,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa4,(char)0x6f,(char)0xa0,(char)0x11,(char)0x70,(char)0x51,(char)0xb9,(char)0x71,(char)0x94,(char)0x71,(char)0x44,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "su__" // ASCII-7-bit=164 Latin1=111 UTF8=160 CP1252=112 CP1251=185 KOI8R=148 KOI8U=68 [top CP1251] {{(char)0x73,(char)0x76,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9d,(char)0xb9,(char)0xa5,(char)0x11,(char)0x8f,(char)0x41,(char)0x3c,(char)0x51,(char)0x3c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sv__" // ASCII-7-bit=157 Latin1=185 UTF8=165 CP1252=143 Latin2=60 ISO-8859-15=60 [top Latin1] {{(char)0x73,(char)0x79,(char)0x5f,(char)0x5f, (char)0x03,(char)0x82,(char)0x5e,(char)0x90,(char)0x11,(char)0x5d,(char)0x61,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sy__" // ASCII-7-bit=130 Latin1=94 UTF8=144 CP1252=93 CP1256=190 [top CP1256] {{(char)0x73,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb7,(char)0xac,(char)0x6c,(char)0x11,(char)0xa1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sz__" // ASCII-7-bit=183 Latin1=172 UTF8=108 CP1252=161 [top ASCII-7-bit] {{(char)0x74,(char)0x63,(char)0x5f,(char)0x5f, (char)0x08,(char)0xa9,(char)0xaa,(char)0x9b,(char)0x62,(char)0x74,(char)0x8d,(char)0x8f,(char)0x7a,(char)0x21,(char)0x67,(char)0x22,(char)0xab,(char)0x9b,(char)0x41,(char)0x70,}}, // "tc__" // ASCII-7-bit=169 Latin1=170 UTF8=155 GB=98 CP1252=116 KSC=141 SJS=143 EUC-JP=122 CP1251=103 Latin5=171 ISO-8859-11=155 GBK=112 [top Latin5] {{(char)0x74,(char)0x66,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa3,(char)0xbc,(char)0x21,(char)0x71,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tf__" // ASCII-7-bit=163 Latin1=188 CP1252=113 [top Latin1] {{(char)0x74,(char)0x67,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb0,(char)0xb3,(char)0x7e,(char)0x11,(char)0xa5,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tg__" // ASCII-7-bit=176 Latin1=179 UTF8=126 CP1252=165 [top Latin1] {{(char)0x74,(char)0x68,(char)0x5f,(char)0x5f, (char)0x09,(char)0x96,(char)0x61,(char)0x93,(char)0x3e,(char)0x67,(char)0x2f,(char)0x52,(char)0x38,(char)0x23,(char)0x11,(char)0x35,(char)0x31,(char)0xbd,(char)0xd1,(char)0x76,}}, // "th__" // ASCII-7-bit=150 Latin1=97 UTF8=147 GB=62 CP1252=103 KSC=47 SJS=82 EUC-JP=56 BIG5=35 CP1251=53 ISO-8859-11=189 CP874=118 [top ISO-8859-11] {{(char)0x74,(char)0x6a,(char)0x5f,(char)0x5f, (char)0x03,(char)0xab,(char)0x74,(char)0xb1,(char)0x11,(char)0x67,(char)0x51,(char)0xae,(char)0x71,(char)0x84,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tj__" // ASCII-7-bit=171 Latin1=116 UTF8=177 CP1252=103 CP1251=174 KOI8R=132 [top UTF8] {{(char)0x74,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x03,(char)0xbc,(char)0x94,(char)0x9d,(char)0x11,(char)0x6b,(char)0x12,(char)0x74,(char)0x6b,(char)0x12,(char)0x53,(char)0x46,(char)0x12,(char)0x74,(char)0x6d,(char)0x00,}}, // "tk__" // ASCII-7-bit=188 Latin1=148 UTF8=157 CP1252=107 SJS=116 EUC-JP=107 Latin2=83 CP1251=70 CP1250=116 Latin5=109 [top ASCII-7-bit] {{(char)0x74,(char)0x6c,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb1,(char)0xb0,(char)0x88,(char)0x61,(char)0x83,(char)0xa1,(char)0xa8,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tl__" // ASCII-7-bit=177 Latin1=176 UTF8=136 GB=97 CP1252=131 ISO-8859-15=168 [top ASCII-7-bit] {{(char)0x74,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb4,(char)0x84,(char)0xad,(char)0x11,(char)0x82,(char)0x42,(char)0x5a,(char)0xa4,(char)0x12,(char)0x5a,(char)0x5a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tm__" // ASCII-7-bit=180 Latin1=132 UTF8=173 CP1252=130 Latin2=90 CP1251=164 CP1250=90 Latin5=90 [top ASCII-7-bit] {{(char)0x74,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9f,(char)0xa2,(char)0xac,(char)0x11,(char)0x9d,(char)0x11,(char)0x4b,(char)0x21,(char)0x3b,(char)0x11,(char)0xb0,(char)0x10,(char)0x61,(char)0x3b,(char)0x00,}}, // "tn__" // ASCII-7-bit=159 Latin1=162 UTF8=172 CP1252=157 SJS=75 Latin2=59 CP1256=176 Arabic=59 [top CP1256] {{(char)0x74,(char)0x6f,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa5,(char)0xa2,(char)0xa5,(char)0x15,(char)0x89,(char)0x8a,(char)0xac,(char)0x99,(char)0x9b,(char)0x31,(char)0x70,(char)0x21,(char)0x87,(char)0x51,(char)0x6c,}}, // "to__" // ASCII-7-bit=165 Latin1=162 UTF8=165 CP1252=137 KSC=138 SJS=172 EUC-JP=153 BIG5=155 CP1250=112 ISO-8859-15=135 JIS=108 [top SJS] {{(char)0x74,(char)0x70,(char)0x5f,(char)0x5f, (char)0x03,(char)0x95,(char)0x9e,(char)0xad,(char)0x11,(char)0x67,(char)0x12,(char)0xb3,(char)0x99,(char)0xd1,(char)0x67,(char)0x21,(char)0x67,(char)0x00,(char)0x00,(char)0x00,}}, // "tp__" // ASCII-7-bit=149 Latin1=158 UTF8=173 CP1252=103 SJS=179 EUC-JP=153 JIS=103 CP932=103 [top SJS] {{(char)0x74,(char)0x72,(char)0x5f,(char)0x5f, (char)0x03,(char)0x8d,(char)0x6c,(char)0xa6,(char)0x11,(char)0x61,(char)0x11,(char)0x3c,(char)0x32,(char)0x3c,(char)0x4a,(char)0x11,(char)0xba,(char)0x81,(char)0x91,(char)0x00,}}, // "tr__" // ASCII-7-bit=141 Latin1=108 UTF8=166 CP1252=97 SJS=60 CP1251=60 CP1256=74 Latin5=186 CP1254=145 [top Latin5] {{(char)0x74,(char)0x72,(char)0x61,(char)0x76, (char)0x05,(char)0xa9,(char)0xa3,(char)0xa7,(char)0x97,(char)0x95,(char)0x11,(char)0xac,(char)0x13,(char)0x74,(char)0x7f,(char)0x6b,(char)0x11,(char)0x63,(char)0x00,(char)0x00,}}, // "trav" // ASCII-7-bit=169 Latin1=163 UTF8=167 GB=151 CP1252=149 SJS=172 BIG5=116 Latin2=127 CP1251=107 CP1250=99 [top SJS] {{(char)0x74,(char)0x74,(char)0x5f,(char)0x5f, (char)0x07,(char)0xb5,(char)0xaf,(char)0x9a,(char)0x49,(char)0x92,(char)0x59,(char)0x49,(char)0x61,(char)0x75,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tt__" // ASCII-7-bit=181 Latin1=175 UTF8=154 GB=73 CP1252=146 KSC=89 SJS=73 Latin5=117 [top ASCII-7-bit] {{(char)0x74,(char)0x76,(char)0x5f,(char)0x5f, (char)0x0e,(char)0xa7,(char)0xa6,(char)0xad,(char)0x89,(char)0x94,(char)0x85,(char)0x9e,(char)0x8d,(char)0x7b,(char)0x74,(char)0x7c,(char)0x88,(char)0x7b,(char)0x81,(char)0x00,}}, // "tv__" // ASCII-7-bit=167 Latin1=166 UTF8=173 GB=137 CP1252=148 KSC=133 SJS=158 EUC-JP=141 BIG5=123 Latin2=116 CP1251=124 CP1256=136 CP1250=123 Latin5=129 [top UTF8] {{(char)0x74,(char)0x77,(char)0x5f,(char)0x5f, (char)0x05,(char)0x85,(char)0x52,(char)0xab,(char)0x5d,(char)0x57,(char)0x13,(char)0x50,(char)0x2e,(char)0xba,(char)0x31,(char)0x23,(char)0x61,(char)0x2e,(char)0xf1,(char)0x21,}}, // "tw__" // ASCII-7-bit=133 Latin1=82 UTF8=171 GB=93 CP1252=87 SJS=80 EUC-JP=46 BIG5=186 CP1250=35 GBK=46 BIG5_HKSCS=33 [top BIG5] {{(char)0x74,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x03,(char)0xae,(char)0xb5,(char)0x8b,(char)0x13,(char)0xa0,(char)0x4c,(char)0x4c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tz__" // ASCII-7-bit=174 Latin1=181 UTF8=139 CP1252=160 KSC=76 SJS=76 [top Latin1] {{(char)0x75,(char)0x61,(char)0x5f,(char)0x5f, (char)0x03,(char)0x87,(char)0x61,(char)0xa2,(char)0x11,(char)0x57,(char)0x44,(char)0x4d,(char)0xbb,(char)0x35,(char)0x48,(char)0x51,(char)0x80,(char)0x72,(char)0x8c,(char)0x3d,}}, // "ua__" // ASCII-7-bit=135 Latin1=97 UTF8=162 CP1252=87 Latin2=77 CP1251=187 CP1256=53 CP1250=72 KOI8R=128 KOI8U=140 ISO-8859-5=61 [top CP1251] {{(char)0x75,(char)0x67,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb8,(char)0x9a,(char)0xa0,(char)0x11,(char)0xa6,(char)0x11,(char)0x68,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ug__" // ASCII-7-bit=184 Latin1=154 UTF8=160 CP1252=166 SJS=104 [top ASCII-7-bit] {{(char)0x75,(char)0x6b,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb7,(char)0xa7,(char)0x9e,(char)0x62,(char)0x97,(char)0x27,(char)0x58,(char)0x62,(char)0x51,(char)0x53,(char)0x62,(char)0x64,(char)0x54,(char)0x11,(char)0x6f,}}, // "uk__" // ASCII-7-bit=183 Latin1=167 UTF8=158 GB=98 CP1252=151 EUC-JP=88 BIG5=98 Latin2=81 CP1251=83 CP1256=98 CP1250=100 Latin5=84 ISO-8859-15=111 [top ASCII-7-bit] {{(char)0x75,(char)0x73,(char)0x5f,(char)0x5f, (char)0x06,(char)0xba,(char)0x94,(char)0xa5,(char)0x45,(char)0x92,(char)0x48,(char)0x24,(char)0x54,(char)0x47,(char)0x5a,(char)0x56,(char)0x11,(char)0x66,(char)0x11,(char)0x40,}}, // "us__" // ASCII-7-bit=186 Latin1=148 UTF8=165 GB=69 CP1252=146 KSC=72 BIG5=84 Latin2=71 CP1251=90 CP1256=86 Latin5=102 ISO-8859-15=64 [top ASCII-7-bit] {{(char)0x75,(char)0x79,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa2,(char)0xba,(char)0x96,(char)0x11,(char)0x9a,(char)0x72,(char)0x2c,(char)0x2c,(char)0x11,(char)0x52,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "uy__" // ASCII-7-bit=162 Latin1=186 UTF8=150 CP1252=154 CP1250=44 Latin5=44 ISO-8859-15=82 [top Latin1] {{(char)0x75,(char)0x7a,(char)0x5f,(char)0x5f, (char)0x05,(char)0x91,(char)0x68,(char)0xb1,(char)0x39,(char)0x88,(char)0x54,(char)0xb5,(char)0x43,(char)0x39,(char)0x6e,(char)0x41,(char)0x7c,(char)0x00,(char)0x00,(char)0x00,}}, // "uz__" // ASCII-7-bit=145 Latin1=104 UTF8=177 GB=57 CP1252=136 CP1251=181 CP1256=67 CP1250=57 Latin5=110 KOI8R=124 [top CP1251] {{(char)0x76,(char)0x61,(char)0x5f,(char)0x5f, (char)0x03,(char)0xae,(char)0xb3,(char)0x8f,(char)0x11,(char)0xa7,(char)0xb1,(char)0x4a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "va__" // ASCII-7-bit=174 Latin1=179 UTF8=143 CP1252=167 CP1257=74 [top Latin1] {{(char)0x76,(char)0x63,(char)0x5f,(char)0x5f, (char)0x08,(char)0xba,(char)0x7a,(char)0x9a,(char)0x5e,(char)0x79,(char)0x4a,(char)0x9a,(char)0x95,(char)0x12,(char)0x54,(char)0x7f,(char)0x81,(char)0x4a,(char)0x00,(char)0x00,}}, // "vc__" // ASCII-7-bit=186 Latin1=122 UTF8=154 GB=94 CP1252=121 KSC=74 SJS=154 EUC-JP=149 Latin2=84 CP1251=127 GBK=74 [top ASCII-7-bit] {{(char)0x76,(char)0x65,(char)0x5f,(char)0x5f, (char)0x05,(char)0x97,(char)0xbc,(char)0x8c,(char)0x14,(char)0x9b,(char)0x11,(char)0x14,(char)0x11,(char)0x1e,(char)0x31,(char)0x42,(char)0x21,(char)0x55,(char)0x31,(char)0x24,}}, // "ve__" // ASCII-7-bit=151 Latin1=188 UTF8=140 GB=20 CP1252=155 SJS=20 BIG5=30 CP1250=66 ISO-8859-15=85 GBK=36 [top Latin1] {{(char)0x76,(char)0x67,(char)0x5f,(char)0x5f, (char)0x05,(char)0xac,(char)0xb2,(char)0x9e,(char)0x6d,(char)0x97,(char)0x13,(char)0x95,(char)0x81,(char)0x95,(char)0x11,(char)0x69,(char)0x21,(char)0x63,(char)0x61,(char)0x59,}}, // "vg__" // ASCII-7-bit=172 Latin1=178 UTF8=158 GB=109 CP1252=151 SJS=149 EUC-JP=129 BIG5=149 CP1251=105 Latin5=99 Greek=89 [top Latin1] {{(char)0x76,(char)0x69,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb9,(char)0x90,(char)0xaa,(char)0x11,(char)0x93,(char)0x11,(char)0x68,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "vi__" // ASCII-7-bit=185 Latin1=144 UTF8=170 CP1252=147 SJS=104 [top ASCII-7-bit] {{(char)0x76,(char)0x6e,(char)0x5f,(char)0x5f, (char)0x03,(char)0x94,(char)0x92,(char)0xbd,(char)0x12,(char)0x83,(char)0x22,(char)0x21,(char)0x2c,(char)0x32,(char)0x26,(char)0x2e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "vn__" // ASCII-7-bit=148 Latin1=146 UTF8=189 CP1252=131 KSC=34 BIG5=44 CP1250=38 Latin5=46 [top UTF8] {{(char)0x76,(char)0x75,(char)0x5f,(char)0x5f, (char)0x03,(char)0xae,(char)0xb6,(char)0x97,(char)0x11,(char)0x7b,(char)0x11,(char)0x5b,(char)0x31,(char)0x6a,(char)0x41,(char)0x4e,(char)0x71,(char)0x90,(char)0x00,(char)0x00,}}, // "vu__" // ASCII-7-bit=174 Latin1=182 UTF8=151 CP1252=123 SJS=91 CP1251=106 ISO-8859-15=78 CP1253=144 [top Latin1] {{(char)0x77,(char)0x73,(char)0x5f,(char)0x5f, (char)0x05,(char)0xae,(char)0xaa,(char)0xa6,(char)0x6c,(char)0x91,(char)0x18,(char)0x76,(char)0x69,(char)0x7c,(char)0x78,(char)0x99,(char)0x9d,(char)0x7d,(char)0x70,(char)0x00,}}, // "ws__" // ASCII-7-bit=174 Latin1=170 UTF8=166 GB=108 CP1252=145 SJS=118 EUC-JP=105 BIG5=124 Latin2=120 CP1251=153 CP1256=157 CP1250=125 Latin5=112 [top ASCII-7-bit] {{(char)0x79,(char)0x65,(char)0x5f,(char)0x5f, (char)0x03,(char)0x9e,(char)0x94,(char)0xab,(char)0x11,(char)0x8b,(char)0x61,(char)0xb6,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ye__" // ASCII-7-bit=158 Latin1=148 UTF8=171 CP1252=139 CP1256=182 [top CP1256] {{(char)0x79,(char)0x75,(char)0x5f,(char)0x5f, (char)0x03,(char)0xa4,(char)0x7f,(char)0xaf,(char)0x11,(char)0x78,(char)0x42,(char)0x87,(char)0x80,(char)0x12,(char)0xb3,(char)0x2c,(char)0xd1,(char)0x60,(char)0x00,(char)0x00,}}, // "yu__" // ASCII-7-bit=164 Latin1=127 UTF8=175 CP1252=120 Latin2=135 CP1251=128 CP1250=179 Latin5=44 ISO-8859-5=96 [top CP1250] {{(char)0x7a,(char)0x61,(char)0x5f,(char)0x5f, (char)0x05,(char)0xb8,(char)0xa3,(char)0x97,(char)0x42,(char)0xa1,(char)0x11,(char)0x30,(char)0x11,(char)0x4e,(char)0x13,(char)0x3a,(char)0x4f,(char)0x41,(char)0x21,(char)0x42,}}, // "za__" // ASCII-7-bit=184 Latin1=163 UTF8=151 GB=66 CP1252=161 SJS=48 BIG5=78 CP1251=58 CP1256=79 CP1250=65 ISO-8859-15=66 [top ASCII-7-bit] {{(char)0x7a,(char)0x6d,(char)0x5f,(char)0x5f, (char)0x03,(char)0xb8,(char)0x8e,(char)0x9c,(char)0x11,(char)0xa9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "zm__" // ASCII-7-bit=184 Latin1=142 UTF8=156 CP1252=169 [top ASCII-7-bit] {{(char)0x7a,(char)0x77,(char)0x5f,(char)0x5f, (char)0x05,(char)0xbb,(char)0x95,(char)0x9b,(char)0x59,(char)0x9a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "zw__" // ASCII-7-bit=187 Latin1=149 UTF8=155 GB=89 CP1252=154 [top ASCII-7-bit] }; static const int kTLDHintProbsSize = 247; static const HintEntry kCharsetHintProbs[] = { // MaxRange 192 {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x30,(char)0x36,(char)0x34,(char)0x36, (char)0x02,(char)0xbd,(char)0x7f,(char)0x21,(char)0x95,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____0646" // ASCII-7-bit=189 Latin1=127 CP1252=149 [top ASCII-7-bit] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0x01,(char)0x96,(char)0xb1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____1250" // ASCII-7-bit=150 CP1250=190 [top CP1250] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0x01,(char)0x7a,(char)0x91,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____1251" // ASCII-7-bit=122 CP1251=190 [top CP1251] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x02,(char)0x99,(char)0x9d,(char)0x21,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____1252" // ASCII-7-bit=153 Latin1=157 CP1252=188 [top CP1252] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x33, (char)0x01,(char)0x79,(char)0x10,(char)0x61,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____1253" // ASCII-7-bit=121 CP1253=190 [top CP1253] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x34, (char)0x01,(char)0x71,(char)0xc1,(char)0xaf,(char)0x81,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____1254" // ASCII-7-bit=113 Latin5=175 CP1254=185 [top CP1254] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x35, (char)0x01,(char)0x86,(char)0x10,(char)0x01,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____1255" // ASCII-7-bit=134 CP1255=190 [top CP1255] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x36, (char)0x01,(char)0x78,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____1256" // ASCII-7-bit=120 CP1256=190 [top CP1256] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x37, (char)0x01,(char)0x79,(char)0xf1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____1257" // ASCII-7-bit=121 CP1257=190 [top CP1257] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x31,(char)0x38,(char)0x30,(char)0x30, (char)0x10,(char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____1800" // KOI8R=191 [top KOI8R] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x33,(char)0x36,(char)0x30,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____3600" // CP1250=191 [top CP1250] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x33,(char)0x36,(char)0x39,(char)0x39, (char)0x01,(char)0xad,(char)0x11,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____3699" // ASCII-7-bit=173 UTF8=185 [top UTF8] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x34,(char)0x34,(char)0x30,(char)0x30, (char)0x02,(char)0xbc,(char)0x87,(char)0x21,(char)0xa4,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____4400" // ASCII-7-bit=188 Latin1=135 CP1252=164 [top ASCII-7-bit] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x35,(char)0x30,(char)0x30,(char)0x31, (char)0x01,(char)0x9a,(char)0x11,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____5001" // ASCII-7-bit=154 UTF8=189 [top UTF8] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x02,(char)0xa8,(char)0xa6,(char)0x21,(char)0xa7,(char)0xa1,(char)0xb2,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____5915" // ASCII-7-bit=168 Latin1=166 CP1252=167 ISO-8859-15=178 [top ISO-8859-15] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x36,(char)0x34,(char)0x36,(char)0x5f, (char)0x02,(char)0xbe,(char)0x8e,(char)0x21,(char)0x81,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____646_" // ASCII-7-bit=190 Latin1=142 CP1252=129 [top ASCII-7-bit] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0xae,(char)0xb8,(char)0x21,(char)0x94,(char)0xa1,(char)0x2f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____8591" // ASCII-7-bit=174 Latin1=184 CP1252=148 ISO-8859-15=47 [top Latin1] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x01,(char)0x8c,(char)0x81,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____8592" // ASCII-7-bit=140 Latin2=190 [top Latin2] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x34, (char)0x10,(char)0xe1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____8594" // Latin4=191 [top Latin4] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x35, (char)0x01,(char)0x6f,(char)0x10,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____8595" // ASCII-7-bit=111 ISO-8859-5=190 [top ISO-8859-5] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x37, (char)0x10,(char)0x41,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____8597" // Greek=191 [top Greek] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x39, (char)0x01,(char)0x72,(char)0xc1,(char)0xbe,(char)0x81,(char)0x7b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____8599" // ASCII-7-bit=114 Latin5=190 CP1254=123 [top Latin5] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x38,(char)0x36,(char)0x31, (char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____8861" // Latin2=191 [top Latin2] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x03,(char)0x98,(char)0x5d,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "____8___" // ASCII-7-bit=152 Latin1=93 UTF8=189 [top UTF8] {{(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x07,(char)0xb1,(char)0xaa,(char)0x9c,(char)0x95,(char)0x96,(char)0x8e,(char)0x8c,(char)0x11,(char)0x82,(char)0x00,(char)0x00,}}, // "________" // ASCII-7-bit=177 Latin1=170 UTF8=156 GB=149 CP1252=150 KSC=142 SJS=140 BIG5=130 [top ASCII-7-bit] {{(char)0x61,(char)0x6e,(char)0x73,(char)0x69,(char)0x33,(char)0x34,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x6e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ansi34__" // ASCII-7-bit=190 Latin1=110 [top ASCII-7-bit] {{(char)0x61,(char)0x6e,(char)0x73,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa2,(char)0xb9,(char)0x21,(char)0xa4,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ansi____" // ASCII-7-bit=162 Latin1=185 CP1252=164 [top Latin1] {{(char)0x61,(char)0x72,(char)0x72,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x90,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "arra____" // ASCII-7-bit=144 CP1256=190 [top CP1256] {{(char)0x61,(char)0x73,(char)0x63,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x72,(char)0x21,(char)0x71,(char)0xa1,(char)0x53,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "asci____" // ASCII-7-bit=190 Latin1=114 CP1252=113 ISO-8859-15=83 [top ASCII-7-bit] {{(char)0x61,(char)0x75,(char)0x74,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x9b,(char)0x51,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "auto____" // ASCII-7-bit=155 SJS=189 [top SJS] {{(char)0x62,(char)0x67,(char)0x5f,(char)0x5f,(char)0x32,(char)0x33,(char)0x31,(char)0x32, (char)0x01,(char)0x93,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bg__2312" // ASCII-7-bit=147 GB=190 [top GB] {{(char)0x62,(char)0x68,(char)0x61,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x30,(char)0x01,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bhas____" // BHASKAR=191 [top BHASKAR] {{(char)0x62,(char)0x69,(char)0x67,(char)0x5f,(char)0x35,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x84,(char)0x71,(char)0xbe,(char)0x10,(char)0xa1,(char)0x2f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "big_5___" // ASCII-7-bit=132 BIG5=190 BIG5_HKSCS=47 [top BIG5] {{(char)0x62,(char)0x69,(char)0x67,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "big_8591" // Latin1=191 [top Latin1] {{(char)0x62,(char)0x69,(char)0x67,(char)0x68,(char)0x35,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x88,(char)0x71,(char)0xae,(char)0x10,(char)0xa1,(char)0xb8,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bigh5___" // ASCII-7-bit=136 BIG5=174 BIG5_HKSCS=184 [top BIG5_HKSCS] {{(char)0x62,(char)0x69,(char)0x6e,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x30,(char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bina____" // X-BINARYENC=191 [top X-BINARYENC] {{(char)0x62,(char)0x6f,(char)0x74,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0xd1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bot_____" // Latin5=191 [top Latin5] {{(char)0x62,(char)0x73,(char)0x5f,(char)0x5f,(char)0x34,(char)0x37,(char)0x33,(char)0x30, (char)0x02,(char)0xb8,(char)0xa8,(char)0x21,(char)0xa3,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "bs__4730" // ASCII-7-bit=184 Latin1=168 CP1252=163 [top ASCII-7-bit] {{(char)0x63,(char)0x68,(char)0x61,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa5,(char)0xbb,(char)0x21,(char)0x91,(char)0xa1,(char)0x28,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "char____" // ASCII-7-bit=165 Latin1=187 CP1252=145 ISO-8859-15=40 [top Latin1] {{(char)0x63,(char)0x6e,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x30,(char)0x71,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cns_____" // CNS=191 [top CNS] {{(char)0x63,(char)0x6f,(char)0x6e,(char)0x66,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x9f,(char)0x11,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "conf____" // ASCII-7-bit=159 UTF8=189 [top UTF8] {{(char)0x63,(char)0x6f,(char)0x6e,(char)0x74,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xa4,(char)0x11,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cont____" // ASCII-7-bit=164 UTF8=188 [top UTF8] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0x01,(char)0x97,(char)0xb1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__1250" // ASCII-7-bit=151 CP1250=190 [top CP1250] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0x01,(char)0x7c,(char)0x91,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__1251" // ASCII-7-bit=124 CP1251=190 [top CP1251] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x02,(char)0xab,(char)0xa9,(char)0x21,(char)0xb5,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__1252" // ASCII-7-bit=171 Latin1=169 CP1252=181 [top CP1252] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x33, (char)0x01,(char)0x79,(char)0x10,(char)0x31,(char)0x7f,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__1253" // ASCII-7-bit=121 Greek=127 CP1253=190 [top CP1253] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x34, (char)0x01,(char)0x5b,(char)0xc1,(char)0xaf,(char)0x81,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__1254" // ASCII-7-bit=91 Latin5=175 CP1254=185 [top CP1254] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x35, (char)0x01,(char)0x86,(char)0x10,(char)0x01,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__1255" // ASCII-7-bit=134 CP1255=190 [top CP1255] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x36, (char)0x01,(char)0x5e,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__1256" // ASCII-7-bit=94 CP1256=190 [top CP1256] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x37, (char)0x01,(char)0xa8,(char)0xf1,(char)0xbb,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__1257" // ASCII-7-bit=168 CP1257=187 [top CP1257] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x30,(char)0x5f, (char)0x02,(char)0x97,(char)0x98,(char)0x21,(char)0x8c,(char)0xa1,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__850_" // ASCII-7-bit=151 Latin1=152 CP1252=140 ISO-8859-15=188 [top ISO-8859-15] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x32,(char)0x5f, (char)0x01,(char)0x8f,(char)0x20,(char)0x01,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__852_" // ASCII-7-bit=143 CP852=190 [top CP852] {{(char)0x63,(char)0x70,(char)0x5f,(char)0x5f,(char)0x38,(char)0x36,(char)0x36,(char)0x5f, (char)0x01,(char)0xa2,(char)0x20,(char)0x31,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cp__866_" // ASCII-7-bit=162 CP866=188 [top CP866] {{(char)0x63,(char)0x70,(char)0x63,(char)0x5f,(char)0x39,(char)0x34,(char)0x33,(char)0x5f, (char)0x01,(char)0x26,(char)0x51,(char)0xbe,(char)0x10,(char)0x11,(char)0x68,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cpc_943_" // ASCII-7-bit=38 SJS=190 CP932=104 [top SJS] {{(char)0x63,(char)0x70,(char)0x63,(char)0x7a,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cpcz1250" // CP1250=191 [top CP1250] {{(char)0x63,(char)0x73,(char)0x69,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x9c,(char)0x10,(char)0x01,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "csis____" // ASCII-7-bit=156 CP1255=189 [top CP1255] {{(char)0x63,(char)0x73,(char)0x6e,(char)0x5f,(char)0x39,(char)0x31,(char)0x30,(char)0x33, (char)0x20,(char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "csn_9103" // CSN_369103=191 [top CSN_369103] {{(char)0x63,(char)0x73,(char)0x73,(char)0x68,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x7f,(char)0x51,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cssh____" // ASCII-7-bit=127 SJS=190 [top SJS] {{(char)0x63,(char)0x73,(char)0x77,(char)0x69,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cswi1250" // CP1250=191 [top CP1250] {{(char)0x63,(char)0x73,(char)0x77,(char)0x69,(char)0x33,(char)0x31,(char)0x5f,(char)0x5f, (char)0x61,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "cswi31__" // SJS=191 [top SJS] {{(char)0x63,(char)0x7a,(char)0x77,(char)0x69,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "czwi1250" // CP1250=191 [top CP1250] {{(char)0x64,(char)0x61,(char)0x64,(char)0x6b,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x7d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "dadk8591" // Latin1=190 CP1252=125 [top Latin1] {{(char)0x64,(char)0x61,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x21,(char)0x6f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "dais8591" // ASCII-7-bit=111 Latin1=190 CP1252=111 [top Latin1] {{(char)0x64,(char)0x65,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0x9d,(char)0xbc,(char)0x21,(char)0x95,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "de______" // ASCII-7-bit=157 Latin1=188 CP1252=149 [top Latin1] {{(char)0x64,(char)0x65,(char)0x61,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0x8f,(char)0xbd,(char)0x21,(char)0x92,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "deas____" // ASCII-7-bit=143 Latin1=189 CP1252=146 [top Latin1] {{(char)0x64,(char)0x65,(char)0x64,(char)0x65,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x92,(char)0xbe,(char)0x21,(char)0x87,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "dede8591" // ASCII-7-bit=146 Latin1=190 CP1252=135 [top Latin1] {{(char)0x64,(char)0x65,(char)0x66,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbc,(char)0x9f,(char)0x21,(char)0x89,(char)0xa1,(char)0x6b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "defa____" // ASCII-7-bit=188 Latin1=159 CP1252=137 ISO-8859-15=107 [top ASCII-7-bit] {{(char)0x64,(char)0x65,(char)0x69,(char)0x73,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x11,(char)0x83,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "deis5915" // Latin1=131 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x64,(char)0x65,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x92,(char)0xbd,(char)0x21,(char)0x89,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "deis8591" // ASCII-7-bit=146 Latin1=189 CP1252=137 [top Latin1] {{(char)0x64,(char)0x65,(char)0x6c,(char)0x65,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa9,(char)0xba,(char)0x21,(char)0x92,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "dele____" // ASCII-7-bit=169 Latin1=186 CP1252=146 [top Latin1] {{(char)0x64,(char)0x65,(char)0x75,(char)0x74,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0x74,(char)0xb8,(char)0x21,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "deut____" // ASCII-7-bit=116 Latin1=184 CP1252=175 [top Latin1] {{(char)0x64,(char)0x6f,(char)0x6f,(char)0x72,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x11,(char)0x79,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "door1252" // Latin1=121 CP1252=190 [top CP1252] {{(char)0x65,(char)0x63,(char)0x75,(char)0x6a,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x71,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ecuj____" // EUC-JP=191 [top EUC-JP] {{(char)0x65,(char)0x63,(char)0x75,(char)0x6b,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x71,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ecuk____" // ASCII-7-bit=113 KSC=190 [top KSC] {{(char)0x65,(char)0x65,(char)0x6d,(char)0x73,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eems1250" // CP1250=191 [top CP1250] {{(char)0x65,(char)0x6e,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "en__8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x65,(char)0x6e,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x92,(char)0x21,(char)0x82,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "en______" // ASCII-7-bit=190 Latin1=146 CP1252=130 [top ASCII-7-bit] {{(char)0x65,(char)0x6e,(char)0x63,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "enco____" // ASCII-7-bit=191 [top ASCII-7-bit] {{(char)0x65,(char)0x6e,(char)0x67,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x8b,(char)0x71,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eng_____" // ASCII-7-bit=139 BIG5=190 [top BIG5] {{(char)0x65,(char)0x6e,(char)0x67,(char)0x62,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x7d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "engb____" // ASCII-7-bit=190 Latin1=125 [top ASCII-7-bit] {{(char)0x65,(char)0x6e,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x96,(char)0xbc,(char)0x21,(char)0x9a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "enis8591" // ASCII-7-bit=150 Latin1=188 CP1252=154 [top Latin1] {{(char)0x65,(char)0x6e,(char)0x75,(char)0x6b,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "enuk8591" // Latin1=191 [top Latin1] {{(char)0x65,(char)0x6e,(char)0x75,(char)0x6b,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x51,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "enuk____" // KSC=191 [top KSC] {{(char)0x65,(char)0x6e,(char)0x75,(char)0x73,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x02,(char)0x6f,(char)0x7f,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "enus5915" // ASCII-7-bit=111 Latin1=127 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x65,(char)0x6e,(char)0x75,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x9c,(char)0xbc,(char)0x21,(char)0x9b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "enus8591" // ASCII-7-bit=156 Latin1=188 CP1252=155 [top Latin1] {{(char)0x65,(char)0x6e,(char)0x75,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbb,(char)0xa1,(char)0x21,(char)0x9e,(char)0xa1,(char)0x68,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "enus____" // ASCII-7-bit=187 Latin1=161 CP1252=158 ISO-8859-15=104 [top ASCII-7-bit] {{(char)0x65,(char)0x6e,(char)0x75,(char)0x74,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x81,(char)0xf1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "enut8___" // ASCII-7-bit=129 CP1257=190 [top CP1257] {{(char)0x65,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xb4,(char)0xb3,(char)0x21,(char)0x9d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "es______" // ASCII-7-bit=180 Latin1=179 CP1252=157 [top ASCII-7-bit] {{(char)0x65,(char)0x73,(char)0x65,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x82,(char)0xbe,(char)0x21,(char)0x6e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eses8591" // ASCII-7-bit=130 Latin1=190 CP1252=110 [top Latin1] {{(char)0x65,(char)0x73,(char)0x65,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa6,(char)0xba,(char)0x21,(char)0x96,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eses____" // ASCII-7-bit=166 Latin1=186 CP1252=150 [top Latin1] {{(char)0x65,(char)0x73,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x87,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "esis8591" // Latin1=190 CP1252=135 [top Latin1] {{(char)0x65,(char)0x74,(char)0x65,(char)0x65,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "etee8591" // Latin1=191 [top Latin1] {{(char)0x65,(char)0x74,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "etis8591" // Latin1=191 [top Latin1] {{(char)0x65,(char)0x75,(char)0x63,(char)0x5f,(char)0x32,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xbe,(char)0x31,(char)0x72,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "euc_2___" // ASCII-7-bit=190 CP1252=114 [top ASCII-7-bit] {{(char)0x65,(char)0x75,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x7d,(char)0x61,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "euc_____" // ASCII-7-bit=125 EUC-JP=190 [top EUC-JP] {{(char)0x65,(char)0x75,(char)0x63,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x6f,(char)0x30,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eucc____" // ASCII-7-bit=111 EUC-CN=190 [top EUC-CN] {{(char)0x65,(char)0x75,(char)0x63,(char)0x64,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x30,(char)0x61,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eucd____" // EUC=191 [top EUC] {{(char)0x65,(char)0x75,(char)0x63,(char)0x6a,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x68,(char)0x61,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eucj____" // ASCII-7-bit=104 EUC-JP=190 [top EUC-JP] {{(char)0x65,(char)0x75,(char)0x63,(char)0x6b,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x6d,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "euck____" // ASCII-7-bit=109 KSC=190 [top KSC] {{(char)0x65,(char)0x75,(char)0x63,(char)0x75,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x6d,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eucu____" // ASCII-7-bit=109 KSC=190 [top KSC] {{(char)0x65,(char)0x75,(char)0x6b,(char)0x6b,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x51,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eukk____" // KSC=191 [top KSC] {{(char)0x65,(char)0x75,(char)0x72,(char)0x6b,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x71,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "eurk____" // ASCII-7-bit=113 KSC=190 [top KSC] {{(char)0x66,(char)0x65,(char)0x61,(char)0x74,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x41,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "feat____" // CP1252=191 [top CP1252] {{(char)0x66,(char)0x66,(char)0x5f,(char)0x5f,(char)0x30,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0x9e,(char)0xba,(char)0x21,(char)0xa5,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ff__0___" // ASCII-7-bit=158 Latin1=186 CP1252=165 [top Latin1] {{(char)0x66,(char)0x69,(char)0x66,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "fifi8591" // Latin1=191 [top Latin1] {{(char)0x66,(char)0x72,(char)0x66,(char)0x72,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbc,(char)0x21,(char)0xa3,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "frfr8591" // ASCII-7-bit=121 Latin1=188 CP1252=163 [top Latin1] {{(char)0x66,(char)0x72,(char)0x66,(char)0x72,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa6,(char)0xad,(char)0x21,(char)0xb5,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "frfr8___" // ASCII-7-bit=166 Latin1=173 CP1252=181 [top CP1252] {{(char)0x66,(char)0x72,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x80,(char)0xbd,(char)0x21,(char)0x9e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "fris8591" // ASCII-7-bit=128 Latin1=189 CP1252=158 [top Latin1] {{(char)0x66,(char)0x72,(char)0x75,(char)0x74,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0x8c,(char)0xb3,(char)0x21,(char)0xb5,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "frut8___" // ASCII-7-bit=140 Latin1=179 CP1252=181 [top CP1252] {{(char)0x67,(char)0x62,(char)0x5f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0x01,(char)0x6f,(char)0x91,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gb__1251" // ASCII-7-bit=111 CP1251=190 [top CP1251] {{(char)0x67,(char)0x62,(char)0x5f,(char)0x5f,(char)0x32,(char)0x31,(char)0x33,(char)0x32, (char)0x01,(char)0x91,(char)0x21,(char)0xbe,(char)0xf1,(char)0x70,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gb__2132" // ASCII-7-bit=145 GB=190 GBK=112 [top GB] {{(char)0x67,(char)0x62,(char)0x5f,(char)0x5f,(char)0x32,(char)0x33,(char)0x31,(char)0x32, (char)0x01,(char)0x7a,(char)0x21,(char)0xbe,(char)0xf1,(char)0x5c,(char)0xc1,(char)0x37,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gb__2312" // ASCII-7-bit=122 GB=190 GBK=92 GB18030=55 [top GB] {{(char)0x67,(char)0x62,(char)0x5f,(char)0x5f,(char)0x32,(char)0x33,(char)0x32,(char)0x31, (char)0x01,(char)0x7d,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gb__2321" // ASCII-7-bit=125 GB=190 [top GB] {{(char)0x67,(char)0x62,(char)0x5f,(char)0x5f,(char)0x33,(char)0x32,(char)0x31,(char)0x32, (char)0x01,(char)0x92,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gb__3212" // ASCII-7-bit=146 GB=190 [top GB] {{(char)0x67,(char)0x62,(char)0x5f,(char)0x5f,(char)0x38,(char)0x30,(char)0x33,(char)0x30, (char)0x01,(char)0x73,(char)0x21,(char)0xaf,(char)0xf1,(char)0x59,(char)0xc1,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gb__8030" // ASCII-7-bit=115 GB=175 GBK=89 GB18030=185 [top GB18030] {{(char)0x67,(char)0x62,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x7f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gb__8591" // ASCII-7-bit=127 Latin1=190 [top Latin1] {{(char)0x67,(char)0x62,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x71,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gb______" // ASCII-7-bit=113 GB=190 [top GB] {{(char)0x67,(char)0x62,(char)0x6b,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x76,(char)0x21,(char)0xaf,(char)0xf1,(char)0xb9,(char)0xc1,(char)0x13,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gbk_____" // ASCII-7-bit=118 GB=175 GBK=185 GB18030=19 [top GBK] {{(char)0x67,(char)0x64,(char)0x5f,(char)0x5f,(char)0x32,(char)0x33,(char)0x31,(char)0x32, (char)0x01,(char)0x56,(char)0x21,(char)0xbe,(char)0xf1,(char)0x72,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gd__2312" // ASCII-7-bit=86 GB=190 GBK=114 [top GB] {{(char)0x67,(char)0x65,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "geis8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x67,(char)0x65,(char)0x6e,(char)0x65,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gene1251" // CP1251=191 [top CP1251] {{(char)0x67,(char)0x69,(char)0x73,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x6f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "giso8591" // Latin1=190 CP1252=111 [top Latin1] {{(char)0x67,(char)0x72,(char)0x65,(char)0x65,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x90,(char)0x10,(char)0x31,(char)0xbe,(char)0x21,(char)0x86,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "gree____" // ASCII-7-bit=144 Greek=190 CP1253=134 [top Greek] {{(char)0x68,(char)0x72,(char)0x77,(char)0x69,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "hrwi1250" // CP1250=191 [top CP1250] {{(char)0x68,(char)0x74,(char)0x63,(char)0x68,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x30,(char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "htch____" // HTCHANAKYA=191 [top HTCHANAKYA] {{(char)0x68,(char)0x74,(char)0x6d,(char)0x6c,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "html____" // ASCII-7-bit=191 [top ASCII-7-bit] {{(char)0x68,(char)0x74,(char)0x74,(char)0x70,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbb,(char)0xa4,(char)0x21,(char)0x8d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "http____" // ASCII-7-bit=187 Latin1=164 CP1252=141 [top ASCII-7-bit] {{(char)0x68,(char)0x7a,(char)0x67,(char)0x62,(char)0x32,(char)0x33,(char)0x31,(char)0x32, (char)0x01,(char)0x85,(char)0x20,(char)0x71,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "hzgb2312" // ASCII-7-bit=133 HZ-GB-2312=190 [top HZ-GB-2312] {{(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "i___8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x69,(char)0x61,(char)0x6e,(char)0x6f,(char)0x35,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x61,(char)0x21,(char)0x54,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iano5___" // ASCII-7-bit=190 Latin1=97 CP1252=84 [top ASCII-7-bit] {{(char)0x69,(char)0x62,(char)0x6d,(char)0x5f,(char)0x38,(char)0x35,(char)0x32,(char)0x5f, (char)0x01,(char)0xac,(char)0x20,(char)0x01,(char)0xba,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ibm_852_" // ASCII-7-bit=172 CP852=186 [top CP852] {{(char)0x69,(char)0x62,(char)0x6d,(char)0x5f,(char)0x38,(char)0x36,(char)0x36,(char)0x5f, (char)0x01,(char)0x84,(char)0x20,(char)0x31,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ibm_866_" // ASCII-7-bit=132 CP866=190 [top CP866] {{(char)0x69,(char)0x62,(char)0x6d,(char)0x5f,(char)0x39,(char)0x34,(char)0x32,(char)0x5f, (char)0x61,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ibm_942_" // SJS=191 [top SJS] {{(char)0x69,(char)0x63,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbb,(char)0x21,(char)0xa9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ico_8591" // ASCII-7-bit=121 Latin1=187 CP1252=169 [top Latin1] {{(char)0x69,(char)0x6e,(char)0x64,(char)0x6f,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "indo1251" // CP1251=191 [top CP1251] {{(char)0x69,(char)0x6e,(char)0x73,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "inso8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x69,(char)0x6f,(char)0x73,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x97,(char)0xbd,(char)0x21,(char)0x6e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ios_8591" // ASCII-7-bit=151 Latin1=189 CP1252=110 [top Latin1] {{(char)0x69,(char)0x6f,(char)0x73,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x79,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ioso8591" // Latin1=190 CP1252=121 [top Latin1] {{(char)0x69,(char)0x73,(char)0x5f,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x11,(char)0x7f,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "is__5915" // Latin1=127 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x69,(char)0x73,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0xad,(char)0xb7,(char)0x21,(char)0x9f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "is__8591" // ASCII-7-bit=173 Latin1=183 CP1252=159 [top Latin1] {{(char)0x69,(char)0x73,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x01,(char)0x78,(char)0x81,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "is__8592" // ASCII-7-bit=120 Latin2=190 [top Latin2] {{(char)0x69,(char)0x73,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x37, (char)0x10,(char)0x41,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "is__8597" // Greek=191 [top Greek] {{(char)0x69,(char)0x73,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x38, (char)0x01,(char)0x6f,(char)0x10,(char)0x81,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "is__8598" // ASCII-7-bit=111 Hebrew=190 [top Hebrew] {{(char)0x69,(char)0x73,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x39, (char)0xd1,(char)0xbe,(char)0x81,(char)0x88,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "is__8599" // Latin5=190 CP1254=136 [top Latin5] {{(char)0x69,(char)0x73,(char)0x61,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x02,(char)0x86,(char)0x89,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isa_5915" // ASCII-7-bit=134 Latin1=137 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x69,(char)0x73,(char)0x64,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isd_8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x64,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isdo8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6e,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isn_8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x30,(char)0x36,(char)0x34,(char)0x36, (char)0x02,(char)0xb8,(char)0xaa,(char)0x21,(char)0xa3,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_0646" // ASCII-7-bit=184 Latin1=170 CP1252=163 [top ASCII-7-bit] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x30,(char)0x34,(char)0x30, (char)0x02,(char)0x98,(char)0xb2,(char)0x21,(char)0xb4,(char)0xa1,(char)0x5e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1040" // ASCII-7-bit=152 Latin1=178 CP1252=180 ISO-8859-15=94 [top CP1252] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0x01,(char)0x90,(char)0xb1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1250" // ASCII-7-bit=144 CP1250=190 [top CP1250] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0x01,(char)0x78,(char)0x91,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1251" // ASCII-7-bit=120 CP1251=190 [top CP1251] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x02,(char)0xad,(char)0x9e,(char)0x21,(char)0xb7,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1252" // ASCII-7-bit=173 Latin1=158 CP1252=183 [top CP1252] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x33, (char)0x10,(char)0x41,(char)0x83,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1253" // Greek=131 CP1253=190 [top CP1253] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x34, (char)0xd1,(char)0x9b,(char)0x81,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1254" // Latin5=155 CP1254=189 [top CP1254] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x35, (char)0x01,(char)0x79,(char)0x10,(char)0x01,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1255" // ASCII-7-bit=121 CP1255=190 [top CP1255] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x36, (char)0x01,(char)0x6f,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1256" // ASCII-7-bit=111 CP1256=190 [top CP1256] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x37, (char)0x01,(char)0x7f,(char)0xf1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1257" // ASCII-7-bit=127 CP1257=190 [top CP1257] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x31,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0x85,(char)0xb5,(char)0x21,(char)0xb3,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_1___" // ASCII-7-bit=133 Latin1=181 CP1252=179 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x32,(char)0x30,(char)0x32,(char)0x32, (char)0x01,(char)0x97,(char)0x51,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_2022" // ASCII-7-bit=151 SJS=190 [top SJS] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0xa9,(char)0xb8,(char)0x21,(char)0xa4,(char)0xa1,(char)0x3c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5591" // ASCII-7-bit=169 Latin1=184 CP1252=164 ISO-8859-15=60 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x35,(char)0x39,(char)0x32, (char)0x02,(char)0x9a,(char)0xbd,(char)0x21,(char)0x92,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5592" // ASCII-7-bit=154 Latin1=189 CP1252=146 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x38,(char)0x39,(char)0x31, (char)0x02,(char)0xa1,(char)0xbc,(char)0x21,(char)0x8b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5891" // ASCII-7-bit=161 Latin1=188 CP1252=139 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x30, (char)0x01,(char)0xaa,(char)0x20,(char)0xa1,(char)0xba,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5910" // ASCII-7-bit=170 Latin6=186 [top Latin6] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x31, (char)0x01,(char)0x86,(char)0xd1,(char)0xbe,(char)0xd1,(char)0x66,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5911" // ASCII-7-bit=134 ISO-8859-11=190 CP874=102 [top ISO-8859-11] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x33, (char)0x01,(char)0x9c,(char)0xf1,(char)0xa1,(char)0xc1,(char)0xbb,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5913" // ASCII-7-bit=156 CP1257=161 ISO-8859-13=187 [top ISO-8859-13] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x34, (char)0x02,(char)0x93,(char)0xbd,(char)0x21,(char)0x95,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5914" // ASCII-7-bit=147 Latin1=189 CP1252=149 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x02,(char)0x98,(char)0xad,(char)0x21,(char)0x81,(char)0xa1,(char)0xb7,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5915" // ASCII-7-bit=152 Latin1=173 CP1252=129 ISO-8859-15=183 [top ISO-8859-15] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x36, (char)0x01,(char)0xae,(char)0xb1,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5916" // ASCII-7-bit=174 CP1250=185 [top CP1250] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x35,(char)0x39,(char)0x32,(char)0x32, (char)0x01,(char)0xa7,(char)0x81,(char)0xbb,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_5922" // ASCII-7-bit=167 Latin2=187 [top Latin2] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x36,(char)0x33,(char)0x39,(char)0x32, (char)0x02,(char)0x7e,(char)0xbe,(char)0x21,(char)0x82,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_6392" // ASCII-7-bit=126 Latin1=190 CP1252=130 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x36,(char)0x33,(char)0x39,(char)0x5f, (char)0x01,(char)0xa6,(char)0xa1,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_639_" // ASCII-7-bit=166 CP1256=188 [top CP1256] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x36,(char)0x34,(char)0x36,(char)0x31, (char)0x02,(char)0x7d,(char)0xbe,(char)0x21,(char)0x68,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_6461" // ASCII-7-bit=125 Latin1=190 CP1252=104 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x31,(char)0x31, (char)0x02,(char)0xb0,(char)0xb7,(char)0x21,(char)0x92,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8511" // ASCII-7-bit=176 Latin1=183 CP1252=146 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x36,(char)0x31, (char)0x02,(char)0x9f,(char)0xba,(char)0x21,(char)0xa5,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8561" // ASCII-7-bit=159 Latin1=186 CP1252=165 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x38,(char)0x31, (char)0x01,(char)0x8d,(char)0x51,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8581" // ASCII-7-bit=141 SJS=190 [top SJS] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x30, (char)0x02,(char)0x99,(char)0xbc,(char)0x21,(char)0x9c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8590" // ASCII-7-bit=153 Latin1=188 CP1252=156 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0xae,(char)0xb8,(char)0x21,(char)0x99,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8591" // ASCII-7-bit=174 Latin1=184 CP1252=153 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x01,(char)0x95,(char)0x81,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8592" // ASCII-7-bit=149 Latin2=190 [top Latin2] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x33, (char)0x01,(char)0x9f,(char)0x20,(char)0x51,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8593" // ASCII-7-bit=159 Latin3=189 [top Latin3] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x34, (char)0x01,(char)0xac,(char)0x10,(char)0xd1,(char)0xba,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8594" // ASCII-7-bit=172 Latin4=186 [top Latin4] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x35, (char)0x01,(char)0xa6,(char)0x10,(char)0xa1,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8595" // ASCII-7-bit=166 ISO-8859-5=188 [top ISO-8859-5] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x36, (char)0x01,(char)0xae,(char)0x20,(char)0x11,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8596" // ASCII-7-bit=174 Arabic=185 [top Arabic] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x37, (char)0x01,(char)0x96,(char)0x10,(char)0x31,(char)0xbd,(char)0x21,(char)0x8f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8597" // ASCII-7-bit=150 Greek=189 CP1253=143 [top Greek] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x38, (char)0x01,(char)0x9b,(char)0x10,(char)0x81,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8598" // ASCII-7-bit=155 Hebrew=189 [top Hebrew] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x39, (char)0x01,(char)0x7a,(char)0xc1,(char)0xbe,(char)0x81,(char)0x7e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8599" // ASCII-7-bit=122 Latin5=190 CP1254=126 [top Latin5] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x36,(char)0x30,(char)0x31, (char)0x02,(char)0xba,(char)0x94,(char)0x21,(char)0xa6,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8601" // ASCII-7-bit=186 Latin1=148 CP1252=166 [top ASCII-7-bit] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x36,(char)0x39,(char)0x31, (char)0x02,(char)0xad,(char)0xb9,(char)0x21,(char)0x83,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8691" // ASCII-7-bit=173 Latin1=185 CP1252=131 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x36,(char)0x39,(char)0x32, (char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8692" // Latin2=191 [top Latin2] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x38,(char)0x35,(char)0x31, (char)0x02,(char)0xac,(char)0xb7,(char)0x21,(char)0x9f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8851" // ASCII-7-bit=172 Latin1=183 CP1252=159 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x38,(char)0x35,(char)0x39, (char)0x02,(char)0xaa,(char)0xba,(char)0x21,(char)0x80,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8859" // ASCII-7-bit=170 Latin1=186 CP1252=128 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x38,(char)0x39,(char)0x39, (char)0xd1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8899" // Latin5=191 [top Latin5] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x39,(char)0x31,(char)0x31, (char)0x02,(char)0x8c,(char)0xbd,(char)0x21,(char)0x9a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8911" // ASCII-7-bit=140 Latin1=189 CP1252=154 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x39,(char)0x31,(char)0x5f, (char)0x01,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_891_" // ASCII-7-bit=191 [top ASCII-7-bit] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x39,(char)0x35,(char)0x31, (char)0x02,(char)0xa3,(char)0xbc,(char)0x21,(char)0x91,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_8951" // ASCII-7-bit=163 Latin1=188 CP1252=145 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x39,(char)0x30,(char)0x30,(char)0x31, (char)0x02,(char)0x75,(char)0xa7,(char)0x21,(char)0x85,(char)0xa1,(char)0xbb,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_9001" // ASCII-7-bit=117 Latin1=167 CP1252=133 ISO-8859-15=187 [top ISO-8859-15] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x39,(char)0x35,(char)0x35,(char)0x31, (char)0x01,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_9551" // ASCII-7-bit=191 [top ASCII-7-bit] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x39,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x72,(char)0xbe,(char)0x21,(char)0x7b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_9591" // ASCII-7-bit=114 Latin1=190 CP1252=123 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x39,(char)0x35,(char)0x39,(char)0x32, (char)0x01,(char)0x7f,(char)0x81,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_9592" // ASCII-7-bit=127 Latin2=190 [top Latin2] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x39,(char)0x35,(char)0x39,(char)0x39, (char)0x01,(char)0x84,(char)0xc1,(char)0xbb,(char)0x81,(char)0xa6,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_9599" // ASCII-7-bit=132 Latin5=187 CP1254=166 [top Latin5] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0x99,(char)0xbc,(char)0x21,(char)0x96,(char)0xa1,(char)0x2e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iso_____" // ASCII-7-bit=153 Latin1=188 CP1252=150 ISO-8859-15=46 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x61,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x9a,(char)0xbd,(char)0x21,(char)0x8a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoa8591" // ASCII-7-bit=154 Latin1=189 CP1252=138 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x62,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x86,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isob8591" // ASCII-7-bit=134 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x63,(char)0x32,(char)0x30,(char)0x32,(char)0x32, (char)0x20,(char)0xd1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoc2022" // ISO_2022_CN=191 [top ISO_2022_CN] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x63,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoc8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x63,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoc8592" // Latin2=191 [top Latin2] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x64,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isod8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x65,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x93,(char)0xbd,(char)0x21,(char)0x8b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoe8591" // ASCII-7-bit=147 Latin1=189 CP1252=139 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x66,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x11,(char)0x6f,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isof5915" // Latin1=111 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x68,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoh8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x69,(char)0x36,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x92,(char)0x21,(char)0x7f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoi6___" // ASCII-7-bit=190 Latin1=146 CP1252=127 [top ASCII-7-bit] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0xa2,(char)0xbc,(char)0x21,(char)0x8c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoi8591" // ASCII-7-bit=162 Latin1=188 CP1252=140 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoi8592" // Latin2=191 [top Latin2] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x35, (char)0x01,(char)0xa4,(char)0x10,(char)0xa1,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoi8595" // ASCII-7-bit=164 ISO-8859-5=188 [top ISO-8859-5] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x36, (char)0x01,(char)0x79,(char)0x20,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoi8596" // ASCII-7-bit=121 Arabic=190 [top Arabic] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x38, (char)0x01,(char)0x83,(char)0x10,(char)0x01,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoi8598" // ASCII-7-bit=131 CP1255=190 [top CP1255] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x39, (char)0xd1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoi8599" // Latin5=191 [top Latin5] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x69,(char)0x38,(char)0x38,(char)0x35,(char)0x39, (char)0x02,(char)0xae,(char)0xb7,(char)0x21,(char)0x9a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoi8859" // ASCII-7-bit=174 Latin1=183 CP1252=154 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x69,(char)0x38,(char)0x39,(char)0x5f,(char)0x5f, (char)0xb1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoi89__" // CP1256=191 [top CP1256] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6a,(char)0x32,(char)0x30,(char)0x30,(char)0x32, (char)0x71,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoj2002" // EUC-JP=191 [top EUC-JP] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6a,(char)0x32,(char)0x30,(char)0x32,(char)0x32, (char)0x01,(char)0x44,(char)0x10,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoj2022" // ASCII-7-bit=68 JIS=190 [top JIS] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6a,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoj8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6b,(char)0x32,(char)0x30,(char)0x30,(char)0x32, (char)0x01,(char)0x7a,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isok2002" // ASCII-7-bit=122 KSC=190 [top KSC] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6b,(char)0x32,(char)0x30,(char)0x32,(char)0x32, (char)0x20,(char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isok2022" // ISO-2022-KR=191 [top ISO-2022-KR] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6c,(char)0x31,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xa6,(char)0x11,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isol1___" // ASCII-7-bit=166 UTF8=188 [top UTF8] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6c,(char)0x35,(char)0x39,(char)0x31,(char)0x31, (char)0x01,(char)0x83,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isol5911" // ASCII-7-bit=131 ISO-8859-11=190 [top ISO-8859-11] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6c,(char)0x37,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa4,(char)0xb8,(char)0x21,(char)0xa7,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isol7___" // ASCII-7-bit=164 Latin1=184 CP1252=167 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6c,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isol8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6d,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isom8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6e,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ison8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6e,(char)0xbe,(char)0x21,(char)0x6e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoo8591" // ASCII-7-bit=110 Latin1=190 CP1252=110 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x70,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0xf1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isop5915" // ISO-8859-15=191 [top ISO-8859-15] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x70,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x91,(char)0xbe,(char)0x21,(char)0x6f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isop8591" // ASCII-7-bit=145 Latin1=190 CP1252=111 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x84,(char)0xbe,(char)0x21,(char)0x8d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isos8591" // ASCII-7-bit=132 Latin1=190 CP1252=141 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x75,(char)0x36,(char)0x34,(char)0x36,(char)0x31, (char)0x02,(char)0xa6,(char)0xb9,(char)0x21,(char)0xa1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isou6461" // ASCII-7-bit=166 Latin1=185 CP1252=161 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x75,(char)0x36,(char)0x34,(char)0x36,(char)0x5f, (char)0x01,(char)0xbe,(char)0x31,(char)0x8e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isou646_" // ASCII-7-bit=190 CP1252=142 [top ASCII-7-bit] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x75,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isou8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x75,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa2,(char)0xbc,(char)0x21,(char)0x8c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isou8___" // ASCII-7-bit=162 Latin1=188 CP1252=140 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x77,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0x01,(char)0x6e,(char)0xb1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isow1250" // ASCII-7-bit=110 CP1250=190 [top CP1250] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x77,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isow1251" // CP1251=191 [top CP1251] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x77,(char)0x31,(char)0x32,(char)0x35,(char)0x33, (char)0x01,(char)0x6f,(char)0x10,(char)0x61,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isow1253" // ASCII-7-bit=111 CP1253=190 [top CP1253] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x77,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x89,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isow8591" // ASCII-7-bit=137 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x78,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isox8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x6f,(char)0x7a,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x8b,(char)0xbe,(char)0x21,(char)0x79,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isoz8591" // ASCII-7-bit=139 Latin1=190 CP1252=121 [top Latin1] {{(char)0x69,(char)0x73,(char)0x70,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x86,(char)0xbe,(char)0x21,(char)0x6f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isp_8591" // ASCII-7-bit=134 Latin1=190 CP1252=111 [top Latin1] {{(char)0x69,(char)0x73,(char)0x73,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iss_8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x73,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isso8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x69,(char)0x73,(char)0x74,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x01,(char)0x79,(char)0xe1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ist_5915" // ASCII-7-bit=121 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x69,(char)0x73,(char)0x74,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x6f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "isto8591" // Latin1=190 CP1252=111 [top Latin1] {{(char)0x69,(char)0x74,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x21,(char)0x86,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "itis8591" // ASCII-7-bit=111 Latin1=190 CP1252=134 [top Latin1] {{(char)0x69,(char)0x74,(char)0x69,(char)0x74,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x41,(char)0x79,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "itit5915" // CP1252=121 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x69,(char)0x74,(char)0x69,(char)0x74,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x8f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "itit8591" // Latin1=190 CP1252=143 [top Latin1] {{(char)0x69,(char)0x74,(char)0x69,(char)0x74,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xb7,(char)0xab,(char)0x21,(char)0xa4,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "itit____" // ASCII-7-bit=183 Latin1=171 CP1252=164 [top ASCII-7-bit] {{(char)0x69,(char)0x75,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iu__8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x69,(char)0x77,(char)0x69,(char)0x6e,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iwin1250" // CP1250=191 [top CP1250] {{(char)0x69,(char)0x77,(char)0x69,(char)0x6e,(char)0x31,(char)0x32,(char)0x35,(char)0x37, (char)0x10,(char)0x01,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iwin1257" // CP1257=191 [top CP1257] {{(char)0x69,(char)0x79,(char)0x73,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "iyso8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x6a,(char)0x61,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x78,(char)0x51,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ja______" // ASCII-7-bit=120 SJS=190 [top SJS] {{(char)0x6a,(char)0x61,(char)0x67,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x20,(char)0xf1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "jagr____" // JAGRAN=191 [top JAGRAN] {{(char)0x6a,(char)0x69,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x81,(char)0x10,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "jis_____" // ASCII-7-bit=129 JIS=190 [top JIS] {{(char)0x6b,(char)0x61,(char)0x6d,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x20,(char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kamc____" // CP852=191 [top CP852] {{(char)0x6b,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x7c,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ko______" // ASCII-7-bit=124 KSC=190 [top KSC] {{(char)0x6b,(char)0x6f,(char)0x69,(char)0x5f,(char)0x37,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xbe,(char)0x31,(char)0x6b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "koi_7___" // ASCII-7-bit=190 CP1252=107 [top ASCII-7-bit] {{(char)0x6b,(char)0x6f,(char)0x69,(char)0x72,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x8b,(char)0x10,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "koir8___" // ASCII-7-bit=139 KOI8R=190 [top KOI8R] {{(char)0x6b,(char)0x6f,(char)0x69,(char)0x75,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x77,(char)0x10,(char)0x91,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "koiu8___" // ASCII-7-bit=119 KOI8U=190 [top KOI8U] {{(char)0x6b,(char)0x6f,(char)0x6b,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x4b,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kokr____" // ASCII-7-bit=75 KSC=190 [top KSC] {{(char)0x6b,(char)0x6f,(char)0x6b,(char)0x73,(char)0x35,(char)0x36,(char)0x30,(char)0x31, (char)0x01,(char)0x75,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "koks5601" // ASCII-7-bit=117 KSC=190 [top KSC] {{(char)0x6b,(char)0x6f,(char)0x72,(char)0x65,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x4e,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kore____" // ASCII-7-bit=78 KSC=190 [top KSC] {{(char)0x6b,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x74,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "kr______" // ASCII-7-bit=116 KSC=190 [top KSC] {{(char)0x6b,(char)0x72,(char)0x63,(char)0x5f,(char)0x35,(char)0x36,(char)0x30,(char)0x31, (char)0x01,(char)0x74,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "krc_5601" // ASCII-7-bit=116 KSC=190 [top KSC] {{(char)0x6b,(char)0x73,(char)0x63,(char)0x5f,(char)0x35,(char)0x35,(char)0x30,(char)0x31, (char)0x51,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ksc_5501" // KSC=191 [top KSC] {{(char)0x6b,(char)0x73,(char)0x63,(char)0x5f,(char)0x35,(char)0x36,(char)0x30,(char)0x31, (char)0x01,(char)0x62,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ksc_5601" // ASCII-7-bit=98 KSC=190 [top KSC] {{(char)0x6b,(char)0x73,(char)0x63,(char)0x5f,(char)0x36,(char)0x30,(char)0x30,(char)0x31, (char)0x51,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ksc_6001" // KSC=191 [top KSC] {{(char)0x6c,(char)0x61,(char)0x73,(char)0x74,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xb7,(char)0xaf,(char)0x21,(char)0x90,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "last____" // ASCII-7-bit=183 Latin1=175 CP1252=144 [top ASCII-7-bit] {{(char)0x6c,(char)0x61,(char)0x74,(char)0x69,(char)0x31,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa3,(char)0xbb,(char)0x21,(char)0x9b,(char)0xa1,(char)0x73,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lati1___" // ASCII-7-bit=163 Latin1=187 CP1252=155 ISO-8859-15=115 [top Latin1] {{(char)0x6c,(char)0x61,(char)0x74,(char)0x69,(char)0x32,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x94,(char)0x81,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lati2___" // ASCII-7-bit=148 Latin2=190 [top Latin2] {{(char)0x6c,(char)0x61,(char)0x74,(char)0x69,(char)0x35,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x7c,(char)0xc1,(char)0xbe,(char)0x81,(char)0x87,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lati5___" // ASCII-7-bit=124 Latin5=190 CP1254=135 [top Latin5] {{(char)0x6c,(char)0x61,(char)0x74,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lati8591" // Latin1=191 [top Latin1] {{(char)0x6c,(char)0x61,(char)0x74,(char)0x69,(char)0x38,(char)0x38,(char)0x35,(char)0x39, (char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lati8859" // Latin2=191 [top Latin2] {{(char)0x6c,(char)0x69,(char)0x6e,(char)0x75,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x11,(char)0x79,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "linu1252" // Latin1=121 CP1252=190 [top CP1252] {{(char)0x6c,(char)0x6f,(char)0x67,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x88,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "logi____" // ASCII-7-bit=136 UTF8=190 [top UTF8] {{(char)0x6c,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lso_8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x6c,(char)0x74,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "lto_8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x6c,(char)0x74,(char)0x77,(char)0x69,(char)0x31,(char)0x32,(char)0x35,(char)0x37, (char)0x10,(char)0x01,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ltwi1257" // CP1257=191 [top CP1257] {{(char)0x6d,(char)0x61,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x82,(char)0x91,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mac_____" // ASCII-7-bit=130 CP1251=190 [top CP1251] {{(char)0x6d,(char)0x61,(char)0x63,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x94,(char)0x10,(char)0xe1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "macc____" // ASCII-7-bit=148 MACINTOSH=190 [top MACINTOSH] {{(char)0x6d,(char)0x61,(char)0x63,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbd,(char)0x93,(char)0x21,(char)0x8b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "maci____" // ASCII-7-bit=189 Latin1=147 CP1252=139 [top ASCII-7-bit] {{(char)0x6d,(char)0x61,(char)0x63,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xaf,(char)0x10,(char)0xe1,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "macr____" // ASCII-7-bit=175 MACINTOSH=185 [top MACINTOSH] {{(char)0x6d,(char)0x73,(char)0x5f,(char)0x5f,(char)0x38,(char)0x37,(char)0x34,(char)0x5f, (char)0x01,(char)0x80,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ms__874_" // ASCII-7-bit=128 ISO-8859-11=190 [top ISO-8859-11] {{(char)0x6d,(char)0x73,(char)0x5f,(char)0x5f,(char)0x39,(char)0x33,(char)0x32,(char)0x5f, (char)0x01,(char)0x91,(char)0x51,(char)0xbe,(char)0x10,(char)0x11,(char)0x82,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ms__932_" // ASCII-7-bit=145 SJS=190 CP932=130 [top SJS] {{(char)0x6d,(char)0x73,(char)0x5f,(char)0x5f,(char)0x39,(char)0x34,(char)0x39,(char)0x5f, (char)0x01,(char)0x49,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ms__949_" // ASCII-7-bit=73 KSC=190 [top KSC] {{(char)0x6d,(char)0x73,(char)0x5f,(char)0x5f,(char)0x39,(char)0x35,(char)0x30,(char)0x5f, (char)0x01,(char)0x75,(char)0x71,(char)0xbe,(char)0x10,(char)0xa1,(char)0x43,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ms__950_" // ASCII-7-bit=117 BIG5=190 BIG5_HKSCS=67 [top BIG5] {{(char)0x6d,(char)0x73,(char)0x63,(char)0x70,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mscp1250" // CP1250=191 [top CP1250] {{(char)0x6d,(char)0x73,(char)0x68,(char)0x6b,(char)0x39,(char)0x35,(char)0x30,(char)0x5f, (char)0x01,(char)0x82,(char)0x71,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mshk950_" // ASCII-7-bit=130 BIG5=190 [top BIG5] {{(char)0x6d,(char)0x73,(char)0x77,(char)0x69,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mswi1250" // CP1250=191 [top CP1250] {{(char)0x6d,(char)0x73,(char)0x77,(char)0x69,(char)0x31,(char)0x32,(char)0x35,(char)0x33, (char)0x10,(char)0x41,(char)0x8f,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mswi1253" // Greek=143 CP1253=190 [top CP1253] {{(char)0x6d,(char)0x78,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "mx______" // UTF8=191 [top UTF8] {{(char)0x6e,(char)0x65,(char)0x77,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xab,(char)0xb2,(char)0x21,(char)0xaf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "new_____" // ASCII-7-bit=171 Latin1=178 CP1252=175 [top Latin1] {{(char)0x6e,(char)0x66,(char)0x7a,(char)0x5f,(char)0x32,(char)0x30,(char)0x31,(char)0x30, (char)0x02,(char)0x80,(char)0xbc,(char)0x21,(char)0xa3,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "nfz_2010" // ASCII-7-bit=128 Latin1=188 CP1252=163 [top Latin1] {{(char)0x6e,(char)0x69,(char)0x73,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "niso8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x6e,(char)0x6c,(char)0x61,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "nlai8591" // Latin1=191 [top Latin1] {{(char)0x6e,(char)0x6c,(char)0x6e,(char)0x6c,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x6f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "nlnl8591" // Latin1=190 CP1252=111 [top Latin1] {{(char)0x6e,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xa4,(char)0x71,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "no______" // ASCII-7-bit=164 BIG5=188 [top BIG5] {{(char)0x6e,(char)0x6f,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "nois8591" // Latin1=191 [top Latin1] {{(char)0x6e,(char)0x6f,(char)0x6e,(char)0x65,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x9b,(char)0x51,(char)0xbd,(char)0x10,(char)0x11,(char)0x70,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "none____" // ASCII-7-bit=155 SJS=189 CP932=112 [top SJS] {{(char)0x6e,(char)0x75,(char)0x6c,(char)0x6c,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x92,(char)0x71,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "null____" // ASCII-7-bit=146 BIG5=190 [top BIG5] {{(char)0x6f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "o___8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x6f,(char)0x6e,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "on______" // UTF8=191 [top UTF8] {{(char)0x6f,(char)0x73,(char)0x69,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x01,(char)0x6f,(char)0xe1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "osi_5915" // ASCII-7-bit=111 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x6f,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "oso_8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x6f,(char)0x73,(char)0x70,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x38, (char)0x01,(char)0x6f,(char)0x10,(char)0x81,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "osp_8598" // ASCII-7-bit=111 Hebrew=190 [top Hebrew] {{(char)0x6f,(char)0x77,(char)0x69,(char)0x6e,(char)0x31,(char)0x32,(char)0x35,(char)0x36, (char)0xb1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "owin1256" // CP1256=191 [top CP1256] {{(char)0x70,(char)0x61,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0x6e,(char)0xb8,(char)0x21,(char)0xaf,(char)0xa1,(char)0x64,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "par_____" // ASCII-7-bit=110 Latin1=184 CP1252=175 ISO-8859-15=100 [top Latin1] {{(char)0x70,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "pc______" // UTF8=191 [top UTF8] {{(char)0x70,(char)0x6c,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "plis8592" // Latin2=191 [top Latin2] {{(char)0x70,(char)0x6c,(char)0x70,(char)0x6c,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "plpl8592" // Latin2=191 [top Latin2] {{(char)0x70,(char)0x72,(char)0x65,(char)0x64,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xb4,(char)0xa3,(char)0x21,(char)0xb1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "pred____" // ASCII-7-bit=180 Latin1=163 CP1252=177 [top ASCII-7-bit] {{(char)0x70,(char)0x74,(char)0x62,(char)0x72,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6e,(char)0xbd,(char)0x21,(char)0x9a,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ptbr8591" // ASCII-7-bit=110 Latin1=189 CP1252=154 [top Latin1] {{(char)0x70,(char)0x74,(char)0x62,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x79,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ptbr____" // ASCII-7-bit=121 UTF8=190 [top UTF8] {{(char)0x70,(char)0x74,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x7e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ptis8591" // Latin1=190 CP1252=126 [top Latin1] {{(char)0x70,(char)0x74,(char)0x70,(char)0x74,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x11,(char)0x89,(char)0x21,(char)0x6f,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ptpt5915" // Latin1=137 CP1252=111 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x72,(char)0x66,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x87,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "rfc_____" // ASCII-7-bit=135 UTF8=190 [top UTF8] {{(char)0x72,(char)0x6f,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x83,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "rois8591" // ASCII-7-bit=131 Latin1=190 [top Latin1] {{(char)0x72,(char)0x6f,(char)0x72,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x01,(char)0x99,(char)0x81,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "roro8592" // ASCII-7-bit=153 Latin2=189 [top Latin2] {{(char)0x72,(char)0x75,(char)0x72,(char)0x75,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ruru1251" // CP1251=191 [top CP1251] {{(char)0x72,(char)0x75,(char)0x77,(char)0x69,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0x01,(char)0x6f,(char)0x91,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ruwi1251" // ASCII-7-bit=111 CP1251=190 [top CP1251] {{(char)0x73,(char)0x65,(char)0x65,(char)0x6d,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "seem8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x73,(char)0x65,(char)0x74,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "setc____" // ASCII-7-bit=191 [top ASCII-7-bit] {{(char)0x73,(char)0x68,(char)0x69,(char)0x66,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x02,(char)0x86,(char)0x6f,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "shif1252" // ASCII-7-bit=134 Latin1=111 CP1252=190 [top CP1252] {{(char)0x73,(char)0x68,(char)0x69,(char)0x66,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x6e,(char)0x51,(char)0xbe,(char)0x10,(char)0x11,(char)0x6b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "shif____" // ASCII-7-bit=110 SJS=190 CP932=107 [top SJS] {{(char)0x73,(char)0x69,(char)0x66,(char)0x74,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x72,(char)0x51,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sift____" // ASCII-7-bit=114 SJS=190 [top SJS] {{(char)0x73,(char)0x6a,(char)0x69,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x79,(char)0x51,(char)0xbe,(char)0x10,(char)0x11,(char)0x5d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "sjis____" // ASCII-7-bit=121 SJS=190 CP932=93 [top SJS] {{(char)0x73,(char)0x6b,(char)0x77,(char)0x69,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "skwi1250" // CP1250=191 [top CP1250] {{(char)0x73,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x02,(char)0x86,(char)0x6f,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "so__5915" // ASCII-7-bit=134 Latin1=111 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x73,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x9a,(char)0xbd,(char)0x21,(char)0x8b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "so__8591" // ASCII-7-bit=154 Latin1=189 CP1252=139 [top Latin1] {{(char)0x73,(char)0x6f,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "so__8592" // Latin2=191 [top Latin2] {{(char)0x73,(char)0x76,(char)0x73,(char)0x65,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "svse8591" // Latin1=191 [top Latin1] {{(char)0x74,(char)0x61,(char)0x62,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x30,(char)0x41,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tab_____" // TAB=191 [top TAB] {{(char)0x74,(char)0x61,(char)0x6d,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x30,(char)0x31,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tam_____" // TAM=191 [top TAM] {{(char)0x74,(char)0x65,(char)0x78,(char)0x74,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xac,(char)0xb7,(char)0x21,(char)0xa0,(char)0xa1,(char)0x49,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "text____" // ASCII-7-bit=172 Latin1=183 CP1252=160 ISO-8859-15=73 [top Latin1] {{(char)0x74,(char)0x69,(char)0x73,(char)0x5f,(char)0x36,(char)0x31,(char)0x38,(char)0x5f, (char)0x01,(char)0x75,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tis_618_" // ASCII-7-bit=117 ISO-8859-11=190 [top ISO-8859-11] {{(char)0x74,(char)0x69,(char)0x73,(char)0x5f,(char)0x36,(char)0x32,(char)0x30,(char)0x5f, (char)0x01,(char)0x82,(char)0xd1,(char)0xbe,(char)0xd1,(char)0x7b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tis_620_" // ASCII-7-bit=130 ISO-8859-11=190 CP874=123 [top ISO-8859-11] {{(char)0x74,(char)0x72,(char)0x5f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x39, (char)0xd1,(char)0xbe,(char)0x81,(char)0x6f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tr__8599" // Latin5=190 CP1254=111 [top Latin5] {{(char)0x74,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0xd1,(char)0xbe,(char)0x81,(char)0x5f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tr______" // Latin5=190 CP1254=95 [top Latin5] {{(char)0x74,(char)0x72,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x39, (char)0xd1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tris8599" // Latin5=191 [top Latin5] {{(char)0x74,(char)0x73,(char)0x63,(char)0x69,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x30,(char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "tsci____" // TSCII=191 [top TSCII] {{(char)0x75,(char)0x63,(char)0x73,(char)0x5f,(char)0x32,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xb8,(char)0xa7,(char)0x21,(char)0xa3,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "ucs_2___" // ASCII-7-bit=184 Latin1=167 CP1252=163 [top ASCII-7-bit] {{(char)0x75,(char)0x66,(char)0x74,(char)0x5f,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xb0,(char)0x11,(char)0xb8,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "uft_8___" // ASCII-7-bit=176 UTF8=184 [top UTF8] {{(char)0x75,(char)0x69,(char)0x73,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "uiso8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] {{(char)0x75,(char)0x6e,(char)0x69,(char)0x63,(char)0x31,(char)0x31,(char)0x5f,(char)0x5f, (char)0x01,(char)0xa7,(char)0x11,(char)0xbb,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "unic11__" // ASCII-7-bit=167 UTF8=187 [top UTF8] {{(char)0x75,(char)0x6e,(char)0x69,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x90,(char)0x21,(char)0x85,(char)0xa1,(char)0x45,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "unic____" // ASCII-7-bit=190 Latin1=144 CP1252=133 ISO-8859-15=69 [top ASCII-7-bit] {{(char)0x75,(char)0x6e,(char)0x6b,(char)0x6e,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa2,(char)0xbb,(char)0x21,(char)0x95,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "unkn8___" // ASCII-7-bit=162 Latin1=187 CP1252=149 [top Latin1] {{(char)0x75,(char)0x6e,(char)0x6b,(char)0x6e,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x9c,(char)0x51,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "unkn____" // ASCII-7-bit=156 SJS=189 [top SJS] {{(char)0x75,(char)0x70,(char)0x66,(char)0x5f,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x21,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "upf_8___" // UTF8=191 [top UTF8] {{(char)0x75,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x7d,(char)0x21,(char)0x7d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "us______" // ASCII-7-bit=190 Latin1=125 CP1252=125 [top ASCII-7-bit] {{(char)0x75,(char)0x73,(char)0x61,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x83,(char)0x21,(char)0x6a,(char)0xa1,(char)0x38,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "usas____" // ASCII-7-bit=190 Latin1=131 CP1252=106 ISO-8859-15=56 [top ASCII-7-bit] {{(char)0x75,(char)0x73,(char)0x65,(char)0x6e,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xb8,(char)0x94,(char)0x21,(char)0xad,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "usen____" // ASCII-7-bit=184 Latin1=148 CP1252=173 [top ASCII-7-bit] {{(char)0x75,(char)0x73,(char)0x65,(char)0x72,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xb9,(char)0x9e,(char)0x21,(char)0xa7,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "user____" // ASCII-7-bit=185 Latin1=158 CP1252=167 [top ASCII-7-bit] {{(char)0x75,(char)0x73,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x78,(char)0xbe,(char)0x21,(char)0x78,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "usis8591" // ASCII-7-bit=120 Latin1=190 CP1252=120 [top Latin1] {{(char)0x75,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbc,(char)0x21,(char)0xa5,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "uso_8591" // ASCII-7-bit=121 Latin1=188 CP1252=165 [top Latin1] {{(char)0x75,(char)0x74,(char)0x66,(char)0x5f,(char)0x31,(char)0x36,(char)0x5f,(char)0x5f, (char)0x01,(char)0xb0,(char)0x11,(char)0xb8,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utf_16__" // ASCII-7-bit=176 UTF8=184 [top UTF8] {{(char)0x75,(char)0x74,(char)0x66,(char)0x5f,(char)0x33,(char)0x32,(char)0x5f,(char)0x5f, (char)0x02,(char)0xb5,(char)0xa9,(char)0x21,(char)0x9f,(char)0xa1,(char)0xa1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utf_32__" // ASCII-7-bit=181 Latin1=169 CP1252=159 ISO-8859-15=161 [top ASCII-7-bit] {{(char)0x75,(char)0x74,(char)0x66,(char)0x5f,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x11,(char)0x90,(char)0xd1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utf_5915" // Latin1=144 ISO-8859-15=190 [top ISO-8859-15] {{(char)0x75,(char)0x74,(char)0x66,(char)0x5f,(char)0x37,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x88,(char)0x20,(char)0xb1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utf_7___" // ASCII-7-bit=136 UTF7=190 [top UTF7] {{(char)0x75,(char)0x74,(char)0x66,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x95,(char)0xbd,(char)0x21,(char)0x8c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utf_8591" // ASCII-7-bit=149 Latin1=189 CP1252=140 [top Latin1] {{(char)0x75,(char)0x74,(char)0x66,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x39, (char)0xd1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utf_8599" // Latin5=191 [top Latin5] {{(char)0x75,(char)0x74,(char)0x66,(char)0x5f,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xae,(char)0x11,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utf_8___" // ASCII-7-bit=174 UTF8=185 [top UTF8] {{(char)0x75,(char)0x74,(char)0x66,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x8a,(char)0x21,(char)0x74,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utf_____" // ASCII-7-bit=190 Latin1=138 CP1252=116 [top ASCII-7-bit] {{(char)0x75,(char)0x74,(char)0x66,(char)0x62,(char)0x31,(char)0x36,(char)0x5f,(char)0x5f, (char)0x01,(char)0xa5,(char)0x20,(char)0x41,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utfb16__" // ASCII-7-bit=165 UTF-16BE=188 [top UTF-16BE] {{(char)0x75,(char)0x74,(char)0x66,(char)0x62,(char)0x33,(char)0x32,(char)0x5f,(char)0x5f, (char)0x30,(char)0x81,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utfb32__" // UTF-32BE=191 [top UTF-32BE] {{(char)0x75,(char)0x74,(char)0x66,(char)0x69,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x99,(char)0xbd,(char)0x21,(char)0x87,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utfi8591" // ASCII-7-bit=153 Latin1=189 CP1252=135 [top Latin1] {{(char)0x75,(char)0x74,(char)0x66,(char)0x6c,(char)0x31,(char)0x36,(char)0x5f,(char)0x5f, (char)0x20,(char)0x71,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utfl16__" // UTF-16LE=191 [top UTF-16LE] {{(char)0x75,(char)0x74,(char)0x66,(char)0x6c,(char)0x33,(char)0x32,(char)0x5f,(char)0x5f, (char)0x30,(char)0x91,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utfl32__" // UTF-32LE=191 [top UTF-32LE] {{(char)0x75,(char)0x74,(char)0x66,(char)0x75,(char)0x38,(char)0x38,(char)0x5f,(char)0x5f, (char)0x30,(char)0xb1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "utfu88__" // X-UTF8UTF8=191 [top X-UTF8UTF8] {{(char)0x76,(char)0x61,(char)0x6c,(char)0x75,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "valu____" // Latin1=191 [top Latin1] {{(char)0x76,(char)0x69,(char)0x73,(char)0x75,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x84,(char)0x10,(char)0x81,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "visu____" // ASCII-7-bit=132 Hebrew=190 [top Hebrew] {{(char)0x77,(char)0x61,(char)0x69,(char)0x6e,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wain1250" // CP1250=191 [top CP1250] {{(char)0x77,(char)0x65,(char)0x69,(char)0x73,(char)0x35,(char)0x39,(char)0x31,(char)0x35, (char)0x02,(char)0x9f,(char)0x7d,(char)0x21,(char)0x84,(char)0xa1,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "weis5915" // ASCII-7-bit=159 Latin1=125 CP1252=132 ISO-8859-15=188 [top ISO-8859-15] {{(char)0x77,(char)0x65,(char)0x69,(char)0x73,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x7e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "weis8591" // Latin1=190 CP1252=126 [top Latin1] {{(char)0x77,(char)0x65,(char)0x73,(char)0x74,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x01,(char)0x6f,(char)0x31,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "west1252" // ASCII-7-bit=111 CP1252=190 [top CP1252] {{(char)0x77,(char)0x65,(char)0x73,(char)0x74,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x79,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "west8591" // ASCII-7-bit=121 Latin1=190 [top Latin1] {{(char)0x77,(char)0x65,(char)0x73,(char)0x74,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xa9,(char)0x9d,(char)0x21,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "west____" // ASCII-7-bit=169 Latin1=157 CP1252=185 [top CP1252] {{(char)0x77,(char)0x69,(char)0x64,(char)0x6e,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "widn1250" // CP1250=191 [top CP1250] {{(char)0x77,(char)0x69,(char)0x64,(char)0x6f,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0x01,(char)0x7c,(char)0xb1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wido1250" // ASCII-7-bit=124 CP1250=190 [top CP1250] {{(char)0x77,(char)0x69,(char)0x64,(char)0x6f,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wido1251" // CP1251=191 [top CP1251] {{(char)0x77,(char)0x69,(char)0x64,(char)0x6f,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x11,(char)0xa9,(char)0x21,(char)0xbb,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wido1252" // Latin1=169 CP1252=187 [top CP1252] {{(char)0x77,(char)0x69,(char)0x64,(char)0x6f,(char)0x31,(char)0x32,(char)0x35,(char)0x36, (char)0xb1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wido1256" // CP1256=191 [top CP1256] {{(char)0x77,(char)0x69,(char)0x6d,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wimd1251" // CP1251=191 [top CP1251] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0x01,(char)0x8d,(char)0xb1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_1250" // ASCII-7-bit=141 CP1250=190 [top CP1250] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0x01,(char)0x8f,(char)0x91,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_1251" // ASCII-7-bit=143 CP1251=190 [top CP1251] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x02,(char)0xac,(char)0xa4,(char)0x21,(char)0xb6,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_1252" // ASCII-7-bit=172 Latin1=164 CP1252=182 [top CP1252] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x33, (char)0x10,(char)0x41,(char)0x85,(char)0x21,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_1253" // Greek=133 CP1253=190 [top CP1253] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x34, (char)0x01,(char)0x6f,(char)0xc1,(char)0xaf,(char)0x81,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_1254" // ASCII-7-bit=111 Latin5=175 CP1254=185 [top CP1254] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x35, (char)0x10,(char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_1255" // CP1255=191 [top CP1255] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x36, (char)0x01,(char)0x7f,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_1256" // ASCII-7-bit=127 CP1256=190 [top CP1256] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x31,(char)0x32,(char)0x35,(char)0x37, (char)0x01,(char)0x8c,(char)0xf1,(char)0xbe,(char)0xc1,(char)0x77,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_1257" // ASCII-7-bit=140 CP1257=190 ISO-8859-13=119 [top CP1257] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x38,(char)0x37,(char)0x34,(char)0x5f, (char)0x01,(char)0x56,(char)0xd1,(char)0xaf,(char)0xd1,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_874_" // ASCII-7-bit=86 ISO-8859-11=175 CP874=185 [top CP874] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x9a,(char)0x91,(char)0xbd,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "win_____" // ASCII-7-bit=154 CP1251=189 [top CP1251] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x63,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "winc1250" // CP1250=191 [top CP1250] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x63,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "winc1251" // CP1251=191 [top CP1251] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x33,(char)0x34, (char)0xb1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind1234" // CP1256=191 [top CP1256] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0x01,(char)0x88,(char)0xb1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind1250" // ASCII-7-bit=136 CP1250=190 [top CP1250] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0x01,(char)0x8b,(char)0x91,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind1251" // ASCII-7-bit=139 CP1251=190 [top CP1251] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x02,(char)0xa5,(char)0xac,(char)0x21,(char)0xb6,(char)0xa1,(char)0x4f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind1252" // ASCII-7-bit=165 Latin1=172 CP1252=182 ISO-8859-15=79 [top CP1252] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x33, (char)0x01,(char)0x94,(char)0x10,(char)0x31,(char)0xae,(char)0x21,(char)0xb8,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind1253" // ASCII-7-bit=148 Greek=174 CP1253=184 [top CP1253] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x34, (char)0x01,(char)0x73,(char)0xc1,(char)0xaf,(char)0x81,(char)0xb9,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind1254" // ASCII-7-bit=115 Latin5=175 CP1254=185 [top CP1254] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x35, (char)0x01,(char)0x86,(char)0x10,(char)0x01,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind1255" // ASCII-7-bit=134 CP1255=190 [top CP1255] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x36, (char)0x01,(char)0x74,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind1256" // ASCII-7-bit=116 CP1256=190 [top CP1256] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x37, (char)0x01,(char)0x87,(char)0xf1,(char)0xbe,(char)0xc1,(char)0x52,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind1257" // ASCII-7-bit=135 CP1257=190 ISO-8859-13=82 [top CP1257] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x33,(char)0x31,(char)0x5f,(char)0x5f, (char)0x01,(char)0x62,(char)0x51,(char)0xbe,(char)0x10,(char)0x11,(char)0x5e,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind31__" // ASCII-7-bit=98 SJS=190 CP932=94 [top SJS] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x34,(char)0x37,(char)0x5f, (char)0xe1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind847_" // ISO-8859-11=191 [top ISO-8859-11] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x35,(char)0x32,(char)0x5f, (char)0x01,(char)0x79,(char)0x20,(char)0x01,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind852_" // ASCII-7-bit=121 CP852=190 [top CP852] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x9a,(char)0xbd,(char)0x21,(char)0x89,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind8591" // ASCII-7-bit=154 Latin1=189 CP1252=137 [top Latin1] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x35,(char)0x39,(char)0x32, (char)0x01,(char)0x83,(char)0x81,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind8592" // ASCII-7-bit=131 Latin2=190 [top Latin2] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x35,(char)0x39,(char)0x36, (char)0x01,(char)0x6f,(char)0x20,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind8596" // ASCII-7-bit=111 Arabic=190 [top Arabic] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x35,(char)0x39,(char)0x37, (char)0x01,(char)0x6f,(char)0x10,(char)0x31,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind8597" // ASCII-7-bit=111 Greek=190 [top Greek] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x35,(char)0x39,(char)0x39, (char)0x01,(char)0x6c,(char)0xc1,(char)0xbe,(char)0x81,(char)0x6c,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind8599" // ASCII-7-bit=108 Latin5=190 CP1254=108 [top Latin5] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x36,(char)0x36,(char)0x5f, (char)0x20,(char)0x41,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind866_" // CP866=191 [top CP866] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x37,(char)0x34,(char)0x5f, (char)0x01,(char)0x8a,(char)0xd1,(char)0xbe,(char)0xd1,(char)0x7d,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind874_" // ASCII-7-bit=138 ISO-8859-11=190 CP874=125 [top ISO-8859-11] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x38,(char)0x35,(char)0x39, (char)0x02,(char)0x97,(char)0xb6,(char)0x21,(char)0xb1,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind8859" // ASCII-7-bit=151 Latin1=182 CP1252=177 [top Latin1] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x38,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0x93,(char)0x11,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind8___" // ASCII-7-bit=147 UTF8=190 [top UTF8] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x39,(char)0x33,(char)0x32,(char)0x5f, (char)0x01,(char)0x7d,(char)0x51,(char)0xa4,(char)0x10,(char)0x11,(char)0xbc,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind932_" // ASCII-7-bit=125 SJS=164 CP932=188 [top CP932] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x39,(char)0x34,(char)0x39,(char)0x5f, (char)0x01,(char)0x7b,(char)0x41,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind949_" // ASCII-7-bit=123 KSC=190 [top KSC] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x39,(char)0x35,(char)0x30,(char)0x5f, (char)0x01,(char)0x6f,(char)0x71,(char)0x7f,(char)0x20,(char)0x51,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind950_" // ASCII-7-bit=111 BIG5=127 BIG5-CP950=190 [top BIG5-CP950] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x64,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x01,(char)0xb5,(char)0x11,(char)0xb4,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wind____" // ASCII-7-bit=181 UTF8=180 [top ASCII-7-bit] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x65,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x01,(char)0x6f,(char)0x31,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wine1252" // ASCII-7-bit=111 CP1252=190 [top CP1252] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x6f,(char)0x31,(char)0x32,(char)0x35,(char)0x30, (char)0xc1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wino1250" // CP1250=191 [top CP1250] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x6f,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wino1251" // CP1251=191 [top CP1251] {{(char)0x77,(char)0x69,(char)0x6e,(char)0x73,(char)0x31,(char)0x32,(char)0x35,(char)0x35, (char)0x10,(char)0x11,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wins1255" // CP1255=191 [top CP1255] {{(char)0x77,(char)0x69,(char)0x72,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wird1251" // CP1251=191 [top CP1251] {{(char)0x77,(char)0x69,(char)0x73,(char)0x6f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x11,(char)0xbe,(char)0x21,(char)0x7f,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wiso8591" // Latin1=190 CP1252=127 [top Latin1] {{(char)0x77,(char)0x6e,(char)0x64,(char)0x6f,(char)0x31,(char)0x32,(char)0x35,(char)0x31, (char)0xa1,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wndo1251" // CP1251=191 [top CP1251] {{(char)0x77,(char)0x6e,(char)0x64,(char)0x6f,(char)0x31,(char)0x32,(char)0x35,(char)0x36, (char)0x01,(char)0x6e,(char)0xa1,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wndo1256" // ASCII-7-bit=110 CP1256=190 [top CP1256] {{(char)0x77,(char)0x6f,(char)0x6e,(char)0x64,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x41,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "wond1252" // CP1252=191 [top CP1252] {{(char)0x77,(char)0x6f,(char)0x72,(char)0x67,(char)0x31,(char)0x32,(char)0x35,(char)0x32, (char)0x01,(char)0x83,(char)0x31,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "worg1252" // ASCII-7-bit=131 CP1252=190 [top CP1252] {{(char)0x79,(char)0x65,(char)0x73,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x02,(char)0xbe,(char)0x81,(char)0x21,(char)0x8b,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "yes_____" // ASCII-7-bit=190 Latin1=129 CP1252=139 [top ASCII-7-bit] {{(char)0x79,(char)0x6b,(char)0x74,(char)0x63,(char)0x5f,(char)0x5f,(char)0x5f,(char)0x5f, (char)0x51,(char)0xbf,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "yktc____" // KSC=191 [top KSC] {{(char)0x7a,(char)0x73,(char)0x6f,(char)0x5f,(char)0x38,(char)0x35,(char)0x39,(char)0x31, (char)0x02,(char)0x6f,(char)0xbe,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,(char)0x00,}}, // "zso_8591" // ASCII-7-bit=111 Latin1=190 [top Latin1] }; static const int kCharsetHintProbsSize = 438; static const uint8 kDefaultProb[NUM_RANKEDENCODING] = { // MaxRange 192 177, 170, 156, 149, 150, 142, 140, 124, 130, 127, 124, 118, 127, 118, 109, 104, 98, 93, 96, 82, 84, 81, 80, 64, 61, 57, 53, 47, 42, 28, 24, 22, 17, 0, 5, 1, 5, 12, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static const int kMaxTldKey = 4; static const int kMaxTldVector = 16; static const int kMaxCharsetKey = 8; static const int kMaxCharsetVector = 12; static const int kMaxLangKey = 8; static const int kMaxLangVector = 12; // Smoothing percentage across encodings with same UTF-8 result: 100% static const UnigramEntry unigram_table[NUM_RANKEDENCODING] = { { // ASCII-7-bit (788.373M chars) [0] {NULL, NULL, NULL, NULL}, 77, 207, 29, 27, 255, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,189,189,0,0,189,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, }, { // Latin1 (1792.786M chars) [1] {NULL, NULL, ced_hires_13, ced_hires_13, }, 87, 217, 37, 20, 128, {1,0,1,1,0,0,1,0, 0,9,9,0,1,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 186,137,105,112,140,106,126,145, 132,113,128,124,123,101,126,119, 141,113,107,116,129,113,113,143, 130,105,127,128,103,116,106,128, 122,138,132,155,161,129,133,190, 124,152,124,119,117,144,120,121, 127,136,122,132,112,139,144,116, 113,101,117,117,145,120,135,114, 121,138,107,125,163,129,131,190, 120,141,112,110,114,143,115,133, 124,135,126,131,118,141,160,110, 114,104,119,99,148,119,129,117, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 195,159,115,166,155,125,133,156, 130,168,156,159,121,135,150,133, 169,125,135,118,150,113,114,173, 126,107,176,178,97,131,103,170, 165,209,166,183,211,198,182,194, 193,219,182,153,130,205,161,148, 160,187,142,208,169,167,210,131, 192,122,189,152,212,181,158,185, 195,214,155,184,212,208,182,181, 183,213,171,154,161,215,150,137, 175,187,162,210,158,168,208,131, 192,156,189,142,199,193,155,120, }, {43,13,19,71,0,0,0,0, 0,145,153,0,0,165,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 226,142,175,92,109,120,168,161, 150,151,135,110,183,159,177,142, 146,163,159,149,146,144,137,136, 133,134,166,128,200,102,117,143, 102,197,188,202,195,190,180,196, 185,179,172,189,202,198,215,195, 185,164,216,206,204,172,190,182, 158,170,181,119,107,136,114,132, 134,194,189,198,192,189,178,194, 182,176,171,189,201,194,213,194, 181,151,213,203,201,171,189,182, 155,176,182,106,136,85,122,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 187,138,112,113,139,107,128,136, 133,137,118,120,118,129,135,123, 139,125,101,126,128,108,123,140, 131,107,125,133,123,119,104,138, 133,128,130,187,160,126,123,145, 123,153,122,122,114,136,125,117, 153,141,127,129,107,167,144,114, 113,105,118,118,134,117,122,164, 130,132,122,187,161,131,122,139, 122,137,119,120,113,138,123,110, 153,141,127,130,133,167,146,104, 117,105,130,109,131,117,133,119, }, {128,0,110,142,142,142,142,140, 0,0,142,142,142,142,142,142, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 22,0,2,2,2,2,2,2, 0,0,2,14,2,2,2,2, 46,0,2,14,2,2,2,2, 0,0,2,18,2,4,2,6, 16,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 42,0,2,10,2,2,2,2, 0,0,2,2,2,2,2,2, 18,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 38,0,2,6,2,2,2,2, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 164,0,136,164,110,108,108,106, 0,0,190,164,136,134,122,152, 158,0,144,156,112,116,106,106, 0,0,166,212,158,164,146,162, 90,0,92,96,139,139,94,92, 0,0,148,166,184,176,134,146, 98,0,96,104,139,139,110,110, 0,0,138,172,174,190,154,164, 130,0,138,126,38,48,135,135, 0,0,130,156,128,148,186,180, 120,0,126,120,48,56,139,141, 0,0,142,156,140,186,166,188, }, }, { // UTF8 (16713.069M chars) [2] {NULL, NULL, NULL, NULL}, 169, 203, 42, 24, 131, {197,207,201,202,188,181,180,180, 188,183,184,187,188,182,178,183, 181,179,172,178,182,182,183,183, 181,181,183,180,189,181,175,180, 182,183,175,177,184,183,183,184, 187,176,181,181,178,186,187,184, 187,177,175,183,184,176,174,177, 196,183,188,186,194,184,180,181, 0,0,183,211,189,187,147,104, 65,123,87,102,121,13,187,176, 216,203,118,108,88,134,124,193, 206,202,155,161,58,0,119,0, 181,176,180,213,192,206,202,197, 192,187,165,177,183,170,90,182, 71,0,0,13,1,0,0,0, 0,0,0,0,0,0,0,0, 119,115,120,96,114,98,104,106, 121,111,96,110,113,105,109,100, 109,107,92,112,112,97,91,102, 110,119,116,99,117,110,104,106, 133,132,135,130,132,139,129,131, 133,127,121,126,132,128,121,138, 136,128,120,126,145,114,120,123, 132,124,128,122,138,120,117,132, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,64, }, {0,0,0,0,0,0,0,0, 0,109,143,0,0,144,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 189,125,169,73,68,107,151,137, 146,147,111,102,152,138,154,129, 142,152,148,137,131,132,127,127, 123,121,139,118,189,98,96,127, 87,124,119,124,117,115,112,111, 114,127,109,102,114,120,120,114, 120,94,118,122,122,113,106,113, 95,99,88,117,109,125,97,107, 80,139,113,146,112,126,103,99, 115,147,96,97,118,131,156,123, 132,80,111,140,146,136,107,102, 86,116,85,83,110,84,118,0, 204,210,207,204,196,192,190,188, 194,187,191,189,194,188,179,187, 184,183,175,181,186,187,183,187, 184,189,185,186,191,184,178,186, 192,196,179,183,192,185,183,198, 192,196,189,182,182,193,189,192, 199,194,188,195,190,194,185,185, 203,191,196,195,200,196,197,188, 0,0,121,113,72,69,49,4, 0,0,0,71,0,0,113,107, 113,102,0,0,0,0,19,86, 134,132,91,105,0,0,0,0, 174,140,150,207,185,199,194,190, 187,181,160,174,177,157,75,176, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 6,0,2,2,2,6,2,2, 0,0,0,0,50,38,2,128, 4,0,2,2,2,4,2,2, 0,0,0,0,54,40,2,128, 4,0,2,2,2,6,2,2, 0,0,0,0,128,128,128,128, 2,0,2,2,2,2,2,2, 0,0,0,0,128,128,128,128, 2,0,2,2,2,2,2,2, 0,0,0,0,128,128,128,128, 128,0,118,118,128,128,128,128, 0,0,0,0,128,128,64,128, 176,0,168,172,172,172,162,164, 120,126,126,116,126,140,134,128, 168,0,170,166,172,170,174,176, 118,122,118,116,142,116,138,128, 168,0,170,168,168,172,176,174, 110,120,114,112,136,142,140,128, 168,0,172,170,160,166,160,164, 120,126,118,116,140,134,136,128, 0,0,0,0,0,0,0,0, 116,122,140,128,0,0,0,0, 0,0,0,0,0,0,0,0, 128,120,126,134,0,0,0,0, 0,0,0,0,0,0,0,0, 134,132,120,126,0,0,0,0, 0,0,0,0,0,0,0,0, 116,152,138,116,0,0,0,0, }, }, { // GB (9061.562M chars) [3] {NULL, ced_hires_3, ced_hires_4, ced_hires_5, }, 204, 189, 27, 16, 128, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,66,73, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 70,204,125,202,219,216,120,114, 118,156,113,85,96,78,81,79, 190,196,199,195,195,208,196,199, 196,203,195,200,201,197,193,195, 193,195,190,195,195,183,196,191, 201,197,207,197,197,198,201,199, 201,191,203,201,198,196,202,200, 134,116,114,132,122,124,118,115, 115,120,116,120,141,121,124,123, 121,120,121,113,125,116,117,110, 117,114,112,113,119,112,124,123, 84,74,83,78,69,83,77,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,93,66,68,84,3,51,0, 116,102,41,61,83,57,66,12, 70,85,73,66,54,64,44,68, 0,3,3,3,54,73,70,54, 95,66,54,44,66,78,26,37, 57,41,3,57,13,2,0,0, 54,51,0,41,68,70,70,59, 41,70,41,13,0,64,59,80, 12,3,51,12,13,26,41,3, 0,79,47,61,2,19,66,64, 37,37,13,93,54,13,54,51, 51,12,59,73,89,54,54,94, }, {101,14,0,0,0,0,0,0, 16,16,0,0,68,49,44,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 81,56,73,0,0,0,64,71, 49,49,0,84,53,69,60,32, 84,60,49,35,15,19,18,1, 2,0,15,0,92,29,0,0, 83,69,66,85,103,49,69,51, 56,71,53,83,70,73,65,91, 71,59,61,71,80,77,72,79, 61,69,67,64,66,73,77,73, 70,75,71,70,86,62,64,69, 71,66,39,69,73,64,74,75, 79,69,71,70,83,80,53,92, 69,66,59,69,69,85,90,3, 94,72,77,73,64,67,62,71, 80,76,76,72,65,74,80,73, 77,93,79,99,84,69,81,94, 51,35,67,74,49,67,84,78, 126,196,197,192,196,176,185,184, 195,185,196,194,198,187,184,191, 190,190,180,189,189,194,181,191, 182,191,188,196,189,191,187,192, 186,174,192,193,203,190,193,194, 190,188,189,195,181,187,196,191, 200,178,184,186,189,186,192,180, 193,176,195,182,185,179,182,186, 185,187,190,185,183,187,185,186, 177,190,189,192,187,187,181,180, 178,185,188,196,172,177,186,192, 192,182,197,186,178,187,185,0, }, {128,0,128,128,128,128,128,128, 128,128,104,128,114,124,128,118, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 46,0,46,50,32,40,40,34, 128,128,26,28,26,30,32,32, 42,0,42,44,26,34,34,28, 128,128,46,50,46,52,54,54, 44,0,44,46,28,36,36,30, 128,128,48,50,46,52,56,54, 50,0,50,54,34,42,42,38, 128,128,50,52,50,56,58,58, 128,0,128,128,128,128,128,128, 128,128,58,62,58,64,70,66, 128,0,128,128,128,128,128,128, 128,128,40,42,40,44,48,46, 0,0,0,0,154,180,164,168, 188,176,128,106,122,124,134,92, 0,0,0,0,128,128,128,136, 128,128,132,130,130,132,130,130, 0,0,0,0,242,218,218,232, 138,134,137,131,129,117,127,113, 0,0,0,0,202,206,218,216, 110,112,129,127,129,127,127,131, 0,0,0,0,202,218,218,206, 114,106,122,126,126,128,130,132, 0,0,0,0,210,214,206,206, 120,114,124,128,126,136,122,126, 0,0,0,0,206,208,200,202, 218,236,136,124,124,122,126,126, 230,194,200,214,190,198,194,216, 192,186,128,122,132,128,130,120, }, }, { // CP1252 (408.280M chars) [4] {NULL, NULL, ced_hires_13, ced_hires_13, }, 89, 209, 40, 30, 128, {116,114,130,121,123,133,113,118, 108,96,180,101,111,113,172,102, 63,68,105,82,59,104,73,70, 61,79,141,65,74,59,133,92, 184,136,106,111,139,104,125,143, 132,111,126,123,121,100,125,118, 143,111,106,114,127,111,112,142, 128,104,127,127,102,114,106,126, 120,172,132,158,159,131,136,188, 123,153,123,119,120,159,118,120, 127,136,121,131,136,137,143,117, 112,109,131,116,143,151,134,114, 120,172,130,128,161,130,131,188, 120,143,112,109,119,159,114,131, 122,133,125,130,137,139,158,109, 114,108,131,98,146,151,128,116, 169,126,98,99,143,148,118,105, 94,83,203,88,113,99,199,98, 95,134,176,160,158,170,169,143, 114,141,201,118,111,110,201,130, 193,157,113,163,153,123,131,154, 127,166,153,157,119,132,148,131, 167,123,133,115,148,111,112,171, 124,105,174,176,96,128,101,168, 163,207,164,180,208,196,180,192, 191,217,180,151,128,203,159,146, 158,185,140,206,167,165,207,128, 190,119,187,150,210,179,156,183, 193,212,152,182,209,206,180,179, 181,211,168,151,159,213,148,135, 173,185,160,208,156,166,206,129, 190,153,187,139,197,191,153,118, }, {128,43,4,69,19,0,0,0, 0,146,153,0,0,165,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 226,141,174,92,108,119,170,160, 148,152,134,110,182,158,177,142, 147,162,157,147,145,143,136,135, 132,133,165,129,200,100,121,143, 118,197,187,200,193,200,178,194, 183,191,170,191,201,196,214,194, 184,162,214,205,205,174,188,180, 157,168,179,122,110,135,115,131, 133,196,189,196,191,201,176,192, 180,192,169,191,199,192,212,193, 182,149,211,202,203,175,187,180, 153,174,180,105,136,86,122,30, 113,107,124,132,114,134,112,118, 113,93,171,97,104,105,166,96, 99,108,124,118,117,133,112,109, 102,129,171,117,112,107,166,135, 183,137,111,110,137,105,126,133, 132,134,125,119,116,126,133,122, 144,123,99,123,127,108,120,139, 128,105,124,131,120,117,103,138, 130,152,132,184,157,126,125,142, 124,153,120,120,118,183,123,115, 150,138,125,127,107,164,145,111, 111,103,118,117,132,116,120,161, 130,157,121,184,158,129,123,136, 124,145,121,118,111,183,121,110, 150,139,124,127,130,164,143,101, 116,102,132,106,129,115,130,117, }, {32,0,2,24,2,2,2,2, 22,20,16,36,6,24,6,26, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 24,0,2,2,2,2,2,2, 2,2,2,16,2,2,2,4, 46,0,2,16,2,2,2,2, 6,6,2,20,2,6,2,10, 14,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 38,0,2,6,2,2,2,2, 2,2,2,2,2,2,2,2, 14,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 34,0,2,4,2,2,2,2, 2,2,2,2,2,2,2,2, 130,0,106,124,140,126,112,112, 160,134,134,140,180,136,142,134, 134,0,132,126,86,84,140,128, 118,162,132,166,130,138,180,136, 162,0,136,166,110,110,108,106, 118,138,192,162,130,136,116,152, 158,0,144,154,112,118,106,106, 148,164,166,210,152,164,138,164, 88,0,92,96,139,141,94,92, 180,136,146,162,174,174,124,144, 98,0,96,104,139,139,110,112, 184,150,134,164,162,186,142,158, 128,0,138,128,38,48,135,137, 130,178,128,152,118,146,176,178, 120,0,126,120,48,56,139,141, 136,180,140,150,130,184,156,184, }, }, { // KSC (5258.976M chars) [5] {NULL, ced_hires_6, ced_hires_7, ced_hires_8, }, 203, 186, 27, 9, 128, {71,109,117,106,108,109,104,107, 110,108,108,112,103,104,106,105, 102,108,101,103,104,107,99,103, 104,99,107,103,102,103,107,98, 106,206,164,204,164,121,141,122, 146,119,136,130,120,90,91,81, 216,212,164,201,215,207,187,206, 213,208,207,204,210,209,205,216, 225,214,178,201,188,198,199,213, 199,93,107,104,116,113,115,113, 108,107,109,113,110,97,99,104, 101,113,115,107,110,108,111,117, 110,108,103,116,115,142,146,136, 118,134,125,131,144,112,112,126, 112,117,107,103,107,103,102,104, 101,114,109,104,105,93,0,0, 52,0,0,60,0,1,0,0, 0,12,0,0,28,0,18,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,78,41,83,69,52,75,65, 1,50,60,76,0,62,88,58, 79,72,60,68,0,65,54,44, 72,58,78,86,46,82,73,48, 57,67,58,67,72,57,60,86, 18,31,65,50,69,65,85,79, 52,57,54,34,54,0,41,38, 0,78,82,58,50,78,1,46, 0,57,68,0,72,67,48,65, 48,41,31,107,18,67,63,0, 12,48,0,52,0,28,85,46, 82,67,44,48,48,1,0,0, }, {0,0,0,0,0,0,0,0, 0,44,71,0,0,61,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 117,80,77,0,0,0,66,63, 78,84,0,97,84,72,82,66, 4,74,65,78,51,54,50,9, 24,6,52,5,117,40,0,44, 63,9,0,52,36,0,9,0, 0,0,0,24,48,0,51,51, 60,1,55,58,40,0,7,6, 59,8,0,81,54,73,75,73, 57,2,57,35,48,28,1,2, 0,42,0,6,50,1,20,8, 38,0,0,32,57,0,4,2, 35,32,36,56,57,50,89,38, 66,99,111,102,98,106,96,97, 95,99,98,96,98,104,96,95, 98,97,92,103,92,97,93,96, 95,96,104,97,94,93,92,91, 157,208,188,195,195,184,194,180, 174,186,184,181,197,195,200,187, 193,181,186,192,167,192,186,169, 205,187,203,199,192,172,174,185, 186,179,196,199,181,187,182,201, 179,175,184,177,204,183,204,207, 190,189,185,176,191,179,192,189, 182,200,194,190,178,181,182,187, 177,176,199,166,189,187,186,198, 184,182,174,196,175,194,193,169, 178,186,174,191,161,176,204,191, 198,180,187,178,193,181,149,9, }, {128,0,128,128,128,128,128,128, 128,128,80,86,78,94,92,92, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 92,0,42,48,90,68,96,74, 128,128,44,44,42,48,48,50, 58,0,10,16,56,36,58,40, 128,128,42,44,40,46,48,48, 66,0,18,26,66,44,66,50, 128,128,42,44,42,48,48,50, 128,0,128,128,128,128,128,128, 128,128,50,52,48,58,58,58, 128,0,108,108,128,128,128,128, 128,128,40,40,38,44,44,46, 128,0,128,128,128,128,128,128, 128,128,54,56,50,60,58,60, 0,0,0,0,186,204,190,182, 244,244,124,124,72,82,142,64, 0,0,0,0,164,206,174,184, 240,238,122,124,78,80,144,52, 0,0,0,0,186,200,180,188, 142,140,147,131,99,107,101,91, 0,0,0,0,174,196,184,194, 112,114,125,127,127,125,133,129, 0,0,0,0,196,204,194,204, 120,108,124,126,130,132,116,128, 0,0,0,0,0,0,0,0, 0,0,124,130,122,130,126,126, 0,0,0,0,0,0,0,0, 0,0,144,130,102,108,110,110, 0,0,0,0,0,0,0,0, 0,0,126,130,124,124,130,126, }, }, { // SJS (6339.756M chars) [6] {NULL, NULL, NULL, NULL}, 151, 136, 55, 16, 129, {50,188,238,215,160,59,66,108, 192,200,192,194,200,199,202,200, 190,190,186,192,182,192,188,186, 101,96,109,95,94,95,102,113, 84,100,117,108,117,135,81,77, 99,97,99,87,94,104,96,118, 120,115,111,101,96,105,108,108, 111,98,126,107,129,116,102,97, 121,104,84,106,118,104,105,80, 97,98,110,102,121,108,114,99, 91,90,109,89,86,81,89,103, 106,103,118,100,101,114,121,115, 114,112,106,111,106,104,109,112, 108,105,167,179,185,80,87,184, 83,79,20,45,22,55,39,0, 21,0,65,55,62,0,0,0, 0,223,195,229,105,32,59,131, 61,180,189,185,180,185,191,185, 177,167,169,174,171,174,169,172, 163,80,84,78,90,80,80,85, 59,108,81,89,100,121,105,17, 50,24,63,0,25,17,1,53, 95,61,66,50,0,31,31,81, 122,2,32,1,95,88,0,56, 61,50,56,0,94,59,44,0, 38,84,50,0,106,63,0,18, 44,63,28,0,24,0,80,50, 56,88,38,24,1,93,98,91, 113,91,95,105,97,102,91,93, 93,99,91,0,23,0,0,44, 0,76,0,0,7,42,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,15,79,0,0,65,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 113,69,98,19,0,8,69,67, 80,86,51,58,73,87,70,67, 54,73,78,62,54,54,44,46, 38,34,67,70,119,41,36,55, 200,198,192,189,158,190,180,168, 171,181,178,171,176,161,191,184, 172,169,180,178,178,160,185,181, 191,169,175,200,180,158,184,172, 177,159,190,176,163,179,174,191, 178,187,183,159,184,168,174,182, 179,167,178,179,178,180,188,176, 172,175,172,178,169,173,171,37, 175,177,171,172,170,176,176,180, 168,182,188,188,179,179,172,172, 155,178,155,196,173,164,176,173, 162,162,164,156,168,174,177,175, 179,175,195,159,185,163,180,172, 181,189,191,180,175,184,173,177, 166,185,174,185,165,192,178,192, 167,176,168,178,189,191,180,179, 167,183,176,162,191,193,192,176, 191,193,177,160,203,189,170,166, 173,161,169,158,174,146,173,170, 162,160,175,166,189,175,165,174, 186,163,175,177,160,176,185,183, 187,191,188,159,174,173,175,176, 193,187,161,164,151,172,158,144, 152,140,181,168,175,37,20,2, }, {46,0,6,6,2,2,2,2, 2,2,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 128,0,126,120,8,12,14,18, 34,38,30,30,26,42,32,42, 128,0,128,126,6,10,10,14, 38,42,34,34,30,46,36,46, 128,0,128,128,10,14,16,20, 52,56,48,46,42,60,50,60, 128,0,128,128,12,16,18,22, 52,56,48,46,42,60,50,60, 94,0,52,54,2,2,2,2, 32,38,28,28,24,40,30,40, 128,0,128,128,46,50,52,58, 82,88,78,78,72,94,80,90, 0,0,0,0,140,140,138,138, 132,130,132,130,134,132,132,128, 0,0,0,0,134,142,142,142, 130,136,134,134,124,134,132,142, 214,0,248,242,110,114,102,98, 152,140,134,122,120,120,88,72, 182,0,226,234,144,134,80,86, 136,114,134,134,126,154,96,86, 178,0,234,228,102,112,100,108, 140,126,126,128,112,160,72,74, 180,0,232,230,100,114,108,110, 138,130,120,146,128,142,50,56, 0,0,0,0,134,146,130,142, 138,144,128,148,64,80,66,78, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, }, { // EUC-JP (4368.914M chars) [7] {NULL, ced_hires_0, ced_hires_1, ced_hires_2, }, 202, 178, 27, 15, 128, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,173,100, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,228,186,180,229,225,122,123, 168,7,2,28,62,133,86,74, 195,190,202,195,193,195,191,198, 201,199,199,204,200,197,198,200, 200,193,197,196,192,199,202,195, 189,196,201,190,197,197,191,183, 120,107,102,109,112,111,101,113, 107,110,96,107,105,115,111,124, 116,109,107,105,105,141,147,137, 110,140,100,120,146,102,103,102, 105,112,105,133,84,0,0,0, 0,54,7,43,73,0,9,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {146,59,0,0,61,22,13,0, 60,71,0,0,80,26,61,28, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 83,27,41,0,46,51,35,0, 49,37,24,68,35,38,32,13, 131,42,28,35,34,12,0,0, 63,21,33,0,74,25,11,68, 61,0,0,0,68,11,0,0, 31,1,1,0,39,0,101,78, 61,83,87,94,79,39,85,70, 76,64,19,86,75,87,77,75, 72,46,73,78,49,96,75,69, 60,49,27,69,85,65,60,49, 74,36,61,72,76,65,80,67, 67,77,74,64,73,63,88,36, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 164,202,199,199,199,177,202,190, 185,187,195,193,192,191,183,196, 192,181,174,190,182,189,177,195, 190,197,177,183,211,189,184,194, 186,192,177,195,187,176,192,194, 198,186,201,196,186,188,198,191, 190,186,182,176,189,182,193,190, 188,181,187,183,189,177,189,189, 180,185,188,180,184,187,184,191, 191,188,197,192,194,179,192,186, 182,187,188,200,180,176,184,190, 174,170,179,160,193,182,193,31, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,44,8,34,20,28,28, 0,0,0,0,0,0,0,0, 2,0,56,14,40,28,34,34, 0,0,0,0,0,0,0,0, 2,0,60,16,42,30,36,38, 0,0,0,0,0,0,0,0, 92,0,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 70,0,128,88,128,128,128,128, 0,0,0,0,0,0,0,0, 102,0,128,120,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,146,186,190,162,182,180, 178,180,134,130,124,136,18,30, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 246,0,174,232,204,218,212,204, 0,0,131,131,129,123,123,117, 250,0,190,230,210,212,216,214, 0,0,125,121,125,131,131,133, 250,0,192,232,204,216,202,214, 0,0,120,126,124,128,128,132, 244,0,172,236,206,224,218,216, 0,0,126,128,124,130,124,128, 246,0,202,232,208,214,212,210, 0,0,144,110,104,110,108,108, 238,0,210,224,196,224,210,208, 0,0,118,114,104,116,104,152, }, }, { // BIG5 (2431.102M chars) [8] {NULL, NULL, NULL, NULL}, 157, 174, 62, 10, 129, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,70,70, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,182,164,130,214,207,204,195, 202,198,207,192,194,201,196,187, 202,189,195,196,188,194,190,181, 194,188,192,185,188,188,191,185, 184,179,185,186,180,189,110,108, 94,123,111,121,108,113,105,112, 116,103,101,106,110,102,114,99, 88,91,120,98,95,107,108,94, 113,93,95,93,94,131,139,129, 121,130,93,111,138,87,98,87, 90,89,97,92,97,92,92,96, 102,147,84,82,84,87,88,107, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,216,162,127,212,204,205,192, 184,187,189,191,193,185,187,179, 188,190,183,192,177,189,189,198, 181,189,172,184,183,180,173,165, 177,175,172,174,167,176,167,100, 42,127,129,92,89,80,107,94, 90,84,93,108,107,102,93,84, 105,100,83,90,94,79,92,95, 84,84,90,92,77,89,103,113, 89,87,81,74,82,87,92,56, 77,96,70,88,72,107,102,81, 90,70,90,80,91,56,42,19, }, {90,0,0,0,0,0,0,0, 0,0,0,0,0,4,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 77,44,72,0,0,0,44,0, 53,54,4,69,21,39,51,1, 78,36,31,5,0,4,0,0, 0,0,5,0,85,0,0,0, 200,201,188,193,189,168,184,189, 192,178,176,174,183,184,182,191, 186,180,173,170,180,184,162,188, 182,171,166,172,168,185,178,176, 173,183,178,161,180,180,169,177, 177,186,185,178,177,170,187,186, 184,188,165,193,177,186,185,182, 179,178,178,175,185,176,192,2, 51,0,0,0,0,0,0,0, 0,0,0,19,0,0,0,14, 52,0,0,0,3,17,19,1, 0,0,0,0,0,0,0,0, 157,190,169,191,185,175,165,184, 179,175,174,184,175,175,167,166, 181,177,178,189,170,179,183,169, 182,186,200,181,167,183,169,167, 184,179,171,169,182,173,187,181, 182,184,182,175,183,177,188,186, 186,187,182,194,163,176,175,182, 180,172,184,181,179,176,173,180, 175,175,178,172,178,181,187,170, 177,191,189,178,186,179,167,176, 165,169,173,182,190,175,181,181, 187,183,185,177,183,178,177,107, }, {128,0,128,128,72,86,86,80, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 48,0,42,44,2,2,2,2, 80,76,2,2,2,2,2,2, 54,0,52,52,2,2,2,2, 96,96,2,2,2,2,2,2, 74,0,76,72,2,2,2,2, 128,128,2,2,2,2,2,2, 128,0,128,128,8,18,18,14, 128,128,28,26,26,26,26,28, 128,0,128,128,2,4,4,2, 128,128,34,30,30,30,32,32, 128,0,128,128,4,14,12,10, 128,128,38,34,34,34,36,36, 0,0,0,0,160,160,160,166, 0,0,160,122,152,116,140,114, 0,0,0,0,150,150,150,148, 0,0,148,150,150,150,150,148, 0,0,0,0,142,138,138,134, 0,0,136,138,134,134,136,134, 0,0,0,0,132,138,142,146, 0,0,136,130,138,138,134,136, 0,0,0,0,136,146,134,142, 0,0,126,134,134,130,144,140, 0,0,0,0,136,138,138,144, 0,0,142,144,128,136,130,124, 0,0,0,0,144,140,134,134, 0,0,160,126,108,102,108,106, 224,128,202,216,130,148,132,136, 204,204,126,118,114,144,122,150, }, }, { // Latin2 (315.882M chars) [9] {NULL, NULL, ced_hires_14, ced_hires_14, }, 90, 204, 45, 27, 127, {0,0,0,0,0,0,0,0, 0,13,13,0,0,13,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 176,178,79,184,121,96,188,129, 119,153,115,86,132,84,143,152, 125,178,73,182,114,95,188,79, 117,152,115,86,133,93,141,152, 89,170,119,130,151,109,85,137, 171,147,170,100,153,155,102,118, 87,92,116,171,110,99,128,101, 181,128,158,80,133,126,117,98, 90,170,94,124,153,103,95,127, 169,141,170,94,155,155,99,117, 81,92,116,171,113,99,148,82, 180,129,154,79,137,126,117,81, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 185,202,72,207,144,140,210,145, 119,178,153,122,170,124,172,196, 158,217,79,211,140,141,210,120, 115,176,151,152,187,124,173,200, 97,198,155,156,200,127,165,183, 202,208,195,143,194,195,151,143, 149,174,157,197,159,157,199,120, 192,171,178,136,201,170,155,174, 102,203,144,173,201,101,197,171, 203,203,208,143,202,204,139,150, 148,188,166,199,147,166,197,121, 192,191,178,144,189,182,155,121, }, {65,0,0,0,0,0,0,0, 0,129,154,0,0,162,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 228,154,181,85,87,110,164,158, 144,155,125,102,191,153,189,148, 131,145,140,130,127,125,117,115, 113,114,177,135,201,88,123,155, 81,200,180,210,197,203,168,188, 175,191,170,190,200,190,208,194, 182,141,204,199,200,181,182,186, 146,188,181,102,112,126,100,120, 110,200,181,209,196,205,167,186, 172,191,169,190,200,189,207,194, 180,135,203,198,199,182,181,191, 143,189,181,91,125,72,102,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 176,176,79,167,122,89,163,118, 119,144,100,124,140,114,142,179, 121,178,71,168,109,88,163,67, 117,144,103,124,140,102,142,179, 91,160,116,126,149,84,190,132, 166,138,143,91,83,185,105,126, 81,118,127,168,91,58,130,99, 171,124,126,82,122,95,120,153, 93,161,107,127,150,87,190,124, 167,128,145,91,82,185,102,129, 83,119,127,170,121,59,134,85, 172,125,112,80,118,93,120,85, }, {132,0,128,156,156,156,156,154, 0,0,156,156,156,156,156,156, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 10,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 14,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 24,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 24,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 24,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 24,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 132,0,98,130,142,136,102,114, 0,0,172,130,168,162,108,142, 130,0,136,132,52,54,136,130, 0,0,108,174,82,90,170,166, 98,0,90,98,141,143,100,90, 0,0,164,118,170,178,130,128, 100,0,92,100,139,143,108,110, 0,0,166,92,174,156,128,142, 134,0,136,134,36,54,135,135, 0,0,114,168,90,144,168,180, 130,0,130,134,40,56,137,141, 0,0,102,170,80,158,172,156, }, }, { // CP1251 (2609.249M chars) [10] {NULL, NULL, ced_hires_10, ced_hires_10, }, 190, 219, 69, 19, 128, {61,54,71,50,88,0,0,0, 0,0,73,0,84,68,72,51, 56,82,97,103,74,0,0,0, 0,0,69,0,81,63,70,32, 175,85,84,108,0,54,0,0, 121,94,119,0,0,89,99,124, 0,0,150,148,47,70,0,0, 121,0,117,0,105,2,0,124, 203,190,201,189,197,200,175,191, 205,172,201,198,196,207,207,203, 205,207,204,187,179,172,176,183, 172,169,147,176,170,168,160,171, 201,185,197,186,194,200,174,188, 203,172,197,197,192,205,205,197, 203,204,203,185,172,167,174,181, 170,169,147,176,170,161,157,169, 31,0,88,0,134,0,0,0, 85,0,28,0,0,0,5,0, 0,100,141,125,124,0,0,0, 1,0,16,0,11,11,33,0, 184,2,95,21,0,6,0,0, 87,157,63,0,0,123,138,72, 0,0,102,143,7,102,0,0, 126,0,110,0,84,0,0,130, 157,125,161,130,131,135,111,123, 148,122,140,123,137,137,153,133, 131,147,134,135,118,122,118,114, 110,103,83,118,114,116,116,143, 193,147,189,166,165,195,131,156, 199,187,178,167,181,169,190,141, 170,175,180,173,120,175,145,137, 140,111,88,180,182,106,164,193, }, {0,0,0,0,0,0,0,0, 0,123,152,0,0,158,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 223,147,180,67,83,115,163,151, 135,154,99,111,188,166,187,138, 128,140,138,123,122,123,115,111, 108,109,171,133,198,101,111,143, 134,133,114,124,118,126,111,112, 113,129,111,108,118,121,114,117, 124,83,116,126,121,108,110,114, 76,103,91,97,102,121,55,113, 81,143,106,111,119,137,102,102, 116,138,96,102,116,118,119,128, 122,71,118,150,131,126,116,96, 72,98,99,47,123,70,85,0, 48,44,53,47,0,85,0,0, 0,0,66,0,81,17,64,0, 50,75,98,66,98,71,62,54, 0,60,67,96,81,29,65,16, 175,84,89,98,74,0,54,89, 125,68,109,58,57,85,81,121, 74,34,155,158,0,74,29,81, 128,29,110,103,98,0,0,121, 210,181,193,178,187,209,169,174, 206,177,192,194,187,202,211,177, 199,195,203,188,160,171,169,173, 162,156,142,188,185,132,168,185, 213,184,195,179,188,212,171,176, 208,178,193,197,188,203,215,181, 203,197,205,192,162,172,170,174, 162,157,150,190,185,141,170,186, }, {128,0,52,78,128,128,128,128, 128,128,74,82,12,26,10,22, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 42,0,2,6,48,58,46,48, 106,84,22,28,2,2,2,2, 56,0,2,20,64,76,62,64, 128,128,56,64,2,8,2,6, 2,0,2,2,2,2,2,2, 128,110,26,34,2,2,2,2, 2,0,2,2,2,6,2,2, 128,128,42,50,2,2,2,2, 2,0,2,2,2,2,2,2, 66,44,2,2,2,2,2,2, 2,0,2,2,2,8,2,2, 80,56,2,4,2,2,2,2, 130,0,112,138,218,228,196,188, 184,166,182,184,138,132,110,112, 144,0,134,138,190,188,202,204, 196,226,158,170,124,124,124,126, 174,0,136,170,182,184,172,174, 168,194,204,146,106,102,84,84, 154,0,152,148,150,166,162,138, 158,178,156,166,124,128,130,130, 146,0,152,154,166,162,144,134, 134,86,98,126,139,139,112,110, 148,0,150,162,176,170,154,134, 130,104,96,128,139,141,112,108, 150,0,154,148,132,128,120,110, 122,130,92,130,6,4,139,139, 150,0,154,152,96,132,122,106, 124,124,82,130,6,2,139,141, }, }, { // CP1256 (4291.965M chars) [11] {NULL, NULL, NULL, NULL}, 175, 213, 75, 16, 129, {89,120,82,85,70,119,81,87, 78,57,0,61,52,107,87,0, 120,88,122,83,73,125,94,89, 114,96,1,85,34,116,73,0, 173,142,76,85,128,71,110,132, 117,107,30,127,106,73,102,99, 133,84,73,90,108,82,96,130, 115,70,110,116,69,78,76,146, 37,143,167,196,136,188,168,229, 204,148,208,168,191,193,183,197, 170,203,175,195,189,190,178,101, 181,157,204,175,195,197,193,197, 97,209,116,216,198,191,209,110, 85,125,90,85,128,210,82,85, 126,99,116,154,99,137,142,85, 146,71,143,75,117,89,124,44, 157,89,85,86,132,136,106,93, 83,69,0,77,102,72,53,0, 66,103,144,128,127,138,137,111, 67,109,0,87,78,86,35,10, 182,172,102,152,141,111,120,142, 116,155,25,145,107,121,136,120, 155,111,121,104,137,100,101,159, 112,93,117,165,83,117,88,152, 26,167,114,129,77,84,119,189, 178,200,192,163,167,160,159,182, 136,190,152,168,143,156,162,117, 154,133,178,121,152,172,165,172, 181,188,141,190,186,184,180,168, 169,200,157,140,190,187,136,123, 149,117,121,139,145,135,137,118, 122,142,125,128,186,100,134,77, }, {116,3,1,0,0,0,0,0, 0,134,143,0,0,157,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 228,134,177,78,100,111,160,151, 140,149,130,106,178,144,169,141, 137,152,147,136,134,132,126,124, 121,123,169,107,200,102,108,114, 99,132,117,131,120,127,115,113, 116,121,112,109,121,123,118,119, 123,94,122,129,129,117,115,119, 115,108,101,110,97,133,114,122, 120,160,152,167,156,164,144,156, 150,149,124,140,162,163,170,153, 151,130,177,173,168,136,148,104, 122,130,139,80,126,96,114,0, 97,97,88,86,83,119,83,85, 98,64,79,60,61,80,88,47, 115,91,101,80,93,122,92,91, 105,117,46,102,80,115,80,37, 173,163,81,85,125,72,114,122, 119,118,106,104,102,81,117,107, 133,87,73,88,113,82,96,129, 115,78,124,125,69,76,76,152, 36,168,139,171,153,157,172,218, 198,200,201,168,187,192,186,204, 174,209,179,200,190,181,185,101, 182,157,199,169,196,190,195,192, 104,226,105,204,209,198,208,118, 101,130,101,80,174,214,92,83, 163,120,130,171,118,155,158,79, 156,70,154,80,108,87,119,81, }, {90,0,18,44,128,128,54,56, 102,84,40,60,2,2,2,34, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 42,0,2,2,48,48,10,14, 62,48,10,28,2,2,2,2, 62,0,2,22,72,74,30,34, 80,62,22,42,2,2,2,16, 2,0,2,2,2,2,2,2, 36,24,2,6,2,2,2,2, 2,0,2,2,2,2,2,2, 48,34,2,16,2,2,2,2, 2,0,2,2,2,2,2,2, 30,18,2,2,2,2,2,2, 48,0,2,8,54,56,16,20, 64,52,12,30,2,2,2,4, 178,0,138,160,188,202,138,136, 246,218,168,188,116,124,126,114, 160,0,142,144,184,174,160,162, 212,248,162,204,118,126,126,120, 168,0,140,164,178,172,140,138, 162,176,200,170,106,100,92,136, 172,0,144,162,174,166,138,138, 212,212,170,220,92,90,90,122, 142,0,150,150,92,128,44,72, 114,114,114,108,128,130,134,130, 142,0,150,148,114,142,74,80, 126,116,112,110,134,132,130,132, 140,0,148,142,112,124,154,154, 120,132,116,116,134,132,128,132, 140,0,132,132,126,136,172,174, 158,152,148,140,132,130,128,164, }, }, { // CP1250 (456.295M chars) [12] {NULL, NULL, ced_hires_15, ced_hires_15, }, 90, 207, 44, 30, 128, {106,94,109,3,114,124,102,101, 0,71,177,95,143,118,167,98, 48,59,96,73,40,99,64,61, 0,67,141,59,108,83,130,60, 178,82,81,175,131,134,115,136, 125,101,117,114,114,90,115,134, 133,104,75,173,117,99,105,135, 120,134,117,119,129,95,129,131, 94,177,121,140,156,127,86,139, 173,151,161,106,170,163,105,122, 92,104,118,172,129,101,131,105, 183,159,162,83,135,145,120,103, 95,177,123,127,157,116,103,130, 171,145,162,96,170,163,102,121, 83,93,119,172,131,103,150,86, 182,159,158,82,139,145,119,83, 162,120,91,35,137,141,111,98, 13,75,196,81,168,151,193,131, 88,128,169,153,152,163,162,136, 10,134,194,112,166,184,194,139, 187,92,75,209,146,163,125,147, 121,160,155,150,112,126,141,198, 160,116,81,213,142,104,106,164, 117,176,153,170,170,126,171,202, 99,200,157,158,202,129,167,185, 204,210,197,145,196,197,153,145, 151,176,159,199,161,159,201,122, 194,173,180,138,203,172,157,176, 104,205,146,175,203,103,199,173, 205,205,211,145,204,206,141,152, 150,191,168,201,150,168,199,123, 194,193,180,146,191,184,157,123, }, {122,0,0,0,0,0,0,0, 0,143,154,0,0,165,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 227,153,180,86,97,112,169,159, 147,157,128,106,190,155,189,149, 138,150,147,134,133,129,124,123, 120,121,178,134,203,92,128,154, 110,204,183,200,193,208,171,187, 178,196,172,193,197,190,210,197, 183,143,205,201,201,184,184,176, 150,190,178,114,114,132,107,122, 115,204,184,198,191,209,169,185, 175,197,172,193,196,187,209,197, 181,137,202,200,201,186,184,176, 145,192,178,94,130,77,114,0, 105,89,105,77,114,127,87,104, 65,77,167,87,121,154,174,103, 85,93,106,115,112,126,100,99, 71,123,167,110,121,155,174,104, 177,116,81,166,127,131,117,124, 123,122,102,105,107,115,124,164, 136,109,72,166,119,93,103,132, 119,133,104,122,116,103,122,164, 93,165,121,130,150,102,158,134, 169,143,144,96,85,190,109,129, 88,98,136,169,98,62,135,101, 172,130,135,83,124,100,121,154, 95,167,111,128,151,90,158,126, 170,139,146,91,84,191,105,135, 89,99,137,172,123,63,135,88, 173,130,131,81,120,97,121,86, }, {28,0,2,18,2,2,2,2, 14,14,14,22,4,16,2,16, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 22,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 32,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 16,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 18,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 16,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 18,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 130,0,104,120,140,130,110,116, 162,132,114,116,180,146,140,112, 134,0,136,128,84,84,138,128, 108,162,124,148,120,118,180,146, 140,0,112,138,140,134,98,104, 108,128,184,142,144,178,120,158, 136,0,132,138,94,84,138,132, 116,142,142,178,124,144,154,188, 94,0,90,96,141,143,100,90, 180,114,154,138,170,172,130,124, 96,0,94,98,139,143,108,112, 170,106,170,116,174,152,128,136, 130,0,138,132,36,52,135,135, 114,180,122,162,92,140,170,174, 128,0,130,132,40,56,137,141, 94,170,112,180,80,154,172,150, }, }, { // Latin5 (322.539M chars) [13] {NULL, NULL, ced_hires_18, ced_hires_18, }, 96, 232, 51, 21, 128, {20,0,20,20,20,20,20,20, 20,37,37,20,20,16,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 174,125,94,100,128,93,114,133, 120,100,115,113,111,97,114,106, 129,100,95,102,119,100,101,130, 117,91,117,117,87,95,93,116, 109,114,123,142,149,117,104,183, 111,140,112,106,104,116,108,107, 147,123,109,109,99,127,169,104, 100,88,100,105,175,189,165,102, 108,113,104,109,151,116,97,192, 108,128,102,97,101,120,103,120, 178,123,114,107,105,128,165,98, 101,92,102,87,175,201,186,105, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 183,147,103,153,143,113,121,144, 117,156,143,147,109,122,138,121, 157,113,123,105,138,101,102,161, 114,95,164,166,85,118,91,158, 153,197,154,170,198,186,170,182, 181,207,170,141,118,193,149,136, 201,175,130,196,157,155,197,118, 180,109,177,140,200,218,211,173, 183,202,142,172,199,196,170,169, 171,201,158,141,149,203,138,125, 202,175,150,198,146,156,196,119, 180,143,177,129,187,238,211,108, }, {50,6,11,57,0,0,0,0, 0,144,149,0,0,164,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 226,146,185,81,100,113,168,166, 142,154,126,112,190,161,183,145, 134,151,147,137,134,132,126,124, 121,122,176,137,206,105,128,149, 92,194,178,190,185,190,170,185, 176,197,160,189,202,193,206,184, 174,152,207,197,198,181,179,170, 146,175,180,111,108,128,102,138, 127,196,180,195,187,192,172,183, 173,199,158,205,212,204,220,183, 177,140,211,202,199,186,178,170, 143,189,200,94,140,80,111,5, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 175,126,100,100,127,94,116,124, 121,125,106,108,106,120,123,111, 127,113,88,113,118,96,111,128, 119,95,113,121,111,107,92,126, 118,110,119,175,148,113,108,168, 110,141,110,109,101,124,114,104, 171,129,114,115,94,154,141,101, 100,92,102,106,132,171,177,152, 114,115,112,174,149,118,107,171, 109,124,108,108,100,125,114,97, 190,129,114,113,120,155,143,91, 105,92,113,100,137,200,199,107, }, {130,0,102,144,144,142,108,138, 0,0,154,154,154,154,154,154, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 36,0,2,2,2,2,2,2, 0,0,14,38,8,2,8,2, 62,0,2,22,2,10,2,4, 0,0,20,44,12,6,12,2, 26,0,2,2,2,2,2,2, 0,0,2,4,2,2,2,2, 14,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 20,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 4,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 164,0,136,160,116,116,104,106, 0,0,202,178,144,126,130,118, 160,0,142,150,118,124,102,106, 0,0,180,246,168,156,154,124, 90,0,92,92,145,147,90,92, 0,0,156,176,188,168,138,134, 112,0,112,116,141,141,114,116, 0,0,110,138,166,180,166,148, 132,0,138,122,44,54,131,135, 0,0,130,156,124,128,182,162, 128,0,132,132,50,60,135,133, 0,0,112,120,100,130,142,168, }, }, { // ISO-8859-11 (489.481M chars) [14] {NULL, NULL, NULL, NULL}, 184, 198, 48, 20, 127, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 175,209,195,88,202,83,128,203, 192,152,191,169,88,166,132,138, 156,134,149,172,200,200,176,200, 176,211,199,194,179,150,192,164, 175,205,201,213,136,199,75,202, 176,173,203,200,140,209,144,123, 197,203,215,179,198,198,169,189, 190,187,93,39,18,43,4,72, 210,196,186,186,192,106,151,183, 207,206,151,138,179,120,113,126, 122,127,132,111,120,111,102,99, 96,94,33,88,83,68,64,77, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 184,175,143,82,159,80,91,182, 155,114,141,116,87,135,98,96, 126,88,93,153,172,160,139,156, 134,188,176,156,101,92,163,122, 113,183,179,173,84,159,74,169, 155,135,151,108,92,170,98,140, 166,90,180,144,149,166,80,79, 133,137,84,1,4,52,40,119, 116,99,97,96,100,92,161,101, 174,168,108,110,179,87,92,109, 117,117,114,109,105,106,99,96, 94,95,20,89,93,21,54,98, }, {70,0,0,46,0,0,0,0, 0,136,148,0,0,160,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 207,129,181,82,82,93,164,157, 152,152,114,111,166,150,188,146, 128,141,136,126,124,123,115,111, 109,109,165,100,202,96,118,126, 79,118,108,118,109,116,106,106, 104,104,108,101,111,116,105,100, 115,76,111,119,110,92,99,104, 73,98,81,125,114,120,90,106, 61,105,100,99,109,106,92,82, 92,104,93,95,95,106,105,107, 114,58,104,111,104,93,100,89, 80,71,96,55,132,63,99,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 175,206,190,91,199,78,140,206, 190,148,188,166,92,168,152,144, 148,139,143,179,199,196,177,200, 172,213,199,192,172,143,191,162, 175,208,201,213,153,202,62,203, 176,170,200,196,121,209,145,145, 194,206,218,188,201,202,172,189, 193,191,94,64,59,63,57,74, 203,186,178,183,187,119,161,181, 208,206,150,139,187,118,121,123, 127,115,118,111,108,125,108,109, 106,112,71,99,90,69,77,91, }, {128,0,148,148,148,148,148,148, 0,0,148,148,148,148,148,148, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,8,8,16,14, 0,0,2,2,2,2,2,36, 2,0,2,2,4,4,14,10, 0,0,2,2,2,2,2,34, 2,0,2,2,2,2,8,4, 0,0,2,2,2,2,2,32, 2,0,2,2,4,4,14,10, 0,0,2,2,2,2,2,44, 2,0,2,2,6,6,14,10, 0,0,2,2,2,2,2,42, 68,0,20,30,128,126,128,112, 0,0,16,12,6,8,14,128, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 166,0,158,164,182,174,180,178, 0,0,126,118,128,132,130,78, 158,0,162,160,132,152,142,144, 0,0,120,122,126,134,130,92, 158,0,162,160,128,160,132,146, 0,0,126,126,124,134,128,90, 166,0,162,160,142,146,146,156, 0,0,134,134,128,68,132,84, 162,0,162,160,138,154,148,150, 0,0,130,134,132,114,112,128, 158,0,164,148,196,208,204,216, 0,0,84,76,64,52,134,254, }, }, { // ISO-8859-15 (27.581M chars) [15] {NULL, NULL, ced_hires_21, ced_hires_21, }, 86, 217, 37, 21, 127, {0,0,0,0,0,0,0,0, 0,85,85,0,0,85,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 187,137,107,112,127,105,104,142, 106,111,127,124,123,101,126,118, 133,112,107,116,117,113,113,142, 111,105,127,127,92,89,91,126, 121,138,130,159,161,129,133,190, 123,152,123,118,116,144,119,121, 126,135,122,132,111,139,144,115, 113,103,117,117,145,120,135,114, 121,137,113,131,163,128,131,190, 121,141,112,111,114,143,115,133, 123,135,125,131,110,140,160,110, 114,105,118,101,148,119,129,118, 0,0,0,0,0,0,0,0, 0,34,33,0,0,33,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 195,159,116,166,180,125,125,156, 145,168,155,159,121,135,150,134, 169,125,135,118,145,114,115,173, 125,108,176,178,138,141,110,170, 165,209,166,183,211,198,182,194, 193,219,182,153,130,205,161,148, 160,187,142,208,169,167,209,131, 192,122,189,152,212,181,158,185, 195,214,155,184,212,208,182,181, 183,213,170,154,161,215,150,137, 175,187,162,210,158,168,208,131, 192,156,189,142,199,193,155,120, }, {23,0,0,70,0,0,0,0, 0,145,155,0,0,165,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 226,142,175,96,115,116,169,162, 150,154,125,112,184,159,177,144, 147,165,159,150,148,149,139,138, 134,136,166,128,201,103,116,143, 104,197,188,202,195,190,180,196, 185,179,172,189,202,198,215,195, 185,164,216,206,204,173,190,182, 158,170,181,116,107,135,114,133, 130,194,189,197,192,189,178,194, 182,176,171,189,201,194,213,194, 181,151,213,203,201,172,189,182, 155,176,182,107,136,90,117,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 187,138,113,113,149,107,108,134, 123,135,117,120,118,129,131,122, 135,125,101,126,120,109,123,140, 113,107,124,133,118,119,101,138, 132,128,129,187,160,126,122,145, 123,152,121,121,113,136,125,116, 152,141,127,129,106,167,144,114, 113,104,118,117,134,117,122,164, 130,132,121,187,161,130,119,138, 122,137,119,120,112,137,123,109, 153,141,126,130,124,167,145,104, 116,104,130,109,131,116,130,120, }, {178,0,128,156,122,126,124,128, 0,0,168,202,168,202,168,202, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 22,0,2,2,2,2,2,2, 0,0,2,14,2,2,2,2, 50,0,2,18,2,2,2,2, 0,0,2,20,2,2,2,6, 16,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 42,0,2,8,2,2,2,2, 0,0,2,2,2,2,2,2, 16,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 38,0,2,4,2,2,2,2, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 160,0,138,164,108,108,102,104, 0,0,190,160,132,134,120,146, 158,0,144,154,112,118,106,110, 0,0,160,218,160,164,148,160, 88,0,92,94,139,139,94,92, 0,0,152,166,184,176,134,148, 98,0,96,102,139,139,110,110, 0,0,138,172,174,190,154,164, 128,0,138,126,40,48,135,135, 0,0,130,160,128,148,186,180, 120,0,126,120,48,54,139,141, 0,0,136,160,142,188,166,188, }, }, { // CP1257 (41.264M chars) [16] {NULL, NULL, ced_hires_20, ced_hires_20, }, 84, 222, 39, 20, 128, {112,108,100,0,132,119,103,89, 0,78,64,75,0,77,68,67, 11,35,79,71,21,82,53,35, 0,31,45,33,0,0,49,0, 173,72,85,94,121,69,110,128, 74,94,81,110,109,101,104,75, 124,97,89,88,110,94,97,129, 74,80,81,113,82,88,85,80, 132,139,163,137,149,121,106,164, 124,141,114,153,127,139,154,153, 181,121,165,109,89,101,125,103, 97,82,78,145,112,85,162,98, 138,140,163,106,150,118,115,164, 124,135,112,155,125,133,155,153, 179,115,165,109,88,104,145,100, 130,82,79,145,129,84,161,94, 157,114,85,13,131,136,105,92, 1,81,72,77,10,83,100,70, 81,122,164,148,146,158,157,131, 0,129,85,106,48,81,114,1, 181,85,101,152,141,118,119,142, 101,154,98,145,107,120,136,92, 155,111,121,103,136,99,100,159, 111,92,101,164,84,116,89,89, 171,189,211,72,196,184,158,199, 199,205,85,210,168,152,203,176, 211,170,179,194,91,153,195,116, 172,97,91,199,198,89,204,171, 205,199,217,92,198,194,183,201, 200,199,104,216,166,147,205,177, 211,185,178,196,93,154,194,117, 220,101,91,199,185,90,202,118, }, {116,0,0,0,0,0,0,0, 0,139,155,0,0,164,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 228,153,188,77,92,107,206,155, 138,165,122,102,192,146,189,135, 135,150,145,135,132,131,124,123, 120,121,178,143,202,85,105,154, 107,193,189,191,196,191,164,188, 169,204,198,197,197,192,203,181, 177,134,209,211,206,182,187,168, 142,176,171,109,99,129,101,112, 100,195,190,187,196,195,162,186, 165,207,198,197,197,192,202,181, 176,126,208,211,206,184,192,168, 136,178,172,83,124,77,109,0, 117,90,127,119,115,124,85,99, 57,71,0,89,81,86,68,85, 80,86,101,138,134,121,102,96, 36,92,81,109,21,74,91,19, 173,101,111,88,123,70,112,120, 89,109,84,101,109,115,119,115, 133,107,98,98,116,107,100,128, 113,93,107,121,96,107,110,117, 136,143,168,99,146,122,112,156, 159,136,103,157,139,159,155,146, 175,101,144,111,83,103,128,97, 149,82,75,140,115,76,159,150, 138,144,169,93,147,125,112,157, 159,131,104,158,139,160,159,147, 175,102,144,111,84,103,122,91, 149,83,76,143,108,75,158,101, }, {100,0,60,88,62,66,62,66, 128,122,100,126,86,90,84,92, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 38,0,2,2,2,2,2,2, 52,46,20,44,6,12,6,14, 70,0,6,34,6,12,6,12, 64,56,32,54,18,22,16,24, 26,0,2,2,2,2,2,2, 4,2,2,2,2,2,2,2, 22,0,2,2,2,2,2,2, 8,4,2,2,2,2,2,2, 26,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 24,0,2,2,2,2,2,2, 4,2,2,2,2,2,2,2, 168,0,132,156,116,128,102,104, 234,200,166,204,168,184,164,158, 152,0,138,142,110,104,124,126, 210,216,166,230,168,168,172,154, 164,0,130,166,110,108,106,106, 148,164,204,170,130,130,130,128, 164,0,140,158,102,98,106,104, 204,214,178,244,158,162,146,152, 102,0,88,106,141,141,94,98, 190,154,154,162,178,188,140,126, 102,0,90,98,141,139,114,106, 152,140,118,176,188,174,148,132, 132,0,134,134,26,40,135,135, 176,186,144,164,96,138,176,190, 126,0,136,122,28,38,135,133, 140,172,130,130,114,154,186,176, }, }, { // CP1255 (313.575M chars) [17] {NULL, NULL, NULL, ced_hires_12, }, 192, 233, 81, 15, 127, {98,94,106,111,72,121,83,91, 81,65,26,68,0,71,0,69, 81,85,102,93,99,127,102,95, 75,97,17,87,61,82,71,67, 175,124,97,90,58,73,104,127, 119,93,86,110,111,82,101,112, 129,87,94,110,112,86,97,132, 116,73,60,114,71,123,75,120, 119,65,141,119,118,109,112,113, 121,112,61,74,117,67,73,62, 61,98,78,56,68,54,124,148, 38,49,42,32,35,40,36,27, 211,211,193,200,214,221,187,200, 193,220,109,200,214,125,214,131, 205,198,202,108,201,91,192,199, 210,210,202,32,36,81,108,32, 159,117,88,89,134,138,108,95, 85,73,57,78,26,89,0,88, 63,104,145,129,128,139,138,112, 83,110,64,88,33,78,35,6, 184,147,104,154,150,113,122,144, 118,156,77,147,109,123,138,122, 157,113,123,106,139,101,103,161, 114,95,71,167,86,119,91,159, 81,40,33,27,57,50,53,76, 89,84,40,25,97,25,54,51, 36,79,53,49,25,25,27,56, 26,26,27,24,26,39,25,39, 181,180,170,178,203,186,155,176, 171,197,173,144,189,203,159,191, 133,169,170,166,142,163,146,172, 192,178,205,35,59,102,136,39, }, {118,0,0,0,0,0,0,0, 0,137,146,0,0,165,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 227,155,187,100,97,112,172,178, 136,158,128,132,188,170,183,153, 137,155,149,140,137,135,129,128, 124,127,173,136,203,112,110,154, 108,138,122,146,128,136,120,118, 124,127,114,112,126,128,125,124, 133,137,129,135,139,118,124,121, 117,118,103,111,143,128,106,131, 142,144,112,120,123,140,110,110, 119,135,106,107,129,123,126,129, 124,108,122,153,134,129,118,103, 84,104,101,80,145,91,116,0, 106,72,108,107,84,120,79,80, 98,59,0,68,0,76,0,66, 101,102,115,98,109,128,101,107, 92,118,68,108,103,102,97,114, 175,126,108,86,95,75,110,121, 124,112,102,101,106,84,113,116, 133,82,132,131,119,84,97,130, 116,74,64,119,72,123,75,135, 128,83,129,119,124,114,117,127, 127,114,43,82,134,59,75,65, 44,112,90,59,50,58,80,109, 50,44,39,43,41,44,40,43, 205,205,192,202,209,223,186,199, 192,223,176,195,211,204,206,190, 204,195,200,171,199,162,190,198, 213,203,213,43,41,82,94,46, }, {86,0,44,70,130,132,130,122, 110,94,68,88,90,132,2,10, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 36,0,2,2,40,40,40,40, 60,46,16,34,34,72,2,2, 62,0,2,26,74,72,72,70, 70,54,24,42,44,82,2,2, 60,0,2,22,70,70,68,68, 128,128,100,128,128,128,26,36, 62,0,2,26,66,66,66,68, 128,128,128,128,128,128,48,62, 2,0,2,2,2,2,2,2, 24,10,2,2,2,34,2,2, 2,0,2,2,2,2,2,2, 34,20,2,10,10,46,2,2, 170,0,136,156,182,190,170,166, 248,224,180,222,232,172,106,66, 154,0,140,142,176,164,188,188, 214,246,176,224,176,218,104,106, 166,0,132,164,178,170,168,166, 160,170,204,170,154,182,76,76, 162,0,140,154,182,180,172,168, 224,230,176,228,214,218,94,74, 172,0,148,146,180,182,188,180, 236,188,168,220,190,202,120,120, 158,0,146,158,180,180,180,178, 162,232,182,208,174,184,68,66, 146,0,150,148,106,132,122,126, 110,90,74,98,128,90,131,133, 142,0,150,144,92,132,120,128, 78,90,74,72,124,138,133,127, }, }, { // KOI8R (315.553M chars) [18] {NULL, NULL, ced_hires_9, ced_hires_9, }, 189, 220, 69, 17, 128, {17,17,17,17,17,17,17,17, 17,39,39,17,17,39,17,17, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 17,17,17,117,17,17,17,17, 17,17,17,17,17,17,17,17, 17,17,17,118,17,25,17,17, 17,17,17,25,17,17,17,47, 155,199,183,172,193,200,169,185, 168,203,166,197,197,191,205,205, 196,169,201,203,201,186,173,196, 170,177,187,171,168,166,181,137, 158,201,188,174,195,200,175,189, 171,204,166,200,198,196,207,207, 201,170,204,206,202,187,175,199, 170,177,189,174,172,166,183,137, 7,7,7,7,7,7,7,7, 7,39,39,7,7,39,7,7, 7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7, 7,7,7,123,7,7,7,7, 7,7,7,7,7,7,7,7, 7,7,7,74,7,7,7,7, 7,7,7,7,7,7,7,100, 164,191,135,141,166,194,118,163, 175,198,187,177,169,182,165,191, 138,192,164,174,180,171,125,189, 179,178,152,139,98,108,139,73, 131,162,130,110,132,145,129,147, 126,158,123,145,139,148,148,152, 142,148,128,154,139,149,108,167, 114,119,123,105,122,90,109,85, }, {0,0,0,0,0,0,0,0, 0,111,171,0,0,149,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 223,146,172,30,25,90,164,138, 116,148,90,87,187,167,194,124, 72,106,101,90,90,85,93,77, 75,75,165,131,188,82,114,147, 125,92,36,71,49,93,30,0, 64,104,0,30,49,47,61,97, 110,0,62,58,56,11,54,71, 45,83,11,70,85,112,54,106, 92,94,57,74,51,94,36,30, 66,106,0,34,57,53,67,98, 113,0,67,61,51,49,56,17, 49,84,41,0,111,57,57,0, 47,49,56,30,0,36,0,0, 0,0,0,25,17,0,0,11, 0,36,17,0,0,0,0,0, 0,0,49,0,0,11,0,0, 25,0,0,123,0,0,0,0, 0,0,0,0,0,0,0,0, 57,17,45,121,30,57,11,36, 66,11,36,41,36,49,58,53, 169,212,182,169,188,212,160,181, 172,207,177,191,196,188,203,214, 181,185,201,197,203,191,170,194, 184,189,174,162,139,157,176,118, 167,209,180,168,186,208,159,179, 171,206,177,190,193,187,201,211, 178,185,198,195,202,188,168,192, 184,187,173,162,133,156,176,117, }, {130,0,102,154,154,154,154,154, 154,154,154,154,112,154,116,154, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 92,0,38,74,128,128,128,128, 128,128,128,128,22,34,24,36, 92,0,38,74,128,128,128,128, 128,128,128,128,44,54,46,56, 2,0,2,2,18,22,26,26, 110,128,40,40,2,2,2,2, 2,0,2,2,22,28,32,30, 128,128,48,50,2,2,2,2, 2,0,2,2,16,20,24,24, 128,128,76,80,2,2,2,2, 2,0,2,2,20,24,30,28, 128,128,82,84,2,2,2,2, 154,0,128,178,178,178,178,178, 178,178,178,178,128,178,140,178, 154,0,132,178,178,178,178,178, 178,178,178,178,138,178,178,178, 146,0,154,136,178,182,180,178, 178,178,180,178,134,146,82,92, 148,0,152,168,180,184,180,178, 178,180,180,180,90,106,136,148, 154,0,154,152,154,146,152,150, 134,154,138,86,141,141,6,4, 154,0,154,156,114,150,158,160, 166,172,142,122,139,141,2,12, 136,0,154,156,180,184,184,158, 124,140,110,136,112,106,141,139, 140,0,152,158,180,186,178,172, 130,144,112,138,114,110,139,141, }, }, { // GBK (106.219M chars) [19] {NULL, NULL, NULL, NULL}, 203, 189, 27, 17, 128, {80,136,138,128,141,121,130,133, 125,121,114,108,141,130,70,75, 125,127,117,120,119,135,127,109, 133,129,119,130,122,125,128,114, 74,204,125,202,219,215,119,114, 118,156,113,86,97,79,82,81, 189,196,199,195,195,208,196,199, 196,203,194,200,201,197,193,195, 192,195,189,194,195,183,196,191, 201,197,207,197,197,197,201,199, 201,191,203,201,198,196,202,200, 134,116,114,132,122,124,118,115, 115,120,116,120,141,121,124,123, 121,120,121,113,125,116,117,110, 117,114,112,113,119,112,124,123, 85,77,84,80,72,84,79,0, 135,112,99,113,112,124,117,103, 124,95,92,89,122,95,0,51, 0,0,0,0,0,0,0,0, 25,1,0,0,0,0,0,0, 1,113,69,80,84,69,59,13, 116,104,61,70,84,69,73,47, 74,88,74,72,72,73,61,73, 51,54,54,59,70,77,75,75, 96,68,68,66,84,83,47,68, 64,64,44,78,54,61,26,26, 64,64,47,59,70,74,70,66, 64,80,61,44,44,69,66,82, 51,57,66,57,64,47,64,54, 18,82,68,66,40,66,70,69, 51,70,40,88,37,37,40,59, 59,40,102,70,73,70,68,0, }, {0,0,0,0,0,0,0,0, 0,1,60,0,0,64,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 94,78,82,0,0,0,93,107, 64,60,46,107,76,56,82,44, 29,64,73,39,27,27,18,14, 14,15,18,0,111,60,0,46, 104,95,102,121,118,73,105,75, 96,131,74,109,89,100,103,111, 93,108,98,107,126,103,101,125, 113,99,98,90,89,109,120,88, 77,85,85,92,91,104,101,109, 101,83,74,90,111,98,98,117, 96,93,127,97,106,100,91,99, 91,102,105,84,114,93,91,17, 124,109,99,116,90,100,105,89, 96,95,103,108,93,117,111,110, 98,115,123,116,94,82,112,111, 83,97,106,96,74,105,115,121, 126,196,197,192,196,176,185,184, 195,185,196,194,198,187,184,191, 190,190,180,189,189,194,181,191, 181,191,188,196,189,191,187,192, 186,174,192,193,202,189,193,194, 190,188,189,195,181,187,196,191, 200,178,184,186,189,186,192,180, 193,176,195,182,185,179,182,186, 185,187,190,185,183,187,185,186, 177,190,189,191,187,187,181,180, 178,185,188,196,173,177,186,192, 192,182,197,186,177,187,185,0, }, {144,0,168,168,120,122,152,128, 124,116,2,2,2,2,4,4, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 78,0,26,38,2,2,12,8, 128,128,22,22,20,24,26,26, 72,0,20,32,2,2,6,2, 128,128,40,42,40,44,46,46, 74,0,22,34,2,2,6,4, 128,128,40,42,38,44,46,46, 80,0,28,40,6,4,14,10, 128,128,44,46,42,50,52,50, 128,0,128,128,98,102,124,110, 128,128,46,50,46,54,56,54, 128,0,128,128,128,128,128,128, 128,128,38,40,38,44,46,44, 0,0,0,0,236,252,250,242, 230,226,122,106,114,124,130,128, 0,0,0,0,252,238,254,254, 240,234,112,116,106,116,144,130, 0,0,0,0,242,220,220,232, 106,108,136,130,128,116,126,114, 0,0,0,0,206,208,218,216, 82,88,128,126,128,126,126,132, 0,0,0,0,204,218,220,208, 84,82,122,128,128,128,132,132, 0,0,0,0,212,214,210,210, 92,88,124,128,126,136,120,126, 0,0,0,0,208,210,204,206, 200,208,136,124,124,122,126,126, 0,0,0,0,198,202,200,218, 200,196,128,122,132,128,130,120, }, }, { // Greek (109.816M chars) [20] {NULL, NULL, ced_hires_11, ced_hires_11, }, 186, 219, 72, 19, 128, {0,0,0,0,0,0,0,0, 0,24,24,0,0,24,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 174,64,123,80,13,49,101,123, 114,89,0,152,107,83,76,53, 122,81,71,65,105,84,180,126, 183,174,186,111,183,56,165,168, 117,206,178,191,194,206,163,186, 183,198,202,195,198,199,165,203, 201,196,56,205,210,185,180,183, 154,177,136,87,180,183,177,186, 157,202,171,187,188,204,165,188, 183,199,199,194,197,198,161,202, 194,196,154,201,208,185,175,180, 147,179,136,79,183,166,168,0, 0,0,0,0,0,0,0,0, 0,34,34,0,0,34,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 183,58,94,153,91,63,120,143, 117,155,71,146,108,122,78,71, 156,112,122,105,105,84,83,160, 96,97,84,166,98,118,76,75, 70,162,129,130,139,152,103,165, 133,144,142,123,130,144,98,158, 139,113,63,159,134,140,122,126, 98,117,81,46,175,143,180,165, 64,199,125,122,122,176,111,189, 115,196,146,142,141,197,113,188, 137,142,206,133,145,191,115,124, 78,148,115,74,181,161,152,93, }, {98,0,0,0,0,0,0,0, 2,135,160,0,67,161,42,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 225,142,174,72,92,107,173,153, 133,152,109,98,183,147,185,142, 132,150,145,135,133,131,124,123, 119,121,167,138,195,117,108,120, 78,122,108,129,112,120,111,107, 109,113,108,105,115,117,111,121, 118,81,119,121,112,95,108,105, 80,100,85,102,97,121,98,109, 109,116,101,104,112,116,102,95, 104,115,100,100,121,112,116,124, 116,72,112,117,112,104,110,87, 82,90,98,64,123,66,101,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 174,42,84,78,172,159,104,116, 116,102,153,94,101,82,171,60, 122,76,68,71,118,78,185,127, 180,182,189,143,179,67,177,172, 111,207,161,179,175,201,159,197, 167,203,190,188,186,197,160,205, 189,198,0,199,200,190,174,173, 145,183,137,110,188,186,184,191, 66,211,163,182,177,206,160,199, 172,206,192,193,189,200,165,208, 196,203,194,200,201,194,176,176, 146,185,138,110,182,181,174,0, }, {146,0,130,170,170,170,170,168, 0,0,166,170,136,168,130,154, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 34,0,2,6,52,58,56,62, 0,0,4,2,2,2,2,2, 4,0,2,2,22,28,24,32, 0,0,14,2,2,2,2,2, 2,0,2,2,2,2,2,4, 0,0,6,2,2,2,2,2, 2,0,2,2,2,6,2,8, 0,0,2,2,2,2,2,2, 2,0,2,2,2,2,2,6, 0,0,2,2,2,2,2,2, 2,0,2,2,2,10,6,12, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 166,0,136,172,188,188,186,188, 0,0,186,116,110,106,106,106, 164,0,146,164,180,178,180,174, 0,0,98,100,140,144,98,104, 146,0,152,154,164,164,162,156, 0,0,52,142,139,137,118,112, 148,0,152,154,150,144,142,134, 0,0,48,136,139,131,120,126, 150,0,152,146,92,128,132,126, 0,0,144,72,30,124,139,139, 150,0,152,150,88,124,136,128, 0,0,66,76,4,118,141,139, }, }, { // JIS (138.804M chars) [21] {NULL, NULL, NULL, NULL}, 37, 154, 2, 1, 129, {0,0,0,0,0,0,0,0, 0,99,99,0,0,99,107,197, 0,0,0,0,0,0,0,0, 0,0,0,254,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {119,0,0,0,0,0,0,0, 0,53,49,0,0,49,0,0, 0,0,0,0,0,0,0,0, 0,0,0,197,0,0,0,0, 73,56,65,75,246,65,49,49, 243,61,49,49,49,49,49,49, 49,56,61,49,49,49,49,49, 49,49,56,56,49,49,49,49, 49,49,49,49,49,49,49,49, 49,49,49,49,49,56,143,49, 49,49,97,49,75,49,59,49, 49,49,61,49,49,53,56,53, 49,98,49,53,49,49,49,94, 49,49,49,49,63,69,74,49, 49,49,53,65,49,49,49,49, 49,49,49,49,49,56,53,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {130,184,30,216,132,172,164,208, 0,0,0,0,0,0,0,0, 128,2,128,38,128,122,124,104, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, }, { // CP1254 (20.130M chars) [22] {NULL, NULL, ced_hires_18, ced_hires_18, }, 97, 228, 51, 26, 128, {105,102,117,110,111,122,102,106, 97,93,168,92,91,102,30,86, 53,83,126,96,72,96,70,66, 56,74,134,61,61,50,82,84, 173,124,96,100,127,93,113,131, 120,100,114,112,110,97,113,106, 131,100,95,101,117,100,100,131, 116,92,116,116,90,96,94,114, 108,154,124,147,148,125,114,181, 110,139,111,106,104,133,107,106, 146,124,109,108,100,126,167,105, 99,95,111,104,173,187,163,102, 108,154,121,114,150,117,103,190, 108,128,103,98,103,136,103,119, 177,122,113,108,105,127,163,98, 101,94,113,91,173,200,184,105, 157,114,89,88,132,136,106,94, 88,90,191,83,103,92,21,83, 80,123,164,148,146,158,157,131, 101,129,189,106,99,97,60,118, 182,145,102,152,141,111,120,142, 116,154,142,145,107,121,136,120, 155,111,121,104,137,100,101,159, 112,95,162,165,88,117,91,157, 152,195,152,169,197,184,168,180, 179,205,169,140,116,192,148,134, 200,173,128,194,156,153,196,117, 179,108,175,138,198,216,209,171, 181,200,141,171,198,195,168,167, 169,200,157,140,147,201,136,123, 200,173,148,196,144,154,194,118, 178,142,175,128,185,237,209,106, }, {116,4,4,52,4,0,0,0, 0,144,148,0,0,163,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 225,145,184,86,101,112,168,165, 141,153,125,111,189,160,182,143, 136,151,146,136,133,132,125,124, 121,122,175,136,205,105,128,148, 108,194,176,188,184,192,169,184, 174,197,159,189,200,191,205,183, 174,151,205,195,198,180,178,169, 146,174,178,113,109,127,105,136, 126,195,178,194,186,194,171,181, 172,199,157,204,211,202,219,182, 177,139,210,201,200,185,177,168, 141,187,198,94,139,85,111,0, 103,94,114,122,104,131,103,108, 103,87,157,89,94,91,51,79, 84,99,153,107,139,122,104,101, 94,118,157,108,103,94,118,122, 173,126,101,99,126,94,115,123, 121,124,114,109,106,119,122,111, 133,112,90,112,118,97,110,129, 118,94,113,120,110,107,93,127, 117,118,123,173,147,114,112,166, 112,142,110,109,107,167,114,104, 170,127,113,114,95,153,141,101, 99,92,103,107,131,170,176,150, 116,123,113,173,147,118,110,169, 112,133,111,107,99,168,113,98, 188,128,113,112,119,153,142,91, 104,92,117,99,135,199,197,107, }, {84,0,50,70,50,58,42,52, 90,82,80,100,68,64,68,44, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 36,0,2,2,2,2,2,2, 32,24,16,38,6,2,6,2, 62,0,2,22,2,10,2,4, 36,28,22,44,12,8,10,2, 26,0,2,2,2,2,2,2, 2,2,2,4,2,2,2,2, 16,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 20,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 4,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 140,0,112,126,144,140,106,118, 180,152,152,160,192,130,148,104, 142,0,134,130,100,98,134,132, 138,168,142,178,148,152,184,152, 164,0,136,162,116,118,104,106, 140,152,204,176,140,126,126,118, 160,0,144,152,118,124,102,106, 174,182,180,238,162,154,150,126, 92,0,94,92,145,149,90,92, 190,154,156,172,184,168,132,134, 112,0,114,118,143,143,116,118, 140,146,112,138,166,182,162,148, 132,0,138,124,44,56,131,135, 142,176,130,156,120,128,176,162, 128,0,132,132,50,60,137,135, 130,160,114,122,98,130,138,168, }, }, { // CP1253 (37.682M chars) [23] {NULL, NULL, ced_hires_11, ced_hires_11, }, 186, 218, 73, 21, 128, {98,79,82,91,78,122,85,90, 0,82,68,76,0,75,0,65, 79,105,101,115,101,127,107,94, 0,98,0,91,0,78,48,0, 174,70,182,88,122,76,110,130, 119,95,70,153,108,88,101,71, 130,87,79,77,106,197,107,129, 184,175,187,114,184,75,166,169, 118,206,179,192,195,207,164,187, 184,199,203,195,198,200,165,203, 202,197,70,205,210,185,180,184, 155,178,137,90,181,184,178,187, 86,203,172,188,189,203,161,188, 181,199,199,194,198,198,162,203, 195,196,156,202,208,186,176,181, 148,179,137,85,184,167,169,70, 158,116,88,89,133,138,107,95, 0,84,72,80,9,91,0,87, 58,101,143,127,125,137,136,110, 0,108,60,84,28,75,32,6, 183,68,95,153,143,112,121,144, 117,156,66,147,109,122,138,78, 157,112,123,105,106,101,102,161, 98,99,87,166,100,118,81,80, 77,163,130,131,140,152,105,166, 133,145,142,124,131,145,100,159, 140,114,66,160,135,141,123,127, 100,118,86,68,176,144,181,166, 74,200,125,123,122,177,112,190, 115,197,147,142,142,198,114,189, 137,143,206,134,146,192,116,125, 82,149,116,80,182,162,153,66, }, {118,0,0,0,0,0,0,0, 0,138,161,0,0,163,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 226,143,175,80,96,111,174,154, 134,154,123,101,184,149,186,143, 136,152,147,137,135,133,126,125, 122,123,168,139,197,118,114,121, 107,133,118,132,121,129,117,114, 119,125,113,112,122,124,119,128, 125,97,124,130,131,115,120,120, 116,111,103,108,101,126,102,112, 111,143,112,125,126,141,110,108, 120,135,105,107,128,122,124,134, 122,86,123,151,133,128,120,103, 90,103,102,77,126,78,111,0, 91,79,78,82,79,127,85,84, 0,77,0,78,58,76,0,63, 76,87,132,84,113,123,101,97, 0,101,76,105,55,86,59,12, 175,74,185,85,123,84,113,121, 119,111,74,101,104,87,118,74, 133,87,79,85,119,144,95,130, 181,183,190,144,180,79,178,172, 112,208,162,180,176,202,160,198, 168,204,190,189,187,198,160,206, 190,199,70,200,200,190,175,174, 145,183,138,111,190,189,185,193, 80,212,167,183,177,208,161,200, 173,208,193,194,190,201,165,209, 197,204,194,200,202,195,177,177, 147,186,139,111,184,182,175,72, }, {120,0,80,110,184,184,160,166, 142,128,86,68,44,50,40,48, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 20,0,2,2,32,36,28,32, 64,50,2,2,2,2,2,2, 2,0,2,2,10,14,6,10, 78,62,14,2,2,2,2,2, 2,0,2,2,2,2,2,2, 70,56,6,2,2,2,2,2, 2,0,2,2,2,2,2,2, 58,46,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 32,20,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 38,26,2,2,2,2,2,2, 168,0,138,162,188,202,172,168, 248,222,164,132,100,104,104,108, 150,0,142,148,180,174,188,192, 212,242,158,156,116,114,118,120, 162,0,136,170,180,178,174,172, 148,160,176,108,132,134,106,104, 162,0,146,164,172,168,166,156, 118,142,100,98,134,138,126,114, 144,0,152,152,156,152,144,136, 116,120,132,142,139,135,116,112, 146,0,150,152,142,134,126,118, 106,104,132,134,139,131,120,126, 148,0,152,144,90,118,116,110, 122,122,68,86,30,122,137,139, 150,0,152,148,90,116,122,112, 122,132,66,88,12,118,139,137, }, }, { // CP932 (5.390M chars) [24] {NULL, NULL, NULL, NULL}, 151, 140, 55, 26, 129, {73,188,237,214,159,83,84,109, 191,199,191,194,200,199,202,199, 190,190,186,192,182,191,188,186, 105,102,112,102,102,102,107,115, 101,107,119,112,119,135,100,99, 106,106,107,101,103,109,105,120, 121,117,114,106,104,110,111,112, 114,105,127,110,129,118,108,105, 123,109,100,111,120,109,109,99, 105,106,114,108,122,112,116,106, 102,102,113,101,100,99,102,108, 110,108,119,107,108,116,122,117, 117,116,111,115,112,109,113,115, 113,111,167,178,184,104,106,183, 160,142,115,156,149,130,163,163, 184,191,154,133,75,97,94,93, 0,223,195,229,107,12,47,131, 44,180,189,184,179,185,191,185, 177,166,168,174,170,173,169,172, 162,86,89,86,93,87,87,91, 99,113,100,104,106,122,111,98, 99,99,99,99,99,99,99,99, 105,99,100,99,98,99,99,102, 124,99,99,99,106,103,99,99, 100,99,99,98,105,99,99,99, 99,101,99,99,112,99,98,99, 99,100,99,99,99,98,102,99, 99,103,99,99,99,104,106,104, 115,99,101,108,103,106,99,99, 99,103,97,0,23,91,96,0, 105,107,95,165,148,101,154,130, 96,175,132,116,100,109,98,101, }, {87,0,0,0,0,0,0,0, 0,84,91,0,0,87,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 114,86,99,84,84,84,86,86, 90,93,85,89,87,94,87,86, 91,88,89,86,85,85,84,84, 84,84,85,87,119,84,84,84, 199,198,192,189,158,189,180,168, 171,180,178,171,176,161,191,183, 172,169,179,177,178,160,185,181, 190,169,175,200,180,158,185,172, 177,159,190,175,162,179,173,191, 177,187,182,158,184,167,174,182, 179,167,177,179,178,179,187,176, 174,176,173,178,169,174,176,0, 175,177,175,172,170,176,176,180, 169,182,188,188,178,179,172,172, 159,180,158,195,174,169,176,176, 162,162,166,158,168,174,176,177, 179,175,195,161,185,163,180,172, 181,189,190,180,175,184,173,177, 166,185,175,184,166,192,178,192, 166,176,169,178,190,190,180,180, 168,183,176,163,192,193,192,176, 191,192,177,162,203,189,171,167, 173,162,169,159,174,148,173,170, 163,160,175,166,188,175,165,174, 186,163,176,177,162,176,185,182, 187,190,188,161,175,174,179,176, 192,187,162,164,156,172,160,145, 155,145,181,167,175,93,93,93, }, {84,0,82,82,2,2,4,6, 2,2,8,8,4,18,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 128,0,126,120,6,10,10,14, 22,24,18,18,14,28,20,30, 128,0,128,126,2,8,8,12, 22,26,18,18,14,30,20,30, 128,0,128,128,6,10,12,14, 26,28,22,22,18,32,24,34, 128,0,128,128,8,12,14,16, 26,30,22,22,18,32,24,34, 68,0,44,44,2,2,2,2, 26,30,24,22,18,34,24,34, 66,0,40,42,2,2,2,2, 2,2,2,2,2,2,2,2, 0,0,0,0,140,138,140,138, 132,130,132,132,136,132,134,128, 0,0,0,0,134,140,142,142, 130,134,132,134,124,134,132,142, 222,128,252,248,124,128,128,130, 148,136,134,126,124,132,86,120, 214,128,240,244,136,132,130,132, 136,118,136,132,126,152,84,118, 212,128,244,242,126,130,132,134, 136,128,130,128,118,156,82,122, 212,128,242,242,126,130,132,134, 136,130,128,144,130,142,66,122, 0,0,0,0,134,144,136,142, 138,144,128,150,72,88,76,86, 184,180,164,164,126,140,126,154, 134,144,126,132,124,128,136,134, }, }, { // Hebrew (10.753M chars) [25] {NULL, NULL, NULL, NULL}, 196, 235, 78, 9, 128, {0,0,0,0,0,0,0,0, 0,63,63,0,0,63,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 165,0,80,80,80,80,80,80, 80,82,80,80,82,89,80,80, 85,80,80,80,86,80,80,82, 80,80,83,80,80,80,80,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,80, 205,203,189,201,216,218,185,196, 190,220,185,190,212,212,202,200, 199,194,199,175,193,168,187,196, 214,202,217,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,77,77,0,0,77,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 145,0,87,87,105,87,87,87, 88,138,88,88,88,89,105,87, 89,88,88,87,91,87,87,118, 87,87,87,88,88,89,87,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,87, 194,196,170,172,206,189,164,179, 163,185,130,182,196,152,197,145, 174,174,179,130,174,124,162,174, 179,192,183,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,136,147,0,0,157,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 227,138,183,80,80,95,170,157, 104,163,103,95,150,163,151,133, 86,103,112,90,86,90,87,88, 85,86,126,96,204,95,106,111, 82,84,81,84,82,82,81,81, 82,84,81,81,81,81,82,82, 82,80,85,94,81,81,80,82, 81,80,82,83,104,130,83,93, 114,87,82,84,83,83,82,81, 82,88,80,81,82,82,82,86, 83,81,84,85,88,82,81,85, 80,82,80,81,92,108,97,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 165,0,81,80,80,80,80,81, 80,82,80,80,81,81,80,80, 86,80,81,80,85,80,80,83, 80,80,81,80,80,80,80,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,80, 209,210,192,200,210,223,187,198, 189,223,131,200,211,161,212,142, 207,193,203,135,198,112,191,196, 208,208,204,0,0,0,0,0, }, {180,0,128,152,204,204,204,202, 0,0,202,202,0,164,118,124, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 54,0,2,14,128,84,104,102, 0,0,66,128,0,128,2,2, 128,0,36,58,128,128,128,128, 0,0,98,128,0,128,4,16, 128,0,128,128,128,128,128,128, 0,0,128,128,0,128,128,128, 128,0,76,98,128,128,128,128, 0,0,128,128,0,128,50,62, 2,0,2,2,16,2,8,10, 0,0,2,38,0,78,2,2, 2,0,2,2,26,10,18,20, 0,0,6,56,0,98,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 154,0,146,158,230,204,230,232, 0,0,186,226,0,186,128,130, 186,0,128,164,228,226,226,226, 0,0,226,226,0,186,118,124, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 164,0,128,152,188,188,188,186, 0,0,186,186,0,148,116,124, 150,0,150,150,136,142,142,136, 0,0,130,118,0,118,130,132, 154,0,150,154,146,158,148,158, 0,0,124,124,0,122,132,128, }, }, { // KOI8U (14.358M chars) [26] {NULL, NULL, ced_hires_9, ced_hires_9, }, 189, 220, 69, 18, 129, {87,87,87,87,87,87,87,87, 87,95,95,87,87,95,87,87, 84,84,84,84,84,84,84,84, 84,84,84,84,84,84,84,84, 87,87,87,119,129,87,162,137, 87,87,87,87,87,90,87,87, 87,87,87,119,131,87,163,137, 87,87,87,87,87,92,87,87, 156,198,183,173,193,200,169,185, 168,203,166,197,197,191,205,205, 196,169,201,203,201,185,173,196, 170,177,187,171,168,165,181,137, 158,200,188,175,195,200,175,189, 171,204,166,200,198,196,207,207, 201,170,204,206,202,187,175,199, 170,177,189,174,172,166,183,137, 82,82,82,82,82,82,82,82, 82,95,95,82,82,95,82,82, 56,56,56,56,56,56,56,56, 56,56,56,56,56,56,56,56, 82,82,82,124,131,82,157,142, 82,82,82,82,82,83,82,82, 82,82,82,87,89,82,115,97, 82,82,82,82,82,82,82,103, 164,191,135,141,166,194,119,163, 175,198,187,177,169,181,165,191, 138,192,163,174,180,171,125,189, 179,178,152,139,101,110,139,87, 131,161,130,111,132,145,129,147, 126,157,123,145,139,148,148,152, 142,148,128,154,139,149,110,167, 115,120,124,107,123,95,110,92, }, {0,0,0,0,0,0,0,0, 0,112,170,0,0,149,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 223,146,172,86,86,96,164,138, 117,148,96,95,187,167,194,124, 88,108,104,96,97,94,99,91, 91,91,165,131,188,92,116,147, 126,98,86,90,87,99,86,86, 87,107,86,86,86,87,87,101, 112,86,87,87,86,86,87,91, 86,93,86,87,94,113,86,107, 97,99,87,90,86,99,86,86, 87,108,86,86,87,87,88,102, 114,86,88,87,86,86,87,86, 86,94,86,86,113,86,87,0, 87,87,87,86,86,86,86,86, 86,86,86,86,86,86,86,86, 86,86,86,86,86,86,86,86, 86,86,86,86,86,86,86,86, 86,86,86,123,128,86,170,136, 86,86,86,86,86,87,86,86, 88,86,87,121,127,88,168,135, 88,86,86,87,87,87,86,87, 169,212,182,169,188,211,160,181, 172,207,177,191,196,188,203,214, 181,185,201,197,203,191,170,194, 184,189,174,162,139,157,176,119, 167,209,179,168,186,208,159,179, 171,205,177,190,193,187,202,210, 178,185,198,195,202,188,168,192, 184,187,173,162,133,156,176,118, }, {132,0,98,138,200,200,200,198, 200,200,174,176,92,102,94,104, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 44,0,2,24,84,92,96,96, 128,128,46,48,2,2,2,2, 42,0,2,24,84,90,96,94, 128,128,88,90,14,24,16,26, 2,0,2,2,10,14,16,16, 36,36,2,2,2,2,2,2, 2,0,2,2,16,20,22,22, 46,46,2,2,2,2,2,2, 2,0,2,2,8,12,14,14, 128,128,26,28,2,2,2,2, 2,0,2,2,14,16,20,18, 112,128,30,32,2,2,2,2, 174,0,126,164,224,224,224,222, 224,224,180,182,112,124,116,126, 200,0,128,168,224,224,224,222, 224,224,182,184,114,126,118,128, 146,0,154,150,184,194,200,194, 224,224,170,142,134,140,78,88, 158,0,142,170,224,224,224,222, 224,224,140,172,104,106,136,142, 156,0,154,152,148,140,142,142, 118,120,138,74,139,139,16,24, 154,0,154,156,130,146,148,152, 126,124,138,84,139,141,18,30, 136,0,154,156,180,186,186,174, 116,118,108,138,112,106,141,139, 140,0,152,158,182,184,182,178, 122,122,112,138,114,110,139,141, }, }, { // ISO-8859-5 (4.566M chars) [27] {NULL, NULL, NULL, NULL}, 178, 203, 63, 18, 128, {0,0,0,0,0,0,0,0, 0,73,73,0,0,73,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 174,139,153,105,121,99,146,124, 153,123,130,127,103,100,117,115, 203,190,202,193,196,200,173,190, 205,165,202,200,198,206,204,202, 204,206,200,185,176,172,175,186, 177,166,129,174,167,168,175,170, 198,179,195,186,191,199,170,186, 202,165,197,197,190,203,202,194, 202,202,199,184,167,167,172,183, 170,164,142,174,169,160,162,170, 145,139,152,104,117,99,146,124, 151,121,129,126,103,100,117,115, 0,0,0,0,0,0,0,0, 0,96,96,0,0,96,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 183,107,100,119,101,102,114,101, 108,107,102,105,110,123,100,105, 155,132,162,147,135,132,126,125, 144,118,136,128,135,134,143,136, 129,148,131,134,127,123,119,121, 119,113,118,126,116,118,119,138, 196,133,191,156,166,192,126,148, 197,189,175,160,180,171,185,142, 170,174,180,171,119,174,145,137, 136,107,110,179,181,109,162,193, 112,129,101,118,119,103,147,123, 126,105,102,131,111,99,125,102, }, {0,0,0,0,0,0,0,0, 0,114,146,0,0,157,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 222,138,169,99,103,106,165,146, 132,152,105,105,185,162,182,129, 128,138,133,123,122,122,115,115, 112,113,166,133,204,103,107,138, 107,127,114,123,114,133,112,117, 112,112,116,112,118,118,113,127, 126,101,118,122,116,107,107,118, 101,108,104,104,106,112,100,115, 103,127,109,118,116,128,106,107, 105,117,110,111,115,113,118,136, 126,100,117,119,115,110,109,117, 100,113,108,99,124,100,99,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 174,147,138,136,115,100,153,120, 139,118,125,128,109,100,117,138, 209,174,192,178,187,205,163,176, 205,178,190,191,185,200,208,172, 198,193,199,188,157,168,168,173, 166,150,130,185,182,133,166,183, 215,178,196,181,189,211,165,178, 208,178,192,200,187,202,213,176, 204,195,202,197,156,173,167,173, 161,154,133,189,185,135,171,185, 146,148,138,136,116,99,155,119, 139,120,128,128,109,103,118,137, }, {176,0,130,152,216,216,216,214, 0,0,182,122,134,118,130,216, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 36,0,2,2,42,50,44,50, 0,0,16,2,2,2,2,24, 2,0,2,2,2,2,2,2, 0,0,18,2,2,2,2,26, 2,0,2,2,2,4,2,4, 0,0,32,2,2,2,2,42, 2,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 2,0,2,2,2,8,2,8, 0,0,2,2,2,2,2,2, 46,0,2,4,54,64,54,64, 0,0,38,2,2,2,2,48, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 178,0,132,168,188,188,180,186, 0,0,192,126,130,94,98,138, 140,0,150,154,182,178,186,182, 0,0,122,138,138,120,116,102, 146,0,146,160,198,200,184,190, 0,0,126,138,140,118,114,104, 148,0,154,154,116,130,140,130, 0,0,78,28,40,138,138,134, 156,0,154,148,128,138,132,134, 0,0,88,38,50,138,140,144, 150,0,152,140,186,198,198,204, 0,0,142,88,100,130,142,182, }, }, { // CP874 (90.889M chars) [28] {NULL, NULL, NULL, NULL}, 183, 197, 49, 21, 127, {105,102,97,58,82,121,0,91, 87,94,89,61,69,81,0,58, 84,99,96,131,98,112,94,97, 77,90,89,80,56,80,84,0, 175,209,195,89,202,83,128,203, 192,151,191,169,87,166,132,138, 156,134,149,172,200,200,176,200, 176,211,199,193,179,149,192,164, 175,205,201,213,136,199,77,202, 175,173,203,200,140,209,144,122, 197,203,215,179,198,198,169,189, 190,187,93,58,56,58,53,74, 209,196,186,186,191,106,151,183, 207,205,151,138,179,120,113,126, 122,127,132,111,120,111,102,99, 97,95,58,89,84,72,69,79, 159,116,43,30,27,138,0,65, 1,58,62,0,19,89,0,87, 48,92,134,118,116,128,127,100, 0,39,50,0,17,66,20,0, 184,175,143,83,159,81,91,181, 155,114,141,116,87,135,98,96, 126,89,93,153,172,160,139,156, 133,188,176,156,101,93,162,122, 113,182,178,173,85,158,76,169, 155,135,151,108,93,170,98,140, 166,90,179,144,149,166,81,80, 132,137,85,52,53,62,58,119, 116,99,98,96,101,93,161,101, 173,168,107,110,179,86,93,109, 117,116,114,109,105,106,99,96, 94,95,54,89,94,56,64,98, }, {119,0,0,44,0,0,0,0, 0,138,149,0,0,161,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 209,129,181,84,86,94,166,157, 152,153,115,111,167,151,188,147, 133,142,138,128,126,125,117,113, 111,112,165,104,202,96,121,126, 106,131,115,123,116,126,111,111, 114,120,111,105,118,121,113,118, 121,94,117,127,130,114,114,118, 116,109,100,126,115,121,92,108, 78,142,110,112,119,136,104,98, 116,133,97,101,116,118,116,127, 119,79,119,150,131,126,114,102, 84,97,98,64,134,70,101,0, 99,94,75,63,80,121,0,92, 94,84,92,59,78,81,49,49, 77,82,103,84,123,111,96,101, 80,100,87,78,55,86,81,0, 175,206,190,92,199,79,139,206, 190,148,188,166,94,168,152,144, 148,139,143,179,199,195,177,200, 172,213,199,192,172,143,191,161, 174,207,201,213,153,202,68,203, 176,170,200,196,121,209,144,145, 194,206,217,188,201,202,172,189, 193,191,94,68,66,68,64,77, 203,186,177,183,187,119,161,181, 208,206,149,139,187,118,121,123, 127,115,118,111,108,125,108,109, 106,112,74,99,91,72,79,91, }, {110,0,78,92,172,172,158,156, 114,122,40,36,30,34,38,118, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 54,48,2,2,2,2,2,36, 2,0,2,2,2,2,2,2, 54,46,2,2,2,2,2,34, 2,0,2,2,2,2,2,2, 54,46,2,2,2,2,2,34, 2,0,2,2,2,2,2,2, 64,58,2,2,2,2,2,44, 2,0,2,2,2,2,2,2, 62,56,2,2,2,2,2,42, 66,0,18,30,108,104,86,80, 128,128,16,12,6,8,14,128, 174,0,152,160,182,202,168,162, 246,218,114,92,92,80,144,174, 156,0,156,144,186,176,196,194, 204,246,128,124,120,72,138,184, 164,0,158,164,172,166,158,160, 106,118,126,118,128,132,130,82, 156,0,162,160,124,144,118,126, 140,136,120,122,126,134,130,94, 156,0,162,160,120,152,110,128, 92,114,126,124,126,134,128,90, 164,0,160,162,132,138,124,138, 88,116,134,134,128,66,132,86, 160,0,160,160,130,146,126,132, 98,116,132,134,134,114,112,128, 156,0,164,148,202,212,190,188, 168,192,88,80,70,70,134,254, }, }, { // ISO-8859-13 (0.207M chars) [29] {NULL, NULL, ced_hires_20, ced_hires_20, }, 87, 221, 44, 20, 128, {0,0,0,0,0,0,0,0, 0,140,140,0,0,140,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 172,141,141,141,142,142,141,144, 141,141,141,141,141,141,141,141, 142,141,141,141,141,141,141,144, 141,141,141,142,141,141,141,141, 145,148,162,142,153,142,141,165, 141,149,141,156,144,147,157,156, 180,141,166,141,141,141,143,141, 141,141,141,151,142,141,162,141, 145,149,162,141,154,141,141,165, 142,147,141,156,144,146,157,156, 178,141,165,141,141,141,151,141, 142,141,141,151,145,141,162,141, 0,0,0,0,0,0,0,0, 0,103,103,0,0,103,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 179,147,141,155,148,163,142,148, 141,157,141,149,141,141,147,141, 156,141,143,141,164,141,141,160, 142,141,141,164,141,141,141,141, 171,188,209,141,195,182,160,197, 197,203,141,208,168,155,202,175, 209,170,178,192,141,156,194,142, 172,141,141,197,196,141,202,170, 203,197,216,141,196,193,181,199, 198,198,141,215,167,153,203,176, 209,184,177,194,141,156,192,141, 218,141,141,197,184,141,201,147, }, {0,0,0,0,0,0,0,0, 0,147,156,0,0,163,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 226,155,187,141,141,141,205,156, 147,165,143,141,191,150,188,145, 145,153,151,146,146,145,143,143, 142,143,177,149,200,141,141,157, 141,192,188,189,194,190,165,186, 169,203,196,195,196,191,201,180, 177,147,207,210,204,181,186,168, 149,175,171,141,141,143,141,141, 141,193,189,186,194,193,163,185, 166,205,196,195,195,191,200,180, 175,144,206,209,204,182,190,168, 147,177,171,141,143,141,141,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 172,142,142,141,143,141,142,142, 141,142,141,141,142,141,142,143, 144,141,141,141,144,142,141,144, 142,141,142,143,141,142,142,143, 146,151,168,141,152,142,142,159, 160,146,141,160,148,161,157,152, 174,141,150,141,141,141,143,141, 154,141,141,149,142,141,160,154, 147,151,168,141,152,142,142,159, 161,143,141,160,148,161,160,152, 174,141,150,141,141,141,143,141, 154,141,141,150,142,141,160,141, }, {158,0,124,150,126,130,126,128, 0,0,170,174,162,166,162,166, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 24,0,2,2,2,2,2,2, 0,0,2,6,2,2,2,2, 30,0,2,2,2,2,2,2, 0,0,6,12,2,2,2,4, 18,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 16,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 18,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 16,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 162,0,130,160,124,122,116,118, 0,0,184,168,156,160,156,160, 160,0,136,152,118,120,118,120, 0,0,168,176,162,164,162,166, 112,0,92,110,143,143,98,102, 0,0,160,164,168,178,152,154, 116,0,94,110,143,141,116,110, 0,0,156,162,178,166,152,152, 130,0,134,134,68,72,135,137, 0,0,158,164,152,156,168,178, 126,0,136,124,74,78,137,135, 0,0,156,162,150,158,178,166, }, }, { // Latin4 (1.274M chars) [30] {NULL, NULL, ced_hires_17, ced_hires_17, }, 82, 215, 39, 25, 128, {0,0,0,0,0,0,0,0, 0,115,115,0,0,115,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 173,117,116,117,126,117,148,132, 125,177,162,132,116,116,164,120, 128,118,116,117,124,117,148,116, 124,175,162,130,116,116,163,116, 157,149,123,151,148,122,117,138, 167,143,123,118,151,148,118,153, 121,162,122,139,120,119,129,118, 117,116,148,118,124,121,142,117, 157,149,118,127,151,122,117,137, 166,138,123,117,150,149,118,153, 120,162,122,131,121,119,146,117, 118,128,146,116,134,116,142,117, 0,0,0,0,0,0,0,0, 0,70,70,0,0,70,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 181,199,116,118,142,116,174,142, 124,175,196,171,116,126,169,127, 155,213,117,118,137,116,173,125, 122,173,197,168,117,142,170,118, 207,195,152,169,196,183,168,186, 199,205,192,140,210,191,148,201, 147,178,118,155,156,154,195,123, 178,174,175,140,198,117,198,171, 213,200,142,170,197,194,168,195, 200,199,205,141,216,201,138,202, 146,177,121,146,145,154,194,125, 178,220,175,131,185,119,198,126, }, {57,0,0,38,0,0,0,0, 0,131,151,0,0,166,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 228,152,180,117,117,121,211,153, 140,167,128,117,189,148,187,138, 132,143,139,132,130,129,124,123, 122,123,176,138,202,117,118,154, 118,186,190,201,200,189,167,191, 171,184,194,192,197,190,201,180, 181,140,208,211,206,171,184,129, 140,156,180,118,122,126,119,124, 127,186,190,200,200,192,165,190, 168,185,194,192,197,189,200,179, 179,135,207,211,206,172,186,130, 136,162,180,118,128,117,119,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 173,117,117,117,128,123,146,126, 126,173,155,140,117,124,156,121, 126,119,117,117,121,134,147,117, 125,173,155,141,136,134,156,135, 164,151,124,120,147,123,118,143, 164,136,118,120,153,166,122,151, 121,140,124,152,118,120,129,119, 117,154,119,117,123,117,140,151, 164,153,120,117,148,124,119,144, 165,128,118,120,153,167,121,156, 125,142,122,153,127,119,128,121, 118,154,121,117,120,117,144,118, }, {162,0,122,152,126,130,126,128, 0,0,168,174,170,184,168,186, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 20,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 24,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 26,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 36,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 26,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 36,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 142,0,104,138,144,136,100,96, 0,0,180,140,178,180,148,160, 132,0,136,126,68,68,138,130, 0,0,140,176,140,152,182,186, 108,0,90,112,143,143,98,98, 0,0,176,164,182,164,150,154, 118,0,100,112,139,145,112,108, 0,0,180,154,176,174,158,170, 134,0,132,134,46,52,137,137, 0,0,142,182,140,160,182,166, 120,0,140,126,56,60,127,133, 0,0,152,184,148,180,174,174, }, }, { // MACINTOSH (7.890M chars) [31] {NULL, NULL, NULL, NULL}, 93, 176, 57, 40, 128, {157,149,165,157,149,138,123,160, 152,165,162,148,156,168,162,155, 132,145,140,141,135,131,120,139, 145,132,114,87,138,116,126,107, 122,121,109,120,124,153,124,137, 115,116,118,128,124,104,106,113, 104,117,104,104,109,107,139,107, 126,104,109,117,116,104,105,110, 111,159,167,120,108,142,122,128, 139,154,202,125,151,121,112,145, 122,135,125,128,127,169,111,105, 105,105,106,131,106,115,157,151, 178,165,177,166,176,175,150,161, 175,138,169,172,167,178,180,169, 181,177,176,161,145,151,149,162, 150,150,134,154,149,146,136,108, 187,160,176,222,183,180,186,200, 209,171,190,175,171,176,227,198, 178,155,199,157,162,155,181,198, 159,170,176,133,176,169,177,184, 153,174,115,162,149,204,131,171, 181,164,183,160,143,100,144,155, 100,123,132,132,125,113,123,102, 131,114,100,143,166,100,142,153, 167,156,133,122,124,144,123,171, 183,183,202,158,173,141,144,148, 197,182,196,197,174,218,115,99, 113,111,102,198,116,150,173,165, 163,179,162,158,169,174,179,196, 171,195,195,169,176,142,198,171, 137,149,180,180,122,144,118,130, 126,177,118,147,152,115,134,107, }, {42,0,13,0,0,0,0,0, 0,162,166,0,0,180,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 232,145,182,109,125,120,185,162, 148,164,123,123,190,165,187,146, 152,167,161,152,152,149,142,140, 139,140,164,140,212,106,144,148, 114,197,179,197,187,193,175,187, 174,172,164,164,193,190,204,189, 182,167,202,202,200,165,181,159, 152,152,154,137,122,135,112,138, 124,201,182,197,188,200,175,187, 178,184,163,166,195,192,204,192, 182,163,203,213,204,179,184,151, 152,150,156,105,146,106,124,0, 154,118,136,147,125,135,127,149, 150,171,149,158,123,138,165,150, 145,167,173,164,158,153,119,174, 161,141,125,139,166,124,149,128, 121,135,106,117,127,149,123,154, 119,135,121,131,129,103,106,107, 103,121,103,103,108,106,141,104, 125,103,103,109,119,103,106,107, 121,146,166,124,112,147,123,119, 142,156,201,137,158,141,109,143, 126,135,114,134,124,136,109,103, 105,103,103,132,103,152,150,164, 189,156,172,160,169,185,143,151, 179,154,167,169,166,174,187,145, 178,169,174,164,137,148,147,154, 144,138,124,165,164,121,147,108, }, {64,0,40,60,48,54,44,48, 40,32,58,74,24,52,16,30, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 30,0,2,2,2,2,2,2, 2,2,2,14,2,2,2,2, 40,0,2,14,2,8,2,2, 14,8,34,52,2,28,2,6, 2,0,2,2,2,2,2,2, 2,2,2,14,2,2,2,2, 16,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,4,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,14,30,2,8,2,2, 110,0,128,112,130,132,130,130, 172,160,146,144,140,156,152,144, 116,0,126,118,72,74,142,134, 166,176,152,142,114,142,138,132, 150,0,140,144,110,108,104,102, 150,144,198,192,158,160,124,142, 118,0,138,130,110,122,126,128, 152,146,184,206,166,166,128,142, 154,0,132,150,124,122,106,110, 110,102,160,166,174,156,114,104, 126,0,130,136,116,114,128,136, 178,160,156,162,138,174,134,142, 118,0,122,114,142,144,108,96, 120,128,142,140,104,154,162,162, 124,0,132,118,132,136,124,118, 114,100,130,140,112,150,162,164, }, }, { // GB18030 (0.640M chars) [32] {NULL, NULL, NULL, NULL}, 202, 189, 30, 18, 127, {107,143,144,138,146,135,139,141, 137,141,140,132,146,144,130,130, 137,138,134,135,134,142,138,131, 141,139,135,139,136,137,138,133, 130,205,136,202,219,216,134,132, 133,158,133,130,130,130,130,130, 190,196,199,196,196,209,197,199, 197,204,195,200,202,198,193,195, 193,196,190,195,196,183,196,192, 202,197,207,198,197,198,202,200, 202,191,204,201,199,197,203,200, 140,132,132,140,134,135,133,131, 132,133,132,133,146,134,134,134, 133,133,134,132,135,132,132,131, 133,132,131,131,133,132,135,135, 130,130,130,130,130,130,130,0, 150,126,124,127,127,133,129,124, 132,124,123,123,132,122,120,121, 35,63,39,52,35,68,64,64, 75,69,63,67,52,52,39,65, 121,121,121,121,122,120,121,121, 126,122,121,120,121,120,121,121, 121,121,121,120,121,121,120,121, 121,121,120,121,122,121,121,121, 121,121,121,121,121,120,120,120, 121,120,120,121,121,121,121,120, 120,120,121,120,120,120,120,121, 121,121,121,121,121,121,121,121, 121,120,121,120,121,120,120,120, 121,121,121,121,120,121,120,120, 120,120,120,122,120,120,120,121, 121,121,120,120,121,121,120,0, }, {0,0,0,0,0,0,0,0, 0,79,79,0,0,79,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 79,85,79,79,79,79,95,79, 83,83,79,93,93,79,87,79, 126,115,111,106,110,106,103,106, 108,108,79,79,140,83,79,110, 132,131,132,136,135,131,132,131, 131,141,131,133,131,132,132,133, 131,133,131,132,138,132,132,137, 134,131,131,131,131,133,136,131, 131,131,131,131,131,132,132,133, 131,131,131,131,134,131,131,135, 131,131,139,131,132,131,131,132, 131,132,132,131,134,131,131,0, 138,132,131,134,130,131,132,130, 130,130,131,132,131,134,133,133, 131,134,137,134,131,130,133,133, 130,131,132,131,130,132,134,136, 138,196,198,193,197,176,186,185, 196,185,197,195,199,187,185,192, 190,191,180,190,190,195,182,192, 182,191,188,196,190,191,188,193, 187,175,193,194,203,190,193,195, 191,189,190,196,182,188,196,192, 200,179,185,187,190,187,193,181, 193,177,196,183,186,180,183,186, 186,188,190,186,184,188,186,187, 178,191,190,192,188,188,182,181, 179,186,189,196,174,178,187,193, 193,183,197,187,178,188,186,0, }, {218,0,240,172,146,146,148,146, 120,44,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 56,0,26,2,2,2,2,2, 74,70,2,2,2,2,2,2, 50,0,20,2,2,2,2,2, 84,76,2,2,2,2,2,2, 50,0,22,2,2,2,2,2, 86,76,2,2,2,2,2,2, 58,0,28,2,2,2,2,2, 86,76,2,2,2,2,2,2, 128,0,128,64,36,36,38,38, 86,76,2,2,2,2,2,2, 128,0,128,68,40,40,42,42, 84,76,2,2,2,2,2,2, 0,0,0,212,188,194,188,186, 180,180,120,114,116,122,126,126, 0,0,0,192,194,188,194,194, 176,176,116,120,116,122,136,128, 0,0,0,194,206,204,216,214, 118,118,136,130,128,116,126,112, 0,0,0,198,208,208,228,220, 112,112,126,126,128,126,126,130, 0,0,0,188,210,208,232,222, 112,112,120,126,126,126,130,130, 0,0,0,192,210,208,232,222, 120,120,124,128,126,134,120,124, 0,0,0,188,210,208,236,222, 176,176,128,122,120,122,124,124, 0,0,0,180,210,208,236,222, 178,178,122,122,122,124,126,124, }, }, { // CP852 (9.112M chars) [33] {NULL, NULL, NULL, NULL}, 85, 183, 47, 36, 128, {147,99,153,98,113,162,97,141, 139,113,105,98,99,105,112,106, 117,111,78,82,68,70,92,81, 93,63,63,89,87,89,89,145, 187,171,114,163,117,105,174,173, 163,149,96,97,180,97,98,99, 96,96,96,96,96,186,101,174, 97,96,96,96,96,99,100,96, 96,96,96,96,96,96,112,102, 96,96,96,96,96,96,96,96, 97,99,112,109,110,120,170,99, 174,96,96,96,96,98,162,96, 115,98,115,99,99,120,184,183, 99,167,99,97,153,153,98,101, 97,97,96,97,96,158,99,96, 100,97,97,100,191,191,96,158, 178,142,216,118,134,202,143,174, 177,140,130,157,125,109,134,147, 194,166,135,125,142,148,164,161, 172,142,141,143,163,165,129,208, 222,229,177,175,143,129,196,201, 175,165,92,102,208,119,112,129, 92,92,92,92,92,217,114,205, 120,92,92,92,92,119,130,92, 92,92,92,92,92,92,117,134, 95,95,92,92,92,92,92,99, 100,101,140,134,151,163,210,124, 213,92,92,92,92,116,181,94, 176,147,127,120,122,171,198,197, 98,182,97,109,208,197,117,134, 100,102,93,126,93,173,129,92, 111,100,112,145,203,203,92,168, }, {0,0,0,0,0,0,0,0, 0,124,152,0,0,168,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 234,148,183,99,97,113,164,166, 117,160,105,108,196,160,193,147, 123,151,151,145,144,134,140,137, 123,116,177,135,205,109,140,149, 99,185,176,199,192,207,123,147, 188,196,177,198,197,199,208,171, 173,98,190,193,202,160,196,129, 101,116,185,101,102,119,97,112, 97,188,176,199,192,210,124,151, 188,197,178,199,198,199,208,173, 176,98,191,194,203,165,197,129, 100,117,186,97,109,97,97,0, 127,96,131,106,97,136,102,129, 109,96,96,129,100,96,97,102, 122,147,109,96,96,114,120,101, 101,96,96,149,150,109,105,174, 176,201,108,134,125,115,179,179, 153,141,96,96,173,96,98,99, 96,96,96,96,96,174,106,99, 96,96,96,96,96,110,110,96, 96,96,96,96,96,96,98,98, 96,96,96,96,96,96,96,98, 97,97,137,96,141,138,199,98, 99,96,96,96,96,100,136,96, 108,105,96,97,97,138,174,174, 99,131,100,96,100,100,100,102, 116,100,96,107,96,115,97,96, 100,97,97,99,180,181,96,164, }, {92,0,50,80,56,70,54,68, 82,58,30,64,104,40,54,46, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 8,0,2,2,2,2,2,2, 2,2,2,2,6,2,2,2, 20,0,2,2,2,2,2,2, 4,2,2,2,24,2,2,2, 78,0,10,38,14,28,12,26, 96,60,28,64,128,38,54,46, 26,0,2,2,2,2,2,2, 2,2,2,2,24,2,2,2, 14,0,2,2,2,2,2,2, 2,2,2,2,24,2,2,2, 8,0,2,2,2,2,2,2, 10,2,2,2,32,2,2,2, 138,0,138,136,100,100,126,124, 180,178,162,150,190,144,146,142, 122,0,120,134,128,124,134,128, 182,146,170,148,172,110,140,132, 132,0,132,130,120,106,130,132, 158,170,152,172,148,158,164,162, 86,0,86,90,142,152,50,60, 150,144,154,132,162,132,174,174, 148,0,132,140,116,136,116,134, 232,176,140,174,232,152,168,164, 128,0,124,124,134,132,122,132, 156,160,164,142,166,136,162,164, 124,0,124,120,130,132,128,132, 156,156,160,132,156,166,160,146, 118,0,96,134,136,98,136,108, 136,130,160,158,150,168,118,150, }, }, { // Arabic (0.205M chars) [34] {NULL, NULL, NULL, NULL}, 180, 214, 71, 14, 128, {0,0,0,0,0,0,0,0, 0,121,121,0,0,121,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 136,0,0,0,136,0,0,0, 0,0,0,0,138,136,0,0, 0,0,0,0,0,0,0,0, 0,0,0,136,0,0,0,152, 0,151,167,198,147,188,171,230, 205,155,210,171,192,196,187,199, 176,204,173,195,191,195,175,181, 170,203,174,0,0,0,0,0, 182,201,194,197,213,218,204,199, 211,169,210,171,161,136,141,183, 141,152,136,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,133,133,0,0,133,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 145,0,0,0,145,0,0,0, 0,0,0,0,184,145,0,0, 0,0,0,0,0,0,0,0, 0,0,0,148,0,0,0,159, 0,171,146,149,145,145,147,191, 180,203,194,168,171,165,164,185, 152,192,159,171,155,163,167,168, 152,175,156,0,0,0,0,0, 152,177,173,172,190,189,191,184, 173,192,184,156,145,145,146,145, 145,149,145,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,137,171,0,0,150,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 227,142,169,137,137,137,163,144, 137,152,138,137,171,141,178,147, 138,139,137,137,137,138,137,137, 137,137,167,137,194,137,137,137, 137,137,137,137,137,137,137,137, 137,137,137,137,137,137,137,137, 137,137,137,137,137,137,137,137, 137,137,137,137,138,137,137,142, 137,137,137,137,137,137,137,137, 137,137,137,137,137,137,137,137, 137,137,137,137,137,137,137,137, 137,137,137,137,137,137,137,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 137,164,151,154,137,159,165,165, 160,155,154,156,173,137,172,165, 170,158,160,163,159,161,154,161, 189,173,179,140,185,172,164,157, 0,171,144,171,160,163,176,218, 199,202,201,175,192,195,189,204, 182,210,177,202,184,184,183,185, 163,200,179,0,0,0,0,0, 160,196,197,191,226,205,211,195, 209,178,216,158,137,138,147,151, 146,154,138,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {158,0,126,158,180,178,180,180, 0,0,144,124,130,132,124,178, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 52,0,2,28,50,50,50,52, 0,0,2,2,2,2,2,34, 52,0,2,28,50,50,50,52, 0,0,20,10,2,2,2,56, 2,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,16, 2,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 48,0,2,24,46,46,46,48, 0,0,22,12,2,2,2,58, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 166,0,150,140,158,156,158,158, 0,0,146,124,130,132,122,178, 154,0,138,166,170,170,170,170, 0,0,134,162,120,124,114,168, 134,0,150,152,144,144,144,144, 0,0,106,68,128,132,132,124, 144,0,150,152,154,154,154,154, 0,0,110,76,134,124,130,130, 156,0,150,144,146,146,146,146, 0,0,140,142,130,128,126,130, 156,0,134,156,178,178,178,178, 0,0,138,116,132,130,128,174, }, }, { // BIG5_HKSCS (0.271M chars) [35] {NULL, NULL, NULL, NULL}, 157, 175, 62, 14, 128, {0,0,0,0,0,0,0,0, 108,149,150,140,0,150,152,140, 132,132,131,132,132,132,132,132, 132,132,132,131,131,132,131,130, 139,181,164,132,214,207,204,195, 203,198,208,192,195,201,196,187, 202,189,195,196,188,194,190,182, 195,188,192,186,188,188,191,185, 184,180,185,187,180,189,169,181, 135,142,140,142,141,141,140,141, 141,140,140,140,141,140,141,140, 140,140,142,140,140,141,141,140, 140,140,140,140,140,146,149,145, 143,146,140,141,149,140,140,140, 140,140,140,140,140,140,140,140, 140,151,141,140,141,139,140,0, 0,0,0,0,0,0,0,0, 134,133,133,134,0,124,134,133, 122,122,122,122,122,122,122,122, 122,122,122,121,121,122,122,121, 132,216,163,137,212,204,205,192, 184,187,190,192,193,185,187,179, 188,190,183,193,178,189,189,198, 181,189,172,184,183,181,173,166, 178,176,172,174,168,176,168,176, 163,140,141,134,134,134,135,134, 134,134,135,135,135,135,134,134, 135,135,134,134,134,134,134,134, 134,134,134,134,134,134,135,136, 134,134,134,134,134,134,135,134, 134,134,134,134,134,136,135,134, 134,134,144,134,134,134,134,0, }, {0,0,0,0,0,0,0,0, 0,81,81,0,0,81,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,81,81,81,81,81,81,81, 81,81,81,81,81,81,81,81, 81,81,81,81,81,81,81,81, 81,81,81,81,85,81,81,81, 200,202,189,193,189,173,185,189, 193,179,177,176,184,185,182,192, 186,181,175,172,181,185,166,189, 183,172,168,173,170,186,179,178, 174,184,179,166,182,181,171,178, 178,187,186,179,178,172,187,186, 185,189,169,194,178,186,186,183, 180,180,179,177,186,177,193,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 157,191,170,191,186,176,168,184, 181,177,175,185,177,176,169,168, 182,178,179,190,172,180,184,171, 183,186,201,182,169,184,171,170, 185,180,173,171,183,175,187,182, 183,185,183,177,184,178,189,186, 187,188,183,195,166,177,177,182, 181,174,185,182,180,178,175,181, 176,176,179,175,179,183,187,172, 179,192,190,179,187,180,169,178, 168,171,175,183,191,176,182,182, 188,183,186,178,183,179,177,0, }, {232,0,254,254,110,120,118,114, 128,128,4,2,2,2,2,4, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 40,0,16,16,2,2,2,2, 128,128,2,2,2,2,2,2, 46,0,24,22,2,2,2,2, 128,128,2,2,2,2,2,2, 66,0,42,40,2,2,2,2, 128,128,2,2,2,2,2,2, 128,0,128,128,2,2,2,2, 128,128,2,2,2,2,2,2, 128,0,128,128,2,2,2,2, 128,128,2,2,2,2,2,2, 128,0,128,128,2,2,2,2, 128,128,2,2,2,2,2,2, 0,0,0,0,132,142,144,140, 0,0,140,124,126,126,126,126, 0,0,0,0,134,142,142,138, 0,0,136,134,134,134,134,134, 0,0,0,0,142,138,138,134, 0,0,136,138,132,132,134,134, 0,0,0,0,132,138,140,144, 0,0,134,128,138,138,132,136, 0,0,0,0,134,144,136,140, 0,0,126,134,132,132,142,138, 0,0,0,0,134,144,142,138, 0,0,136,134,134,134,136,136, 0,0,0,0,134,144,142,138, 0,0,144,132,132,132,132,132, 0,0,0,0,136,142,140,138, 0,0,136,132,134,136,134,138, }, }, { // CP866 (75.238M chars) [36] {NULL, NULL, NULL, NULL}, 144, 168, 54, 34, 129, {202,189,201,189,198,201,176,191, 205,171,201,198,196,207,207,203, 202,204,202,184,177,168,173,180, 170,166,142,175,168,167,156,168, 200,185,197,186,194,201,174,188, 204,171,197,197,192,205,205,197, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 203,204,203,185,172,167,174,181, 171,168,145,178,171,163,156,169, 122,121,61,61,64,61,61,61, 82,60,60,60,60,60,60,149, 155,129,160,132,130,136,112,122, 155,123,142,126,140,137,156,133, 109,124,109,108,94,99,94,88, 84,75,58,94,87,91,94,119, 193,150,189,167,164,195,129,155, 199,188,180,165,183,167,190,143, 55,55,55,55,55,55,55,55, 55,55,55,55,55,55,55,55, 55,55,55,55,55,55,55,55, 55,55,55,55,55,55,55,55, 55,55,55,55,55,55,55,55, 55,55,55,55,55,55,55,55, 172,176,181,172,118,175,146,138, 137,99,105,181,182,104,163,194, 90,129,56,55,55,62,55,57, 106,70,89,55,55,55,55,167, }, {0,0,0,0,0,0,0,0, 0,118,150,0,0,157,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 221,147,180,74,65,105,160,149, 120,156,94,110,186,165,186,136, 108,128,124,115,112,121,107,104, 100,97,169,132,195,113,104,144, 134,102,74,101,82,91,78,71, 88,102,80,94,92,80,75,94, 112,60,73,125,77,72,89,82, 78,91,81,80,102,111,73,107, 93,109,104,99,117,99,90,77, 101,105,109,107,97,101,119,121, 134,59,107,112,113,105,117,82, 72,94,116,60,90,75,74,0, 210,180,193,179,186,209,168,174, 206,179,191,195,187,202,211,177, 198,196,203,188,161,170,168,174, 161,156,124,189,187,127,169,186, 213,183,195,180,188,212,170,177, 208,179,193,198,188,204,215,181, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 60,60,60,60,60,60,60,60, 202,198,205,193,164,172,168,175, 162,157,125,191,187,137,171,187, 127,130,61,61,67,67,60,61, 82,60,61,60,66,61,60,147, }, {2,0,2,2,50,52,44,42, 12,26,10,176,176,176,22,96, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,4,6,2,2, 2,2,2,68,68,68,2,8, 128,0,58,84,128,128,128,128, 52,68,48,128,128,128,66,128, 128,0,58,84,128,128,128,128, 52,68,48,128,128,128,66,128, 128,0,58,84,128,128,128,128, 52,68,48,128,128,128,66,128, 2,0,2,2,16,18,10,10, 2,2,2,86,86,86,2,18, 64,0,4,30,96,98,92,86, 2,2,2,128,128,128,2,62, 146,0,152,154,174,180,156,152, 138,138,114,116,116,116,110,112, 148,0,150,162,184,184,176,158, 138,140,112,130,130,130,110,118, 154,0,152,150,150,138,126,128, 10,12,138,118,118,118,138,116, 176,0,132,158,200,200,200,198, 118,136,116,200,200,200,132,200, 176,0,132,158,200,200,200,198, 118,136,116,200,200,200,132,200, 176,0,132,158,200,200,200,198, 118,136,116,200,200,200,132,200, 152,0,152,154,122,140,132,122, 10,14,136,132,132,132,138,120, 166,0,126,164,192,204,210,212, 118,118,110,200,200,200,116,224, }, }, { // UTF-16BE (921.761M chars) [37] {NULL, NULL, NULL, NULL}, 58, 128, 46, 5, 128, {255,148,128,107,171,104,157,100, 118,108,101,120,124,90,133,117, 110,115,104,101,109,109,114,104, 109,116,118,96,107,107,124,118, 70,74,71,58,71,66,66,63, 77,54,49,59,103,87,65,64, 97,64,107,90,85,62,70,84, 68,102,96,78,93,84,65,62, 98,86,102,72,68,106,98,98, 86,95,76,75,78,83,75,75, 86,85,82,77,76,85,76,77, 73,80,63,66,87,93,89,101, 71,70,54,77,57,100,56,43, 81,50,69,75,59,63,75,80, 86,62,64,76,70,35,84,71, 72,68,83,83,81,83,96,112, 158,116,117,132,124,138,121,108, 116,113,119,126,121,103,105,108, 120,97,117,112,89,96,106,109, 108,102,107,100,99,84,118,104, 97,103,109,97,115,85,102,101, 103,94,96,102,108,105,104,111, 112,95,96,109,94,101,100,108, 109,120,113,105,98,89,95,106, 95,111,93,114,92,107,109,118, 118,105,105,108,86,103,97,102, 101,110,88,98,94,117,109,105, 78,77,73,73,66,78,86,78, 104,107,89,105,83,121,89,89, 97,107,111,111,101,103,99,100, 88,81,89,122,99,70,98,85, 99,87,106,114,125,103,97,136, }, {236,123,89,99,100,109,89,100, 108,198,193,73,119,181,104,83, 99,103,97,99,99,97,82,94, 101,109,110,107,104,93,93,106, 216,151,203,161,118,166,169,173, 164,164,144,152,168,182,186,198, 189,182,179,173,169,172,169,168, 170,168,177,180,198,196,198,153, 139,171,167,169,169,168,165,158, 160,167,150,145,164,164,166,162, 165,146,165,168,170,153,155,156, 147,151,149,145,145,143,117,176, 111,206,186,196,198,208,187,191, 193,205,165,175,201,192,202,201, 195,149,202,203,208,188,183,182, 175,180,162,150,135,150,118,103, 112,108,111,92,98,93,88,76, 111,111,111,115,106,106,97,112, 115,111,81,95,101,109,110,98, 111,93,99,76,83,70,93,76, 118,92,84,86,91,83,65,85, 86,99,71,87,101,87,83,95, 96,99,90,82,97,95,62,97, 88,93,93,96,90,93,79,99, 100,101,86,92,104,90,86,96, 95,94,77,82,107,97,85,85, 105,105,86,90,102,108,87,87, 97,112,82,93,109,99,100,96, 112,124,97,99,120,103,92,104, 114,131,110,75,88,121,83,84, 84,109,72,116,98,89,110,72, 99,78,96,85,114,106,69,129, }, {126,120,126,128,126,126,126,126, 206,210,222,240,224,222,220,216, 122,164,100,126,150,150,112,122, 232,224,222,208,220,232,222,228, 28,128,42,46,76,82,30,42, 128,128,128,128,128,128,128,128, 18,128,28,34,58,64,18,28, 128,128,128,128,128,128,128,128, 16,128,26,32,54,62,16,26, 128,128,128,128,128,128,128,128, 22,128,32,38,70,74,22,32, 128,128,128,128,128,128,128,128, 30,128,42,48,82,88,32,42, 128,128,128,128,128,128,128,128, 90,190,74,128,122,156,100,110, 212,182,194,168,162,186,118,178, 96,180,78,128,126,140,100,104, 98,96,94,100,98,90,80,92, 108,222,102,132,140,156,114,122, 236,234,220,202,226,226,226,230, 118,206,78,150,134,154,108,118, 228,218,192,196,192,176,210,224, 112,218,96,148,132,158,110,122, 232,232,220,208,226,212,224,228, 112,224,102,146,142,156,108,124, 234,232,226,222,226,226,216,222, 114,196,84,148,140,164,110,118, 242,232,196,208,200,198,192,206, 110,160,74,150,140,156,114,118, 230,224,160,160,162,160,160,220, 124,240,102,144,132,152,106,116, 230,226,200,198,162,174,190,230, }, }, { // Latin3 (0.294M chars) [38] {NULL, NULL, ced_hires_16, ced_hires_16, }, 99, 202, 43, 23, 128, {0,0,0,0,0,0,0,0, 0,142,142,0,0,142,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 180,143,143,143,145,0,143,148, 145,143,143,143,143,143,0,146, 147,143,143,143,144,143,143,148, 145,206,195,143,143,143,0,145, 143,143,143,0,158,143,143,150, 143,151,143,143,143,143,143,143, 0,145,143,162,143,143,147,143, 143,143,143,143,172,143,143,143, 154,143,143,0,165,177,154,182, 165,150,143,148,143,144,143,145, 0,145,143,162,143,143,157,143, 143,143,143,143,172,144,143,143, 0,0,0,0,0,0,0,0, 0,112,112,0,0,112,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 188,148,144,162,154,0,145,154, 146,209,160,192,146,145,0,200, 163,148,147,145,151,144,144,167, 145,236,159,192,146,145,0,204, 161,202,162,87,203,144,144,187, 186,211,176,153,145,198,159,150, 76,180,149,201,165,145,202,146, 144,144,182,153,204,144,144,178, 188,206,154,0,204,144,144,175, 177,206,166,153,158,208,152,146, 0,180,159,203,157,145,200,146, 144,155,182,149,192,144,144,147, }, {86,0,0,0,0,0,0,0, 0,149,151,0,0,159,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 223,146,167,143,143,144,158,154, 152,149,146,143,193,154,169,146, 150,160,164,151,150,149,147,146, 146,146,160,144,200,143,144,146, 143,194,180,194,186,193,173,187, 178,180,164,179,196,190,207,184, 177,157,206,202,196,184,182,176, 156,184,174,143,143,145,144,143, 144,192,181,189,184,193,172,184, 175,179,163,204,214,197,221,182, 173,152,217,199,214,184,180,176, 154,186,193,144,147,143,144,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 180,143,143,143,146,164,143,146, 146,145,143,171,143,144,177,162, 146,143,143,143,145,143,143,148, 146,199,202,192,143,143,169,162, 145,144,145,0,158,143,143,149, 143,151,144,143,143,146,144,143, 0,144,144,146,143,143,148,144, 143,143,143,143,146,143,143,161, 144,144,144,0,159,143,143,146, 143,147,144,143,143,146,143,143, 0,144,144,147,146,143,150,143, 143,143,144,143,145,143,143,143, }, {162,0,130,150,128,132,120,124, 0,0,156,140,170,170,172,172, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 24,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 30,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 26,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 16,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 24,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 144,0,124,142,134,134,124,120, 0,0,174,132,162,162,162,166, 118,0,132,130,74,76,134,134, 0,0,126,164,140,140,140,142, 118,0,100,110,147,145,94,90, 0,0,152,136,178,170,170,170, 124,0,102,116,143,145,108,108, 0,0,170,132,166,166,164,166, 134,0,140,130,82,86,131,131, 0,0,168,152,154,156,164,156, 130,0,124,124,92,96,137,137, 0,0,148,152,164,170,166,166, }, }, { // UTF-16LE (912.138M chars) [39] {NULL, NULL, NULL, NULL}, 58, 128, 46, 4, 127, {255,146,126,120,177,123,159,99, 110,78,94,116,115,99,130,112, 110,112,82,97,100,94,113,102, 100,94,112,92,103,102,120,113, 60,84,76,72,67,43,63,72, 75,64,74,96,95,88,83,52, 78,81,96,84,76,57,31,82, 83,85,86,82,92,78,88,68, 84,91,96,52,84,96,99,105, 89,83,72,65,83,88,84,86, 81,94,75,70,97,95,78,57, 109,82,33,91,80,77,77,75, 25,59,64,81,47,69,60,19, 96,31,92,30,20,68,72,81, 58,66,54,80,88,55,60,66, 55,40,45,78,55,99,113,116, 161,117,113,130,127,131,118,108, 119,110,115,123,129,107,105,108, 116,99,114,110,93,99,108,111, 109,103,113,103,97,84,101,103, 91,100,101,94,110,85,98,97, 98,88,86,93,108,101,99,107, 111,91,107,105,91,95,97,104, 105,118,111,98,97,92,87,101, 101,106,99,111,87,110,107,116, 114,105,99,102,87,99,93,98, 100,103,88,98,89,111,105,101, 111,92,89,98,104,108,110,105, 102,102,83,99,77,115,78,86, 85,100,104,107,98,100,92,97, 86,77,86,117,94,64,98,84, 97,89,103,109,121,97,98,126, }, {236,123,100,94,96,100,91,97, 108,196,193,90,112,182,101,92, 101,105,95,98,102,96,89,96, 98,112,104,103,108,101,95,106, 216,149,203,169,119,166,174,176, 165,165,142,152,168,181,187,198, 189,182,180,175,173,177,172,171, 173,176,177,184,198,197,198,156, 139,172,168,169,171,168,166,159, 159,167,150,145,165,165,166,163, 165,145,164,168,170,153,155,156, 147,150,149,144,147,141,118,176, 125,206,186,196,197,208,187,190, 192,205,164,175,200,191,201,201, 195,151,202,202,207,188,182,182, 175,179,161,149,134,149,121,100, 115,103,100,89,101,94,90,87, 101,114,108,116,108,98,92,113, 113,107,90,81,101,110,105,94, 107,95,107,74,84,72,92,81, 118,95,89,86,95,86,81,84, 92,99,79,88,102,91,89,97, 104,100,92,91,99,99,79,96, 89,102,98,99,90,95,85,101, 101,103,87,94,104,94,85,94, 97,94,83,90,106,96,82,86, 105,103,85,93,102,108,92,91, 91,103,79,87,101,91,92,87, 112,124,97,99,119,112,90,105, 108,128,107,81,91,121,89,85, 88,97,79,113,98,90,111,79, 102,83,100,94,112,102,86,130, }, {128,124,128,126,126,126,126,126, 204,202,224,222,224,224,220,218, 120,164,116,98,140,156,124,122, 220,224,168,162,168,220,206,238, 82,158,96,72,110,162,88,92, 170,160,158,158,158,176,158,164, 54,158,66,68,104,108,56,66, 158,158,158,158,158,148,158,158, 48,158,58,62,88,96,50,60, 158,158,158,158,158,148,158,158, 50,158,60,64,90,98,52,62, 158,158,158,158,158,148,158,158, 62,158,74,80,110,116,66,76, 158,158,158,158,158,148,158,158, 112,192,96,138,138,132,104,106, 206,210,184,198,188,196,186,186, 106,174,86,120,124,134,92,112, 96,94,82,82,82,78,66,76, 122,214,110,132,136,160,112,112, 228,230,210,212,214,210,216,212, 90,200,118,146,140,162,114,120, 234,222,202,200,206,188,196,196, 96,206,128,142,144,156,116,126, 238,216,210,206,214,206,218,208, 94,216,130,142,136,160,108,126, 238,236,218,214,222,212,214,212, 94,214,134,138,140,158,114,124, 238,238,212,208,212,204,214,208, 62,162,54,148,148,164,116,124, 232,226,164,164,162,150,164,174, 94,210,110,146,134,162,112,118, 232,228,192,198,194,188,198,208, }, }, { // HZ-GB-2312 (87.400M chars) [40] {NULL, NULL, NULL, NULL}, 92, 0, 37, 0, 255, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {126,0,164,0,0,0,126,0, 178,139,148,0,0,132,154,146, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 161,195,176,211,162,158,148,144, 213,209,179,164,154,148,168,174, 182,184,172,182,184,188,187,175, 180,183,176,176,182,177,179,172, 170,193,196,199,167,165,195,168, 183,178,178,180,168,178,186,182, 183,158,180,182,181,183,186,180, 155,132,136,132,146,136,132,132, 132,132,136,139,173,183,178,171, 162,161,132,142,144,132,139,139, 132,136,139,144,132,132,149,139, 132,132,136,152,139,132,245,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, }, { // CSN_369103 (8.850M chars) [41] {NULL, NULL, NULL, NULL}, 90, 204, 46, 27, 127, {0,0,0,0,0,0,0,0, 0,90,90,0,0,90,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 176,178,96,184,92,102,188,127, 120,153,117,98,133,96,143,153, 122,178,93,182,115,102,188,96, 119,152,117,98,133,101,141,152, 98,169,119,130,151,111,96,137, 171,147,170,103,153,155,105,120, 96,98,118,171,112,104,128,105, 180,129,158,96,133,127,119,102, 99,169,99,125,153,107,102,128, 169,142,170,99,155,155,103,119, 95,99,118,171,112,105,148,95, 180,130,154,95,137,127,119,96, 0,0,0,0,0,0,0,0, 0,55,55,0,0,55,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 185,202,93,207,98,140,210,145, 119,178,153,123,170,124,172,196, 158,217,94,211,139,141,210,121, 116,176,151,152,187,124,173,200, 103,198,155,156,200,128,165,183, 202,208,195,143,194,194,151,144, 149,174,157,197,159,157,199,120, 192,171,178,137,201,170,155,174, 106,203,144,173,201,105,197,170, 203,203,208,143,202,204,139,150, 148,188,166,199,147,166,197,121, 192,191,178,144,188,182,155,122, }, {62,0,0,0,0,0,0,0, 0,129,153,0,0,162,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 228,154,181,95,91,108,164,158, 144,155,114,105,191,153,189,148, 132,145,139,130,128,126,119,117, 115,116,177,135,201,95,124,155, 93,200,180,210,197,203,168,188, 175,191,170,190,200,190,208,194, 182,141,204,199,200,181,182,186, 146,188,181,105,114,126,105,120, 112,201,181,209,196,205,167,186, 172,191,169,190,200,189,207,194, 180,135,203,198,199,182,181,191, 143,189,181,100,125,92,99,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 176,176,95,167,93,99,163,117, 120,144,106,125,140,115,142,179, 121,178,93,168,111,97,163,92, 119,144,107,125,141,107,143,179, 99,160,117,127,149,96,190,132, 166,138,143,97,95,185,108,127, 94,120,128,168,99,91,130,104, 171,126,127,95,123,101,122,153, 100,161,110,128,150,96,190,125, 167,128,145,96,95,185,105,130, 94,120,128,170,114,91,134,95, 172,126,113,95,119,100,122,97, }, {182,0,124,152,122,132,122,132, 0,0,162,164,156,176,156,176, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 12,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 14,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 24,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 26,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 24,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 26,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 132,0,96,130,142,136,100,114, 0,0,172,130,168,162,110,142, 130,0,136,132,52,54,136,130, 0,0,108,174,92,106,170,166, 98,0,90,100,140,142,100,90, 0,0,164,122,170,178,132,132, 100,0,92,102,138,142,108,110, 0,0,166,106,174,156,130,144, 134,0,136,134,38,54,134,134, 0,0,118,168,102,146,168,180, 132,0,130,134,44,58,136,140, 0,0,108,170,98,158,172,156, }, }, { // ISO-2022-KR (85.145M chars) [42] {NULL, NULL, NULL, NULL}, 44, 144, 15, 3, 129, {0,0,130,0,0,0,0,0, 0,66,66,0,0,66,213,252, 0,0,0,0,0,0,0,0, 0,0,0,224,0,0,91,91, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {80,0,0,0,0,0,0,0, 0,155,178,0,0,191,94,16, 0,0,0,0,0,0,0,0, 0,0,0,159,0,0,115,80, 237,178,211,150,215,142,197,197, 215,186,147,141,202,191,204,184, 182,193,189,179,176,177,168,168, 173,174,186,191,233,164,175,184, 177,172,153,166,162,158,159,169, 164,164,152,159,147,160,152,147, 160,143,152,154,156,148,153,153, 128,113,118,160,143,179,134,168, 120,133,133,128,134,139,123,121, 142,133,113,107,120,125,168,114, 123,102,122,140,136,109,112,132, 116,115,107,101,157,124,155,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {130,130,126,130,130,130,118,128, 0,0,0,0,0,0,0,0, 42,2,134,2,62,40,70,60, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, }, { // Latin6 (0.061M chars) [43] {NULL, NULL, ced_hires_19, ced_hires_19, }, 93, 214, 54, 26, 129, {0,0,0,0,0,0,0,0, 0,156,156,0,0,156,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 175,158,158,158,158,158,158,159, 158,158,161,158,159,158,158,158, 158,158,158,158,159,158,158,159, 158,158,161,158,159,158,158,158, 159,164,158,159,162,158,158,158, 171,161,158,158,159,162,158,158, 158,160,158,158,158,158,159,158, 158,158,162,158,158,158,158,158, 159,164,158,158,163,158,158,158, 171,160,158,158,159,162,158,158, 158,160,158,158,158,158,162,158, 158,159,162,158,159,158,158,158, 0,0,0,0,0,0,0,0, 0,130,130,0,0,130,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 180,198,158,158,160,158,158,160, 158,163,190,158,168,158,159,158, 163,212,158,158,162,158,158,166, 159,158,180,158,168,158,158,158, 206,194,163,172,195,183,171,185, 198,203,191,160,209,190,162,159, 161,179,158,193,165,163,194,158, 179,176,175,160,196,171,160,172, 211,198,160,173,196,193,171,194, 199,198,204,160,214,199,160,158, 167,178,159,195,161,163,193,158, 178,219,176,159,185,179,160,158, }, {0,0,0,0,0,0,0,0, 0,160,164,0,0,168,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 227,163,177,159,159,159,210,162, 160,170,159,159,189,161,185,159, 162,161,160,159,159,159,159,159, 159,159,178,159,200,159,159,164, 159,184,177,200,197,187,171,187, 174,180,189,189,194,188,202,180, 180,160,204,208,200,171,181,173, 162,166,178,159,159,159,159,159, 159,184,179,199,197,189,170,185, 172,181,189,189,194,186,201,179, 179,159,203,208,200,171,185,173, 162,169,178,159,159,159,159,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 176,159,159,159,159,159,159,159, 159,159,163,159,161,159,159,159, 159,159,159,159,159,160,159,159, 159,159,163,159,161,159,159,159, 161,164,159,159,163,159,159,159, 168,160,159,159,159,168,159,159, 160,159,159,159,159,159,159,159, 159,159,159,159,159,159,159,164, 161,164,159,159,163,159,159,159, 169,159,159,159,159,169,159,159, 160,159,159,159,159,159,159,159, 159,159,159,159,159,159,159,159, }, {152,0,122,146,128,132,128,130, 0,0,154,156,154,156,154,158, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 4,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 4,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 4,0,2,2,2,2,2,2, 0,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 144,0,114,140,138,132,120,128, 0,0,162,154,152,154,152,154, 142,0,138,134,108,112,134,126, 0,0,154,158,154,156,154,156, 118,0,98,118,143,145,106,106, 0,0,154,154,162,156,154,154, 132,0,108,126,143,143,118,118, 0,0,154,156,158,158,154,156, 126,0,132,132,90,92,139,139, 0,0,152,156,152,156,162,156, 126,0,140,126,98,102,131,131, 0,0,154,156,154,158,156,158, }, }, { // UTF7 (0.037M chars) [44] {NULL, NULL, NULL, NULL}, 77, 207, 29, 27, 255, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,184, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,189,189,0,0,189,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,189,189,189,189,189,189,189, 189,189,189,0,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,189, 189,189,189,189,189,189,189,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, }, { // ISO_2022_CN (63.392M chars) [45] {NULL, NULL, NULL, NULL}, 43, 144, 14, 3, 129, {0,0,0,0,0,0,0,0, 0,70,70,0,0,70,213,252, 0,0,0,0,0,0,0,0, 0,0,0,222,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {79,0,0,0,0,0,0,0, 0,155,177,0,0,190,19,19, 0,0,0,0,0,0,0,0, 0,0,0,158,0,0,114,79, 240,177,210,148,212,141,197,195, 214,185,147,140,202,190,203,183, 182,192,188,179,175,177,167,168, 173,174,186,190,231,164,175,183, 177,172,152,166,161,157,158,168, 164,163,151,158,146,160,151,146, 159,143,151,153,155,147,152,152, 127,112,117,160,142,178,133,168, 119,132,130,126,124,138,122,120, 141,131,112,106,119,124,122,112, 122,101,108,135,135,101,111,130, 112,115,106,96,156,123,154,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {130,130,126,128,130,128,128,130, 0,0,0,0,0,0,0,0, 44,2,134,2,62,26,62,10, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, }, { // BIG5-CP950 (0.029M chars) [46] {NULL, NULL, NULL, NULL}, 158, 182, 61, 26, 128, {0,166,166,166,166,166,166,166, 166,177,177,166,166,177,166,166, 158,158,158,158,158,158,158,158, 158,158,158,158,158,158,158,158, 166,179,169,151,208,201,198,190, 197,193,202,187,190,196,191,184, 197,185,191,191,184,189,185,179, 190,185,188,182,184,184,187,182, 181,178,182,183,178,186,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,167,168,167, 166,167,166,166,168,166,166,166, 166,166,166,166,166,166,166,166, 166,168,166,166,166,166,166,101, 0,161,161,161,161,161,161,161, 161,161,161,161,161,161,161,161, 149,149,149,149,149,149,149,149, 149,149,149,149,149,149,149,149, 161,211,166,161,206,199,200,187, 180,182,185,186,188,181,182,176, 183,186,179,188,175,185,185,193, 178,185,170,180,179,177,170,167, 175,174,171,172,168,174,169,161, 161,161,161,161,161,161,161,161, 161,161,161,161,161,161,161,161, 161,161,161,161,161,161,161,161, 161,161,161,161,161,161,161,161, 161,161,161,161,161,161,161,161, 161,161,161,161,161,161,161,161, 161,161,161,161,161,161,161,167, }, {0,0,0,0,0,0,0,0, 0,113,113,0,0,113,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,113,113,113,113,113,113,113, 113,113,113,113,113,113,113,113, 113,113,113,113,113,113,113,113, 113,113,113,113,113,113,113,113, 197,198,187,191,188,176,184,188, 190,180,179,179,184,184,183,189, 185,182,178,177,182,184,174,187, 183,177,175,178,176,185,181,180, 178,183,181,174,182,182,176,180, 180,186,185,181,180,177,186,185, 184,187,175,191,180,185,185,183, 181,180,181,179,185,179,190,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 150,188,176,189,185,179,174,184, 181,179,178,184,179,179,175,174, 182,179,180,187,176,180,183,176, 183,185,197,182,175,183,176,175, 184,181,177,176,183,178,186,182, 182,184,183,179,184,180,187,185, 186,186,182,191,174,179,179,182, 182,177,184,182,180,179,178,181, 179,179,180,177,180,182,186,176, 180,190,188,180,185,181,175,179, 174,176,178,183,188,178,182,182, 186,183,185,180,183,180,180,121, }, {170,0,170,170,104,110,110,108, 128,128,2,2,2,2,2,78, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 14,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 20,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 34,0,10,10,2,2,2,2, 128,128,2,2,2,2,2,2, 42,0,18,18,2,2,2,2, 128,128,2,2,2,2,2,2, 40,0,18,16,2,2,2,2, 128,128,2,2,2,2,2,2, 42,0,18,18,2,2,2,2, 128,128,2,2,2,2,2,2, 0,0,0,0,134,142,140,138, 0,0,132,132,132,132,132,132, 0,0,0,0,134,142,140,138, 0,0,136,134,134,136,136,136, 0,0,0,0,142,136,138,134, 0,0,134,138,132,134,134,134, 0,0,0,0,134,136,140,144, 0,0,134,130,138,136,134,136, 0,0,0,0,136,142,138,140, 0,0,130,134,134,132,140,138, 0,0,0,0,134,142,140,138, 0,0,136,134,134,136,136,136, 0,0,0,0,134,142,140,138, 0,0,138,134,134,134,134,134, 160,128,160,160,134,140,140,138, 128,128,136,134,134,134,136,136, }, }, { // JAGRAN (0.046M chars) [47] {NULL, NULL, NULL, NULL}, 142, 199, 66, 34, 133, {174,174,174,174,174,174,174,174, 174,182,182,174,174,182,174,174, 174,174,174,174,174,174,174,174, 174,174,174,0,0,0,174,174, 0,182,182,182,182,182,182,182, 182,182,182,182,182,0,182,182, 182,182,0,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,0,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,0,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 166,166,166,166,166,166,166,166, 166,178,178,166,166,178,166,166, 166,166,166,166,166,166,166,166, 166,166,166,0,0,0,166,166, 0,178,178,178,178,178,178,178, 178,178,178,178,178,0,178,178, 166,166,0,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,0,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,0,166, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, }, {0,0,0,0,0,0,0,0, 0,180,180,0,0,180,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,180,127,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,127,180, 180,180,180,180,180,180,180,180, 180,180,127,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,127,180,180,0, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,0,0,0,176,176, 0,176,176,176,176,176,176,176, 176,176,176,176,176,0,176,176, 176,176,0,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,0,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,0,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 132,0,132,132,132,132,132,132, 130,130,130,130,130,130,130,130, 136,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 136,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 136,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 136,0,134,136,134,134,136,134, 130,130,130,130,130,130,130,130, 136,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 136,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 136,0,134,136,134,134,136,134, 130,130,130,130,130,130,130,130, }, }, { // BHASKAR (0.047M chars) [48] {NULL, NULL, NULL, NULL}, 141, 199, 66, 34, 132, {174,174,174,174,174,174,174,174, 174,182,182,174,174,182,174,174, 174,174,174,174,174,174,174,174, 174,174,174,0,0,0,174,174, 0,182,182,182,181,182,182,182, 182,182,182,182,182,0,182,182, 182,182,0,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,0,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,0,181, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 166,166,166,166,166,166,166,166, 166,178,178,166,166,178,166,166, 166,166,166,166,166,166,166,166, 166,166,166,0,0,0,166,166, 0,178,178,178,178,178,178,178, 178,178,178,178,178,0,178,178, 166,166,0,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,0,166, 166,166,166,166,166,166,166,166, 166,166,166,166,166,166,0,166, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, }, {0,0,0,0,0,0,0,0, 0,180,180,0,0,180,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,126,180, 180,180,180,180,180,180,180,180, 180,180,126,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,0, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,0,0,0,176,176, 0,176,176,176,176,176,176,176, 176,176,176,176,176,0,176,176, 176,176,0,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,0,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,0,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 132,0,132,132,132,132,132,132, 130,130,130,130,130,130,130,130, 134,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 136,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 136,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 134,0,134,136,134,134,136,134, 130,130,130,130,130,130,130,130, 136,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 136,0,134,134,134,134,134,134, 130,130,130,130,130,130,130,130, 134,0,134,136,134,134,136,134, 130,130,130,130,130,130,130,130, }, }, { // HTCHANAKYA (0.041M chars) [49] {NULL, NULL, NULL, NULL}, 142, 202, 68, 32, 133, {173,0,0,0,173,173,173,173, 173,182,171,173,105,171,0,0, 0,173,173,0,173,173,173,173, 0,0,173,0,0,0,0,0, 181,182,182,182,181,182,182,182, 182,182,182,182,182,0,182,182, 182,182,182,182,182,182,182,0, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,0,181, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 169,0,0,0,169,169,169,169, 169,180,170,169,0,170,0,0, 0,169,169,0,169,169,169,169, 0,0,169,0,0,0,0,0, 0,180,180,180,179,180,180,180, 180,180,180,180,180,0,180,180, 169,169,169,169,169,169,169,0, 169,169,169,169,169,169,169,169, 169,169,169,169,169,169,169,169, 169,169,169,169,169,169,169,169, 169,169,169,169,169,169,169,169, 169,169,169,169,169,169,169,169, 169,169,169,169,169,169,169,169, 169,169,169,169,169,169,0,168, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, }, {0,0,0,0,0,0,0,0, 0,181,181,0,0,181,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,181,129,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,129,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,0, 176,0,0,0,176,176,176,176, 176,176,0,176,0,0,0,0, 0,176,176,0,176,176,176,176, 0,0,176,0,0,0,0,0, 175,176,176,176,176,176,176,176, 176,176,176,176,176,0,176,176, 176,176,176,176,176,176,176,0, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,0,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 130,0,128,130,128,130,130,128, 128,128,128,128,128,128,128,128, 134,0,134,134,134,134,134,134, 132,132,132,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,132,132,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,132,132,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,132,132,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,132,132,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,132,132,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,132,132,132,132,132,132,132, }, }, { // TSCII (0.047M chars) [50] {NULL, NULL, NULL, NULL}, 141, 199, 66, 33, 134, {173,173,173,173,173,173,173,173, 173,182,182,173,173,182,173,173, 173,173,173,173,173,173,173,173, 173,173,173,173,173,173,0,173, 0,181,181,181,181,181,157,157, 157,181,0,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,0, 167,167,167,167,167,167,167,167, 167,179,179,167,167,167,167,167, 167,167,175,168,170,167,167,167, 167,167,167,167,167,167,0,167, 0,178,178,178,178,178,0,0, 0,183,0,178,178,178,178,178, 167,167,167,167,167,167,167,167, 167,167,167,167,167,167,167,167, 167,167,167,167,167,167,167,167, 167,167,167,167,167,167,167,167, 167,167,167,167,167,167,167,167, 167,167,167,167,167,167,167,167, 167,167,167,167,167,167,167,167, 167,167,167,167,167,167,167,167, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,0, }, {0,0,0,0,0,0,0,0, 0,179,179,0,0,125,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 170,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,180,179,179,179,180,179,179, 179,180,179,179,179,179,179,179, 179,179,179,182,179,179,179,179, 179,179,179,179,179,179,179,0, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,0,175, 0,175,175,175,175,175,0,0, 0,175,0,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,175, 175,175,175,175,175,175,175,0, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 132,0,132,132,132,132,132,132, 128,128,130,128,128,128,128,128, 132,0,134,132,132,132,134,136, 130,130,132,130,130,130,130,130, 134,0,136,134,134,134,134,134, 132,130,130,132,132,130,130,130, 134,0,134,134,134,134,134,134, 130,130,132,130,130,130,130,130, 134,0,134,134,134,134,134,134, 130,130,132,130,130,130,130,130, 134,0,134,134,134,134,134,134, 130,130,132,130,130,130,130,130, 134,0,134,134,134,134,134,134, 130,130,132,130,130,130,130,130, 134,0,134,134,134,134,134,134, 130,130,132,130,130,130,130,130, }, }, { // TAM (0.036M chars) [51] {NULL, NULL, NULL, NULL}, 140, 203, 70, 33, 133, {0,0,174,174,174,174,174,174, 174,184,184,174,174,174,0,0, 0,0,0,0,0,0,0,0, 174,174,174,174,174,0,0,174, 0,183,183,183,183,0,183,183, 183,0,161,161,161,0,183,183, 183,183,183,183,183,183,183,0, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,0,183,183,183,183,183, 0,0,0,0,0,0,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 0,0,170,170,170,170,170,170, 170,181,181,170,170,0,0,0, 0,0,0,0,0,0,0,0, 170,170,170,170,170,0,0,170, 0,181,181,181,181,0,181,181, 181,0,0,0,0,0,181,181, 170,170,170,170,170,170,170,0, 170,170,170,170,170,170,170,170, 170,170,170,170,170,170,170,170, 170,170,0,170,170,170,170,170, 0,0,0,0,0,0,170,170, 170,170,170,170,170,170,170,170, 170,170,170,170,170,170,170,170, 170,170,170,170,170,170,170,170, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, }, {0,0,0,0,0,0,0,0, 0,182,182,0,0,132,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,132,132,132,132,132, 132,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,182,182,182,182,182, 182,182,182,132,132,132,132,0, 0,0,177,177,177,177,177,177, 177,177,177,177,177,0,0,0, 0,0,0,0,0,0,0,0, 177,177,177,177,177,0,0,177, 0,177,177,177,177,0,177,177, 177,0,0,0,0,0,177,177, 177,177,177,177,177,177,177,0, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,0,177,177,177,177,177, 0,0,0,0,0,0,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,177,177, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 132,0,132,132,132,132,132,132, 130,130,130,128,128,128,128,128, 134,0,136,136,136,134,136,134, 132,132,132,134,134,132,132,132, 134,0,134,134,134,134,134,134, 132,132,132,132,132,132,134,134, 134,0,134,134,134,134,134,134, 132,134,132,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,134,132,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,132,134,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,134,132,132,132,132,132,132, 134,0,134,134,134,134,134,134, 132,134,132,132,132,132,132,132, }, }, { // TAB (0.030M chars) [52] {NULL, NULL, NULL, NULL}, 137, 210, 72, 28, 132, {0,0,0,0,0,0,0,0, 0,174,174,0,0,174,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,183,183,183,0,183,183, 183,0,165,165,165,0,183,183, 183,183,183,183,183,183,183,0, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,0,183,183,183,183,183, 0,0,0,0,0,0,183,0, 0,0,0,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 0,0,0,0,0,0,0,0, 0,174,174,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,186,186,186,0,186,186, 186,0,0,0,0,0,186,186, 177,177,177,177,177,177,177,0, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,0,177,177,177,177,177, 0,0,0,0,0,0,177,0, 0,0,0,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 186,186,186,186,186,186,186,186, 186,186,186,186,186,186,186,186, }, {0,0,0,0,0,0,0,0, 0,183,183,0,0,136,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,183, 183,183,183,183,183,183,183,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,176,176,176,0,176,176, 176,0,0,0,0,0,176,176, 176,176,176,176,176,176,176,0, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,0,176,176,176,176,176, 0,0,0,0,0,0,176,0, 0,0,0,176,176,176,176,176, 176,176,176,176,176,176,176,176, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,176,176, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 128,0,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 132,0,132,134,134,134,134,132, 128,128,134,134,134,134,138,138, 132,0,132,132,132,132,132,132, 128,128,136,136,136,136,136,136, 132,0,132,132,132,132,132,132, 128,128,136,136,136,136,136,136, 132,0,134,134,134,134,134,134, 128,128,136,136,136,136,136,136, 132,0,132,134,134,134,134,132, 128,128,136,136,136,136,136,136, 132,0,132,134,134,134,134,132, 128,128,136,136,136,136,136,136, }, }, { // EUC-CN (0.035M chars) [53] {NULL, NULL, NULL, NULL}, 197, 192, 37, 32, 128, {0,0,0,0,0,0,0,0, 0,169,169,0,0,169,119,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,240,216,176,191,186,168,185, 184,166,0,0,118,0,0,0, 0,103,0,0,0,0,29,0, 0,0,0,0,0,0,0,0, 0,0,169,0,197,197,190,192, 190,212,188,187,188,186,190,188, 187,186,186,185,184,186,187,187, 185,185,186,185,193,186,186,190, 185,185,185,187,189,185,186,191, 185,185,185,184,186,185,184,184, 185,184,184,184,184,184,184,184, 186,184,184,184,184,173,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,147,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,134,134,0,0,134,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,134,134,134,134,134,134,134, 134,134,134,134,134,134,134,134, 134,134,134,134,134,134,134,134, 134,134,134,134,134,134,134,134, 134,134,134,134,138,134,138,134, 134,138,134,134,138,134,134,134, 134,134,134,134,138,138,134,134, 134,134,134,134,134,134,134,134, 134,134,134,134,134,134,134,134, 134,134,134,134,138,134,134,134, 134,134,134,134,134,134,134,134, 134,134,134,134,134,134,134,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 170,230,193,197,184,184,184,184, 210,184,185,182,188,181,181,185, 183,207,189,182,181,182,181,180, 181,181,182,185,181,179,187,187, 183,180,180,181,182,180,186,180, 180,185,195,191,183,180,182,180, 179,182,189,183,182,180,192,195, 179,179,181,182,181,179,183,183, 180,180,178,184,182,198,195,192, 180,183,186,180,180,183,181,181, 183,179,180,189,179,179,178,178, 182,179,212,180,186,180,211,0, }, {182,0,182,182,180,182,182,182, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 128,128,2,10,14,14,12,8, 76,0,52,52,50,52,52,52, 128,128,128,128,128,128,128,128, 4,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 8,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 8,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 12,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,76,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,134,124,114,118,122,124, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,116,126,130,128,126,136, 0,0,0,0,0,0,0,0, 0,0,116,128,136,132,134,124, 0,0,0,0,0,0,0,0, 0,0,118,130,132,134,130,124, 0,0,0,0,0,0,0,0, 0,0,118,130,132,134,130,126, }, }, { // EUC (15478 chars) [54] {NULL, NULL, NULL, NULL}, 197, 200, 38, 33, 129, {0,0,0,0,0,0,0,0, 0,173,173,0,0,173,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,234,211,180,190,188,173,189, 189,170,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,174,0,193,195,190,191, 191,208,190,189,190,189,191,190, 190,189,190,189,189,190,189,190, 189,189,190,189,193,189,190,191, 189,189,189,190,191,190,190,193, 189,190,189,189,190,189,189,189, 189,189,189,189,189,189,189,189, 190,189,189,189,189,178,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,140,140,0,0,140,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 162,226,192,195,186,186,185,186, 205,186,187,185,188,185,185,186, 184,202,187,184,184,184,183,183, 184,184,184,185,183,183,187,187, 183,183,183,183,184,183,186,183, 183,185,192,189,184,183,184,183, 182,184,187,184,183,182,190,192, 182,182,182,183,184,182,184,184, 182,182,182,185,184,194,191,190, 183,184,185,183,183,184,183,183, 184,182,182,188,182,182,182,182, 184,182,206,183,185,182,206,0, }, {176,0,176,176,176,176,176,176, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 128,0,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,2,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,136,124,116,118,122,124, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,118,126,128,128,128,136, 0,0,0,0,0,0,0,0, 0,0,118,128,132,130,130,126, 0,0,0,0,0,0,0,0, 0,0,120,128,130,132,130,126, 0,0,0,0,0,0,0,0, 0,0,120,130,130,130,130,126, }, }, { // CNS (15478 chars) [55] {NULL, NULL, NULL, NULL}, 197, 200, 38, 33, 129, {0,0,0,0,0,0,0,0, 0,173,173,0,0,173,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,234,211,180,190,188,173,189, 189,170,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,174,0,193,195,190,191, 191,208,190,189,190,189,191,190, 190,189,190,189,189,190,189,190, 189,189,190,189,193,189,190,191, 189,189,189,190,191,190,190,193, 189,190,189,189,190,189,189,189, 189,189,189,189,189,189,189,189, 190,189,189,189,189,178,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,140,140,0,0,140,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,140, 140,140,140,140,140,140,140,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 162,226,192,195,186,186,185,186, 205,186,187,185,188,185,185,186, 184,202,187,184,184,184,183,183, 184,184,184,185,183,183,187,187, 183,183,183,183,184,183,186,183, 183,185,192,189,184,183,184,183, 182,184,187,184,183,182,190,192, 182,182,182,183,184,182,184,184, 182,182,182,185,184,194,191,190, 183,184,185,183,183,184,183,183, 184,182,182,188,182,182,182,182, 184,182,206,183,185,182,206,0, }, {176,0,176,176,176,176,176,176, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 128,0,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 2,0,2,2,2,2,2,2, 128,128,128,128,128,128,128,128, 0,0,0,0,0,0,0,0, 0,0,2,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,136,124,116,118,122,124, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,118,126,128,128,128,136, 0,0,0,0,0,0,0,0, 0,0,118,128,132,130,130,126, 0,0,0,0,0,0,0,0, 0,0,120,128,130,132,130,126, 0,0,0,0,0,0,0,0, 0,0,120,130,130,130,130,126, }, }, { // UTF-32BE (1032.458M chars) [56] {NULL, NULL, NULL, NULL}, 77, 151, 56, 41, 127, {250,137,119,116,158,116,151,92, 103,89,82,111,111,75,204,151, 102,106,71,86,94,92,104,91, 88,92,106,215,97,93,99,106, 79,97,116,106,115,126,78,66, 89,96,94,80,79,92,90,90, 93,101,90,90,72,96,79,91, 82,89,78,88,80,99,84,86, 86,92,83,59,101,100,101,79, 89,93,71,46,102,89,64,68, 78,74,72,65,71,56,71,64, 76,84,65,68,92,98,94,106, 182,177,181,215,194,207,203,198, 193,188,166,179,184,171,90,183, 67,2,0,27,20,10,16,20, 7,0,3,46,24,71,43,104, 160,104,104,120,120,123,106,99, 106,101,107,114,119,100,91,96, 110,88,107,102,79,91,100,101, 99,92,100,94,88,67,104,92, 68,80,83,73,92,62,75,75, 79,64,69,73,88,82,78,88, 92,73,82,84,71,76,74,82, 84,98,91,76,78,66,71,80, 78,89,78,91,66,88,86,94, 97,83,76,79,62,78,71,75, 80,86,62,78,68,93,85,80, 83,80,76,75,69,83,90,83, 82,82,61,78,58,98,56,64, 68,80,85,85,74,85,73,74, 60,46,58,83,68,31,72,64, 71,62,78,78,88,72,62,103, }, {231,96,83,86,82,95,79,87, 91,190,189,71,101,175,87,75, 88,93,82,83,89,84,75,84, 89,98,94,150,95,84,82,97, 211,164,198,158,206,163,163,167, 204,160,139,149,163,176,181,194, 186,180,173,172,169,172,164,166, 171,171,175,177,193,193,193,164, 169,173,164,169,169,167,165,166, 164,164,153,153,160,162,163,160, 163,145,162,165,167,153,156,157, 144,147,146,140,138,138,110,171, 103,201,181,192,192,203,181,185, 187,200,161,171,196,187,196,196, 190,145,197,197,203,183,178,178, 170,174,157,147,130,147,113,85, 194,202,196,197,161,172,160,164, 174,168,169,165,163,162,161,172, 167,152,151,154,172,173,173,172, 170,167,172,172,181,172,158,158, 158,165,152,155,174,160,165,166, 161,156,155,157,154,167,173,166, 170,159,161,164,160,162,155,162, 190,174,180,181,186,173,165,168, 96,98,83,90,99,87,83,90, 91,88,75,80,102,90,78,81, 99,97,81,86,97,102,86,85, 95,107,84,92,106,96,96,92, 105,120,91,98,114,104,86,102, 104,125,102,72,80,118,81,79, 79,91,70,110,91,83,108,69, 93,74,94,86,107,97,65,124, }, {132,132,126,132,132,132,132,132, 122,128,140,130,230,224,222,224, 60,24,152,14,68,74,40,40, 104,122,122,98,204,218,206,224, 8,96,12,22,38,48,10,20, 44,64,80,56,128,128,128,128, 20,128,26,34,56,70,22,32, 40,58,72,50,128,128,128,128, 20,128,24,34,54,66,22,32, 38,56,70,50,128,128,128,128, 26,128,30,40,62,74,28,38, 40,60,76,52,128,128,128,128, 2,2,2,2,2,2,2,2, 42,62,78,54,128,128,128,128, 134,180,74,128,144,158,114,92, 116,128,122,78,150,192,132,164, 118,142,64,114,106,120,82,106, 14,12,26,10,92,80,68,72, 138,192,94,128,132,154,112,108, 34,52,40,14,124,118,102,106, 142,188,72,144,148,176,108,110, 156,152,90,112,202,162,200,174, 142,200,86,138,146,162,110,118, 156,146,132,106,208,200,212,192, 142,208,88,138,138,162,96,118, 154,152,138,122,208,212,182,178, 138,180,68,144,148,178,114,122, 154,162,112,112,184,192,158,168, 140,128,102,142,150,172,108,116, 148,148,148,148,20,14,4,12, 136,196,112,138,136,176,110,118, 132,148,136,112,148,160,162,150, }, }, { // UTF-32LE (1032.461M chars) [57] {NULL, NULL, NULL, NULL}, 77, 152, 56, 41, 127, {250,137,119,116,158,116,151,92, 103,89,82,111,111,75,204,150, 102,106,71,86,94,92,104,91, 88,92,106,215,97,93,99,106, 79,97,116,106,114,126,78,66, 89,96,94,144,79,92,90,90, 93,101,90,90,72,96,79,91, 80,89,78,88,80,99,84,86, 86,92,83,58,101,100,101,79, 89,93,71,46,102,89,64,68, 78,74,72,65,71,54,71,64, 76,84,65,68,92,98,94,106, 182,177,181,215,193,207,203,198, 193,188,166,178,184,171,90,183, 67,3,0,27,20,11,17,20, 8,0,4,46,24,71,162,104, 160,104,104,120,120,123,106,99, 106,101,107,114,118,100,91,94, 110,88,107,102,79,91,100,101, 99,92,100,94,88,67,104,92, 68,80,83,73,92,62,75,75, 79,64,71,124,88,82,78,88, 92,73,82,84,71,76,74,82, 84,98,91,76,78,66,71,80, 78,89,78,91,66,88,86,94, 97,83,76,79,62,78,71,75, 80,86,62,78,68,93,85,80, 83,80,76,75,69,83,90,83, 82,82,61,78,57,98,57,64, 68,80,85,85,74,85,73,74, 60,46,57,83,68,31,72,64, 71,62,78,78,88,72,122,103, }, {231,96,83,86,82,95,79,87, 91,190,189,71,101,175,87,75, 88,93,82,83,89,84,75,84, 88,98,94,158,95,84,82,97, 211,164,198,159,206,163,163,167, 204,160,139,149,163,176,181,194, 186,180,174,172,169,172,165,166, 171,171,175,177,193,193,193,164, 169,173,164,169,169,167,165,166, 164,164,155,154,161,163,165,160, 163,145,162,165,167,154,157,157, 144,147,146,140,138,138,110,171, 103,201,181,192,192,203,181,185, 187,200,161,171,196,187,196,196, 190,145,197,197,203,183,178,177, 170,174,157,147,130,147,131,85, 193,202,196,197,161,172,160,164, 174,168,169,165,163,162,161,172, 167,152,151,154,172,173,173,172, 170,167,172,172,181,172,158,158, 158,165,152,155,174,160,165,166, 161,155,155,157,154,167,173,166, 170,159,161,164,160,162,155,162, 190,174,180,181,186,173,165,168, 99,99,87,92,100,90,85,93, 93,89,79,83,102,91,81,82, 101,97,82,87,97,102,87,86, 95,107,84,92,106,96,96,92, 105,120,93,102,115,107,92,103, 105,125,103,77,82,118,81,84, 79,91,70,110,91,83,107,69, 93,74,94,86,107,97,65,124, }, {132,124,126,132,132,132,132,132, 122,128,140,130,228,224,222,224, 60,14,152,16,66,74,40,40, 104,122,122,98,204,218,206,224, 44,212,2,12,34,104,44,134, 116,112,144,150,220,208,220,130, 20,116,26,34,56,70,22,32, 40,58,72,50,128,128,128,128, 20,104,24,34,54,66,22,32, 38,56,70,50,128,128,128,128, 26,114,30,40,60,74,28,38, 42,60,76,52,128,128,128,128, 2,2,2,2,2,2,2,2, 44,62,78,54,128,128,128,128, 84,190,114,148,160,156,70,62, 116,118,160,144,212,200,222,166, 118,134,64,114,106,120,82,106, 14,12,26,8,90,80,66,72, 138,168,94,128,130,154,112,108, 34,52,40,14,122,116,100,106, 130,162,60,130,122,146,98,100, 146,140,78,102,202,162,172,162, 142,200,86,138,144,162,110,118, 158,146,132,106,208,200,212,192, 142,208,88,138,136,162,96,118, 154,152,138,122,208,212,182,176, 138,180,68,144,148,178,114,122, 156,162,112,112,182,192,156,168, 140,128,102,142,150,172,108,116, 148,148,148,148,18,14,4,12, 124,168,100,124,114,154,98,106, 76,90,78,54,122,120,108,108, }, }, { // X-BINARYENC (0 chars) [58] {NULL, NULL, NULL, NULL}, 0, 0, 0, 0, 255, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, }, }, { // X-UTF8UTF8 (43.271M chars) [59] {NULL, NULL, NULL, NULL}, 150, 194, 32, 13, 129, {191,104,167,173,203,123,113,0, 0,69,69,80,0,107,0,105, 95,0,125,146,116,0,0,0, 104,129,184,0,125,122,159,0, 139,144,162,111,112,105,148,117, 115,101,122,104,217,112,130,114, 151,116,107,120,116,116,98,89, 124,119,136,113,115,116,126,105, 0,0,239,243,62,181,145,62, 62,62,62,147,62,62,62,62, 62,62,62,62,62,62,62,62, 62,62,62,62,62,62,62,62, 0,0,220,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,58,0,0,0,0,5,0, 0,0,36,0,102,23,86,28, 9,0,75,142,74,0,0,0, 89,85,64,0,119,139,99,0, 121,119,159,71,88,75,139,88, 67,69,78,82,156,71,75,61, 134,70,55,54,61,63,56,60, 80,102,119,63,76,71,134,73, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,24,140,0,0,147,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 195,107,138,80,100,83,158,123, 107,139,106,91,157,127,159,122, 111,135,127,120,115,117,108,109, 106,109,120,113,182,78,121,111, 84,149,138,143,143,145,133,136, 138,145,127,129,143,142,149,143, 141,113,143,148,151,137,137,140, 124,119,115,112,96,117,97,106, 108,137,132,140,136,131,138,130, 131,133,119,128,140,133,137,128, 135,113,137,152,143,136,130,123, 116,108,106,112,84,77,91,0, 196,150,226,235,119,165,141,52, 52,52,52,115,52,142,52,124, 121,52,147,165,107,52,52,52, 97,124,126,52,187,166,117,52, 216,191,222,181,200,177,168,187, 191,218,177,170,169,189,169,153, 169,175,160,194,171,165,189,171, 182,163,176,175,198,160,155,150, 0,0,205,182,0,189,133,0, 0,0,0,163,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,209,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 12,0,2,2,2,2,2,2, 0,0,0,0,2,128,2,128, 66,0,20,36,40,48,50,54, 0,0,0,0,2,128,2,128, 2,0,2,2,2,2,2,2, 0,0,0,0,128,128,128,128, 128,0,84,128,128,128,128,128, 0,0,0,0,128,128,128,128, 10,0,2,2,2,2,2,2, 0,0,0,0,128,128,128,128, 128,0,128,128,128,128,128,128, 0,0,0,0,128,128,128,128, 120,0,130,112,192,198,136,140, 2,168,134,98,134,128,124,128, 160,0,168,162,178,176,178,178, 2,2,2,2,170,128,2,128, 178,0,174,178,150,154,158,156, 2,2,2,2,158,128,164,128, 156,0,162,152,182,182,182,184, 2,26,2,2,170,128,10,128, 0,0,128,128,128,128,128,128, 128,108,130,130,2,128,2,128, 0,0,128,128,128,128,128,128, 120,210,124,154,74,128,70,128, 0,0,128,128,128,128,128,128, 140,2,2,2,2,128,2,128, 0,0,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, }, }, { // X-TAM-ELANGO (0.036M chars) [60] {NULL, NULL, NULL, NULL}, 126, 180, 58, 30, 129, {0,180,180,180,180,180,180,180, 180,191,191,180,180,191,0,180, 170,170,170,170,170,170,170,170, 170,170,170,170,170,170,0,170, 0,180,180,180,180,180,180,180, 180,180,180,180,0,0,180,0, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,0,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,0,0,180,180, 180,0,180,180,0,0,0,0, 0,0,0,0,180,0,180,180, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,181,181,181,181,181,181,181, 181,191,191,181,181,191,0,181, 171,171,171,171,171,171,171,171, 171,171,171,171,171,171,0,171, 0,181,181,181,181,181,181,181, 181,181,181,181,0,0,181,0, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,0,181, 181,181,181,181,181,181,181,181, 181,181,181,181,181,181,181,181, 181,181,181,181,0,0,181,181, 181,0,181,181,0,0,0,0, 0,0,0,0,181,0,181,181, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {0,0,0,0,0,0,0,0, 0,180,180,0,0,180,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,0, 0,180,180,180,180,180,180,180, 180,180,180,180,180,180,0,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,0,180, 0,180,180,180,180,180,180,180, 180,180,180,180,0,0,180,0, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,0,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,0,0,180,180, 180,0,180,180,0,0,0,0, 0,0,0,0,180,0,180,180, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }, {110,0,110,110,110,110,110,110, 110,110,110,110,110,110,110,128, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,128, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,128, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,128, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,128, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,128, 128,0,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 132,0,132,132,132,132,132,132, 132,132,132,132,132,132,132,128, 136,0,134,134,134,134,134,134, 136,136,136,136,136,136,136,128, 136,0,136,136,136,136,136,136, 136,136,136,136,136,136,136,128, 136,0,134,134,134,134,134,134, 136,136,136,136,136,136,136,128, 136,0,134,134,134,134,134,134, 136,136,136,136,136,136,136,128, 136,0,134,134,134,134,134,134, 136,136,136,136,136,136,136,128, 136,0,136,136,136,136,136,136, 136,136,136,136,136,136,136,128, 128,0,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, }, }, { // X-TAM-LTTMBARANI (0.043M chars) [61] {NULL, NULL, NULL, NULL}, 141, 199, 69, 34, 128, {0,178,178,0,178,0,178,178, 0,187,187,178,178,176,0,0, 0,0,0,0,0,168,0,0, 0,0,168,168,168,0,0,168, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 0,176,176,0,176,0,176,176, 0,187,187,176,176,178,0,0, 0,0,0,0,0,165,0,0, 0,0,165,165,165,0,0,165, 0,176,176,176,176,176,177,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,182, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,177,176,176, 176,176,176,176,176,176,176,176, 176,176,176,176,176,176,176,176, 181,176,176,176,176,176,176,176, 176,176,176,176,176,189,176,176, }, {0,0,0,0,0,0,0,0, 0,178,177,0,0,177,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 185,177,177,177,177,177,178,177, 177,177,177,177,178,177,178,177, 177,177,177,177,177,177,177,177, 177,177,177,177,180,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,0, 0,178,178,0,178,0,178,178, 0,178,178,178,178,0,0,0, 0,0,0,0,0,178,0,0, 0,0,178,178,178,0,0,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,179, 179,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, }, {116,0,114,116,116,116,116,116, 118,118,116,118,118,118,118,118, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 134,0,132,134,134,134,134,134, 132,132,132,132,132,132,132,132, 138,0,136,138,138,138,138,138, 136,136,136,136,136,136,136,136, 138,0,138,138,138,138,138,138, 136,136,136,136,136,136,136,136, 138,0,138,138,138,138,138,138, 136,136,136,136,136,136,136,136, 138,0,136,138,138,138,138,138, 136,136,136,136,136,136,136,136, 138,0,138,138,138,138,138,138, 136,136,136,136,136,136,136,136, 138,0,136,138,138,138,138,138, 136,136,136,136,136,136,136,136, 136,0,142,138,136,136,136,136, 136,136,136,136,136,136,136,136, }, }, { // X-TAM-SHREE (0.037M chars) [62] {NULL, NULL, NULL, NULL}, 140, 204, 70, 30, 129, {0,0,0,0,0,0,0,0, 0,188,179,0,0,179,0,0, 0,168,0,0,0,168,0,0, 0,0,0,168,0,0,0,168, 0,178,178,178,178,178,178,178, 178,178,178,178,0,0,178,178, 178,178,178,178,178,178,0,0, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,0,178, 0,0,0,0,0,0,0,0, 0,188,178,0,0,178,0,0, 0,169,0,0,0,169,0,0, 0,0,0,169,0,0,0,169, 0,179,179,179,179,179,179,179, 179,179,179,179,0,0,179,179, 179,179,179,179,179,179,0,0, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,0,179, }, {0,0,0,0,0,0,0,0, 0,179,179,0,0,179,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,0, 0,0,0,0,0,0,0,0, 0,179,0,0,0,0,0,0, 0,179,0,0,0,179,0,0, 0,0,0,179,0,0,0,179, 0,179,179,179,179,179,179,179, 179,179,179,179,0,0,179,179, 179,179,179,179,179,179,0,0, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,0,179, }, {132,0,132,132,132,132,132,132, 134,134,132,132,132,132,132,132, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 118,0,118,118,118,118,118,118, 118,118,118,118,118,118,118,118, 136,0,136,138,138,138,138,136, 138,138,138,138,138,138,138,138, 136,0,136,136,136,136,136,136, 138,138,138,138,138,138,138,138, 136,0,136,136,136,136,136,136, 138,138,138,138,138,138,138,138, 136,0,136,136,136,136,136,136, 138,138,138,138,138,138,138,138, 136,0,136,136,136,136,136,136, 138,138,138,138,138,138,138,138, 136,0,136,136,136,136,136,136, 138,138,138,138,138,138,138,138, 136,0,136,136,136,136,136,136, 138,138,138,138,138,138,138,138, }, }, { // X-TAM-TBOOMIS (0.038M chars) [63] {NULL, NULL, NULL, NULL}, 139, 205, 71, 31, 129, {178,0,0,0,0,0,0,0, 0,178,178,0,0,178,0,0, 0,0,0,168,168,0,0,0, 0,0,0,0,0,0,0,0, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,0,0,0,0,0,0,0, 0,178,178,0,0,178,0,0, 0,0,0,168,168,0,0,0, 0,0,0,0,0,0,0,0, 0,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,200,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 179,178,178,178,181,190,178,188, }, {0,0,0,0,0,0,0,0, 0,178,178,0,0,178,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 200,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,180,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,177, 178,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,178,178,0,0,0, 0,0,0,0,0,0,0,0, 177,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, }, {134,0,130,132,132,132,132,132, 132,132,132,132,132,132,132,132, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 94,94,94,94,94,94,94,94, 118,0,114,116,116,116,116,118, 116,116,118,116,116,116,116,116, 138,0,134,136,136,136,136,138, 136,136,138,136,136,136,136,136, 138,0,134,136,136,136,136,136, 136,136,138,136,136,136,136,136, 138,0,134,136,136,136,136,138, 136,136,138,136,136,136,136,136, 138,0,134,136,136,136,136,138, 136,136,138,136,136,136,136,136, 138,0,134,136,136,136,136,138, 136,136,138,136,136,136,136,136, 134,0,144,134,134,134,134,134, 136,136,138,136,136,136,136,136, 134,0,138,136,134,134,134,134, 136,136,138,136,136,136,136,136, }, }, { // X-TAM-TMNEWS (0.037M chars) [64] {NULL, NULL, NULL, NULL}, 141, 205, 71, 29, 128, {0,0,0,0,0,0,0,0, 0,179,179,0,0,179,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 0,0,0,0,0,0,0,0, 0,179,179,0,0,179,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,190,179,180,181,179, 180,179,179,179,179,179,179,179, }, {0,0,0,0,0,0,0,0, 0,179,179,0,0,179,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 180,179,180,179,179,179,179,179, 179,179,179,179,180,179,180,179, 179,179,179,179,179,179,179,179, 179,179,180,179,181,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,179, 179,179,179,179,179,179,179,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 179,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, 180,180,180,180,180,180,180,180, }, {138,0,136,136,138,138,138,138, 128,128,136,136,136,136,136,136, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 128,128,2,2,2,2,2,2, 128,0,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 138,0,136,136,136,136,136,136, 128,128,136,136,136,136,136,136, 138,0,136,136,138,138,138,136, 128,128,136,136,136,136,136,136, 138,0,136,136,138,138,138,136, 128,128,136,136,136,136,136,136, 138,0,136,136,138,138,138,136, 128,128,136,136,136,136,136,136, 138,0,136,136,138,138,138,136, 128,128,136,136,136,136,136,136, 136,0,140,136,136,136,136,136, 128,128,136,136,136,136,136,136, }, }, { // X-TAM-WEBTAMIL (0.050M chars) [65] {NULL, NULL, NULL, NULL}, 142, 193, 66, 37, 129, {178,178,178,178,178,178,178,178, 178,186,186,178,178,186,178,178, 169,169,169,169,169,169,0,169, 169,169,169,169,169,169,169,169, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,179, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 178,178,178,178,178,178,178,178, 174,174,174,174,174,174,174,174, 174,186,186,174,174,186,174,174, 162,162,162,162,162,162,0,162, 162,162,162,162,162,162,162,162, 0,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,181, 174,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,174, 174,174,174,174,174,174,174,174, }, {0,0,0,0,0,0,0,0, 0,178,177,0,0,177,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 158,177,177,177,177,177,178,177, 177,177,177,177,177,177,178,177, 177,177,177,177,177,177,177,177, 177,177,177,177,179,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,178,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,0, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,133,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,178, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, 177,177,177,177,177,177,177,177, }, {108,0,108,108,108,108,108,108, 110,110,110,110,110,110,110,110, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,0,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 134,0,134,134,134,134,134,134, 132,132,132,132,132,132,132,132, 138,0,138,138,138,138,138,138, 134,134,134,134,134,134,134,134, 138,0,138,138,138,138,138,138, 134,134,134,134,134,134,134,134, 138,0,138,138,138,138,138,138, 134,134,134,134,134,134,134,134, 138,0,138,138,138,138,138,138, 134,134,134,134,134,134,134,134, 138,0,138,138,138,138,138,138, 134,134,134,134,134,134,134,134, 138,0,138,138,138,138,138,138, 134,134,134,134,134,134,134,134, 138,0,138,138,138,138,138,138, 134,134,134,134,134,134,134,134, }, }, { // UTF8CP1252 (178.156M chars) [66] {NULL, NULL, NULL, NULL}, 127, 200, 59, 31, 133, {181,189,183,184,176,167,163,162, 171,165,167,170,170,164,161,165, 163,161,165,161,164,166,165,166, 163,164,168,163,171,163,158,162, 206,174,166,168,175,173,174,175, 177,166,173,171,187,176,178,175, 178,168,166,174,175,166,165,168, 186,173,179,177,184,174,171,171, 119,121,206,216,183,183,147,141, 116,157,118,125,127,125,181,171, 210,198,125,120,113,136,145,187, 200,196,150,157,110,121,122,116, 177,173,191,209,190,201,198,198, 188,185,166,178,183,167,123,183, 120,134,134,122,116,132,155,115, 122,120,125,97,146,127,124,122, 186,143,146,128,162,163,140,136, 145,136,144,136,144,130,143,126, 134,159,199,183,181,182,183,161, 136,161,149,139,147,147,140,133, 194,145,152,160,146,142,140,152, 139,166,140,162,150,144,159,142, 165,141,142,133,158,130,129,165, 138,130,156,172,141,139,132,152, 146,177,150,157,188,159,153,165, 178,205,165,144,125,177,148,136, 125,164,126,181,156,148,180,118, 161,109,162,137,189,137,127,170, 196,183,151,159,189,172,153,166, 185,210,166,152,154,180,147,138, 133,164,153,186,156,147,178,152, 160,162,164,140,188,144,126,109, }, {148,50,56,78,0,0,0,0, 0,146,153,0,0,166,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 225,137,174,103,110,121,177,155, 149,159,126,115,183,160,179,142, 162,172,165,154,151,151,144,143, 141,143,157,138,205,108,138,142, 124,187,176,189,179,184,170,182, 175,169,154,158,186,182,198,181, 175,156,199,194,193,169,173,155, 158,150,147,134,124,138,112,134, 122,193,181,189,179,191,172,183, 177,178,152,159,187,182,199,184, 175,153,200,203,195,176,174,143, 147,148,143,122,135,97,118,45, 189,193,197,200,179,177,173,171, 177,169,174,172,176,171,162,170, 167,165,159,165,169,171,167,170, 167,172,168,170,176,168,162,169, 201,180,183,168,179,169,167,182, 176,187,173,166,167,178,173,174, 182,177,171,180,173,177,171,169, 186,175,179,179,186,179,179,171, 129,129,169,152,124,152,130,133, 107,158,114,130,116,114,119,120, 120,118,126,120,107,124,147,116, 137,132,118,122,118,119,119,156, 174,145,176,207,186,198,193,190, 186,184,161,173,176,161,128,175, 133,123,125,123,107,155,137,103, 119,110,131,110,136,122,127,123, }, {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2, 0,0,0,0,2,4,2,6, 2,0,2,2,2,2,2,2, 0,0,0,0,4,14,2,16, 2,0,2,2,2,2,2,2, 0,0,0,0,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,0,0,2,2,2,2, 2,0,2,2,2,2,2,2, 0,0,0,0,2,2,2,2, 32,0,2,4,2,2,2,2, 0,0,0,0,2,2,2,2, 156,0,136,152,124,138,112,108, 126,134,130,124,120,126,140,96, 138,0,138,136,122,116,134,138, 124,130,118,122,140,122,146,112, 150,0,140,156,114,112,112,112, 108,122,140,112,150,128,142,122, 144,0,142,152,118,120,114,114, 124,134,120,126,132,136,144,128, 0,0,90,80,150,152,98,98, 134,120,142,130,128,128,70,112, 0,0,102,98,150,148,124,110, 134,128,128,144,104,128,66,114, 0,0,138,118,64,72,142,142, 138,138,122,134,110,120,110,140, 0,0,126,122,70,82,148,144, 88,108,108,110,162,194,128,196, }, }, }; // End unigram_table static const uint8 kMostLikelyEncoding[] = { // 00xx 37,39,39,39,39,39,39,39, 39,37,37,39,39,39,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 37,37,37,39,39,37,39,39, 39,39,37,39,37,37,39,37, 39,39,39,39,39,39,39,39, 39,39,37,39,37,39,37,39, 37,39,39,39,39,37,39,39, 37,37,39,37,39,39,39,39, 37,39,37,37,37,37,37,37, 39,39,39,37,39,37,56,39, 39,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,39,37,37,37,37,37,37, 39,37,37,37,39,37,39,56, 56,39,56,56,39,39,39,39, 56,56,56,56,56,56,39,56, 56,56,39,39,57,56,56,39, 56,56,56,57,39,39,56,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,57, 39,56,39,39,39,56,39,39, 39,39,39,39,39,57,39,39, 39,39,57,39,39,39,39,39, 39,39,39,39,56,39,39,39, 39,39,39,39,39,57,39,39, 57,57,57,57,56,57,56,57, 39,37,39,39,37,39,39,39, 39,37,39,39,39,37,39,39, 39,37,39,37,39,39,39,39, 39,39,39,39,37,39,39,57, // 01xx 56,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,37, 39,39,39,37,37,37,39,39, 39,39,37,37,39,39,39,37, 39,37,39,37,37,37,37,37, 37,37,39,39,39,37,37,39, 39,37,37,37,37,39,37,39, 37,39,39,39,39,39,37,39, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,39,39,39,37,37, 37,39,39,37,39,39,39,39, 39,37,39,39,39,39,39,39, 39,39,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 39,37,37,39,39,39,39,39, 37,39,37,39,39,39,37,37, 37,39,37,39,39,37,39,39, 37,39,37,37,37,37,37,39, 37,39,39,39,37,39,39,39, 39,39,39,39,39,37,37,37, 37,37,37,39,37,39,37,39, 37,56,56,56,37,56,39,56, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,37, 39,39,39,39,39,37,39,37, 39,39,39,37,39,39,37,39, // 02xx 37,37,37,39,37,37,37,39, 39,39,39,37,37,39,37,37, 37,8,37,37,37,37,37,37, 37,37,37,37,39,39,37,39, 37,37,39,40,37,39,37,37, 39,39,39,39,39,39,39,39, 39,37,37,37,37,37,40,37, 40,40,39,39,39,39,37,37, 6,39,39,40,39,37,39,39, 39,39,37,37,39,39,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,39,37, 37,37,37,37,39,37,37,37, 37,37,39,37,37,37,37,39, 37,37,39,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,39,37,37,37,39, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,39,39,37,37,39, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,39,37,37,37,37,37,39, 37,39,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,39,37,37,37,37, // 03xx 56,37,37,37,56,37,37,37, 37,37,39,56,37,39,39,37, 39,37,37,39,37,39,37,37, 37,39,56,39,37,37,39,39, 39,39,39,37,37,37,39,39, 39,39,39,39,39,39,39,39, 37,39,39,39,39,39,39,39, 39,56,39,39,39,39,39,56, 39,39,39,56,56,39,39,39, 39,39,39,39,39,39,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,39,37, 37,37,37,39,37,37,37,39, 37,39,37,37,37,39,39,39, 39,37,37,37,39,37,37,37, 37,37,37,37,37,37,40,37, 39,37,37,39,39,37,37,37, 37,37,37,37,39,37,37,39, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,39, 37,37,37,37,37,37,37,37, 37,37,37,39,37,39,37,37, 37,39,39,37,39,37,37,37, 39,37,39,37,39,37,37,37, 39,39,39,39,39,39,37,37, // 04xx 56,39,37,39,37,39,37,37, 37,39,39,37,39,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,39,37,37,37,39,39, 37,39,39,37,39,39,39,37, 39,39,37,39,39,39,39,37, 39,39,39,39,39,39,39,37, 39,39,39,39,39,37,39,39, 39,39,39,39,39,37,39,39, 37,39,37,37,39,37,37,37, 37,39,37,37,39,39,37,39, 37,39,37,39,39,37,37,37, 39,39,37,39,37,37,39,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,39,37, 37,37,37,39,37,37,37,37, 37,37,37,39,37,37,37,37, 37,37,37,39,37,37,37,39, 37,37,37,37,39,37,37,39, 39,37,39,39,37,37,39,39, 37,39,37,37,39,39,37,37, 37,39,37,37,39,39,37,39, 37,39,37,39,39,39,39,37, 37,37,37,39,37,37,39,37, 39,37,39,37,37,39,39,37, 39,39,37,37,37,39,39,39, 37,37,37,37,37,37,37,37, 39,37,39,39,39,39,39,39, 37,37,39,37,39,37,37,37, 37,37,37,37,39,39,39,37, 39,39,39,39,37,39,37,37, // 05xx 56,37,37,37,37,37,37,37, 37,37,39,37,37,39,37,37, 37,37,37,39,37,37,37,37, 37,37,37,37,37,37,37,37, 39,39,39,37,37,37,39,39, 39,39,39,39,39,39,39,39, 37,39,39,39,37,37,40,37, 37,39,39,39,39,39,39,39, 37,39,40,39,37,37,37,39, 37,37,37,37,40,37,37,37, 37,37,37,39,37,37,39,37, 37,37,37,37,37,37,39,39, 39,37,37,37,39,37,37,37, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,39,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,39,37, 39,39,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 37,37,37,37,39,37,37,37, // 06xx 56,37,37,37,37,37,37,37, 37,37,39,37,39,39,39,39, 37,37,37,39,37,37,37,37, 39,39,37,37,37,37,37,37, 39,39,39,37,37,37,39,37, 37,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,39,39,39,39,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,37, 37,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,39,37,39,37,37,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,39,37,37,37,37,37, 37,37,37,39,37,37,37,37, 39,37,37,39,37,37,37,39, 37,37,37,39,39,39,39,37, 37,37,37,37,37,37,37,39, 37,37,37,39,37,37,37,39, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,39, 37,37,37,39,37,37,37,39, 37,37,37,37,37,37,37,37, 39,39,39,39,39,37,39,37, 39,37,39,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 07xx 56,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,37, 39,37,39,40,37,37,37,37, 37,39,37,37,39,37,39,37, 37,39,37,40,37,40,37,37, 37,37,40,37,39,37,37,37, 37,37,39,37,37,37,40,40, 37,37,37,40,37,37,39,37, 37,37,39,37,37,39,37,37, 37,39,39,37,39,39,37,37, 37,37,37,39,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,39,37, 37,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 08xx 37,37,37,37,37,37,37,37, 3,39,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,40,40,37,37,37, 40,40,37,37,37,37,37,37, 37,39,40,40,40,40,40,40, 40,40,40,40,40,40,40,37, 40,40,40,40,37,37,37,37, 40,40,37,37,40,37,37,37, 37,37,37,37,39,37,37,37, 37,37,37,37,39,37,39,37, 37,39,37,37,37,37,37,39, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,40,37, 37,37,39,37,37,37,37,37, 37,37,39,37,39,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,39,37, 37,39,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,39,37,37,39,37, 39,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,39, // 09xx 37,37,37,37,37,37,37,37, 37,0,0,37,37,0,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 0,10,0,0,0,0,0,0, 0,0,0,0,0,10,0,10, 10,0,0,0,0,0,0,0, 0,0,0,0,0,10,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 0Axx 37,37,37,37,37,37,37,37, 37,0,0,37,37,0,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 0,10,0,0,0,0,0,0, 0,0,0,0,0,10,0,10, 10,0,0,0,0,0,0,0, 0,0,0,0,0,10,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 0Bxx 56,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,40, 37,37,37,37,37,37,37,37, 37,39,37,37,37,37,37,37, 39,40,39,40,37,37,37,37, 37,39,37,37,39,39,39,40, 37,39,39,39,39,39,39,40, 39,39,39,37,39,37,37,37, 37,37,40,40,37,37,40,37, 39,37,37,37,39,37,39,37, 39,37,37,37,37,37,37,39, 37,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,39, 37,37,39,37,37,37,40,37, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 0Cxx 57,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,39,37,37,37,37,37, 37,39,37,37,39,37,37,37, 37,39,37,37,37,37,37,37, 37,37,39,37,39,37,37,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,37,37,37, 39,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 37,37,37,39,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 0Dxx 37,37,37,37,37,37,37,37, 37,0,0,37,37,0,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 0,10,0,0,0,0,0,0, 0,0,0,0,0,10,0,10, 10,0,0,0,0,0,0,0, 0,0,0,0,0,10,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, // 0Exx 56,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,57,56,57,56,37,56,37, 56,56,37,56,56,37,39,39, 57,57,57,57,57,57,57,57, 57,57,57,57,57,57,57,57, 57,57,56,57,57,57,57,57, 57,57,56,57,57,57,56,56, 57,56,57,56,56,57,56,57, 56,56,56,56,57,56,56,56, 56,56,56,56,56,56,39,56, 56,56,56,56,56,56,56,56, 56,56,56,56,56,37,56,56, 37,56,39,56,56,37,37,37, 37,37,37,39,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,39,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 6,37,37,37,37,37,37,37, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,39,37,39,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 0Fxx 37,37,40,37,37,37,37,37, 40,42,42,37,37,42,40,37, 37,37,37,37,37,37,37,37, 37,40,37,57,37,37,37,37, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,37, 37,39,42,37,37,37,37,37, 37,37,37,37,37,37,39,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 10xx 56,39,37,37,39,37,39,37, 37,37,39,37,37,37,37,37, 37,37,37,39,37,37,37,37, 37,37,37,37,39,39,37,39, 39,40,39,37,37,37,37,37, 40,39,40,37,39,39,39,39, 37,39,37,39,40,40,37,37, 40,40,39,39,39,37,37,39, 37,40,40,40,37,40,37,37, 37,40,40,37,40,37,37,37, 37,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,39,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,39,37,39,37, 39,37,37,39,37,37,37,37, 39,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 3,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,37, // 11xx 56,39,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,40,39,40,37,37,37,37, 37,37,37,37,37,37,39,37, 37,40,40,40,40,40,40,37, 40,40,40,40,40,40,40,40, 37,40,40,40,40,37,40,40, 40,40,40,40,37,40,37,39, 39,37,37,37,39,37,37,37, 37,37,37,37,39,37,37,37, 37,37,39,39,37,37,37,37, 39,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,39,37,37,40,37, 37,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,3,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,39,37,37,37,37,37,37, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,37, // 12xx 37,37,37,37,39,39,37,37, 37,37,37,39,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,40,39,39,37,37,37,37, 37,39,37,39,37,37,39,39, 37,39,37,40,37,37,37,37, 39,40,37,39,39,37,37,37, 40,37,37,37,37,39,37,37, 37,37,39,37,37,37,37,37, 39,37,39,37,37,37,37,39, 37,37,37,37,37,37,37,37, 39,37,39,37,37,37,37,37, 37,39,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,40,37, 37,37,39,37,37,37,37,39, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 13xx 37,39,37,37,37,37,37,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 39,37,37,40,37,37,37,37, 37,37,39,37,39,39,37,37, 37,39,40,37,40,37,37,37, 37,37,40,37,39,37,37,37, 37,37,37,40,37,37,37,37, 37,37,37,37,40,37,39,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,39,37, 39,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,40,39, 37,37,37,37,37,39,37,37, 37,37,39,37,39,37,37,37, 37,37,37,37,37,37,37,39, 37,39,39,37,39,37,37,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,6,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,39,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 37,37,37,39,37,39,37,37, 37,37,37,37,37,37,37,39, // 14xx 37,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,39,39,39,39,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,40,37,39,37,37, 39,37,37,39,39,39,39,37, 37,37,37,39,40,40,40,40, 40,37,40,40,39,37,40,40, 40,40,40,40,40,37,39,39, 40,40,40,40,37,40,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,39, 37,37,37,37,37,37,37,37, 39,37,37,39,37,39,40,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 37,37,37,37,39,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 15xx 56,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,40,39,40,39,37,39,37, 37,37,37,37,39,37,37,37, 37,37,39,37,40,40,37,37, 37,40,37,37,39,37,40,40, 37,40,40,37,37,37,37,37, 37,37,40,37,40,37,37,37, 37,37,37,37,37,37,39,37, 39,39,37,37,37,37,37,39, 39,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,40,37, 39,37,37,37,37,37,37,39, 39,37,37,37,37,37,37,39, 37,39,39,37,37,37,37,37, 37,37,37,37,37,39,37,37, 37,39,37,37,37,39,37,39, 37,37,37,39,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,37, 37,37,39,37,37,37,37,37, 39,37,37,37,37,37,37,37, 39,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 16xx 56,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,39,37,37,37,37,37,37, 37,40,37,37,37,37,37,40, 37,39,37,40,37,37,40,37, 40,40,37,40,37,37,40,37, 37,40,37,37,40,37,40,37, 40,37,37,40,37,37,39,37, 37,37,37,39,37,37,37,39, 37,39,37,37,37,37,37,37, 39,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 17xx 56,37,37,37,37,37,37,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 40,37,37,37,37,37,40,37, 37,39,40,37,37,37,37,37, 37,37,37,37,37,40,40,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,39,39,39,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,39,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,40,37, 39,37,39,37,37,39,37,39, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 18xx 37,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,39,37,40,37,37,37,37, 37,37,37,37,40,37,37,40, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 39,37,37,37,37,37,37,39, 37,37,39,37,39,37,37,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,37,37,39, 37,37,39,37,37,37,37,37, 37,37,37,37,39,37,37,37, 39,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 19xx 37,37,37,37,37,37,37,37, 37,39,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,39,37,40,37,37,37, 37,37,37,37,37,37,40,37, 37,37,37,37,37,37,37,37, 37,37,40,37,37,40,37,37, 37,37,37,40,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,39,37,37,37,37, 37,37,39,37,37,37,37,37, 37,39,37,37,37,37,37,37, 37,39,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 1Axx 37,37,37,37,37,37,37,37, 37,37,4,37,37,37,37,40, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,40,39,40,37,37,37,37, 37,37,37,37,37,37,37,37, 37,39,37,37,40,40,37,37, 37,37,37,37,37,37,40,6, 40,37,37,37,37,37,37,37, 37,37,37,37,37,37,39,39, 37,37,37,37,37,37,37,37, 37,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 37,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 1Bxx 56,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,57,37,37,37, 57,37,37,37,37,37,37,37, 37,39,37,37,40,40,37,37, 40,37,37,37,37,40,37,37, 37,37,37,37,37,40,37,37, 37,37,37,37,37,37,56,37, 37,37,39,37,39,37,37,37, 37,37,39,37,37,39,37,37, 37,39,37,37,37,37,37,39, 37,37,37,37,39,39,39,37, 37,37,39,39,37,37,37,37, 37,37,37,37,37,37,40,37, 37,37,37,37,37,37,37,37, 37,37,37,39,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 1Cxx 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,37,40,37,39,37,37, 37,37,40,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,40,37,37,37,37, 37,40,40,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,39,39,37,37,37,37,37, 37,37,37,37,39,37,37,37, 37,39,37,37,37,37,37,37, 37,37,37,39,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,39,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,37, 37,37,37,37,39,37,37,37, 37,39,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 1Dxx 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 39,37,40,40,37,39,37,37, 37,37,37,37,37,37,37,37, 37,39,37,37,37,37,37,37, 40,37,37,37,37,40,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, 37,37,39,37,37,37,37,37, 37,37,37,37,37,37,39,37, 39,37,37,37,37,37,37,39, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,39,37,37,37, 37,37,37,39,37,39,39,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 1Exx 57,37,37,37,37,37,37,37, 37,39,39,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,37, 39,40,39,40,37,37,39,39, 37,39,37,37,39,39,39,39, 37,40,42,40,40,40,40,37, 40,40,39,39,39,40,37,39, 37,39,42,37,37,37,42,37, 42,39,40,40,40,39,39,39, 39,37,37,37,39,39,37,37, 37,37,42,37,37,37,37,37, 37,39,37,39,39,39,37,37, 39,39,42,39,37,37,39,39, 39,37,37,37,39,39,37,39, 37,39,37,37,37,37,40,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,39,37,37, 39,37,39,37,37,37,37,39, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 1Fxx 37,37,37,37,39,37,39,37, 37,39,37,37,37,39,40,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,40,42,40,37,37,37,37, 42,37,37,42,39,37,37,42, 37,39,40,40,40,40,40,40, 40,40,40,40,40,40,42,40, 40,40,42,40,40,40,40,42, 40,40,40,40,42,42,37,37, 39,37,37,37,37,37,37,39, 37,37,39,37,37,37,37,37, 37,39,37,37,37,37,39,39, 37,37,37,37,37,37,37,37, 37,37,37,37,37,39,37,39, 37,37,37,37,37,37,40,37, 37,37,39,37,37,37,37,37, 37,37,37,37,37,39,37,37, 39,37,37,37,37,37,39,37, 37,37,37,37,37,37,39,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,39,37,37,37,37, 37,37,37,39,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,39, // 20xx 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, // 21xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 22xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 23xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 24xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 25xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 26xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 27xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 28xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 29xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 2Axx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 2Bxx 2,39,1,37,37,37,37,5, 3,2,2,37,3,2,42,42, 37,40,37,37,37,40,37,37, 40,37,40,57,37,37,37,21, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,3,3,3,11,11,11,11, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,11,12,11,12,36,12,4, 11,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 2,2,2,2,2,2,2,11, 2,1,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,11,2,1,11,13,6, 14,10,2,2,2,2,2,2, 2,2,2,2,2,10,17,2, 10,10,10,10,10,10,1,17, 17,17,17,2,11,10,13,37, // 2Cxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 2Dxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 2Exx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 2Fxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 30xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 31xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 32xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 33xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 34xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 35xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 36xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 37xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 38xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 39xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 3Axx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 3Bxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 3Cxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 3Dxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 3Exx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 3Fxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 40xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 41xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 42xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 43xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 44xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 45xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 46xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 47xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 48xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 49xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 4Axx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 4Bxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 4Cxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 4Dxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 4Exx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 4Fxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 50xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 51xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 52xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 53xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 54xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 55xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 56xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 57xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 58xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 59xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 5Axx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 5Bxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 5Cxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 5Dxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 5Exx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 5Fxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 60xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 61xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 62xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 63xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 64xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 65xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 66xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 67xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 68xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 69xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 6Axx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 6Bxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 6Cxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 6Dxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 6Exx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 6Fxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 70xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 71xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 72xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 73xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,31, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,33,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 74xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 75xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 76xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 77xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 78xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 79xx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 7Axx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 7Bxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 7Cxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 7Dxx 37,37,37,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,37, 3,10,11,11,11,11,11,11, 11,11,0,11,11,10,0,10, 10,11,11,11,11,11,11,11, 0,11,0,11,11,10,0,0, 11,1,11,11,11,11,11,11, 11,11,1,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,1,11,11,11,11,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,11, 1,1,1,1,1,1,1,1, 11,1,11,1,1,1,1,11, 11,11,11,11,1,1,11,11, 1,1,1,1,11,1,1,11, 1,11,1,11,11,1,1,1, // 7Exx 2,39,39,39,39,39,39,39, 39,2,2,39,39,2,42,42, 39,39,39,39,39,39,39,39, 39,39,39,56,39,39,39,39, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,3, 3,3,3,3,39,39,11,11, 11,3,3,3,3,3,3,3, 3,3,3,3,3,11,3,3, 39,11,39,3,39,39,39,37, 11,3,3,3,11,3,3,3, 3,3,3,3,3,3,11,3, 11,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 2,2,2,2,2,2,2,11, 2,2,2,2,11,11,2,2, 2,11,2,11,11,2,2,2, 2,37,11,11,11,11,11,11, 17,11,2,2,2,2,2,2, 2,2,2,2,2,2,17,2, 14,17,17,11,37,1,11,17, 16,17,11,39,37,11,39,37, // 7Fxx 56,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 39,39,39,37,39,37,37,39, 37,39,39,39,39,37,39,39, 39,39,39,39,39,39,39,39, 39,37,39,39,39,39,39,39, 37,39,39,39,39,39,37,39, 39,39,37,39,39,39,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,37,39, 37,37,37,37,37,39,37,37, 39,37,39,37,37,37,39,37, 37,39,39,37,37,37,37,39, 39,37,37,37,37,37,37,39, 37,37,37,39,37,37,37,39, 39,37,39,37,39,37,37,39, 37,39,37,37,39,37,39,39, 37,39,37,37,39,37,37,37, 39,39,39,39,37,39,37,39, 39,37,37,39,39,39,39,39, 39,39,39,39,37,39,39,39, 37,37,39,39,39,39,39,39, 39,39,39,39,37,39,39,39, 39,39,39,39,39,37,39,39, 39,37,39,39,39,37,39,39, 39,39,39,39,37,39,39,39, 39,39,37,39,37,39,39,39, 56,56,39,56,56,56,56,56, 37,39,39,39,39,39,39,39, 39,37,39,39,39,39,39,39, 37,37,39,39,39,39,39,39, 39,39,39,37,37,39,39,37, // 80xx 11,37,39,37,39,37,39,39, 39,2,2,39,37,2,39,39, 37,39,39,39,39,37,39,37, 39,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,11, 2,11,11,2,11,11,11,11, 11,11,11,2,11,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,11,2,2, 2,2,2,2,2,2,2,39, 2,2,2,2,36,2,2,36, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 59,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 10,39,2,2,2,10,37,2, 10,2,39,2,37,39,2,2, 2,2,2,10,39,2,33,11, 2,2,2,2,37,5,37,5, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 36,31,39,39,39,31,37,39, 37,39,37,39,11,37,4,37, // 81xx 56,39,37,39,39,37,39,37, 37,2,2,39,39,2,39,39, 37,37,39,39,39,39,39,39, 39,37,37,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,6,6,6,6,6,6, 6,6,2,6,6,6,2,6, 6,6,6,2,2,6,6,2, 6,2,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,37, 36,6,2,6,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,6,2, 2,2,6,2,6,2,2,2, 2,6,6,2,2,6,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 10,39,2,2,2,10,4,11, 6,6,6,6,6,6,2,2, 2,11,11,11,11,39,12,19, 2,2,6,2,6,6,6,6, 2,6,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,6,6,6,6,6,6, 4,4,37,39,6,19,39,37, // 82xx 56,39,39,39,39,39,39,37, 37,2,2,39,39,2,42,39, 39,39,37,39,39,39,39,39, 39,39,39,39,39,39,37,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,6, 6,6,6,6,6,6,6,6, 6,2,2,2,2,2,2,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,2,2,2,2,2,37, 2,2,2,2,2,6,2,2, 2,2,2,2,2,2,6,2, 6,36,2,2,6,6,6,6, 2,2,2,36,2,2,2,6, 6,2,6,2,6,2,6,2, 6,6,6,6,2,6,6,2, 2,6,6,6,2,6,6,6, 2,2,2,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,2,2,2,6,6, 6,6,6,6,6,6,6,2, 6,6,31,12,11,31,39,19, 5,19,39,19,11,33,39,37, // 83xx 56,39,37,37,37,37,39,39, 39,2,2,39,39,2,37,39, 39,39,39,39,39,39,39,37, 39,39,39,39,37,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,37, 6,6,6,2,6,6,2,6, 2,6,6,6,6,6,2,6, 2,2,2,6,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,6, 6,6,59,6,6,59,59,6, 19,6,6,6,6,6,2,2, 2,2,6,6,19,6,6,11, 2,2,2,2,37,6,4,4, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,5,2, 31,4,11,10,39,19,19,11, 37,39,39,39,39,39,39,37, // 84xx 57,39,39,39,39,39,39,39, 39,2,2,39,39,2,39,39, 39,39,39,39,39,39,39,39, 37,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,11,2,2,2, 2,2,2,11,2,2,2,2, 2,2,2,11,2,2,11,11, 2,2,11,2,2,2,2,2, 37,11,2,2,11,2,2,11, 2,2,2,11,2,2,11,2, 2,6,2,2,6,6,39,2, 6,6,11,6,2,6,2,37, 36,2,2,2,2,36,2,2, 2,2,2,36,2,36,36,2, 2,2,2,36,2,2,2,2, 2,2,2,2,2,2,2,2, 6,2,59,6,2,6,2,2, 36,6,6,6,6,2,36,6, 2,2,2,2,2,6,2,2, 2,2,6,5,2,5,2,2, 10,10,2,2,2,10,10,10, 12,12,10,2,10,10,2,2, 2,2,10,19,10,19,12,2, 2,2,2,2,12,19,16,10, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,5,2, 36,10,10,10,11,12,12,10, 12,12,12,39,11,39,16,37, // 85xx 56,11,39,37,39,39,39,39, 39,2,2,39,39,2,39,11, 39,39,39,37,37,39,39,37, 37,37,37,39,39,39,39,39, 2,2,2,2,11,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,39,2,2,2,2,11,11, 2,2,2,2,2,2,19,2, 2,11,11,2,11,2,2,2, 2,11,33,2,2,2,2,11, 11,11,2,11,11,2,33,11, 11,11,33,2,2,2,2,39, 2,2,36,2,2,2,2,2, 2,2,36,2,2,2,2,36, 2,36,2,2,2,2,36,36, 2,2,2,5,2,2,2,36, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 39,5,2,2,19,11,5,11, 11,12,5,2,2,37,2,2, 2,2,6,11,11,19,12,39, 2,2,2,2,11,11,11,11, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,5,2, 36,36,4,23,23,4,19,11, 19,11,12,37,11,33,11,37, // 86xx 56,39,39,11,39,39,39,37, 39,2,2,39,39,2,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,37, 2,6,2,2,36,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,19,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,36,2, 2,2,2,2,2,5,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 39,19,2,2,2,2,2,2, 11,2,19,2,19,37,2,2, 2,2,4,12,12,19,12,11, 2,2,2,2,11,12,4,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 36,36,39,31,39,4,39,11, 4,39,39,39,11,12,19,37, // 87xx 56,39,37,39,39,39,39,39, 39,2,2,39,39,2,39,37, 39,37,37,37,39,37,39,37, 37,39,39,39,37,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,6,6,6,6,6,6, 6,2,6,6,2,2,2,2, 2,11,2,2,6,6,6,6, 6,6,6,2,2,2,2,2, 6,2,2,2,6,39,2,31, 2,11,11,2,2,2,2,6, 2,6,31,31,2,2,31,2, 11,2,37,2,2,2,2,37, 36,6,2,2,2,36,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,5,2, 2,2,2,36,2,2,5,2, 2,2,36,2,2,2,2,2, 2,5,2,36,2,2,11,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 19,12,2,2,2,2,4,11, 4,12,4,2,19,39,2,2, 2,2,4,12,12,4,19,11, 2,2,2,2,11,11,31,19, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,5,2, 36,4,37,11,11,11,4,11, 19,37,19,11,19,4,4,37, // 88xx 57,39,39,39,39,39,39,39, 39,2,2,39,39,2,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,39, 2,36,36,36,2,36,2,2, 2,2,2,36,36,36,2,2, 2,2,2,36,2,2,2,2, 2,2,2,2,2,2,2,36, 2,2,6,6,6,2,2,36, 2,2,2,2,2,2,6,2, 2,2,2,6,2,6,2,2, 2,2,2,2,6,2,2,2, 6,6,2,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 2,6,6,6,6,6,6,6, 2,6,6,2,2,2,2,2, 2,2,6,2,2,2,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,37,39,37, // 89xx 56,39,39,39,39,39,39,37, 39,2,2,39,39,2,39,39, 37,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,6,2,2,6,6,6, 6,2,6,6,6,2,6,2, 6,6,6,6,2,2,6,2, 6,6,6,2,6,2,6,6, 6,6,6,6,2,6,6,6, 6,6,6,6,6,2,2,2, 6,6,6,6,6,6,6,6, 6,37,6,6,6,6,6,37, 2,2,2,6,6,6,2,2, 2,6,2,2,2,2,2,6, 6,6,36,2,6,2,6,6, 6,2,6,6,6,6,6,6, 6,6,6,2,6,2,2,2, 6,2,6,6,2,6,6,2, 2,2,2,6,2,2,2,6, 6,6,6,6,6,6,2,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,2, 2,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 2,6,2,2,2,2,6,2, 2,2,6,2,2,2,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,39,39,37, // 8Axx 56,39,37,39,39,39,39,39, 37,2,2,39,39,2,37,39, 39,39,39,37,39,39,39,39, 37,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,12,6,6,6,6,6,6, 2,12,6,6,12,2,12,6, 12,6,2,2,6,6,12,6, 6,6,6,6,2,2,6,6, 6,12,2,2,6,6,37,6, 2,6,6,12,6,6,6,6, 6,37,6,6,6,6,6,6, 6,6,6,6,6,6,6,39, 2,6,2,6,6,36,36,6, 6,2,2,6,6,12,36,6, 2,2,36,2,2,2,2,2, 2,6,6,2,2,2,2,2, 2,2,2,6,2,2,6,6, 2,2,6,2,2,2,6,6, 6,2,6,6,6,2,2,6, 2,2,6,6,2,6,6,2, 10,12,6,6,6,6,12,6, 6,6,6,6,6,12,6,6, 2,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 2,6,6,2,2,2,2,2, 2,2,2,6,2,6,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,39,4,37, // 8Bxx 56,39,37,39,39,39,39,39, 39,2,2,39,39,2,39,39, 39,39,39,39,39,39,39,39, 39,37,39,37,39,37,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,6,6,2,6,6,6, 6,6,2,6,6,6,6,6, 6,6,6,6,6,6,6,2, 6,6,6,2,6,2,6,6, 6,2,2,6,2,6,2,6, 2,6,6,6,6,2,2,31, 6,6,6,6,6,6,6,2, 6,6,6,6,6,6,6,37, 2,6,2,6,6,6,6,2, 2,2,36,6,6,2,6,6, 6,2,6,6,2,2,6,2, 2,2,5,6,2,2,6,6, 2,2,2,6,2,2,6,2, 2,2,2,6,2,6,2,2, 2,2,6,6,6,6,6,6, 6,2,6,6,2,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,2,2,2,2,2, 2,2,6,2,2,2,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,39,37,37, // 8Cxx 56,39,39,37,39,39,39,39, 37,2,2,37,39,2,39,39, 37,39,39,37,39,39,39,39, 39,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,2,2,12,2,2,6,2, 2,6,6,6,12,2,6,2, 6,6,6,6,2,11,2,6, 6,6,6,6,6,2,6,6, 6,6,6,6,2,6,6,6, 6,6,6,6,2,2,6,6, 6,6,2,2,2,6,6,12, 6,6,2,6,6,6,2,37, 2,2,6,2,2,2,6,2, 6,2,6,6,6,36,6,6, 2,2,6,6,6,6,2,2, 6,6,6,6,6,6,6,6, 6,2,6,6,6,2,2,6, 2,6,2,2,6,6,2,6, 6,6,2,6,6,6,2,6, 6,6,2,6,6,2,6,2, 6,6,6,6,6,6,12,6, 6,6,6,6,6,6,6,6, 2,6,6,6,6,6,6,6, 2,2,2,2,6,6,6,6, 2,6,2,2,2,2,2,2, 2,2,6,2,2,2,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,4,4,37, // 8Dxx 57,39,39,39,39,39,39,39, 39,2,2,39,39,2,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,37,37, 2,2,2,37,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,12,2,6,6,6,6,6, 6,6,6,6,6,2,6,6, 6,6,6,6,6,6,2,6, 6,6,6,6,6,6,6,6, 6,6,6,2,6,6,6,6, 6,6,6,6,6,6,2,6, 2,6,6,6,2,6,6,6, 6,6,6,2,6,6,6,39, 6,2,6,2,6,36,6,6, 2,2,2,6,6,36,2,6, 6,6,2,2,2,2,2,2, 2,36,2,36,6,6,6,2, 6,6,6,2,2,6,2,2, 2,6,6,2,6,6,2,2, 2,2,6,2,2,2,6,2, 6,6,2,6,2,6,2,2, 6,12,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,11,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 2,2,6,2,2,2,2,2, 2,2,2,2,6,6,6,2, 6,6,6,6,6,6,6,6, 6,6,4,6,6,39,39,37, // 8Exx 56,39,39,39,39,39,39,39, 39,2,2,39,39,2,39,37, 39,39,39,37,37,37,39,39, 37,39,39,39,39,37,37,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,12,6,2,6,12,6,6, 2,12,2,12,2,6,12,6, 2,6,6,12,2,6,2,2, 6,6,6,2,6,6,6,6, 6,12,6,6,6,12,6,6, 6,6,6,6,6,6,6,6, 6,6,31,6,6,6,6,6, 6,2,2,6,6,6,6,39, 6,6,2,6,6,2,6,2, 2,2,6,2,6,6,6,6, 36,6,2,2,6,6,6,6, 2,6,6,6,6,6,6,6, 6,6,2,7,7,2,6,2, 2,6,2,6,7,6,6,6, 2,7,2,7,7,6,7,2, 6,7,6,2,7,7,6,6, 6,12,6,7,7,6,7,11, 7,6,6,6,7,12,6,6, 6,7,6,6,6,6,6,7, 6,7,7,7,7,7,7,7, 2,6,2,2,2,2,2,2, 6,2,6,6,2,6,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,37,8,37, // 8Fxx 57,39,39,37,39,39,39,39, 39,2,2,39,39,2,39,39, 39,39,39,39,37,37,39,39, 39,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,6,6,2,6,6,6, 6,6,6,6,6,6,12,6, 6,6,6,2,6,2,6,6, 6,6,6,6,6,6,2,6, 6,6,6,6,6,6,6,2, 6,2,6,6,2,6,6,6, 6,6,6,2,6,6,6,2, 6,6,6,6,2,6,6,39, 6,6,2,6,2,2,6,6, 6,6,6,2,2,2,36,6, 2,6,2,2,6,6,2,6, 2,2,2,2,6,6,6,6, 2,2,6,2,6,2,2,6, 36,2,2,6,6,6,36,2, 2,2,2,6,2,6,2,2, 2,6,6,6,6,2,2,5, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,2,6,6,6,6,6,6, 2,6,2,2,2,2,2,2, 2,2,6,6,6,6,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,37,8,37, // 90xx 57,37,37,37,39,39,37,39, 39,2,2,39,39,2,39,37, 39,39,37,39,37,39,39,39, 39,37,37,39,39,39,39,37, 2,2,2,37,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,6,2,6,6,6,6, 6,2,6,6,6,6,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,2,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,37, 36,6,6,2,2,6,2,6, 2,2,2,6,2,2,2,6, 2,2,36,36,6,2,2,2, 2,6,6,2,2,6,2,6, 36,6,6,6,6,2,2,6, 6,6,6,6,6,6,6,6, 6,2,6,6,6,2,6,6, 6,6,6,6,6,2,2,6, 6,6,6,6,6,6,6,11, 6,6,6,6,6,6,6,6, 6,6,11,6,6,6,6,2, 6,6,6,6,6,6,6,6, 6,2,6,2,2,2,2,2, 2,2,6,2,2,6,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,37,39,37, // 91xx 57,39,39,39,39,39,39,39, 39,2,2,39,39,2,39,39, 39,39,39,39,39,37,39,39, 39,39,39,39,39,39,37,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,2,6,2,6,6,6,2, 6,6,6,6,2,2,6,6, 6,6,6,6,6,6,6,11, 6,6,11,6,6,6,6,6, 6,6,6,2,6,6,6,6, 6,2,6,6,2,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,2,39, 6,6,2,6,2,36,2,6, 6,2,2,6,36,6,36,36, 6,6,36,36,6,6,6,6, 2,2,2,6,6,6,2,6, 6,6,6,6,6,6,6,6, 2,2,6,6,6,6,6,36, 6,6,6,2,6,6,6,6, 6,6,6,2,6,6,6,6, 10,6,2,6,6,6,2,6, 6,6,6,6,6,6,6,6, 2,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,2,2,2,2,6,2,2, 2,2,2,2,2,2,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,22,22,37, // 92xx 56,39,39,37,39,39,37,39, 39,2,2,39,39,2,39,39, 37,39,37,39,37,37,39,37, 37,39,39,39,37,39,37,39, 2,2,2,2,2,2,2,2, 2,2,2,2,11,2,2,2, 39,2,2,2,2,2,2,2, 2,2,2,11,2,2,2,2, 6,11,6,6,6,6,2,2, 11,6,6,6,2,6,6,6, 6,6,2,6,6,6,2,6, 2,6,6,6,2,6,6,6, 6,11,6,6,11,11,6,6, 11,6,6,6,6,6,6,11, 6,6,6,11,11,6,6,6, 6,11,6,6,6,6,6,37, 36,6,36,6,2,6,6,6, 2,6,6,6,2,6,36,2, 36,6,2,6,2,2,2,2, 6,2,6,36,36,6,2,2, 6,6,2,6,6,6,6,6, 2,6,6,2,6,2,6,2, 2,2,6,2,6,6,6,6, 6,6,6,2,6,2,6,6, 6,6,6,6,6,6,2,6, 6,6,6,6,6,6,6,6, 6,2,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,2,2,2,2,2, 6,2,6,6,2,6,11,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,22,10,10, // 93xx 56,39,39,39,37,39,39,39, 39,2,2,39,39,2,39,39, 39,39,39,39,39,39,39,37, 37,39,39,39,39,39,37,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,11,11,11,11,6,11,6, 11,6,6,6,11,11,6,6, 11,11,11,6,6,11,6,6, 6,6,6,2,6,6,6,6, 6,6,2,6,6,11,6,11, 6,2,11,6,6,2,2,6, 11,6,6,6,11,2,11,6, 6,6,6,6,6,6,6,37, 6,2,6,6,2,2,36,6, 2,2,6,6,6,2,2,6, 6,36,6,2,6,6,6,36, 36,6,6,6,2,6,6,6, 2,2,6,2,2,2,2,6, 2,6,6,6,6,6,6,6, 6,6,2,5,6,6,6,2, 2,6,2,6,2,6,6,6, 10,6,6,59,6,6,6,6, 6,12,6,6,10,6,2,6, 6,2,6,10,6,6,6,2, 6,2,6,6,6,6,6,6, 6,2,2,2,2,2,2,2, 2,2,2,2,6,6,6,2, 6,6,6,6,19,6,6,6, 6,6,6,6,6,10,19,37, // 94xx 56,39,39,39,39,39,39,39, 39,2,2,11,39,2,39,39, 39,39,39,39,39,39,39,37, 37,39,39,39,37,39,39,39, 2,2,2,11,2,2,2,2, 2,2,2,2,11,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,11,2, 6,6,2,6,6,6,6,6, 2,2,6,6,6,6,6,6, 2,2,6,6,6,2,6,2, 6,6,6,6,6,6,2,6, 6,2,2,6,6,6,2,6, 6,2,6,2,2,2,6,6, 6,6,6,6,6,2,6,6, 6,6,6,6,6,6,6,39, 2,2,2,6,6,2,2,2, 2,2,2,2,2,6,6,6, 2,6,6,6,2,6,6,6, 2,2,6,6,2,2,6,2, 6,2,2,2,2,36,6,6, 2,2,6,6,2,6,2,2, 2,2,6,2,2,2,2,2, 2,2,2,2,6,6,2,2, 6,6,6,2,6,6,6,6, 6,6,6,6,6,6,2,6, 2,6,6,6,6,6,6,2, 6,2,6,6,6,6,6,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,22,37,37, // 95xx 56,39,39,39,39,37,39,39, 37,11,2,39,39,11,39,39, 37,39,39,39,39,39,39,39, 39,37,39,39,39,39,39,39, 11,2,2,39,11,2,11,2, 2,2,2,2,2,2,11,2, 2,2,2,2,2,2,2,2, 2,2,11,2,2,2,2,2, 6,2,2,6,6,6,6,6, 6,6,2,6,11,6,11,6, 6,6,6,6,11,6,11,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,37, 2,6,6,6,2,2,2,2, 2,6,2,6,2,6,6,2, 6,6,6,2,6,6,2,6, 2,2,6,6,2,6,6,6, 6,6,2,2,2,6,2,6, 6,2,6,2,2,2,2,2, 2,6,6,6,2,6,6,6, 2,6,6,6,2,6,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,39,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 2,2,6,2,2,2,2,2, 2,2,6,2,2,2,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,37,19,37, // 96xx 57,39,39,39,39,37,39,39, 39,2,2,39,39,11,39,39, 37,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 11,2,2,2,11,11,2,2, 2,2,2,2,2,2,2,2, 11,11,11,2,11,2,11,11, 11,11,2,2,2,2,11,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,2,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,11,6,6, 6,6,6,11,11,6,6,6, 6,6,6,6,6,6,6,39, 2,6,6,6,2,6,2,2, 6,2,2,2,6,6,2,2, 2,2,2,2,6,6,6,2, 6,2,2,6,6,6,6,6, 2,6,6,6,2,2,2,6, 6,2,2,2,2,2,2,6, 2,6,2,6,2,2,2,2, 2,2,6,2,6,2,6,6, 6,6,6,6,6,6,6,11, 6,6,6,6,6,6,6,6, 2,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 2,2,6,2,2,2,2,2, 2,2,2,6,6,6,6,2, 6,6,6,6,6,6,6,6, 6,6,17,6,6,39,37,37, // 97xx 56,39,39,39,39,39,39,37, 39,2,2,39,39,2,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,37,39,37,39, 2,2,2,11,11,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,11,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,2,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 6,6,11,6,6,6,6,6, 6,2,6,6,6,6,6,11, 6,6,6,11,6,6,6,6, 6,6,6,6,2,6,6,39, 36,6,6,6,2,2,2,2, 6,2,6,2,2,6,6,2, 2,6,6,6,2,2,6,6, 6,6,6,2,2,6,6,6, 2,2,6,6,6,2,6,6, 2,2,6,6,6,2,2,6, 2,6,6,6,2,6,2,6, 2,6,2,2,6,2,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 2,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6, 2,6,6,2,2,2,2,2, 2,2,6,6,6,6,6,2, 6,6,6,6,6,6,6,6, 6,6,6,6,6,39,39,37, // 98xx 57,37,37,37,39,37,37,39, 37,2,2,39,39,2,39,39, 37,37,37,37,39,39,39,39, 37,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,6,6,2,2,6,2, 6,6,6,2,6,2,6,6, 2,6,6,2,2,6,6,2, 6,6,6,6,6,2,6,6, 6,6,6,2,2,6,6,6, 6,2,6,2,6,2,2,2, 6,6,6,2,2,2,2,2, 2,2,2,2,2,2,2,39, 2,2,2,2,2,2,2,2, 2,2,36,2,2,2,2,2, 2,2,36,2,2,2,2,2, 2,5,2,2,2,11,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,5,2,2, 11,39,2,2,2,6,39,11, 6,11,11,19,6,39,2,11, 2,11,6,11,11,39,6,2, 2,2,2,2,11,11,5,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,5,2, 6,6,37,6,6,4,39,6, 6,5,6,39,6,37,37,37, // 99xx 56,39,39,37,39,37,39,39, 39,2,2,39,39,2,39,39, 37,39,39,37,39,39,39,39, 37,37,39,39,39,39,37,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,6,2,2,2,11,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,6,6,2,2,2,37, 2,2,2,2,2,2,2,2, 2,2,6,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,37,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,5,2,2,2,2,2, 2,2,2,2,2,2,2,5, 6,6,2,2,2,2,2,11, 6,6,6,2,6,6,2,2, 2,2,6,6,6,6,6,2, 2,2,19,2,11,6,11,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,5,2, 6,36,6,6,6,6,6,6, 6,6,6,6,6,39,4,37, // 9Axx 56,39,39,39,39,39,39,39, 39,2,2,39,39,2,37,39, 39,39,37,37,39,39,39,39, 39,37,39,37,39,39,37,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,12,2,2,2,12,2,2, 2,12,2,12,12,2,12,12, 12,6,2,2,12,12,12,2, 2,2,2,2,2,2,2,37, 2,2,2,5,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,6,2,2,2,2,2, 2,2,12,2,2,12,6,36, 6,6,2,2,2,5,2,2, 2,2,2,2,6,6,2,5, 2,2,5,5,2,2,2,2, 2,2,2,2,2,2,2,2, 5,6,59,2,2,2,6,12, 6,2,6,2,4,6,2,2, 2,2,6,6,37,39,6,2, 37,2,6,6,6,19,6,6, 2,2,2,2,2,2,2,2, 2,2,2,5,2,12,6,2, 36,6,12,10,12,6,6,6, 6,12,6,6,12,12,39,37, // 9Bxx 56,39,39,39,39,39,37,39, 39,2,2,39,39,2,39,39, 39,39,39,37,39,39,39,39, 39,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,6,2,2,2,2,2,2, 2,2,39,2,2,2,2,2, 5,2,6,2,2,2,2,2, 2,2,2,2,2,2,2,6, 2,2,6,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,6,6,2,2,2,37, 2,2,36,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,6,2,36,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,5,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,6,2,2,6,2,6,2, 4,6,6,2,2,12,2,2, 2,2,6,6,6,39,2,2, 2,2,6,6,6,6,6,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,6,2, 6,6,6,6,6,6,6,11, 4,6,6,6,11,11,22,37, // 9Cxx 56,39,39,11,37,37,39,39, 39,2,2,39,39,2,39,39, 37,37,39,37,39,37,39,39, 39,39,39,39,39,39,39,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,6,2,2,2, 2,2,2,12,2,2,2,2, 2,2,2,2,12,2,2,2, 2,2,12,2,2,11,2,12, 2,2,2,2,2,2,2,37, 2,2,2,2,2,36,2,2, 2,2,2,2,2,2,2,2, 2,36,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,4,2,2,2,2,6,2, 6,6,19,2,6,4,2,2, 2,2,2,2,6,2,2,2, 2,2,2,6,6,6,6,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,12,6,10,37,4,6,6, 6,6,6,6,11,4,19,37, // 9Dxx 56,39,12,4,37,39,37,39, 37,2,2,39,39,2,39,39, 37,39,37,39,37,37,39,37, 37,37,37,39,37,37,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,2,2,2,2,2,2,2, 2,12,2,2,2,2,6,2, 2,2,2,2,2,2,2,12, 2,2,2,2,12,12,2,2, 2,2,2,2,6,2,2,37, 2,2,2,2,2,5,2,2, 2,2,2,36,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,5, 2,2,2,36,2,2,2,2, 2,2,5,2,2,2,2,2, 2,2,6,2,2,2,2,2, 5,6,2,2,2,2,11,11, 11,6,11,2,11,11,11,11, 2,11,11,11,11,11,4,6, 2,2,11,6,6,11,11,11, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,19,2, 6,19,6,6,6,6,6,19, 6,6,12,10,4,19,11,37, // 9Exx 56,39,39,39,37,39,39,39, 39,2,2,39,39,2,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,37,37, 12,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,12,12,2,12,12,2,2, 2,12,2,12,2,2,12,12, 2,2,2,12,2,12,2,2, 2,2,2,2,2,2,2,37, 2,2,2,2,2,2,6,2, 2,2,6,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,11,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,5,6,2,2,2,2,2, 2,6,2,2,2,6,2,2, 6,12,59,2,6,2,2,2, 6,6,6,6,2,5,2,6, 2,2,6,11,6,6,6,2, 11,6,6,2,6,19,37,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,12,5,2, 12,4,12,10,6,19,39,6, 6,12,12,6,6,12,11,37, // 9Fxx 56,39,39,39,4,39,39,39, 39,2,2,39,39,2,37,39, 39,39,39,37,39,37,39,39, 37,39,39,39,39,39,39,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,6,6, 2,2,2,2,6,2,2,2, 2,2,2,2,2,2,2,2, 2,33,2,31,12,33,2,31, 31,2,2,33,33,2,2,2, 33,6,31,2,33,33,2,12, 2,2,2,6,2,2,2,37, 2,2,36,2,2,36,6,36, 2,2,36,2,36,36,2,2, 2,2,2,2,2,6,36,2, 2,36,2,2,2,2,36,2, 2,33,2,2,2,2,2,2, 6,2,36,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,4,2,2,6,2,6,6, 6,6,6,2,6,6,2,2, 2,2,1,6,6,6,4,2, 2,2,6,6,4,6,6,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 6,12,6,6,19,6,6,6, 6,6,6,6,6,19,4,37, // A0xx 7,11,37,11,37,1,37,1, 1,11,11,37,1,11,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 11,2,2,11,11,11,2,2, 11,2,2,11,2,11,2,2, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,2, 2,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,2,2,2, 2,11,11,11,11,11,11,11, 11,11,11,11,33,11,33,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,2,2,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,11,2,2,12,2, 11,2,36,36,2,2,36,36, 2,36,2,36,36,2,36,2, 2,2,2,5,2,2,2,2, 2,2,2,2,2,2,2,12, 10,10,2,2,10,11,10,11, 11,1,10,14,10,10,10,10, 2,11,11,11,11,11,1,2, 2,2,11,11,1,10,11,11, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,36,2, 10,10,10,10,10,10,10,10, 12,17,1,10,11,33,1,10, // A1xx 7,37,37,1,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,3,37,37,37,37, 11,2,2,2,2,2,11,2, 2,2,2,2,2,2,14,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,14,2, 8,8,8,8,9,8,8,8, 8,8,8,8,8,8,8,8, 8,8,8,9,9,8,8,8, 8,1,9,2,8,8,8,2, 8,8,33,2,33,8,8,1, 33,8,8,33,33,8,8,2, 2,8,8,33,2,8,8,8, 8,8,8,39,2,8,2,37, 2,2,2,2,2,2,2,2, 2,2,2,39,2,2,2,2, 2,2,2,2,2,2,6,2, 2,2,2,2,2,2,2,33, 2,3,3,3,3,7,7,7, 2,7,7,3,2,3,3,3, 3,3,7,8,8,2,3,3, 8,7,3,3,7,7,3,3, 3,7,7,7,7,14,9,14, 7,7,7,7,7,14,7,7, 8,14,14,14,14,14,7,7, 7,7,7,7,7,7,5,7, 2,5,5,2,2,2,2,2, 2,2,2,7,2,2,3,3, 3,3,3,7,3,7,7,7, 3,7,7,7,7,7,7,37, // A2xx 7,37,37,1,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,8,2,2,8,2,2,8, 8,8,8,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,2,2,2,2,2,2,2, 2,2,8,8,33,8,8,2, 8,8,2,8,2,2,2,2, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, 2,2,6,2,2,2,2,2, 2,6,2,2,2,2,2,6, 6,2,2,2,6,6,2,2, 2,2,2,2,2,2,2,2, 36,7,7,7,7,7,7,7, 7,7,7,2,7,7,36,8, 2,8,8,8,8,8,8,14, 5,5,5,14,2,5,5,5, 5,5,5,5,5,14,5,14, 5,5,14,23,5,14,5,5, 8,5,14,8,8,14,14,8, 14,3,3,3,3,5,8,5, 2,2,2,2,2,2,2,2, 2,2,8,36,8,8,8,2, 8,3,3,3,8,8,7,8, 8,3,8,8,8,8,8,37, // A3xx 7,37,37,39,37,37,37,37, 37,2,2,37,4,2,9,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 2,2,2,2,11,11,2,2, 2,2,2,2,2,2,2,2, 11,11,11,11,11,11,11,11, 11,11,2,2,2,2,2,2, 36,12,12,12,12,12,2,12, 2,2,2,12,2,12,12,12, 12,2,2,12,12,12,11,12, 8,12,12,2,8,2,11,2, 8,12,2,2,33,12,2,8, 11,2,8,12,2,2,2,2, 2,11,2,8,2,12,8,2, 8,2,8,8,8,8,8,37, 2,2,2,6,2,2,2,2, 3,2,2,2,2,2,2,2, 2,2,2,2,3,2,5,2, 2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3, 3,3,3,2,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,2,2,2,3, 10,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,5,3,3,3, 2,2,2,2,2,2,2,2, 2,2,2,3,3,3,3,2, 3,3,3,12,3,3,3,3, 3,3,3,3,3,3,3,37, // A4xx 7,37,37,11,1,37,11,39, 11,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,7,37,37,37,37,37, 2,2,2,11,2,11,2,2, 2,2,11,2,2,2,2,2, 37,2,11,2,2,2,2,17, 2,17,2,2,2,2,2,2, 8,8,8,8,8,8,8,8, 8,2,8,8,8,8,2,8, 2,8,8,8,8,8,8,8, 8,8,8,8,8,8,2,8, 8,8,8,11,8,11,8,8, 8,8,8,8,8,2,2,8, 8,8,8,8,8,8,8,8, 8,8,8,2,2,8,8,39, 2,2,2,2,2,2,2,2, 2,2,2,6,2,2,2,2, 2,2,2,6,6,2,2,2, 2,2,2,2,2,2,2,2, 36,3,3,8,3,36,3,2, 3,2,3,3,3,3,3,3, 3,3,3,3,3,3,8,3, 3,3,8,3,3,3,2,3, 3,3,14,3,3,14,3,3, 3,3,3,3,3,3,3,3, 3,8,3,3,14,3,8,3, 3,3,8,3,3,3,3,3, 3,3,3,2,3,8,2,2, 3,3,3,3,3,3,8,3, 8,8,3,3,8,8,8,8, 11,8,8,8,8,5,8,1, // A5xx 7,6,37,39,37,37,6,37, 1,2,2,37,1,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 2,2,2,2,2,2,2,11, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,9,8,12,8,2,8,8, 8,8,8,8,8,2,8,8, 8,2,8,8,12,8,8,2, 8,8,8,8,8,8,8,8, 8,8,8,2,8,8,8,2, 8,8,8,8,8,2,2,2, 2,8,2,8,2,8,8,2, 8,2,8,8,8,8,8,37, 2,2,2,6,2,2,2,2, 2,2,2,2,2,2,6,2, 2,2,6,6,2,2,2,2, 2,2,2,2,2,2,2,2, 2,3,3,3,3,6,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,8,2,2,3,3, 3,3,2,3,3,8,3,3, 3,3,3,3,3,8,8,3, 3,3,3,3,3,3,3,3, 8,3,3,3,3,3,3,3, 3,3,3,2,2,2,2,2, 2,3,3,3,3,3,8,3, 8,8,8,3,8,8,3,8, 8,8,8,8,8,8,8,37, // A6xx 7,37,37,39,37,37,37,1, 12,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,6,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,8,8,9,8,33,2,2, 8,33,8,9,9,9,9,8, 8,8,9,8,8,8,8,8, 8,8,8,2,2,8,8,8, 8,8,8,9,2,2,2,2, 8,8,8,8,9,9,8,8, 8,2,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 36,8,5,8,2,36,5,2, 8,8,2,8,2,8,2,2, 2,8,2,8,2,8,8,8, 8,8,8,2,2,2,2,8, 8,3,3,8,8,3,9,8, 8,14,8,8,8,3,2,8, 8,8,8,8,3,8,33,8, 3,8,8,8,8,8,8,8, 2,2,8,2,2,2,8,2, 2,2,8,8,8,8,8,2, 3,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, // A7xx 7,1,1,37,37,37,37,37, 37,14,2,14,37,14,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 2,2,2,2,11,2,2,14, 2,2,11,2,2,2,2,2, 11,11,11,11,11,11,11,11, 11,11,2,2,2,2,11,2, 8,8,8,8,8,8,2,8, 8,8,8,8,8,8,8,8, 8,8,8,2,8,8,8,2, 8,8,8,11,2,11,8,8, 8,2,8,8,8,8,8,8, 8,8,8,8,8,2,2,8, 8,8,8,8,8,2,8,8, 8,2,2,8,8,8,2,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,5, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 36,14,14,2,14,3,2,11, 8,8,14,2,2,36,8,2, 2,2,8,5,14,14,14,14, 2,8,8,2,14,8,14,2, 8,14,14,14,14,14,8,8, 14,8,14,14,8,14,8,8, 8,8,14,8,14,3,8,14, 2,2,8,2,8,8,8,8, 2,14,8,2,2,2,2,2, 2,2,2,8,8,8,3,2, 8,3,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, // A8xx 7,11,1,39,1,37,37,37, 4,2,2,14,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 2,2,2,2,2,2,2,2, 2,2,11,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,2,8,8,8,2,8,2, 8,8,2,8,8,8,8,3, 2,2,8,8,8,8,2,2, 2,2,8,2,2,2,8,2, 11,8,8,8,8,8,8,8, 2,2,8,8,8,8,8,8, 8,8,3,8,8,8,8,3, 8,8,8,8,8,8,8,37, 2,2,2,2,2,2,2,2, 2,5,2,2,2,2,2,3, 3,3,3,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,7,8,8,8,7,7, 14,8,2,8,7,8,8,8, 11,2,7,2,2,8,2,14, 2,2,8,2,2,8,8,2, 8,14,2,8,8,8,8,8, 8,8,8,14,8,14,8,8, 14,8,14,8,14,5,8,8, 14,2,8,5,5,6,5,8, 2,2,8,2,2,2,2,2, 2,2,2,2,8,2,8,2, 5,5,8,8,8,8,5,8, 8,5,8,8,8,8,8,37, // A9xx 7,1,37,39,37,37,39,37, 37,2,2,37,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 11,2,2,2,11,2,11,2, 2,2,2,11,2,2,2,2, 37,11,11,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,9,8,8,9,9,11,8, 8,8,8,9,9,8,9,8, 8,8,8,8,8,8,9,8, 2,8,8,8,2,8,8,8, 8,2,8,2,8,8,8,8, 8,8,8,9,8,8,2,3, 8,2,2,8,2,8,8,8, 8,8,8,8,8,8,8,39, 2,3,6,3,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,6,2,2,3,2, 2,2,2,2,2,2,2,2, 2,8,2,8,3,3,3,3, 8,2,3,8,2,3,3,8, 2,8,8,8,2,8,2,2, 3,8,2,2,8,3,8,2, 3,3,2,2,3,14,8,8, 8,8,8,2,3,9,8,3, 8,14,8,8,8,14,8,2, 2,2,8,8,8,8,8,8, 2,2,8,2,2,2,2,2, 2,2,2,2,2,2,8,2, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, // AAxx 7,37,37,37,37,1,37,37, 4,2,2,1,37,2,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,8,8,8,8,8,8,8, 2,12,2,8,8,8,2,8, 8,8,8,2,12,2,2,2, 2,8,8,8,2,2,8,8, 8,8,2,8,8,8,8,8, 8,8,8,8,8,8,8,8, 8,8,8,2,2,8,8,8, 8,8,8,8,2,2,2,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,5,2,2,2,2,2,2, 36,14,8,8,2,3,8,8, 2,8,2,8,8,2,36,8, 2,8,2,5,8,5,2,5, 14,14,8,2,8,8,8,2, 8,14,14,14,10,8,5,14, 8,1,5,5,8,14,8,8, 14,8,14,8,14,14,8,14, 14,2,8,2,8,8,8,5, 2,8,2,2,2,2,2,2, 2,2,8,5,8,8,8,2, 8,8,8,5,8,10,8,8, 8,8,8,8,8,8,8,37, // ABxx 7,1,1,37,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,6,37,37,37, 37,37,37,37,37,37,37,37, 2,2,2,2,2,2,11,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,11,8,8,8,11,8,8, 8,8,8,8,8,11,8,8, 8,8,2,11,8,8,11,8, 8,8,2,2,8,2,8,8, 8,8,8,11,8,8,11,8, 8,8,8,8,8,2,8,8, 8,8,8,8,8,2,8,8, 8,8,8,8,8,8,8,37, 2,2,2,2,2,2,5,2, 2,2,2,2,2,2,39,2, 5,2,2,2,2,11,2,2, 2,2,5,2,2,5,2,2, 2,8,8,8,5,2,2,8, 36,2,2,8,8,2,36,2, 8,8,3,8,8,8,2,5, 2,2,8,2,8,8,2,2, 8,8,8,8,8,8,5,8, 8,8,8,8,8,14,8,11, 14,8,8,8,14,14,14,8, 8,14,11,8,8,8,11,8, 2,8,2,2,2,2,2,2, 2,2,2,2,36,8,36,2, 20,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, // ACxx 7,37,37,39,37,39,39,37, 37,2,2,37,39,2,37,39, 37,37,37,37,37,39,37,37, 39,37,37,39,37,37,37,37, 2,2,2,11,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,8,8,9,8,33,8,8, 2,8,8,8,9,8,9,8, 8,8,9,2,2,8,8,9, 8,8,8,8,8,2,2,8, 8,8,2,8,8,33,8,11, 8,2,2,2,2,8,8,8, 8,8,8,8,8,8,8,8, 8,8,8,2,8,8,8,37, 2,6,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,6,5,2,2,2,2, 2,2,2,2,2,2,2,2, 36,8,2,8,2,36,2,2, 36,6,8,36,2,36,36,8, 8,2,2,8,2,8,8,3, 2,8,2,2,2,8,2,3, 8,8,59,8,8,59,8,3, 8,8,3,59,8,8,3,2, 8,5,8,8,8,8,8,8, 2,8,5,8,8,8,8,8, 2,2,59,2,2,2,2,2, 2,2,2,2,2,2,8,2, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, // ADxx 7,39,37,37,39,39,37,39, 39,2,2,37,39,2,37,39, 39,37,39,39,39,39,39,37, 39,39,37,39,39,39,37,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,8,2,8,8,2,8,8, 2,8,8,2,8,8,2,2, 8,2,2,8,8,8,8,8, 8,8,8,8,2,8,8,2, 8,2,8,2,11,8,8,11, 8,2,11,11,8,8,8,11, 8,8,11,8,2,8,11,8, 8,2,8,8,2,8,2,37, 2,2,2,2,2,2,2,2, 2,2,39,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,5,2, 36,2,2,2,2,2,2,8, 36,2,14,8,2,8,36,2, 2,8,8,2,2,8,8,8, 2,8,8,8,8,2,2,8, 8,14,8,14,8,8,8,8, 8,8,8,8,8,8,2,2, 7,8,14,8,8,14,7,8, 2,8,8,8,8,8,8,8, 2,8,2,2,2,2,2,2, 2,2,2,2,8,2,36,2, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, // AExx 7,39,1,39,39,39,37,37, 37,2,2,37,39,2,37,39, 39,39,39,39,39,39,37,37, 39,39,37,39,39,39,37,37, 2,2,2,2,2,2,2,2, 2,2,2,5,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,9,8,2,2,9,2,2, 8,9,8,9,8,8,9,9, 2,8,2,8,8,2,8,2, 2,2,8,2,2,8,2,8, 8,8,8,8,8,8,2,8, 8,8,2,8,8,8,2,8, 8,8,8,2,8,8,8,8, 8,8,8,8,8,8,11,37, 2,2,6,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,36,8,8, 2,2,2,2,36,2,2,2, 2,2,2,2,2,2,2,8, 2,2,2,8,8,2,2,2, 8,8,8,14,8,6,8,8, 8,8,8,14,8,9,2,2, 8,8,8,8,8,8,8,8, 8,2,8,8,8,6,8,8, 2,36,36,2,2,2,2,2, 2,2,2,2,2,8,8,2, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, // AFxx 7,9,1,1,39,39,39,37, 37,2,2,37,39,2,37,37, 37,37,37,37,37,39,37,37, 39,39,37,37,39,37,37,37, 2,2,2,2,2,2,2,2, 2,11,2,2,2,2,2,2, 39,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,12,8,2,12,12,8,2, 2,8,2,12,12,8,12,12, 8,8,8,8,8,2,2,2, 2,12,8,8,2,8,2,2, 11,2,8,2,8,8,8,8, 2,2,2,8,8,2,2,12, 2,8,2,2,2,8,8,8, 8,12,8,8,2,8,2,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 36,9,2,6,2,2,2,2, 2,2,8,8,8,2,36,2, 11,2,8,8,2,8,2,2, 8,2,8,2,2,8,2,2, 8,8,8,8,6,8,8,8, 8,8,8,6,6,10,8,8, 8,8,8,8,14,10,1,8, 2,2,2,2,8,8,8,8, 8,2,2,2,2,2,2,2, 2,2,2,8,2,2,8,2, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, // B0xx 7,39,37,37,39,4,37,37, 39,11,2,37,37,2,37,37, 39,39,37,37,39,39,37,37, 39,39,37,39,39,39,37,37, 2,2,2,2,11,2,2,2, 2,2,11,2,2,2,2,2, 11,11,11,11,11,11,11,11, 11,11,2,2,2,2,2,2, 8,8,2,11,8,11,11,2, 2,8,8,8,2,2,2,8, 2,8,2,2,8,8,8,2, 2,2,8,2,8,8,8,8, 11,8,2,2,8,8,8,8, 8,2,8,8,8,11,2,11, 8,8,2,8,8,8,8,8, 8,8,2,8,8,8,11,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 11,5,5,5,2,5,7,2, 5,5,8,8,3,5,3,2, 5,2,3,5,3,8,5,8, 3,5,3,8,8,2,2,2, 6,3,7,2,3,5,7,5, 8,3,8,5,7,5,3,8, 2,3,14,8,5,7,3,3, 3,3,5,7,5,5,7,5, 2,5,8,2,2,2,5,2, 5,2,8,2,3,5,5,3, 5,5,8,8,3,8,8,5, 5,3,5,7,5,5,3,37, // B1xx 7,11,11,39,39,37,39,37, 37,2,2,37,37,9,39,39, 37,39,37,37,39,39,37,37, 37,39,37,37,39,39,37,37, 9,9,2,2,37,2,2,2, 2,2,2,5,9,2,9,2, 2,2,2,2,2,2,2,2, 2,2,9,9,2,2,2,9, 8,2,8,8,2,8,8,8, 8,8,8,8,8,8,8,8, 2,2,11,2,8,8,8,8, 8,8,8,8,2,2,8,8, 8,8,8,9,9,8,8,9, 8,8,8,9,8,8,2,8, 9,8,8,9,9,2,8,8, 8,8,8,8,2,8,2,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,5,2, 2,2,2,2,2,2,2,2, 2,8,7,3,5,3,3,3, 3,3,2,7,3,3,3,3, 2,3,3,5,3,8,3,8, 5,5,5,3,5,2,3,7, 8,5,8,5,7,5,8,5, 3,7,3,3,3,5,3,3, 8,7,3,8,5,3,5,5, 3,5,8,5,3,5,5,7, 3,8,5,2,3,2,2,2, 5,2,3,2,2,3,5,2, 3,8,5,7,5,3,3,7, 8,3,5,7,7,8,7,37, // B2xx 7,39,37,39,37,37,39,1, 37,2,2,39,37,2,39,39, 39,39,37,37,39,39,37,39, 39,39,37,37,39,39,37,39, 2,2,2,2,2,39,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,2,8,2,8,8,2,8, 8,2,8,8,8,8,8,8, 8,8,8,2,2,8,8,8, 8,8,8,8,8,8,8,8, 8,8,8,2,8,2,2,8, 2,8,8,8,8,8,8,8, 8,8,8,2,3,2,8,8, 8,8,8,8,2,39,8,37, 2,2,2,2,2,2,5,5, 2,2,5,2,2,2,5,5, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,3,3,8,8,3,7,8, 3,3,3,7,7,7,3,7, 7,8,5,8,2,3,3,2, 2,3,3,3,3,3,2,3, 5,7,3,7,8,3,3,7, 7,3,3,3,7,3,3,7, 7,10,3,8,7,8,7,8, 3,3,7,7,3,3,5,3, 2,3,3,2,2,2,2,2, 7,3,7,5,3,10,3,2, 7,7,7,7,5,7,5,7, 8,7,3,5,8,3,7,37, // B3xx 7,39,1,39,39,37,37,37, 39,12,2,37,39,2,37,39, 39,39,37,37,39,39,39,37, 39,39,37,39,39,39,37,37, 12,12,2,2,11,39,2,2, 2,2,2,2,12,2,12,12, 37,2,2,2,2,2,2,2, 2,2,12,12,2,2,2,12, 8,2,8,8,8,2,2,2, 2,2,8,2,2,2,8,12, 2,8,2,8,8,8,8,8, 8,8,8,2,8,8,8,2, 2,12,12,12,8,12,8,8, 8,2,8,12,2,12,8,8, 8,8,8,8,8,12,8,8, 8,12,8,8,2,8,8,37, 2,2,6,2,2,2,2,2, 2,2,2,2,2,2,2,6, 2,2,2,2,2,2,2,2, 5,2,2,2,2,2,2,2, 2,3,2,3,3,3,7,3, 2,3,5,7,3,5,8,5, 7,9,5,5,2,3,2,3, 2,8,8,5,2,8,3,3, 7,3,3,5,5,3,3,3, 7,3,5,3,3,7,7,3, 3,5,8,7,3,8,3,5, 7,3,7,7,8,5,3,8, 5,8,5,2,2,2,2,2, 2,2,3,5,5,5,5,2, 5,10,8,5,7,8,3,3, 8,8,5,3,8,3,3,10, // B4xx 7,39,1,39,39,37,37,4, 39,14,2,14,39,2,37,39, 37,39,37,37,39,39,37,37, 37,39,37,39,37,39,39,37, 2,2,2,11,11,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,11,8,8,8,11,2,2, 8,8,8,8,8,8,8,8, 8,8,11,11,8,8,8,2, 8,8,8,8,2,2,8,8, 8,11,8,8,8,11,8,8, 11,11,8,8,2,11,11,8, 11,8,8,11,11,11,11,8, 8,8,8,2,2,8,2,37, 2,2,2,6,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,3,2,8,8,3,3,14, 3,5,2,3,3,2,3,2, 2,7,3,7,3,8,7,14, 2,2,5,2,8,3,2,3, 5,8,5,5,7,3,7,3, 3,5,3,3,3,14,3,5, 5,7,14,3,5,14,7,5, 7,5,8,7,5,5,5,3, 2,14,2,2,5,2,2,5, 2,2,2,5,2,2,3,3, 3,5,3,3,7,5,5,3, 3,7,3,3,7,3,8,37, // B5xx 7,39,37,39,39,37,37,37, 39,2,2,37,39,2,37,37, 37,39,39,37,37,37,37,37, 37,39,37,37,37,37,37,37, 2,2,2,2,39,2,2,2, 2,2,2,2,2,2,14,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,2,33,33,33,2,11,8, 8,8,8,33,8,8,33,8, 8,39,33,8,33,8,33,8, 8,8,33,8,8,2,8,2, 8,9,8,8,8,8,8,11, 8,8,8,8,8,11,8,8, 8,8,11,8,3,8,8,8, 8,8,8,8,8,8,2,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,5, 2,2,2,2,2,2,2,5, 2,7,7,3,7,3,8,8, 5,3,8,3,7,7,3,3, 2,3,8,3,8,5,5,2, 5,8,3,7,3,3,3,5, 3,3,3,3,3,5,3,5, 3,5,5,5,3,3,5,3, 3,14,7,14,14,7,3,3, 3,7,3,8,7,3,7,7, 2,7,5,3,3,5,2,3, 2,5,3,2,2,2,5,2, 5,5,5,8,3,3,7,3, 8,8,3,8,8,8,7,37, // B6xx 7,1,4,39,37,37,37,37, 37,2,2,37,37,2,37,37, 37,37,37,37,39,37,37,37, 37,39,37,37,37,37,37,37, 9,2,2,2,11,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,9,2,2,2,9, 8,2,8,2,8,8,8,2, 8,2,8,8,8,2,2,8, 8,8,8,8,8,8,8,8, 8,3,8,2,2,8,8,2, 8,30,8,9,8,8,2,8, 8,8,2,9,9,8,9,8, 9,8,9,8,8,8,8,9, 8,2,8,8,8,8,8,37, 2,2,2,5,2,2,5,5, 2,2,2,2,2,5,2,2, 2,11,5,2,2,2,5,5, 2,2,2,2,2,2,2,2, 2,8,8,2,8,3,7,5, 3,3,3,3,3,3,8,3, 8,5,2,2,3,7,7,3, 7,3,8,5,3,3,3,7, 3,3,8,8,3,3,3,5, 3,7,7,3,3,3,3,3, 7,7,14,3,3,8,3,8, 7,3,7,7,8,7,6,5, 3,7,7,2,2,2,2,2, 2,2,8,8,7,3,3,2, 8,7,5,5,5,5,5,5, 3,3,3,3,3,8,3,37, // B7xx 7,39,37,14,39,37,39,37, 39,11,11,37,39,2,37,39, 39,39,37,39,39,39,39,37, 39,39,37,39,39,39,37,37, 11,2,2,11,11,2,11,2, 2,2,11,2,2,2,11,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,11,2, 8,8,8,33,33,11,8,8, 8,2,8,33,8,8,8,8, 8,8,8,8,33,8,8,8, 8,8,33,2,8,2,2,2, 11,11,8,2,8,11,8,11, 8,8,8,8,11,8,8,8, 2,8,8,8,2,8,8,8, 8,8,8,2,8,8,8,37, 2,6,6,2,2,2,2,2, 2,6,2,2,2,2,2,2, 2,2,2,2,2,11,2,2, 2,2,2,5,2,2,2,2, 2,5,3,5,7,2,5,8, 3,5,7,5,3,3,5,5, 5,5,2,5,3,3,3,11, 2,5,3,5,2,3,3,3, 3,5,5,5,5,3,3,3, 7,3,7,8,3,14,5,5, 5,3,14,8,5,14,3,7, 14,14,7,3,3,3,7,3, 2,5,3,2,2,2,2,3, 2,2,7,7,5,8,7,7, 3,3,3,7,3,7,3,7, 3,5,7,3,5,5,3,37, // B8xx 7,39,37,39,39,39,37,37, 37,2,2,37,37,2,37,1, 39,39,37,39,39,39,39,37, 39,37,37,37,39,39,39,37, 2,2,2,2,37,2,2,2, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,8,2,8,2,6,2,8, 8,8,8,8,8,6,8,8, 2,2,8,8,8,8,8,8, 8,8,8,2,37,2,2,8, 8,8,2,11,8,8,8,8, 8,8,8,8,2,8,8,8, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,7,2,5,2,5,5,5, 8,7,2,7,2,2,5,2, 2,2,5,5,3,5,5,5, 5,8,2,5,5,3,3,5, 7,5,5,3,3,5,5,5, 8,3,3,8,8,7,3,3, 3,8,3,5,5,5,3,3, 14,3,3,3,8,7,5,3, 2,7,3,2,2,2,3,5, 3,5,8,2,2,5,7,3, 5,5,7,5,8,8,3,3, 3,3,3,8,3,7,7,37, // B9xx 7,39,4,37,39,39,39,37, 39,14,2,14,39,14,4,37, 39,39,39,39,39,39,37,37, 39,39,37,39,39,39,39,37, 14,2,2,2,2,2,2,14, 2,2,2,2,2,2,14,2, 37,2,2,2,2,2,2,2, 2,2,2,2,2,2,14,2, 8,8,8,8,8,8,8,8, 8,2,8,8,8,8,2,8, 2,8,2,8,8,2,8,2, 8,8,2,2,8,8,2,8, 8,8,12,12,12,9,2,12, 8,9,8,9,9,8,9,9, 8,8,38,8,9,8,8,8, 8,8,12,8,8,8,2,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,14,8,2,3,7,3,14, 14,3,8,3,3,7,5,7, 5,3,3,2,2,14,2,14, 2,3,3,3,2,7,2,2, 3,7,5,14,3,3,7,3, 3,3,3,3,5,7,5,8, 5,14,14,14,7,14,7,5, 3,5,5,3,3,5,5,5, 7,7,3,3,2,2,5,7, 5,5,8,2,2,3,8,8, 7,7,3,3,8,7,5,5, 5,3,3,3,5,3,7,37, // BAxx 7,39,37,39,39,39,37,37, 39,2,2,37,39,2,37,39, 39,39,37,39,39,39,39,37, 39,39,37,39,39,39,37,37, 1,2,2,2,2,1,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,14,2,2,2,2,2, 8,8,2,8,8,2,2,8, 2,8,8,8,8,8,8,8, 8,2,8,2,2,8,8,1, 8,2,8,8,2,8,8,1, 2,8,8,8,2,12,2,2, 8,12,8,8,2,2,8,12, 8,8,2,2,8,8,8,8, 8,8,8,8,8,8,8,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,8,3,3,2,5,2,2, 14,8,2,2,2,2,5,5, 5,3,2,2,5,3,2,2, 5,5,2,5,3,3,5,2, 5,3,7,3,3,3,7,7, 3,3,8,3,7,3,5,3, 5,7,5,3,14,3,8,7, 8,7,3,3,3,7,8,7, 7,3,8,2,2,2,2,2, 2,2,5,8,3,5,7,2, 3,5,3,3,8,3,7,7, 3,5,3,8,5,3,3,37, // BBxx 7,39,1,39,39,37,14,39, 39,2,2,1,39,11,37,11, 39,39,37,37,39,39,39,37, 39,39,37,37,39,39,37,37, 11,2,2,2,2,11,11,11, 2,2,2,2,11,2,11,2, 37,2,2,11,11,2,11,11, 11,11,2,11,11,2,14,2, 8,8,8,2,8,8,8,8, 2,8,2,11,8,2,2,8, 8,8,8,2,8,2,11,8, 8,8,8,8,8,8,2,8, 8,8,2,2,11,8,11,2, 8,2,11,8,2,2,8,2, 8,8,8,8,2,8,37,8, 8,8,8,8,8,8,8,37, 2,2,6,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,8,3,2,3,2,3,3, 3,5,3,8,2,3,3,3, 3,7,7,7,2,3,2,3, 2,3,2,3,3,2,2,2, 7,14,7,14,7,7,3,5, 7,7,3,7,5,7,7,7, 7,14,7,3,7,3,3,7, 3,7,8,3,7,3,7,7, 7,3,8,2,2,2,2,5, 2,2,5,7,5,2,3,7, 3,3,3,5,8,5,5,3, 3,3,3,7,3,5,7,37, // BCxx 7,39,39,39,39,39,37,37, 39,2,2,37,39,2,37,37, 39,39,39,39,37,37,37,37, 37,39,37,37,37,37,37,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,12,8,8,2,2,8,12, 8,2,8,12,8,12,12,12, 8,8,2,12,2,12,12,8, 8,8,8,8,2,2,8,2, 2,8,8,9,9,8,8,8, 8,8,2,9,9,9,9,8, 8,8,9,8,8,8,8,8, 8,8,8,8,2,8,8,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,7,2,7,3,5,3,2, 7,2,3,7,2,5,5,3, 3,5,3,2,3,2,3,2, 3,2,5,2,5,8,5,5, 3,7,7,3,3,5,3,3, 3,8,3,8,7,3,3,8, 8,3,3,3,7,5,8,3, 3,3,8,3,3,3,3,8, 3,3,5,2,3,2,2,2, 7,2,7,2,3,2,5,7, 7,7,3,7,3,3,5,5, 5,3,5,3,3,7,3,37, // BDxx 7,39,37,11,37,37,37,37, 39,2,2,37,39,2,6,37, 37,39,37,37,39,39,37,37, 39,39,37,39,39,39,37,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 8,2,2,2,2,6,8,8, 8,2,2,8,8,8,2,2, 2,8,8,8,8,8,8,8, 8,8,8,2,8,8,2,8, 8,8,8,8,8,2,8,8, 2,2,2,8,8,8,8,8, 2,8,2,8,8,8,8,8, 2,3,2,8,8,8,8,39, 2,2,6,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,3,2,3,7,2,2,8, 3,2,7,3,2,3,2,2, 2,2,3,2,5,3,3,3, 7,3,5,3,5,2,7,2, 5,5,5,5,5,5,8,5, 5,5,5,7,3,5,5,3, 7,7,8,3,3,8,3,8, 3,3,3,3,3,3,8,8, 3,3,3,2,2,2,2,3, 2,3,7,2,3,2,3,2, 3,7,3,3,3,3,3,7, 3,7,3,3,3,7,3,37, // BExx 7,39,37,14,39,1,37,37, 39,2,2,37,37,2,37,39, 37,39,39,37,37,39,37,37, 39,39,37,39,39,37,37,39, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,14,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,14,2, 8,8,8,2,8,8,8,8, 8,2,8,8,8,2,2,2, 8,8,8,59,8,8,2,8, 8,8,8,2,8,2,8,8, 8,12,9,8,8,9,2,12, 8,8,8,12,8,12,8,12, 8,8,8,12,12,12,8,8, 8,8,8,8,8,2,8,37, 2,2,6,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,3,3,3,2,8,7,3, 8,3,3,3,3,3,7,3, 3,3,5,3,5,3,3,2, 5,8,3,3,2,2,5,3, 3,14,8,3,14,3,5,8, 5,8,5,5,8,3,7,5, 7,14,5,3,8,5,3,5, 5,3,7,3,7,3,3,5, 5,8,2,2,2,2,2,5, 2,2,2,7,7,3,5,5, 7,3,7,5,8,3,3,5, 5,3,5,5,3,3,7,37, // BFxx 7,11,37,37,37,12,37,1, 37,2,2,37,39,2,37,37, 37,37,37,37,39,37,37,37, 37,37,37,37,39,37,37,37, 12,11,2,2,2,2,2,11, 2,2,2,2,2,2,2,2, 37,2,2,2,2,2,2,2, 2,2,12,2,2,2,2,1, 8,8,1,1,8,8,1,2, 1,1,2,8,1,1,8,8, 1,1,1,1,1,8,1,8, 8,1,8,2,8,2,8,2, 8,12,12,8,12,12,8,2, 1,8,8,12,12,2,2,12, 2,8,1,12,2,2,8,12, 2,12,8,2,8,8,2,37, 2,2,2,2,2,2,2,2, 2,2,2,6,2,2,2,2, 2,2,2,5,2,2,2,2, 2,2,5,2,2,2,2,2, 2,5,5,5,8,5,7,7, 3,5,3,2,5,5,7,3, 5,5,7,8,3,5,7,7, 3,5,2,2,3,2,5,7, 5,5,5,5,8,3,3,7, 7,3,7,3,3,7,3,5, 5,14,3,3,5,3,3,3, 3,3,3,3,5,3,7,8, 2,3,3,2,5,2,2,2, 2,8,3,5,5,3,5,5, 8,3,5,3,7,5,3,3, 5,5,8,8,5,8,5,37, // C0xx 7,39,37,1,39,39,37,1, 39,10,18,1,39,10,37,39, 39,39,37,37,39,39,39,37, 39,39,7,37,39,39,37,39, 10,10,10,10,1,10,10,10, 10,10,10,10,10,10,10,10, 37,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 8,8,1,1,1,8,1,1, 8,8,8,30,1,1,1,1, 1,1,8,1,1,3,8,8, 1,8,8,8,8,8,3,3, 8,3,8,1,8,8,8,8, 39,3,8,3,3,8,8,39, 8,8,1,8,8,8,8,8, 8,8,8,8,8,37,8,37, 10,6,6,6,6,39,3,3, 39,6,12,6,10,6,6,6, 6,6,6,6,6,6,6,6, 6,3,37,3,3,5,37,1, 10,3,3,8,7,5,8,5, 3,3,7,3,3,3,7,5, 5,5,5,8,3,7,3,14, 5,7,5,5,3,5,7,3, 3,10,10,10,10,10,10,5, 3,8,10,10,5,10,5,5, 10,10,10,5,5,10,5,3, 10,8,5,5,7,10,10,7, 3,5,10,7,3,5,3,5, 7,7,10,3,7,3,3,3, 10,3,8,10,8,7,3,3, 3,8,5,5,5,3,7,10, // C1xx 7,39,1,39,39,39,37,37, 39,14,18,37,39,11,37,39, 39,39,37,39,39,39,37,39, 39,39,39,39,37,37,37,37, 11,18,14,14,37,11,18,14, 14,11,11,14,18,18,14,11, 37,20,11,14,14,14,14,11, 37,14,11,18,11,10,18,18, 8,8,1,1,1,1,1,1, 1,1,1,1,1,1,1,8, 1,1,1,1,1,1,1,8, 1,8,1,14,8,11,8,8, 8,8,1,8,16,16,1,1, 1,10,8,1,1,16,8,8, 8,8,1,16,1,8,16,8, 8,8,1,8,8,8,8,37, 39,6,6,4,39,11,3,6, 3,39,12,39,37,12,12,6, 37,6,6,6,39,3,6,6, 37,3,3,3,4,11,12,1, 14,5,3,3,5,3,5,3, 5,5,3,3,3,3,5,5, 7,7,10,7,3,3,5,5, 5,5,3,5,3,3,5,3, 10,5,5,14,3,10,3,7, 10,11,8,3,18,20,10,3, 3,14,14,10,18,14,5,14, 5,3,3,10,3,5,3,5, 10,7,3,3,8,3,3,8, 14,3,7,10,3,3,5,5, 5,5,5,10,3,5,5,3, 5,3,5,10,7,5,5,10, // C2xx 7,39,37,37,39,39,39,37, 39,14,14,1,39,14,37,1, 39,37,39,39,39,39,39,37, 37,37,37,39,37,39,37,39, 10,14,14,14,39,10,14,14, 14,14,14,10,14,10,10,14, 37,10,10,14,14,10,10,10, 39,14,14,10,14,10,14,14, 8,8,1,16,16,8,8,1, 8,8,16,16,16,1,1,8, 16,8,16,16,1,1,16,8, 8,1,8,8,8,14,8,8, 8,8,8,8,8,8,8,1, 1,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,1, 8,8,8,8,14,8,8,37, 37,59,2,11,3,39,11,11, 2,39,10,2,2,59,11,59, 11,11,12,3,2,3,2,2, 11,11,3,12,4,59,17,11, 2,2,7,2,2,3,7,2, 59,2,2,2,3,7,2,3, 2,2,8,7,2,2,3,3, 7,14,2,2,3,3,7,2, 10,3,8,3,3,10,3,3, 10,3,3,10,3,10,10,18, 7,10,14,7,3,18,3,3, 7,14,10,3,8,3,3,7, 8,11,10,11,3,7,7,7, 7,3,7,3,14,3,10,5, 3,10,3,3,3,10,3,5, 5,5,3,5,5,3,3,10, // C3xx 7,1,4,39,39,37,37,1, 37,14,12,3,39,14,1,1, 39,37,39,37,37,39,37,37, 39,39,37,37,39,37,37,37, 14,14,14,1,1,1,14,14, 14,11,11,5,14,11,14,11, 37,14,10,14,14,10,14,14, 10,10,11,14,14,11,14,1, 8,10,8,8,8,1,8,12, 8,12,8,8,12,8,12,1, 8,8,12,1,12,12,10,10, 8,8,8,8,8,8,8,39, 8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8, 1,8,1,8,8,8,8,8, 8,8,8,8,14,8,8,37, 2,2,59,59,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,5,2,5, 2,2,2,5,2,2,2,3, 3,14,7,14,10,3,7,3, 11,3,5,3,11,11,10,7, 14,11,14,11,11,11,5,3, 3,14,11,11,3,11,11,5, 5,11,5,11,11,7,3,3, 3,14,7,5,14,11,10,3, 10,3,5,11,3,11,8,3, 5,3,7,3,3,8,8,10, // C4xx 7,6,1,39,37,37,37,37, 39,10,18,1,39,18,1,37, 37,37,37,37,39,37,37,37, 39,37,37,37,39,37,37,37, 18,18,10,1,1,1,10,1, 6,10,6,3,18,10,18,10, 37,10,10,10,10,5,5,5, 5,5,18,18,10,6,10,1, 8,8,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,8,1,1,1,1,1,8, 1,8,1,8,8,8,8,8, 3,8,8,8,8,1,8,1, 1,8,8,1,8,8,1,8, 1,8,1,1,1,1,8,8, 8,8,8,8,8,8,8,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,5,7,3,3,7,3,5, 5,3,3,5,3,5,7,2, 2,2,8,8,7,8,3,3, 3,7,7,3,2,3,3,3, 10,5,10,3,5,10,10,3, 10,3,10,10,7,10,10,3, 3,3,8,10,3,18,3,18, 3,18,3,10,3,8,5,10, 10,3,3,3,3,10,8,20, 10,20,3,10,7,5,10,3, 10,3,8,7,3,8,5,5, 7,7,3,5,5,8,3,10, // C5xx 7,39,37,14,39,39,37,37, 39,14,18,39,39,18,39,39, 39,39,37,37,39,39,37,39, 39,39,39,39,39,39,37,37, 18,18,18,14,39,18,18,1, 14,18,14,3,18,18,18,14, 37,10,10,10,10,6,10,10, 39,20,18,18,18,1,18,18, 8,8,1,3,1,1,8,1, 1,1,8,1,1,1,1,1, 1,8,1,1,1,8,1,8, 8,8,1,8,8,8,8,8, 39,8,1,3,1,8,8,1, 1,8,12,1,1,1,8,8, 1,8,1,1,1,8,8,8, 8,8,12,3,8,8,8,37, 2,2,2,2,2,2,2,2, 2,37,5,2,2,2,12,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,3,2,3,14, 3,5,7,2,5,5,3,2, 5,2,5,2,7,3,3,7, 5,7,2,5,2,2,2,5, 7,5,5,5,10,3,3,10, 11,10,10,10,10,5,18,11, 10,10,10,11,7,10,11,5, 5,7,11,5,8,3,11,7, 3,11,3,8,5,8,5,7, 14,8,7,5,7,11,3,3, 5,10,7,3,3,5,7,5, 5,7,3,3,7,8,7,37, // C6xx 7,37,39,1,39,39,37,37, 37,10,12,37,39,11,37,37, 39,39,37,39,39,39,39,37, 39,39,37,39,39,39,37,39, 11,12,10,1,37,39,11,1, 37,11,11,10,12,18,10,10, 37,3,11,10,3,3,3,3, 39,3,12,39,11,6,10,12, 37,12,1,8,1,12,8,1, 1,12,8,1,1,1,1,8, 8,8,1,1,1,8,1,8, 8,8,8,8,8,8,8,8, 8,8,1,1,1,8,8,8, 8,12,8,8,8,12,1,12, 8,8,8,8,1,12,8,12, 8,1,8,8,8,8,8,37, 37,6,6,6,4,3,2,4, 6,39,6,39,6,6,6,2, 6,6,2,6,37,6,39,6, 39,2,4,2,39,3,37,4, 2,2,3,7,3,3,7,7, 7,7,3,3,3,3,5,5, 2,3,5,7,3,3,3,3, 3,3,3,7,5,3,3,3, 3,3,3,7,5,10,3,5, 10,7,10,5,3,10,10,7, 5,11,5,10,5,3,3,3, 3,3,3,5,11,5,3,3, 7,11,7,11,3,10,3,3, 10,7,5,3,3,5,7,3, 3,7,5,3,3,3,11,5, 3,5,5,3,7,7,7,37, // C7xx 7,39,39,39,37,39,39,39, 39,11,11,14,39,11,37,39, 39,39,37,39,39,39,39,37, 39,39,37,39,39,39,39,39, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 37,11,11,11,11,14,11,11, 11,11,11,11,11,11,1,11, 18,1,1,16,16,1,8,16, 1,1,16,16,1,1,16,1, 16,8,16,16,16,1,16,1, 37,1,16,11,39,11,11,11, 39,1,1,31,16,1,8,1, 1,1,8,1,1,1,1,1, 8,8,1,1,37,1,1,3, 37,8,8,39,37,11,8,37, 2,11,6,2,37,37,39,12, 37,6,39,3,39,2,2,39, 11,2,2,2,2,11,2,6, 11,11,2,2,2,2,11,2, 11,11,3,3,7,5,3,3, 3,3,5,3,3,7,3,7, 5,3,5,5,14,7,3,3, 3,14,7,5,7,7,7,3, 10,11,10,1,10,3,11,11, 11,11,11,11,11,11,11,5, 5,5,5,11,11,5,11,5, 5,5,11,11,7,11,11,11, 5,11,5,11,11,11,11,3, 5,3,3,3,3,11,7,3, 11,7,3,3,5,5,5,3, 3,5,3,5,5,5,3,10, // C8xx 7,37,37,14,37,37,39,39, 37,11,11,37,39,11,37,39, 37,37,37,37,39,37,37,39, 39,39,37,39,37,37,37,37, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 37,11,11,11,11,11,18,11, 18,11,11,18,11,11,10,18, 11,12,1,1,1,12,1,1, 12,12,12,12,12,1,12,12, 12,1,1,1,1,12,1,12, 1,1,1,11,11,11,11,11, 11,12,1,1,1,12,3,1, 12,12,12,12,12,1,1,12, 10,37,12,12,12,12,12,11, 39,12,12,11,11,11,3,37, 39,11,6,6,3,37,2,3, 39,6,12,37,39,11,10,6, 11,6,6,6,11,11,6,6, 11,2,2,2,2,11,11,1, 11,3,7,5,3,3,3,3, 3,7,3,3,7,5,5,5, 5,3,5,7,3,3,3,3, 5,5,3,3,3,7,3,5, 10,10,10,3,5,10,5,11, 3,11,10,3,10,11,3,3, 10,11,10,11,11,3,7,10, 11,3,11,11,11,3,11,10, 7,11,3,11,11,11,11,3, 7,3,5,3,10,11,10,5, 10,5,7,7,3,3,11,5, 3,5,11,5,3,3,7,37, // C9xx 7,39,11,39,37,39,37,10, 39,11,18,39,37,11,37,39, 39,37,39,37,39,39,37,37, 39,39,37,39,39,39,37,39, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 37,11,11,11,11,11,11,11, 11,11,11,18,11,11,11,18, 8,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,11,11,11,11,11, 18,8,1,1,1,8,1,1, 1,1,1,1,1,1,1,8, 1,1,1,1,1,8,1,3, 1,1,1,1,11,11,11,37, 39,6,6,6,6,11,37,12, 6,6,12,6,6,6,12,6, 2,2,2,6,2,11,6,2, 6,2,2,2,2,11,11,2, 11,11,3,3,7,3,7,7, 3,7,3,3,7,3,7,3, 3,3,7,3,7,3,3,3, 7,3,3,11,7,3,7,11, 14,3,7,7,10,18,3,3, 18,18,7,3,3,10,18,3, 3,10,10,18,7,7,18,7, 7,3,18,7,3,7,18,7, 3,7,7,3,3,7,3,3, 3,7,3,7,3,3,3,20, 7,3,3,3,7,3,3,7, 3,3,3,7,7,3,7,37, // CAxx 7,6,39,37,39,37,37,37, 37,11,11,37,37,11,37,37, 37,37,37,37,39,37,37,37, 39,37,37,37,39,37,37,4, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 37,11,11,11,11,11,11,11, 14,11,11,18,11,11,10,18, 11,10,12,12,12,1,1,12, 1,8,1,12,1,1,1,10, 12,1,1,1,1,1,1,12, 1,37,12,11,8,11,8,11, 37,10,1,8,12,8,37,37, 1,1,12,12,12,12,1,8, 10,1,1,12,1,1,39,1, 1,8,12,1,11,11,11,37, 2,2,6,2,2,11,2,2, 2,2,2,2,12,2,39,6, 11,39,2,6,2,11,6,6, 11,11,37,2,10,11,2,2, 11,3,3,7,3,3,3,3, 3,3,7,3,7,3,3,3, 3,3,3,3,14,3,3,3, 7,3,14,3,3,3,3,3, 10,14,3,11,7,10,3,3, 11,7,3,10,7,11,10,11, 3,11,3,11,3,3,3,3, 11,3,11,3,3,11,11,11, 10,11,7,11,3,11,11,7, 14,3,3,10,3,11,10,3, 10,7,10,7,3,3,3,3, 3,20,7,3,7,3,7,11, // CBxx 7,1,39,37,37,39,37,37, 1,11,18,37,37,11,37,37, 37,37,37,37,37,37,37,37, 37,37,7,37,37,37,37,37, 11,18,11,10,1,39,18,11, 11,11,11,3,18,18,10,11, 37,10,10,3,10,3,10,10, 3,11,11,18,11,3,11,18, 8,10,1,1,16,1,1,16, 1,1,16,16,1,16,1,10, 16,1,1,16,16,1,16,1, 1,39,1,37,11,10,11,11, 37,1,1,1,1,37,1,1, 1,10,1,1,1,8,1,1, 1,1,1,1,1,37,37,37, 8,39,39,3,8,37,3,37, 2,6,6,4,39,2,2,2, 2,2,2,2,2,2,2,37, 2,2,6,16,6,11,37,6, 2,2,2,2,2,2,2,1, 11,7,3,3,3,3,7,3, 7,3,3,3,7,3,3,3, 3,7,10,3,7,3,3,7, 3,3,7,7,3,3,3,3, 10,14,3,14,3,10,3,11, 10,3,10,10,7,3,3,18, 3,3,14,10,18,3,3,3, 3,3,7,10,7,8,10,3, 3,11,7,3,3,10,3,14, 7,14,3,3,11,11,10,3, 3,3,8,10,7,3,7,3, 3,3,3,3,3,3,7,10, // CCxx 7,39,39,37,39,39,39,37, 39,11,18,37,37,11,37,39, 39,39,39,37,39,39,39,37, 39,39,37,37,39,39,37,37, 11,10,11,11,11,11,11,11, 18,11,11,10,11,10,10,11, 37,11,11,11,11,11,11,11, 11,11,11,6,11,37,6,18, 8,1,12,12,12,16,1,1, 12,16,12,12,12,12,12,31, 12,1,12,12,12,8,12,6, 8,10,12,1,11,11,1,11, 10,1,1,1,8,16,1,1, 1,10,1,1,1,3,1,1, 1,8,18,1,1,10,37,11, 8,10,1,8,8,11,3,39, 2,2,6,2,2,2,2,2, 2,2,12,6,6,12,12,6, 6,6,6,6,6,6,3,6, 6,37,2,3,37,11,2,1, 11,7,7,7,7,3,3,3, 3,3,7,3,3,3,7,3, 3,7,3,3,7,7,3,3, 3,3,3,3,3,3,7,7, 10,18,7,3,7,10,3,11, 10,18,11,10,7,10,10,11, 11,11,11,10,3,3,3,3, 3,3,7,10,7,3,11,10, 10,3,3,11,11,3,11,7, 10,7,3,7,3,11,10,3, 3,7,7,7,3,3,7,7, 3,3,3,3,3,3,7,10, // CDxx 7,39,37,14,39,37,37,37, 37,14,18,14,37,11,14,11, 39,39,37,39,39,39,37,37, 39,37,37,37,39,37,37,37, 11,18,11,11,11,11,14,14, 14,11,11,11,18,18,14,11, 37,14,11,14,14,14,14,14, 14,11,14,18,11,11,10,18, 18,1,1,1,1,1,1,1, 1,10,1,1,1,1,1,1, 1,1,1,1,1,1,1,8, 1,10,1,37,37,11,37,11, 6,1,1,1,1,16,37,1, 8,10,8,39,1,1,1,1, 37,8,1,1,1,37,10,8, 1,39,8,37,14,11,11,37, 37,6,6,6,37,39,37,2, 6,37,12,6,6,12,12,6, 6,39,6,6,37,6,6,6, 11,37,37,3,37,11,11,1, 1,14,7,3,14,3,3,14, 3,3,3,7,3,7,3,3, 3,3,10,3,3,3,3,3, 3,14,14,3,3,7,3,3, 10,3,14,14,10,10,3,11, 10,11,11,3,11,10,10,11, 3,7,10,11,14,7,11,7, 3,11,3,10,11,11,11,11, 10,11,3,11,11,10,11,3, 7,14,3,3,11,11,10,20, 7,7,3,11,3,3,3,7, 3,3,3,3,3,7,3,10, // CExx 7,39,37,37,39,39,37,37, 39,11,18,37,39,11,37,37, 39,39,37,37,39,39,37,37, 39,39,3,37,39,39,37,37, 11,10,11,11,39,10,10,10, 11,10,11,5,11,18,10,11, 37,11,10,10,11,10,10,11, 11,11,11,18,11,11,10,18, 5,8,16,16,16,10,1,16, 1,1,16,16,1,16,1,37, 16,37,16,16,1,31,16,39, 37,1,16,37,37,8,37,10, 8,18,37,1,8,37,10,8, 37,18,1,39,1,1,1,1, 16,8,16,16,37,37,16,37, 8,18,1,37,39,8,3,37, 37,6,6,6,2,2,2,2, 2,2,2,6,2,6,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,3,2,2,3,2,3, 7,7,3,3,3,2,2,3, 3,2,2,2,3,2,3,2, 2,2,2,3,2,2,2,2, 3,10,10,10,3,3,10,11, 3,10,3,10,10,10,11,7, 10,10,3,7,10,3,10,10, 11,18,3,3,11,3,3,10, 7,11,3,7,3,3,11,3, 3,3,10,10,10,11,7,3, 10,3,10,3,10,3,3,3, 7,10,3,3,3,3,3,37, // CFxx 7,11,37,37,37,39,37,37, 37,11,18,11,39,11,37,37, 39,37,37,37,39,39,37,37, 39,39,37,39,37,39,37,37, 11,11,11,6,11,11,11,11, 11,11,11,11,11,18,11,11, 37,11,11,11,11,11,11,11, 11,11,11,18,11,11,11,18, 11,12,1,1,1,1,1,30, 1,16,30,1,1,1,1,16, 10,1,1,1,1,16,1,1, 1,1,1,11,11,11,11,11, 8,12,37,39,12,39,8,37, 8,8,1,39,1,8,1,10, 10,8,12,8,1,12,8,8, 8,8,37,37,18,11,39,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,37, 11,39,11,6,11,2,2,6, 11,11,37,2,2,11,2,1, 11,11,3,3,3,3,3,3, 3,7,3,7,3,7,3,3, 3,3,3,7,3,3,3,3, 3,3,7,7,3,3,20,7, 10,3,3,7,3,10,3,11, 3,11,3,10,18,18,10,11, 10,11,18,10,3,3,3,3, 3,3,11,10,3,11,3,3, 3,11,3,11,3,11,11,3, 3,3,3,3,3,11,10,3, 10,3,3,3,3,11,11,3, 11,3,3,3,3,3,3,10, // D0xx 7,39,1,37,39,1,39,9, 39,14,14,1,39,14,1,39, 39,39,37,37,39,39,37,37, 39,39,37,39,39,37,37,37, 11,14,14,11,1,10,14,14, 14,14,14,14,10,10,10,11, 37,10,10,10,10,14,10,31, 10,10,11,10,14,10,10,14, 1,13,1,13,13,13,1,1, 1,13,1,16,13,13,16,16, 16,37,13,1,16,13,16,1, 39,16,13,14,3,14,14,10, 8,16,1,39,1,16,31,3, 37,16,1,16,16,16,16,16, 18,8,16,8,16,16,16,8, 39,16,8,8,14,8,3,37, 10,2,6,2,2,2,2,2, 2,2,2,2,2,3,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,3,2,3,2,2,3,3, 2,3,14,2,3,3,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 10,3,3,10,3,3,10,3, 10,11,10,3,10,3,10,18, 3,10,10,10,3,3,3,3, 3,18,10,10,10,3,3,11, 10,11,3,3,11,10,11,3, 3,3,3,3,3,3,10,20, 3,20,3,10,3,3,11,3, 3,3,11,3,3,3,3,10, // D1xx 7,37,37,37,39,39,11,37, 39,11,18,37,39,11,37,39, 39,39,37,37,39,39,37,37, 39,39,37,39,39,37,37,37, 11,11,11,10,11,11,11,11, 11,11,11,11,11,11,11,11, 37,11,11,11,11,11,11,11, 11,11,11,18,11,11,11,18, 11,1,12,12,10,1,10,1, 10,1,1,12,8,12,37,1, 10,37,37,12,10,1,10,31, 11,3,1,37,11,11,11,11, 39,1,3,10,31,1,37,37, 10,10,1,11,11,37,7,1, 31,11,10,37,31,1,37,31, 11,39,37,8,11,11,11,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 11,2,2,2,2,2,2,2, 2,2,2,2,2,11,2,2, 11,3,3,3,14,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,14,14,3,3,14, 3,3,14,3,3,3,14,3, 10,20,10,11,11,10,11,11, 11,11,10,10,11,11,10,11, 3,10,10,11,3,3,11,3, 3,20,11,3,10,11,11,11, 10,10,10,11,11,11,11,3, 10,3,10,3,11,11,10,10, 10,10,10,3,3,3,11,10, 3,3,11,3,3,3,3,10, // D2xx 7,39,39,37,39,39,37,12, 39,14,14,39,39,14,37,37, 39,39,37,39,39,39,39,37, 39,39,37,37,39,37,37,37, 11,10,14,14,11,11,14,14, 14,14,11,11,11,10,10,14, 37,10,14,14,10,14,11,11, 14,11,14,18,14,14,14,18, 11,16,1,1,1,16,8,1, 31,16,31,12,1,1,1,12, 1,1,1,12,12,12,1,31, 1,31,1,11,8,14,11,11, 10,31,31,31,31,12,31,31, 31,12,8,39,31,31,31,1, 31,31,1,31,31,16,10,31, 1,31,8,1,14,39,14,39, 37,6,6,2,2,39,3,4, 39,39,3,6,6,12,3,6, 11,2,2,2,28,3,2,2, 11,2,2,2,2,2,39,1, 14,14,14,3,14,3,3,14, 14,3,3,3,3,14,3,2, 3,3,3,3,14,3,3,14, 14,14,3,3,14,3,14,14, 10,14,10,14,3,10,3,11, 10,3,14,3,11,10,10,18, 10,3,3,10,3,3,3,3, 18,18,3,10,10,3,11,3, 10,11,3,11,3,3,3,3, 10,3,3,3,3,11,10,3, 10,3,3,10,3,3,3,3, 3,3,10,3,3,3,3,10, // D3xx 7,37,37,1,39,37,37,37, 39,11,18,39,37,11,37,18, 37,39,37,39,37,39,37,37, 39,39,37,39,39,37,37,37, 11,11,11,11,11,11,11,11, 11,11,11,11,11,18,18,11, 11,11,11,11,11,11,11,11, 11,11,11,18,11,11,31,18, 11,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,3,8,11,3,11, 37,1,1,1,1,1,1,37, 1,8,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,8,1,11,11,8,39,37, 10,11,6,6,2,11,3,12, 39,6,6,3,6,3,6,12, 11,2,11,3,11,6,6,2, 2,2,3,3,37,11,3,2, 11,3,3,12,3,3,3,14, 3,2,3,3,9,3,3,3, 3,3,3,3,3,3,3,14, 20,14,14,14,14,3,3,3, 3,10,3,3,10,3,10,11, 11,3,3,18,11,3,3,10, 3,3,3,11,18,3,3,10, 11,10,3,18,11,11,10,11, 3,11,10,11,11,11,11,10, 3,3,3,3,11,11,3,3, 10,3,3,11,3,20,3,10, 11,3,3,3,3,3,3,10, // D4xx 7,39,37,1,39,39,39,37, 39,14,18,37,39,11,37,37, 39,39,39,37,39,39,37,37, 39,39,37,37,39,37,37,37, 11,18,18,1,11,11,11,1, 18,11,11,3,18,18,18,14, 37,11,11,10,11,11,10,11, 11,11,18,18,11,11,11,18, 1,1,1,1,1,8,1,8, 1,1,1,1,1,1,1,1, 1,1,1,1,1,8,1,11, 1,39,1,37,37,3,11,18, 18,33,14,31,39,20,31,1, 11,10,1,39,1,1,1,20, 18,8,8,31,1,3,31,31, 1,18,1,8,11,11,3,39, 37,6,6,3,3,11,12,3, 37,6,3,6,6,6,12,37, 11,6,3,3,3,6,6,6, 11,3,39,3,3,11,3,4, 11,14,3,3,3,3,3,14, 14,3,3,3,3,3,3,3, 3,3,3,5,3,3,3,14, 3,14,3,14,3,3,3,3, 10,18,3,3,3,18,3,11, 11,18,3,3,11,11,11,18, 3,11,18,3,3,18,3,18, 3,3,3,11,11,3,11,11, 10,11,3,11,11,11,11,3, 10,14,14,3,3,11,10,20, 3,3,3,3,3,3,3,3, 3,3,3,3,3,10,3,37, // D5xx 7,39,37,39,37,39,37,37, 39,14,18,14,37,11,37,37, 39,39,37,39,39,39,37,37, 39,39,37,39,39,39,39,39, 11,14,11,14,39,11,14,14, 14,11,11,14,18,10,18,11, 37,11,11,11,11,11,10,11, 11,11,11,18,11,11,10,18, 1,31,1,12,12,1,12,1, 1,1,1,12,1,1,1,12, 1,37,1,12,1,1,12,37, 37,37,12,37,37,18,8,11, 37,31,1,1,31,31,3,37, 1,1,1,1,39,31,1,31, 1,39,31,31,31,8,31,1, 1,31,37,3,14,37,8,37, 2,2,2,2,2,2,2,2, 2,37,2,39,2,2,2,2, 2,2,2,3,2,2,2,6, 39,11,2,2,2,2,2,4, 14,2,3,2,14,2,3,2, 3,3,3,2,3,3,3,3, 3,3,2,3,2,2,2,14, 2,3,2,14,3,3,3,3, 10,14,3,3,3,3,3,11, 11,11,3,3,18,11,10,11, 3,11,3,18,3,3,3,3, 3,3,11,3,11,11,18,3, 10,11,3,3,11,11,11,3, 14,14,3,3,3,11,10,3, 3,3,3,3,3,3,11,3, 11,3,11,3,3,3,3,37, // D6xx 7,39,37,37,37,39,37,37, 37,11,11,37,39,11,39,39, 39,37,37,37,37,37,37,37, 39,39,39,39,39,39,37,37, 11,11,11,1,39,11,11,1, 11,6,11,3,11,1,11,1, 37,1,11,1,11,11,11,11, 37,1,11,1,11,3,1,1, 39,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,37,37,11,3,11, 8,1,1,1,1,37,1,1, 1,1,1,1,1,1,1,1, 1,8,1,1,1,1,1,1, 1,1,1,1,39,8,3,37, 2,2,2,2,2,2,2,2, 6,2,39,12,6,4,6,37, 6,2,2,6,2,12,2,2, 6,2,2,2,2,2,2,4, 2,14,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,2,3, 3,3,20,3,3,3,3,3, 10,3,3,3,18,10,3,11, 10,11,3,18,3,11,3,11, 3,11,3,3,3,3,3,3, 3,3,3,10,3,3,3,8, 3,11,10,11,11,10,11,3, 10,3,3,3,3,11,3,3, 3,3,3,3,3,3,11,3, 3,3,3,3,3,3,3,10, // D7xx 7,39,37,37,39,37,37,6, 39,18,18,37,39,18,37,4, 37,37,37,39,39,39,37,37, 37,39,37,37,39,39,37,37, 18,18,18,11,11,11,18,10, 11,18,11,3,18,10,18,10, 37,11,11,11,11,11,11,11, 11,11,18,18,18,11,10,11, 11,10,11,3,11,10,11,11, 8,10,11,11,11,11,11,37, 11,8,3,39,11,8,11,11, 11,10,11,11,11,11,8,39, 11,11,11,11,11,37,11,3, 11,18,11,11,11,11,11,3, 18,11,11,11,11,3,37,11, 3,18,11,11,11,11,11,37, 2,2,2,2,2,3,11,6, 2,6,37,6,3,4,6,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,3,3,2,3,2,2, 2,2,2,3,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3, 10,18,10,3,7,3,3,3, 10,3,3,3,3,14,18,18, 3,20,10,3,3,18,3,11, 10,18,3,3,3,3,3,3, 10,20,3,3,3,3,3,3, 14,3,3,10,3,3,3,3, 3,3,3,3,3,3,3,3, 3,3,11,10,7,8,20,37, // D8xx 7,39,39,39,39,39,39,39, 39,1,18,39,39,11,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 11,11,11,39,39,39,11,11, 11,11,1,3,11,1,11,1, 7,1,1,1,1,1,1,1, 1,1,11,18,11,1,18,18, 1,12,1,12,1,12,1,1, 1,12,1,1,1,1,1,12, 1,39,1,1,1,1,1,1, 1,1,1,11,11,11,39,11, 39,12,1,33,33,12,1,1, 33,1,33,1,33,33,1,1, 8,39,1,1,33,1,1,1, 1,1,33,8,18,11,3,39, 39,6,6,6,39,39,39,39, 3,39,12,6,2,6,6,39, 3,6,39,3,3,6,6,6, 39,39,39,2,33,11,39,2, 11,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,14,14,3,14,5, 10,14,14,14,3,10,11,11, 11,11,10,10,10,12,18,10, 10,11,10,10,3,27,10,27, 11,27,11,11,11,11,11,11, 10,11,10,11,11,11,11,20, 14,14,10,10,11,11,10,10, 10,11,10,11,3,11,11,3, 11,3,11,10,3,3,3,3, // D9xx 7,12,39,1,4,39,4,39, 39,18,18,39,39,11,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 11,18,18,14,1,18,18,11, 6,18,14,5,18,18,18,18, 7,6,6,6,6,6,6,6, 6,6,18,18,18,18,14,18, 8,1,12,12,12,1,3,1, 12,1,12,12,12,12,12,1, 12,3,12,12,12,1,12,7, 1,3,12,7,7,6,8,39, 18,8,12,12,12,1,7,8, 12,1,1,12,1,12,1,8, 3,8,12,12,12,3,12,6, 1,8,39,7,3,14,5,3, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,3,6,6, 6,6,3,3,3,3,39,3, 2,14,2,5,3,5,2,14, 14,3,14,2,2,14,9,3, 6,2,3,3,14,14,3,14, 3,2,14,14,2,5,2,3, 10,14,7,14,18,10,3,11, 10,11,18,18,18,20,10,6, 20,11,18,20,20,5,20,18, 12,3,11,18,10,11,18,11, 14,11,3,11,11,11,11,8, 14,14,14,5,11,11,10,7, 3,3,3,11,3,11,11,3, 11,5,11,7,5,5,5,10, // DAxx 7,1,39,1,39,39,39,39, 11,11,11,39,39,11,39,11, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 11,11,11,11,11,11,11,11, 11,11,11,5,11,11,11,11, 7,11,11,5,5,3,5,11, 11,11,11,18,11,11,11,18, 11,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,3, 1,1,1,11,11,11,11,11, 8,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,8,1,1,1,1,1,3, 1,1,1,8,8,39,11,3, 2,2,6,6,2,2,2,2, 2,2,12,6,2,12,12,2, 6,2,6,2,11,2,2,6, 2,2,2,3,2,11,12,1, 11,11,5,3,3,8,5,3, 10,2,5,3,8,2,3,2, 6,5,6,2,3,2,3,5, 5,3,2,8,3,6,2,11, 18,18,11,3,18,10,10,11, 11,11,11,11,11,18,18,11, 11,11,11,11,11,11,11,18, 11,11,11,3,11,11,11,10, 27,11,27,11,11,11,11,7, 12,3,3,5,11,11,3,3, 11,11,11,11,3,11,11,3, 12,3,11,3,3,5,3,11, // DBxx 7,39,39,39,39,39,39,39, 39,10,10,39,39,10,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 11,10,10,10,39,10,10,1, 3,11,11,5,11,10,10,31, 7,31,31,31,31,31,31,31, 31,31,10,18,10,10,10,10, 18,12,1,16,16,12,12,16, 12,1,12,16,16,16,16,39, 16,7,16,16,1,1,12,7, 10,1,16,7,7,8,7,8, 8,1,12,39,16,1,39,16, 31,8,8,16,8,8,1,10, 8,39,1,1,1,8,39,1, 1,8,7,39,3,8,5,39, 2,2,6,2,39,39,2,2, 2,6,6,2,2,2,2,39, 2,6,2,2,2,2,6,6, 39,3,2,39,2,2,2,1, 11,3,3,8,3,8,8,3, 10,2,3,3,3,3,5,3, 2,2,2,2,2,2,2,2, 2,2,3,3,3,6,5,3, 3,18,10,10,10,10,10,11, 11,10,10,10,10,10,18,11, 11,11,10,11,18,10,11,10, 11,7,3,1,11,11,27,10, 3,11,3,11,11,11,11,3, 3,1,7,3,11,11,27,27, 7,3,11,11,5,11,5,3, 11,7,11,3,3,3,3,3, // DCxx 7,39,1,11,4,39,39,39, 39,1,11,39,39,11,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 11,11,11,11,11,11,11,1, 11,1,11,11,11,11,11,11, 7,11,11,11,11,11,11,11, 11,11,11,20,11,11,1,1, 11,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,11,1,1,1,11,1,1, 1,1,1,11,11,11,11,11, 8,11,1,1,1,1,1,8, 1,11,11,1,1,1,1,11, 11,11,1,1,1,11,1,11, 1,1,1,11,11,3,11,3, 39,6,6,39,6,11,11,3, 39,3,3,6,6,6,3,39, 2,11,11,6,3,11,6,6, 2,11,2,3,3,2,3,2, 2,11,3,3,3,7,11,11, 5,11,2,3,5,3,11,6, 3,5,3,3,7,3,6,3, 3,5,11,5,3,3,3,3, 3,10,11,11,11,10,18,11, 11,11,11,18,11,10,11,11, 13,11,11,11,18,11,11,11, 11,11,11,11,11,11,13,11, 3,11,5,11,11,11,11,3, 20,20,20,20,11,11,3,3, 11,20,11,20,20,11,3,20, 11,3,11,3,1,5,3,11, // DDxx 7,1,4,39,39,39,39,39, 39,13,11,13,39,11,4,39, 39,3,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 11,13,11,11,11,11,13,13, 13,11,13,5,11,13,13,11, 7,11,11,11,11,11,11,13, 11,11,11,13,11,11,13,13, 11,13,1,1,13,13,13,13, 13,1,1,13,13,13,13,13, 1,39,13,13,13,1,1,13, 13,13,13,7,13,11,3,11, 13,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13, 13,13,13,13,13,7,13,7, 13,13,13,11,13,11,5,3, 56,6,6,6,3,3,3,6, 39,6,12,6,6,12,12,6, 6,6,6,6,6,6,6,6, 11,6,6,3,3,11,3,3, 11,11,8,5,5,3,7,8, 7,9,3,3,3,3,3,8, 3,3,6,1,3,7,3,3, 3,3,3,5,3,6,5,11, 6,5,10,11,11,11,11,11, 11,11,11,10,11,11,11,11, 11,11,10,11,11,11,11,5, 11,11,11,11,11,11,11,11, 3,11,10,11,11,11,11,13, 20,10,10,10,11,11,20,10, 10,20,10,11,20,11,11,20, 11,20,11,8,3,10,13,3, // DExx 7,1,39,39,4,39,4,39, 39,11,11,39,6,11,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 11,11,11,11,11,11,11,11, 6,11,11,11,11,11,13,11, 7,11,11,11,11,11,11,6, 11,11,11,6,11,11,13,18, 11,13,13,13,16,13,13,13, 13,13,1,13,13,13,16,16, 16,8,1,16,13,13,13,13, 1,13,33,11,11,11,11,1, 13,13,13,1,1,13,13,1, 13,13,1,3,13,16,13,13, 1,3,1,8,13,13,16,1, 7,16,39,7,6,11,11,3, 2,6,2,2,2,2,2,2, 2,2,2,2,2,2,2,6, 2,2,31,2,2,2,2,2, 6,2,2,4,2,2,2,4, 11,11,3,3,3,3,2,2, 2,2,2,2,2,2,2,7, 2,3,6,8,5,6,6,3, 6,3,3,3,7,6,6,11, 5,18,10,10,10,18,10,11, 11,11,11,18,10,11,18,11, 10,11,10,11,18,11,11,10, 11,10,11,18,11,11,11,11, 27,11,10,11,11,11,11,10, 20,5,20,10,11,11,13,10, 10,20,20,11,20,11,11,7, 11,10,11,7,13,13,11,11, // DFxx 7,1,39,39,7,10,39,39, 39,11,11,7,39,11,39,11, 39,39,39,39,39,39,39,39, 39,39,37,37,39,39,39,39, 11,11,11,11,11,11,11,11, 11,11,11,6,11,1,11,11, 7,11,11,11,11,14,14,11, 14,14,11,6,11,11,11,1, 3,11,1,1,1,1,1,1, 1,1,1,8,1,3,8,1, 1,1,1,1,1,1,1,39, 11,8,1,3,3,11,3,11, 3,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,39,1,1,1,1,1,1, 3,1,1,7,11,11,39,3, 3,6,6,6,6,3,12,6, 6,6,6,6,6,6,6,6, 6,6,6,12,6,6,6,3, 39,6,6,6,6,11,3,4, 11,11,3,5,5,6,3,5, 11,5,10,5,3,6,3,6, 6,3,5,3,3,3,3,7, 3,3,3,3,6,3,5,11, 7,10,10,11,10,10,10,11, 11,11,11,11,10,10,11,11, 11,11,10,11,11,10,10,10, 10,10,11,11,11,11,10,11, 27,11,10,11,11,11,11,10, 20,3,10,20,11,11,20,20, 10,10,3,11,20,11,11,3, 11,20,11,3,1,7,11,11, // E0xx 7,37,37,14,1,37,37,37, 37,10,10,37,37,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 11,10,10,10,11,11,10,10, 10,10,10,10,10,10,10,10, 37,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,3,11,11,33,11,6,33, 8,11,11,6,33,11,33,3, 11,39,33,8,8,11,6,33, 11,6,8,10,10,10,10,6, 17,11,11,11,11,39,11,11, 6,11,16,30,11,11,11,11, 11,11,11,11,11,6,11,11, 11,11,39,6,17,37,3,37, 6,6,6,6,6,11,6,6, 6,6,6,6,6,6,6,6, 6,6,6,6,10,6,6,6, 37,6,12,3,10,6,10,10, 36,14,14,36,2,2,2,2, 14,14,14,14,36,36,2,2, 2,2,2,2,2,14,2,14, 2,2,14,14,14,2,14,14, 14,14,14,14,17,14,17,14, 14,1,14,14,18,14,14,8, 27,3,18,27,5,27,3,3, 27,3,3,6,27,7,3,6, 3,10,10,10,10,17,10,10, 17,17,10,10,10,10,17,10, 10,10,10,10,10,10,10,10, 17,17,17,18,5,10,10,10, // E1xx 7,1,1,37,37,39,4,37, 12,1,11,20,37,11,3,11, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 11,11,11,11,11,11,11,11, 11,11,11,11,11,1,10,11, 37,11,11,11,17,11,11,11, 11,11,11,1,11,11,11,1, 11,11,1,1,1,17,1,17, 17,8,1,1,1,8,1,39, 6,39,1,6,39,1,8,11, 6,8,1,11,17,11,11,11, 37,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,6, 1,6,1,6,11,11,11,37, 2,2,2,2,2,2,2,6, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,6, 11,2,12,6,12,12,12,2, 36,14,14,3,14,36,5,14, 14,6,36,36,36,36,36,36, 3,7,3,10,14,14,14,14, 2,14,2,2,2,2,14,14, 3,14,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,18, 11,11,11,11,11,11,11,11, 10,11,36,11,11,11,11,17, 10,17,20,10,11,11,10,17, 10,18,17,10,18,11,11,18, 17,17,17,10,10,18,18,10, // E2xx 7,7,37,37,37,39,37,37, 37,10,10,37,4,10,1,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,10,11,10,10,17, 10,10,10,3,10,10,10,10, 37,10,17,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,8,8,11,3,6,11,6, 6,6,6,6,6,6,11,6, 6,6,11,6,11,6,6,6, 6,37,6,10,17,10,37,10, 17,10,11,16,16,10,16,11, 11,10,16,16,16,11,11,10, 16,8,16,16,11,11,16,6, 8,11,16,3,6,6,3,37, 2,2,2,6,2,2,2,2, 2,2,2,6,2,6,2,6, 6,2,2,2,2,2,2,2, 2,2,10,6,2,2,6,6, 36,14,36,3,14,36,14,3, 36,5,14,14,3,36,36,3, 3,3,3,10,14,14,3,14, 10,14,14,14,14,3,14,3, 14,18,14,14,6,18,3,14, 3,18,14,14,18,14,14,18, 27,3,18,3,7,18,3,3, 27,18,27,7,20,20,27,3, 10,18,10,17,10,10,17,10, 10,17,10,10,17,10,10,18, 10,10,10,10,17,18,10,10, 17,18,10,10,10,3,16,10, // E3xx 7,37,37,37,37,37,37,1, 3,11,11,37,37,11,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,39,37, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,10,11, 37,11,11,11,11,11,11,11, 11,11,11,10,11,11,11,17, 10,12,1,6,6,12,6,1, 31,18,6,6,1,31,39,6, 6,37,6,39,12,1,6,6, 1,6,8,11,11,10,11,11, 6,10,12,12,12,1,37,12, 11,12,6,6,12,12,8,1, 12,8,12,1,12,12,10,37, 37,3,12,11,17,11,11,37, 2,2,2,2,2,2,2,6, 2,2,2,2,2,2,2,2, 11,11,6,6,6,6,6,6, 11,11,6,4,6,11,6,4, 36,11,36,36,14,36,36,36, 14,6,14,36,36,36,7,36, 3,3,3,10,14,14,3,7, 8,14,14,11,5,3,3,11, 5,5,11,11,11,18,11,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,18, 11,11,11,11,11,11,11,11, 10,11,17,11,11,11,11,36, 10,17,10,10,11,11,10,20, 10,20,17,11,17,11,11,17, 17,17,11,3,3,5,3,1, // E4xx 7,11,1,11,37,37,37,37, 1,11,11,4,4,11,3,11, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 11,17,11,11,11,11,11,17, 11,11,11,17,11,17,11,11, 11,11,11,11,11,11,11,11, 11,11,11,17,11,11,11,17, 11,1,6,6,6,1,6,1, 1,17,1,1,1,1,6,11, 6,37,1,6,1,1,1,8, 6,1,1,11,11,11,11,11, 17,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,17,11,11,1, 2,11,6,6,12,11,2,6, 6,6,6,6,6,6,11,6, 11,6,31,3,11,6,6,6, 11,11,6,3,12,12,2,6, 36,11,14,7,14,36,8,14, 36,14,14,14,5,3,36,3, 3,3,5,10,14,14,6,14, 2,2,2,2,2,2,2,2, 3,14,3,14,11,18,11,11, 11,11,11,14,11,11,11,11, 11,11,11,11,11,11,11,18, 11,11,11,11,11,11,11,11, 10,17,10,11,1,10,11,17, 10,17,10,10,11,11,10,18, 10,17,17,10,17,18,17,17, 17,17,17,10,10,20,11,10, // E5xx 7,10,37,37,37,39,37,4, 39,10,10,1,37,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,11,11,10,10,10, 11,11,11,10,10,10,10,10, 37,11,11,11,36,11,10,11, 11,11,10,10,11,11,10,10, 11,6,31,31,6,31,8,1, 6,6,6,6,1,6,6,37, 8,6,1,37,31,6,1,37, 3,6,6,11,10,11,11,11, 17,1,1,10,1,1,1,1, 1,1,6,1,1,1,1,33, 1,39,1,1,1,33,1,39, 8,6,1,11,11,11,11,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 17,7,11,11,11,18,18,11, 11,11,11,3,11,18,11,11, 11,11,11,18,11,5,11,18, 11,11,11,3,11,11,11,20, 17,11,10,11,10,11,11,10, 17,10,10,10,10,10,18,17, 10,10,10,18,17,11,10,17, 17,17,17,18,5,20,10,10, // E6xx 7,11,1,9,1,39,1,12, 1,12,12,11,37,11,37,11, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 11,12,11,11,11,11,11,11, 11,11,11,5,12,11,12,11, 37,11,11,11,11,11,11,11, 11,11,11,12,11,11,11,12, 6,33,11,8,11,33,6,11, 11,33,11,33,33,31,33,33, 33,6,1,6,33,33,6,11, 8,37,11,39,17,6,11,11, 17,12,1,1,1,12,1,1, 1,12,1,1,1,1,1,12, 1,1,1,1,1,12,1,12, 6,8,1,11,6,11,6,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 5,11,11,11,3,11,7,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,3, 11,11,11,11,11,11,11,11, 10,11,10,11,11,11,11,20, 10,17,10,17,11,11,17,18, 1,10,11,11,18,11,11,17, 11,20,11,10,10,3,11,10, // E7xx 7,10,37,37,4,39,37,37, 37,11,10,20,4,10,10,37, 37,37,37,37,37,37,37,37, 37,37,37,3,37,37,37,37, 10,10,10,11,11,10,11,11, 10,10,10,11,10,10,10,17, 37,10,10,11,11,11,10,17, 11,10,11,20,10,11,11,10, 11,11,11,11,31,8,31,31, 6,11,11,11,31,8,31,6, 31,3,31,31,31,11,31,6, 11,11,31,11,17,11,6,11, 11,11,11,16,16,11,11,16, 11,11,16,16,11,11,16,11, 16,6,16,16,16,11,16,11, 8,11,16,11,17,11,8,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,14,2,2,2,2,2,2, 1,14,14,14,18,18,1,14, 5,18,14,14,18,3,6,18, 27,3,18,7,3,18,6,3, 27,18,27,3,8,5,3,3, 10,17,10,1,10,17,17,17, 10,17,10,10,10,10,10,18, 10,17,18,10,17,1,1,17, 17,17,17,10,11,13,10,10, // E8xx 7,1,37,1,12,39,1,37, 37,10,10,10,37,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,17,11,10,10,10, 10,10,10,10,10,10,10,10, 37,14,14,14,14,14,14,14, 14,14,10,10,10,10,10,10, 10,6,6,11,6,12,3,11, 14,6,6,12,31,6,12,6, 18,37,11,11,11,12,6,6, 8,37,6,10,10,10,10,10, 10,12,11,11,11,12,11,11, 12,12,12,12,12,11,12,12, 12,11,11,11,12,12,11,6, 11,11,11,6,10,39,10,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 10,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,14,2,2,2,2,2,2, 14,14,14,14,7,14,3,14, 14,3,14,14,18,14,14,18, 14,3,14,14,6,18,3,3, 5,3,27,3,20,20,20,7, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,18, 10,10,10,10,10,10,10,10, 17,10,17,8,20,20,10,10, // E9xx 7,1,11,4,1,37,39,37, 37,11,11,11,37,11,37,1, 37,37,37,37,37,37,37,37, 37,37,37,3,37,37,39,37, 11,10,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 37,17,11,17,11,11,11,11, 11,11,10,10,11,10,11,11, 11,11,11,11,11,11,3,8, 33,11,6,33,6,31,11,11, 33,6,31,31,3,11,11,11, 11,11,33,6,6,11,11,11, 6,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,8, 11,11,11,6,17,6,17,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,14, 2,2,2,2,2,2,2,2, 2,2,2,2,14,14,2,14, 2,14,2,2,2,2,2,3, 18,14,14,14,3,14,3,14, 18,3,14,14,18,14,18,3, 14,3,14,14,18,27,18,18, 3,3,18,18,20,20,20,3, 14,17,17,17,17,17,17,17, 17,17,20,17,17,17,18,17, 17,10,10,18,18,17,17,17, 17,17,17,18,20,18,18,10, // EAxx 7,37,9,37,37,39,37,9, 37,10,10,37,37,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,12,10,12,11,10,10,10, 10,10,10,10,10,10,10,10, 37,10,6,10,10,10,10,10, 10,10,10,10,10,10,10,12, 10,31,31,31,31,31,6,12, 31,6,6,31,31,8,31,31, 3,31,37,31,31,37,31,8, 11,11,31,10,12,10,12,10, 10,10,12,12,12,11,37,12, 11,10,11,12,11,11,11,10, 12,11,11,11,11,11,11,12, 11,6,12,8,17,6,3,37, 6,39,6,6,2,3,2,3, 6,6,6,2,39,6,6,6, 6,3,6,6,6,6,6,6, 6,11,6,11,12,6,6,6, 10,14,6,5,14,36,8,14, 3,3,5,5,5,5,5,3, 2,2,2,2,2,2,9,2, 2,2,2,2,2,2,2,12, 3,3,14,3,10,5,3,3, 3,3,3,3,3,3,5,3, 14,3,14,3,3,3,5,3, 3,34,3,7,20,20,20,20, 10,20,10,10,18,10,10,20, 10,20,10,10,10,10,10,20, 10,10,10,10,18,20,10,10, 10,20,10,18,20,20,18,10, // EBxx 7,10,37,37,4,37,37,37, 37,10,10,10,37,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,10,11,10,16,10, 10,11,10,5,10,10,10,11, 37,10,17,17,17,10,10,17, 17,10,10,10,10,36,10,10, 10,3,8,8,8,3,11,11, 3,18,14,11,8,3,31,18, 18,37,8,3,31,3,8,37, 39,18,37,3,10,10,37,39, 17,10,11,11,16,11,11,16, 11,11,16,16,11,16,11,10, 16,11,11,16,16,11,16,11, 3,3,11,37,8,37,5,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,36,2,5,2,2,2, 2,2,2,36,2,2,2,2, 2,2,2,2,2,5,2,2, 2,2,5,2,5,2,7,2, 5,18,14,5,3,18,3,14, 3,18,3,3,18,14,18,18, 3,3,18,18,18,18,3,3, 3,3,3,8,20,20,20,20, 10,18,10,10,10,10,10,20, 10,18,10,10,17,10,10,18, 17,10,18,10,18,18,18,10, 17,17,17,10,10,20,10,10, // ECxx 7,11,37,1,37,37,37,37, 37,14,10,14,37,11,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 11,10,11,11,11,10,10,17, 14,10,11,11,10,10,10,10, 37,11,10,10,17,11,17,11, 17,17,11,10,11,10,14,10, 11,1,17,8,8,18,8,8, 8,8,1,8,31,17,39,11, 17,31,17,17,1,1,17,17, 17,18,3,14,17,11,11,11, 3,1,12,12,12,16,1,1, 12,16,12,12,12,12,12,1, 12,1,12,12,12,16,12,1, 11,10,12,11,17,11,11,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,10,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 14,2,2,3,36,36,3,2, 2,2,2,10,2,2,2,14, 2,2,2,2,2,2,14,11, 18,14,14,14,17,3,17,14, 14,18,14,14,3,14,14,18, 3,5,3,11,7,18,3,5, 18,3,12,5,20,20,20,20, 10,18,17,17,17,10,17,17, 10,17,10,17,10,10,10,10, 17,17,17,10,17,18,17,17, 18,17,17,10,10,10,11,10, // EDxx 7,11,37,37,37,37,37,37, 4,1,1,1,37,1,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 11,1,11,17,11,11,1,1, 11,11,11,17,1,10,1,1, 37,11,11,11,11,11,11,11, 11,11,10,1,11,11,10,1, 11,1,33,33,33,18,1,1, 33,18,1,33,8,33,1,1, 33,39,33,33,33,33,33,37, 11,37,33,11,10,11,11,11, 17,1,1,1,1,1,1,1, 1,10,1,1,1,1,1,1, 1,1,1,1,1,1,1,8, 1,10,1,11,17,10,11,37, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 11,2,2,3,2,2,2,2, 2,2,2,2,2,2,2,10, 1,11,36,3,11,3,3,3, 11,7,36,36,3,5,5,7, 7,5,3,10,7,3,3,3, 10,9,5,5,3,3,9,11, 5,18,11,11,11,18,11,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 10,11,36,11,11,10,11,10, 10,18,10,10,11,10,10,18, 18,10,10,10,10,11,10,10, 11,18,11,10,10,20,10,10, // EExx 7,10,37,37,37,37,4,37, 37,10,10,1,37,10,10,37, 39,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,10,11,10,10,10, 10,10,10,10,10,10,10,10, 37,17,17,17,10,17,10,10, 10,17,10,10,10,10,10,10, 10,3,3,31,31,18,31,31, 3,3,31,8,31,31,31,39, 8,37,31,31,31,37,31,31, 31,18,8,10,10,10,3,10, 17,11,16,16,16,37,11,16, 8,11,16,16,11,16,11,11, 16,11,16,16,11,8,16,3, 11,11,16,37,10,3,3,37, 2,2,6,2,2,10,3,2, 2,2,3,2,6,2,6,2, 3,6,11,2,10,6,2,2, 37,2,2,2,2,3,2,2, 10,3,5,3,5,3,8,3, 3,3,3,3,36,10,3,5, 5,7,3,5,3,7,3,3, 10,2,10,5,10,3,3,10, 17,18,3,10,17,18,3,8, 3,18,5,3,17,5,3,18, 3,3,3,3,3,18,3,27, 18,3,3,3,5,20,20,20, 17,10,10,10,10,10,10,17, 10,10,10,10,10,10,18,10, 10,10,10,18,10,10,10,10, 17,17,17,18,18,10,10,10, // EFxx 7,37,37,37,37,37,37,10, 37,17,20,17,37,17,37,37, 37,37,37,37,37,37,37,37, 37,37,37,3,37,37,37,37, 17,17,17,17,17,10,18,17, 17,17,17,17,17,10,10,17, 37,10,10,17,10,10,10,17, 17,10,17,17,17,17,17,17, 3,11,11,11,11,11,3,3, 8,18,3,11,3,31,37,37, 18,37,37,39,31,11,37,8, 8,37,11,37,17,17,37,17, 17,12,11,11,11,11,11,30, 3,16,30,11,11,11,11,16, 10,11,11,11,11,16,11,11, 11,39,39,8,17,37,3,37, 2,2,2,2,2,2,2,2, 2,37,2,2,2,39,2,2, 2,2,2,2,2,2,2,3, 39,3,2,2,2,2,12,2, 17,36,36,3,2,5,5,5, 2,36,7,7,36,2,3,2, 5,3,3,10,2,3,3,5, 2,2,2,2,2,2,2,2, 3,5,18,18,18,7,18,18, 18,3,18,18,18,18,18,3, 18,3,18,18,18,7,18,5, 3,5,3,3,20,20,18,20, 10,5,18,20,18,10,18,18, 10,20,18,10,18,18,10,10, 10,20,18,10,18,20,18,18, 10,20,18,10,10,20,18,10, // F0xx 3,37,1,37,10,37,39,39, 37,10,10,37,37,11,4,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,10,11,10,10,10, 10,10,11,10,10,10,10,10, 37,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,1, 10,12,3,14,1,1,1,13, 1,13,8,8,13,13,37,18, 18,37,13,39,37,13,39,11, 39,37,1,11,10,10,3,10, 17,13,1,13,13,13,1,1, 1,13,1,16,13,13,16,16, 16,37,13,1,16,13,16,1, 1,16,13,11,10,11,14,39, 39,6,6,6,36,11,4,36, 6,6,6,6,6,6,6,6, 2,6,6,6,6,6,6,6, 6,4,3,3,10,2,10,10, 2,11,3,3,3,3,2,3, 5,3,3,5,5,5,3,5, 3,3,5,10,5,3,5,5, 7,5,11,11,5,3,5,11, 3,18,5,8,3,18,3,11, 5,18,3,3,18,3,18,18, 3,18,18,18,18,18,3,7, 3,18,5,3,20,20,20,20, 10,10,10,10,17,10,10,10, 10,17,10,17,10,10,10,18, 10,10,10,10,10,10,10,17, 10,17,17,10,10,13,10,10, // F1xx 3,9,37,9,1,10,39,37, 1,12,10,37,37,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,10,10,10,10,10, 10,10,17,10,10,10,10,10, 37,10,10,10,10,10,10,10, 10,10,10,12,10,10,10,10, 1,1,1,12,8,1,8,1, 1,1,1,8,1,1,37,1, 3,8,3,12,8,1,37,12, 8,37,8,10,1,12,8,10, 17,1,12,12,10,1,10,1, 10,1,8,12,10,12,1,1, 10,1,10,12,10,1,37,1, 10,10,1,3,17,11,5,37, 39,6,6,6,4,10,4,4, 6,6,37,6,6,6,6,6, 6,6,6,6,10,6,6,6, 6,37,10,3,4,3,4,4, 10,11,36,3,3,7,5,5, 3,8,5,3,5,7,3,8, 3,3,3,10,3,3,5,3, 10,5,3,3,3,7,3,3, 17,5,11,3,3,3,3,3, 11,3,3,18,3,18,18,11, 18,3,18,5,3,5,3,18, 3,7,18,18,20,20,20,20, 10,20,10,17,10,10,10,20, 10,17,10,10,10,10,10,10, 10,10,10,10,17,10,10,10, 10,20,10,10,10,18,10,10, // F2xx 3,1,37,1,37,37,39,37, 37,10,10,10,37,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,10,1,10,10,10, 10,10,10,10,10,10,10,10, 37,10,10,10,10,10,10,10, 10,10,10,10,10,20,10,10, 10,31,31,17,31,12,10,1, 1,18,31,1,31,31,31,1, 31,37,8,31,31,8,39,37, 39,3,31,10,10,10,8,10, 17,16,1,1,1,16,39,1, 12,16,1,12,1,1,1,12, 1,1,1,12,12,12,1,1, 1,10,1,1,17,11,37,37, 37,6,6,39,4,10,3,4, 37,6,6,6,6,6,6,37, 6,6,6,6,10,6,39,6, 39,4,12,11,3,12,3,4, 10,11,5,3,5,5,3,3, 5,5,5,3,5,8,1,3, 3,5,7,10,7,5,26,5, 10,3,3,20,3,3,3,7, 3,18,11,3,5,18,3,11, 11,18,11,3,3,11,3,18, 3,3,1,11,3,18,11,3, 5,18,3,3,11,11,11,3, 10,18,10,17,17,10,17,18, 10,17,10,10,17,10,10,18, 10,10,10,10,18,18,17,10, 17,18,17,10,10,10,10,10, // F3xx 3,1,1,37,4,4,39,37, 1,10,10,9,37,10,37,1, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,10,17,10,10,10, 10,10,11,17,10,10,10,1, 37,18,1,10,10,18,10,18, 10,18,1,10,10,10,1,10, 3,11,1,1,1,1,1,1, 18,18,31,31,31,1,1,8, 1,11,1,39,31,37,39,1, 37,37,31,37,1,10,37,1, 39,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,11,17,11,24,37, 37,39,6,6,37,10,3,12, 37,37,6,6,6,6,6,6, 6,11,23,6,12,6,6,39, 37,24,10,3,12,3,10,12, 10,11,5,3,8,8,3,3, 5,3,8,3,3,5,5,3, 3,3,3,12,3,3,9,5, 3,3,10,3,9,2,3,12, 5,18,18,11,18,18,3,11, 11,11,11,18,18,11,11,18, 18,11,18,11,18,18,11,18, 11,11,11,11,11,11,11,11, 10,10,10,10,10,18,10,10, 10,18,10,18,18,10,18,10, 10,10,10,18,18,10,10,10, 10,10,18,18,20,20,10,10, // F4xx 3,4,37,37,37,37,39,37, 37,11,10,37,37,11,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,11,17,11,11,10,20,11, 11,10,11,3,10,10,18,20, 37,10,25,17,10,10,10,11, 10,10,10,11,11,17,10,10, 17,18,11,8,11,18,11,11, 11,18,24,11,11,11,37,18, 18,37,11,37,11,11,39,11, 11,37,11,11,17,11,37,11, 17,11,11,11,11,37,39,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,39,3,37, 2,39,6,6,3,24,3,3, 11,37,37,39,11,6,6,6, 37,6,23,6,3,39,6,37, 37,11,12,3,39,12,12,4, 25,5,3,7,11,3,11,11, 8,3,8,3,3,8,3,8, 8,8,3,10,3,3,5,3, 5,5,3,5,3,3,9,8, 18,18,3,3,3,18,3,3, 5,3,3,3,3,3,8,18, 3,5,18,3,3,18,3,18, 3,18,1,3,20,20,20,3, 10,18,17,17,17,17,3,20, 10,17,10,10,17,10,10,18, 10,17,18,10,10,18,17,18, 17,17,17,10,20,20,20,37, // F5xx 3,37,1,4,37,39,39,37, 37,10,10,37,37,10,37,39, 37,39,37,37,37,37,37,37, 39,37,37,37,37,37,37,37, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,20,10,10, 10,10,11,1,3,8,8,1, 10,1,1,1,1,1,37,8, 1,1,1,1,1,1,1,8, 8,1,1,1,17,10,37,39, 17,12,1,12,12,1,12,1, 1,1,1,12,1,1,1,12, 1,3,1,12,1,1,12,1, 1,1,12,1,8,11,3,37, 37,6,6,6,4,10,4,4, 6,6,6,6,6,39,6,6, 6,11,6,6,10,6,6,6, 4,4,4,4,3,3,3,4, 10,11,5,3,3,3,8,8, 5,1,3,3,8,8,5,1, 8,5,3,10,3,3,5,3, 3,3,10,3,3,5,3,3, 3,5,18,5,18,5,18,1, 11,18,11,18,3,11,3,11, 18,11,18,18,11,11,11,18, 11,11,11,11,11,11,18,11, 10,11,18,11,18,11,11,18, 10,25,20,18,18,10,10,10, 10,1,18,18,18,10,18,18, 20,3,18,18,3,18,18,33, // F6xx 3,1,37,37,37,37,39,37, 37,1,1,1,37,1,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 11,10,1,1,1,10,1,17, 3,10,11,5,10,10,10,1, 37,5,1,1,5,10,10,3, 1,1,10,10,1,11,1,1, 5,11,1,1,1,1,1,1, 1,24,1,1,1,1,39,37, 11,37,1,1,1,37,1,37, 1,1,1,37,17,1,39,1, 17,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,8,1,11,5,37, 39,6,6,4,24,24,3,3, 37,6,6,6,37,37,6,37, 6,17,17,6,39,37,39,6, 37,37,3,11,4,3,3,4, 11,11,5,3,3,8,3,3, 3,3,3,3,3,3,3,8, 3,3,3,10,3,3,3,5, 3,5,3,3,3,5,5,5, 3,3,3,3,3,18,11,11, 11,18,11,11,11,11,3,11, 11,11,11,11,11,18,11,3, 11,11,11,11,11,20,11,1, 10,17,10,11,17,10,11,17, 10,17,10,18,17,11,10,20, 13,20,17,10,17,18,1,17, 17,20,17,10,10,20,13,10, // F7xx 3,1,37,37,37,37,39,37, 37,10,18,6,37,10,37,37, 37,37,37,37,37,37,37,37, 37,37,7,37,37,37,37,39, 17,17,17,17,11,10,18,17, 11,10,17,3,17,10,18,10, 11,11,11,11,11,11,11,11, 11,11,17,17,10,17,10,17, 8,18,11,8,3,18,8,8, 3,18,11,3,11,11,39,18, 11,37,11,39,37,3,11,39, 11,37,3,11,11,8,17,17, 17,10,37,11,11,10,11,11, 37,8,11,11,11,39,11,20, 11,11,11,11,11,11,11,11, 39,10,11,37,17,17,8,37, 3,6,6,3,3,3,3,3, 37,6,6,39,6,37,6,39, 6,37,11,6,10,6,6,6, 4,37,3,3,10,4,12,4, 17,3,3,3,11,3,26,3, 3,3,8,8,3,3,3,3, 3,3,3,10,8,3,26,3, 10,5,3,3,3,5,3,3, 3,18,3,3,3,18,3,5, 3,18,3,18,18,18,18,18, 18,3,18,18,18,18,3,18, 18,18,18,3,20,20,20,20, 10,18,10,17,17,10,17,17, 10,17,10,10,17,10,18,18, 17,17,10,18,17,18,17,18, 17,18,17,18,10,20,20,10, // F8xx 3,1,37,37,37,37,39,37, 1,17,17,37,37,17,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 17,17,17,17,1,17,16,17, 17,16,17,5,17,17,17,17, 37,5,1,17,1,1,1,1, 1,10,17,17,17,17,17,17, 10,8,3,1,1,1,12,1, 1,1,8,1,1,1,37,37, 1,37,1,39,37,8,1,8, 8,37,1,37,17,17,37,1, 17,12,1,12,1,12,1,1, 1,12,1,1,1,1,1,12, 1,8,1,1,1,1,1,1, 1,1,1,3,37,37,5,37, 39,6,6,39,4,16,3,17, 39,6,37,39,6,37,6,37, 37,11,6,16,16,37,16,6, 37,37,12,3,10,3,12,24, 17,11,5,3,11,8,8,8, 5,1,8,5,8,8,1,8, 8,5,3,10,3,5,3,3, 10,5,5,3,5,5,3,5, 5,5,3,11,24,17,17,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,3, 11,3,11,11,11,11,11,11, 17,17,17,17,17,17,17,17, 10,17,10,17,17,12,18,17, 17,17,10,11,17,17,11,17, 17,17,17,18,10,18,10,37, // F9xx 3,1,37,37,37,37,39,39, 37,12,12,1,37,12,37,39, 37,37,37,37,39,37,37,37, 37,37,37,37,37,37,37,37, 12,17,12,17,11,11,30,12, 12,12,17,5,12,12,12,17, 37,17,17,17,17,17,10,17, 3,17,12,12,12,17,12,12, 8,8,11,8,12,11,24,24, 24,24,11,17,11,11,11,8, 39,37,11,8,11,11,11,39, 11,11,3,39,17,12,24,11, 17,11,12,12,12,11,12,11, 12,11,12,12,12,12,12,11, 12,37,12,12,12,11,12,24, 11,11,12,37,17,24,24,37, 37,24,6,11,11,12,37,24, 24,24,24,37,37,24,24,24, 24,24,24,12,24,24,37,24, 24,24,12,24,24,24,12,24, 12,5,24,3,8,5,5,24, 5,24,1,5,5,5,8,8, 5,5,3,8,3,3,5,8, 10,5,8,5,24,3,9,24, 1,5,24,5,8,5,3,5, 3,1,5,24,17,5,5,5, 8,17,17,5,3,8,8,8, 8,8,8,5,8,8,8,8, 10,17,17,17,17,10,17,17, 10,17,18,17,17,17,17,17, 17,20,17,20,17,7,17,17, 17,17,17,18,10,8,8,10, // FAxx 3,10,1,37,37,37,37,37, 37,1,17,1,37,17,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 17,17,17,17,1,17,17,17, 17,17,17,17,17,17,17,17, 37,17,17,17,17,17,17,17, 1,17,17,17,17,17,1,17, 8,8,1,8,8,1,1,8, 8,1,1,24,1,1,37,37, 8,39,1,37,1,1,39,39, 11,1,1,37,17,11,39,17, 17,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,37, 1,37,1,1,17,11,11,37, 39,6,6,6,12,17,37,12, 37,6,37,37,6,6,6,6, 6,6,6,6,12,6,6,24, 6,37,12,12,24,12,12,4, 17,5,3,5,5,6,8,8, 8,5,5,11,8,5,1,5, 5,3,3,3,5,3,3,5, 10,5,3,9,5,3,5,11, 5,18,11,11,18,18,3,11, 11,18,11,11,11,11,11,11, 11,11,11,11,11,11,11,18, 11,11,11,11,11,11,11,11, 17,18,17,11,17,17,11,17, 12,17,17,17,17,18,17,18, 17,18,17,17,17,18,17,17, 17,17,17,1,5,5,5,10, // FBxx 3,37,37,37,37,37,37,14, 37,10,10,10,39,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,3,37,37,37,37, 10,10,10,10,11,10,10,10, 10,10,10,10,10,10,10,10, 39,10,10,10,10,10,10,11, 10,10,10,10,10,10,10,10, 10,8,11,11,8,18,8,3, 11,18,8,11,11,10,39,37, 11,39,37,37,37,37,37,37, 11,37,11,37,10,10,3,10, 10,12,11,16,16,12,12,16, 12,8,12,16,16,16,16,11, 16,3,16,16,11,37,12,37, 10,39,16,37,39,37,37,37, 37,6,6,6,37,10,11,39, 37,6,37,39,6,6,6,6, 3,37,37,6,6,39,6,6, 6,37,37,11,3,10,37,3, 10,5,10,3,8,8,5,8, 8,3,5,5,5,16,11,8, 3,8,8,5,5,3,3,3, 5,3,5,3,5,3,5,5, 5,18,5,3,3,18,3,5, 3,18,3,18,18,18,18,18, 18,3,18,3,18,18,3,18, 3,18,7,5,5,5,5,5, 5,18,10,10,10,10,10,10, 16,10,10,10,10,10,18,18, 10,10,10,5,18,10,10,10, 10,5,5,11,11,5,5,10, // FCxx 3,10,37,37,37,37,37,37, 1,11,10,37,4,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,11,11,10,10,11, 10,10,10,10,10,10,10,10, 37,10,10,10,10,10,10,10, 10,10,10,10,10,11,10,10, 10,33,11,11,11,33,11,11, 11,33,11,11,11,11,11,33, 11,37,11,11,11,33,11,11, 11,11,11,39,10,10,37,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11, 11,11,11,37,11,37,39,39, 37,6,6,6,37,11,11,11, 6,6,6,6,39,6,6,6, 6,6,11,6,10,6,6,6, 39,11,3,11,11,4,39,4, 10,5,5,5,5,5,8,5, 8,8,8,8,5,11,8,5, 5,5,3,5,5,33,3,5, 5,5,5,5,3,5,5,5, 5,5,18,5,18,3,18,18, 18,3,18,18,18,18,18,5, 18,3,18,18,18,5,33,18, 5,3,18,18,5,1,5,1, 10,10,20,10,10,10,18,11, 10,18,10,18,20,10,10,10, 13,10,10,20,18,10,10,20, 10,10,18,18,11,1,13,10, // FDxx 3,37,1,37,37,37,37,37, 37,13,13,37,37,13,4,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 13,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13, 11,11,11,11,11,11,11,11, 11,11,13,13,13,13,13,13, 13,13,13,13,13,13,13,13, 13,13,1,13,13,13,13,37, 13,37,13,13,13,13,39,37, 1,13,13,13,13,13,37,13, 13,33,1,13,13,33,13,13, 1,33,1,13,13,13,13,13, 13,13,13,13,13,13,1,13, 13,13,13,37,13,13,3,37, 39,37,37,37,37,22,3,3, 3,37,37,37,39,37,39,39, 39,37,22,12,22,11,37,37, 3,37,12,3,3,12,12,4, 33,33,8,3,8,8,5,5, 5,8,8,8,8,5,8,1, 3,5,3,5,13,3,3,3, 3,9,5,3,3,3,9,3, 5,3,3,3,3,18,3,11, 3,18,3,3,5,3,3,3, 13,3,3,3,3,3,3,3, 5,5,11,5,11,1,13,11, 10,18,10,11,10,18,11,13, 12,18,10,10,10,10,18,10, 13,10,10,20,10,10,1,20, 18,20,5,5,5,13,13,10, // FExx 3,39,39,39,37,37,39,39, 37,13,10,37,39,11,39,39, 39,39,39,39,39,37,39,37, 39,39,37,39,37,39,37,39, 10,10,10,1,1,10,13,13, 11,10,11,13,10,10,10,13, 11,11,11,11,11,11,11,11, 11,11,13,13,13,13,13,10, 13,13,1,11,13,13,13,13, 11,13,11,13,13,11,37,37, 11,37,37,11,13,13,39,37, 37,13,11,11,13,11,3,13, 13,13,13,13,16,13,13,13, 13,13,1,13,13,13,16,16, 16,13,1,16,13,13,13,11, 11,13,13,11,13,11,3,37, 3,11,37,37,4,4,4,4, 37,37,39,39,37,11,37,37, 11,37,22,16,39,11,39,37, 39,4,3,37,4,11,37,3, 3,11,1,3,8,8,8,8, 8,8,8,11,8,13,1,1, 8,1,3,18,3,3,3,8, 3,3,10,3,3,3,3,11, 5,18,11,11,3,18,3,11, 11,18,11,11,11,11,11,11, 11,11,11,11,18,18,18,3, 11,11,11,11,11,11,11,11, 10,18,10,10,10,18,10,10, 10,18,10,18,10,20,18,18, 10,10,10,20,18,18,13,10, 18,10,1,18,13,13,11,37, // FFxx 3,37,39,39,39,37,37,39, 37,37,10,37,37,10,37,37, 37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37, 10,10,10,37,37,10,10,10, 10,10,10,10,10,10,10,10, 37,36,36,37,36,36,39,39, 39,39,10,10,10,1,10,10, 10,39,39,39,39,37,39,39, 1,39,39,36,39,39,37,39, 39,39,37,36,39,39,36,37, 36,39,36,10,10,10,37,10, 10,2,2,2,36,2,2,2, 2,2,2,36,2,2,36,36, 36,2,2,2,2,2,36,2, 2,2,36,39,10,39,39,39, 36,36,39,37,39,10,39,39, 4,37,36,39,36,36,36,36, 36,37,39,39,10,11,39,39, 37,39,39,39,39,37,39,33, 10,39,10,33,39,39,36,33, 36,1,36,39,33,10,36,36, 39,39,39,18,39,39,39,39, 39,39,10,11,39,39,39,1, 10,1,1,11,39,39,39,39, 39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39, 3,3,3,3,11,3,3,1, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,39,39,10,37,10,10, }; // End kMostLikelyEncoding // End of generated tables #endif // COMPACT_ENC_DET_COMPACT_ENC_DET_GENERATED_TABLES_H_ ================================================ FILE: third_party/ced/compact_enc_det/compact_enc_det_generated_tables2.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #include "util/basictypes.h" static const uint8 ced_hires_0[1024] = { 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 0,135,134,135,89,111,136,129, 81,121,130,40,64,74,78,13, 90,87,103,56,51,37,63,44, 0,97,60,55,143,97,70,100, 29,126,116,149,131,156,108,153, 147,119,135,111,133,135,115,0, 2,13,20,4,12,5,17,5, 4,0,58,50,2,30,80,64, 35,0,0,0,0,22,0,9, 14,12,4,6,7,8,16,3, 147,160,163,141,144,139,146,127, 131,124,23,17,0,11,16,6, 0,68,108,52,129,66,109,65, 113,58,116,124,126,117,88,114, 85,122,102,126,116,122,96,131, 102,126,107,117,49,113,80,128, 0,85,119,107,127,75,102,105, 118,101,108,118,101,117,98,128, 125,114,115,125,115,121,116,121, 125,130,122,119,64,102,78,124, 93,87,64,93,105,92,76,80, 113,82,75,88,89,68,88,97, 87,102,145,90,90,130,106,116, 129,61,81,75,47,69,74,64, 92,98,81,95,81,161,75,81, 101,95,93,75,100,87,108,91, 113,110,118,114,105,105,123,94, 89,92,104,90,62,85,81,84, 47,141,155,88,85,108,121,141, 94,73,82,81,163,125,111,89, 106,133,156,95,80,96,88,61, 65,47,74,55,33,54,59,19, 128,129,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,131,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,135,128,128,128, 128,128,161,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 141,115,118,118,118,128,115,127, 136,136,122,124,125,126,128,121, 147,128,128,128,128,128,128,123, 128,121,128,128,107,154,128,124, 82,141,145,136,128,144,115,123, 124,117,107,104,103,99,107,90, 92,98,102,82,88,134,161,126, 115,104,114,106,73,91,111,84, 128,93,94,94,94,116,91,103, 108,106,98,100,101,102,110,97, 137,133,120,132,146,114,136,131, 144,145,155,131,107,151,144,133, 128,103,106,106,106,128,103,115, 120,118,110,112,113,114,122,109, 157,138,128,117,136,123,136,128, 137,123,152,126,104,136,137,134, 32,94,46,28,98,102,130,97, 59,91,81,73,26,125,102,48, 100,66,105,57,87,121,71,120, 86,64,64,83,68,105,91,70, 32,130,98,103,64,30,123,122, 97,123,58,127,70,74,55,59, 53,99,95,99,105,52,48,73, 52,68,138,89,29,104,97,142, 20,99,54,114,87,86,108,55, 46,27,42,99,130,118,83,95, 138,115,69,67,96,95,125,86, 82,121,92,145,131,142,115,134, 27,53,57,104,139,102,124,124, 135,81,79,148,118,90,71,25, 151,83,146,71,74,129,109,35, 84,115,121,77,48,24,58,63, 29,55,85,51,70,123,21,95, 116,128,90,107,124,74,98,80, 132,125,112,114,118,109,167,103, 57,127,95,84,13,65,84,109, 27,137,123,69,151,81,84,95, 124,80,115,38,140,164,121,122, 86,116,83,102,117,110,111,92, 72,94,114,144,62,90,84,109, 31,128,63,37,14,138,126,79, 132,63,54,95,60,132,89,132, 25,77,134,94,93,154,147,125, 104,98,113,119,70,130,98,111, 24,78,61,30,100,41,65,115, 80,28,93,97,86,38,74,112, 85,105,135,113,132,45,65,30, 126,91,113,114,73,89,65,130, 21,150,114,47,106,125,121,37, 79,158,90,155,73,92,94,107, 87,137,97,135,91,139,152,102, 98,85,126,121,80,140,42,25, 23,47,75,42,64,150,67,93, 100,140,70,62,117,140,54,122, 100,98,95,105,88,100,132,41, 81,137,76,144,60,131,128,66, 23,59,107,144,98,44,20,119, 70,80,58,85,119,93,113,59, 83,28,117,67,135,65,77,60, 130,114,138,111,31,109,92,87, 18,93,79,109,57,128,94,69, 135,54,72,38,53,55,94,56, 133,98,153,147,82,58,124,55, 48,50,153,128,24,54,80,89, 29,130,95,117,49,47,46,91, 164,58,99,148,64,113,86,110, 144,134,49,60,102,62,103,107, 69,89,149,71,113,31,107,71, 25,90,106,113,119,82,75,91, 111,128,139,79,130,101,90,31, 97,103,87,84,53,138,43,87, 155,57,75,150,93,128,120,43, 24,118,82,52,79,56,143,92, 47,103,22,46,70,106,155,129, 93,104,125,42,96,124,137,93, 73,43,134,98,100,111,139,56, 22,65,103,76,38,122,121,155, 111,147,47,76,96,103,153,78, 71,103,137,104,150,89,139,159, 77,120,71,98,98,125,78,143, }; static const uint8 ced_hires_1[1024] = { 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 62,124,71,116,117,77,46,71, 78,98,127,132,69,67,72,79, 34,37,88,95,81,88,135,138, 116,123,132,136,97,128,45,101, 68,71,36,0,24,19,3,1, 0,9,60,40,64,146,70,113, 20,16,20,26,13,20,9,12, 14,21,15,19,55,50,99,61, 17,127,133,119,128,134,113,109, 106,124,100,107,119,131,111,122, 138,113,136,154,132,125,120,114, 115,119,101,25,19,31,19,19, 122,112,48,123,115,89,133,132, 124,114,123,130,73,103,139,130, 106,90,103,114,71,97,92,74, 115,112,59,105,83,90,140,121, 118,113,51,133,112,43,123,112, 133,130,102,109,71,110,89,102, 128,125,104,139,115,139,129,134, 112,120,123,117,111,132,129,118, 73,151,165,130,127,146,100,107, 108,121,103,114,156,112,107,111, 125,129,150,135,107,155,118,116, 168,85,79,83,77,89,77,77, 98,101,81,63,71,82,66,64, 60,72,57,62,72,70,60,67, 75,153,138,154,129,161,146,125, 125,139,151,134,139,151,135,146, 59,21,36,18,26,37,21,19, 15,27,12,17,27,25,15,22, 30,34,38,44,31,38,27,30, 32,39,33,37,31,43,31,31, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,127,128,124,144,128,127,126, 121,128,118,123,128,128,121,128, 128,128,128,128,128,128,128,128, 128,128,128,128,150,128,128,128, 90,112,109,86,83,124,57,54, 84,70,53,84,62,78,53,75, 124,134,116,95,118,85,129,65, 67,74,68,72,66,78,66,66, 141,134,118,107,135,127,130,134, 118,109,94,99,109,107,97,104, 112,116,120,126,113,120,109,112, 114,121,115,119,113,125,113,113, 161,134,128,112,120,139,115,128, 122,121,106,111,121,119,109,116, 124,128,128,128,125,128,121,124, 126,128,127,128,125,128,125,125, 76,29,158,87,47,122,133,89, 63,101,139,116,147,111,79,122, 60,112,93,68,42,145,73,100, 89,123,46,122,124,112,99,90, 118,56,99,61,145,53,131,144, 66,122,110,97,113,82,19,27, 33,134,120,84,79,124,78,108, 138,87,26,133,114,84,47,165, 62,148,104,137,139,97,125,86, 134,47,127,93,141,85,119,111, 126,56,42,26,102,89,122,48, 59,116,110,106,46,115,64,113, 107,81,49,29,28,64,130,22, 111,53,142,89,89,127,131,86, 122,122,37,143,66,96,82,105, 155,96,154,124,63,121,90,60, 115,107,42,30,134,130,119,108, 66,145,122,85,105,19,88,92, 36,134,34,101,97,112,152,73, 150,89,116,144,71,130,131,103, 88,123,77,30,132,53,98,51, 116,61,95,57,84,109,31,74, 20,98,135,114,78,114,95,123, 45,136,116,111,130,94,120,99, 114,121,64,107,94,104,29,77, 152,133,124,119,135,98,0,78, 118,115,88,102,57,61,51,89, 120,51,115,109,64,111,61,66, 110,135,106,110,98,74,86,137, 124,103,134,80,86,43,76,131, 134,105,91,84,73,34,71,133, 60,111,117,53,90,133,106,61, 147,38,145,28,137,149,110,112, 52,83,99,128,56,129,105,74, 93,60,45,62,73,86,30,82, 80,44,19,97,85,87,108,103, 99,114,94,104,97,104,140,51, 98,62,119,74,85,141,51,23, 71,58,119,110,151,65,116,74, 130,81,86,90,7,99,38,116, 61,59,140,66,91,133,123,152, 80,82,98,67,112,110,110,89, 121,132,120,62,43,74,45,110, 88,146,113,101,134,135,104,131, 110,47,96,67,123,147,69,70, 131,106,98,109,71,118,116,128, 92,100,149,53,144,117,99,136, 127,128,3,43,114,100,85,117, 92,134,156,8,88,62,89,98, 6,19,46,96,145,108,88,69, 78,94,152,96,146,108,133,66, 75,102,101,10,79,44,57,61, 102,96,123,91,109,149,84,63, 39,134,53,110,111,64,97,103, 155,133,105,105,34,125,93,56, 28,84,65,95,103,58,41,83, 48,25,116,120,91,104,124,84, 111,119,105,64,63,97,116,114, 128,103,136,74,59,33,47,93, 54,80,130,39,139,130,119,83, 140,68,94,85,77,79,118,109, 120,106,114,103,115,165,94,79, 60,52,84,77,82,78,49,74, 88,49,48,76,102,99,138,71, }; static const uint8 ced_hires_2[1024] = { 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 44,106,18,108,117,63,65,73, 40,57,43,81,77,63,68,90, 54,16,20,95,85,131,112,100, 58,144,140,135,114,96,110,128, 111,93,68,129,135,62,95,32, 82,42,46,10,8,23,10,16, 26,21,70,26,93,84,168,105, 79,71,29,48,15,26,68,128, 28,126,105,123,109,126,102,109, 105,122,72,104,108,132,113,126, 118,82,122,110,129,125,114,134, 113,133,103,54,21,32,21,128, 113,122,134,118,123,77,97,101, 121,135,128,138,125,120,35,120, 31,24,148,129,0,0,0,0, 0,0,0,5,0,0,0,128, 137,137,112,130,105,127,110,121, 86,140,134,139,128,145,17,121, 19,27,60,150,106,62,95,0, 0,0,0,9,0,0,0,128, 86,81,78,87,82,79,82,75, 75,78,69,74,72,87,74,80, 90,85,84,72,92,96,88,82, 98,102,93,112,79,90,79,128, 162,135,144,153,151,137,127,118, 113,125,105,106,91,139,129,109, 124,140,83,71,91,95,87,81, 97,101,92,111,78,89,78,128, 40,35,34,43,36,33,36,29, 29,32,23,28,26,41,28,34, 44,39,38,26,46,50,42,36, 52,56,47,66,33,44,33,128, 128,128,128,131,128,128,130,128, 147,152,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,138,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,143,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 166,128,128,130,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,146,128,128, 128,128,128,128,148,128,128,128, 139,134,133,75,121,105,114,103, 64,68,129,100,62,76,63,69, 79,74,73,114,137,85,77,71, 174,140,82,101,68,79,68,128, 122,117,114,122,118,115,118,113, 112,117,105,110,108,123,110,116, 126,121,120,108,128,128,124,118, 128,128,128,128,115,126,115,128, 128,128,126,154,128,127,132,123, 137,126,117,122,120,128,122,128, 128,128,128,120,128,128,128,128, 128,128,128,128,127,128,127,128, 67,115,51,135,110,136,135,45, 132,133,58,84,156,90,77,88, 106,108,86,29,51,132,78,133, 122,67,145,151,77,36,57,128, 142,57,81,110,113,64,18,123, 101,136,98,45,102,79,83,102, 85,86,54,106,94,38,117,74, 115,80,89,151,109,98,137,128, 57,126,70,74,47,54,112,60, 146,46,72,36,108,101,48,40, 135,151,135,128,78,111,70,101, 107,100,25,118,65,57,106,128, 67,74,25,123,123,65,42,95, 135,62,82,86,45,70,104,59, 92,30,63,55,143,71,26,83, 97,107,87,111,25,86,45,128, 65,102,90,116,124,16,45,51, 110,129,118,128,73,120,108,139, 139,102,109,110,120,134,85,66, 104,100,96,129,134,94,84,128, 68,135,60,114,78,126,135,56, 22,121,35,117,101,118,119,120, 109,82,99,96,29,91,118,96, 63,104,18,139,47,66,138,128, 78,148,152,94,129,120,107,96, 141,71,52,46,111,50,97,36, 101,133,87,23,91,150,92,38, 110,103,97,84,79,68,85,128, 118,16,110,124,126,74,99,94, 132,79,88,135,103,84,161,153, 35,41,125,78,122,107,74,90, 93,122,134,117,97,91,38,128, 56,121,75,93,68,139,117,78, 23,63,43,75,128,101,116,59, 57,65,121,13,48,108,74,121, 144,120,128,78,95,135,119,128, 141,128,143,68,91,46,137,151, 29,50,32,92,55,73,81,107, 139,145,72,67,54,129,86,35, 105,40,40,99,98,61,142,128, 136,98,109,69,113,126,85,56, 56,103,117,104,17,70,148,128, 55,61,117,55,58,53,121,155, 86,126,75,104,27,105,100,128, 117,110,66,101,135,87,114,88, 69,93,78,106,98,98,117,132, 43,125,54,39,97,119,157,98, 79,131,147,134,59,130,143,128, 60,89,40,119,87,99,73,123, 138,107,135,72,78,97,83,134, 85,110,119,93,43,141,77,98, 119,124,28,104,55,131,118,128, 130,92,71,117,97,53,50,134, 114,136,136,98,51,71,62,115, 96,155,36,1,104,124,59,137, 117,93,26,47,129,107,82,128, 25,44,71,115,56,152,109,40, 117,70,60,119,146,80,83,130, 162,18,126,52,102,137,91,39, 105,113,91,105,37,46,95,128, 68,104,78,51,112,141,87,82, 79,68,59,77,84,49,21,91, 81,68,66,30,149,62,30,70, 81,114,25,107,6,89,62,128, }; static const uint8 ced_hires_3[1024] = { 145,108,107,112,108,128,119,120, 123,130,108,110,133,138,120,117, 120,120,128,121,121,116,128,119, 128,119,122,114,121,119,123,124, 77,160,155,161,143,37,29,56, 47,35,127,103,75,130,115,110, 149,149,88,80,89,85,145,135, 102,93,107,99,91,89,140,135, 123,90,70,105,58,80,64,65, 54,64,75,114,51,62,65,58, 91,121,130,110,109,105,111,102, 107,100,93,91,94,94,90,92, 173,130,70,57,104,116,65,65, 135,145,70,76,167,129,117,91, 127,129,135,120,115,112,120,109, 117,108,170,131,84,86,91,132, 62,79,115,64,137,72,131,76, 108,65,120,128,125,126,92,124, 97,123,106,137,119,127,102,145, 120,143,106,114,81,121,87,140, 32,95,125,118,134,80,123,115, 112,107,111,122,99,125,101,137, 136,114,118,135,117,125,121,134, 142,145,120,115,95,109,84,135, 149,90,62,97,105,90,90,83, 100,81,70,84,80,69,84,99, 91,95,141,93,85,127,104,122, 139,91,91,84,114,85,87,82, 128,108,87,106,88,166,96,91, 95,101,96,78,98,95,111,100, 124,110,121,124,107,109,128,107, 106,107,102,86,93,92,87,95, 128,128,121,112,126,121,150,106, 125,124,120,96,136,130,135,110, 131,109,148,108,124,113,113,94, 107,139,145,102,114,94,96,95, 92,96,25,73,155,144,172,124, 82,104,144,100,98,115,154,121, 106,60,79,85,106,68,75,81, 150,81,74,87,105,46,52,81, 128,115,75,109,150,190,102,84, 108,126,118,117,98,102,82,70, 101,160,145,120,104,121,112,110, 124,103,124,102,101,99,97,98, 128,121,92,125,93,113,104,105, 94,104,93,99,93,102,105,98, 129,127,166,129,127,135,139,136, 142,143,142,131,131,127,123,126, 128,115,81,140,82,102,107,94, 83,93,83,84,80,91,94,87, 131,132,152,131,139,139,150,144, 142,131,134,133,139,135,137,136, 128,144,99,131,100,120,124,112, 101,111,100,102,98,109,112,105, 126,133,137,137,132,146,148,131, 144,153,139,142,147,123,115,120, 128,132,96,135,97,117,108,109, 98,108,97,99,95,106,109,108, 133,126,134,126,133,142,142,127, 140,133,144,121,134,129,135,117, 128,137,98,138,99,119,110,111, 100,110,99,102,97,112,111,111, 133,122,147,135,132,142,126,127, 144,133,138,140,129,124,135,131, 66,120,131,103,77,97,82,96, 49,122,50,79,108,111,157,61, 103,104,175,93,150,114,129,97, 163,62,107,74,85,83,86,65, 60,104,55,155,93,106,145,111, 154,124,81,79,114,119,104,98, 78,156,105,125,122,58,126,51, 158,67,68,140,110,97,170,83, 57,133,137,102,68,149,108,61, 123,146,85,82,59,65,109,45, 93,71,73,77,93,78,111,93, 84,127,90,164,148,138,91,161, 61,151,94,146,151,131,111,141, 77,115,111,98,134,96,86,120, 72,120,108,84,108,154,91,107, 59,119,71,81,97,99,110,111, 61,123,117,54,44,130,154,70, 125,120,23,146,110,91,116,88, 138,83,134,93,150,98,76,53, 90,99,140,60,102,90,84,118, 48,50,50,114,97,154,78,31, 88,101,72,126,31,104,99,105, 108,142,96,135,96,117,112,62, 90,103,116,59,144,151,100,63, 60,111,72,74,81,149,104,72, 154,140,90,149,106,117,107,164, 94,68,40,103,113,75,95,119, 78,119,86,84,153,133,135,61, 57,55,162,113,44,109,106,106, 156,45,51,86,91,122,91,49, 59,115,122,101,140,123,148,88, 128,112,113,99,106,160,94,146, 60,103,65,134,55,108,82,107, 109,74,62,66,51,60,154,112, 107,132,118,98,153,90,145,96, 127,103,138,131,32,128,125,71, 83,37,62,74,156,128,140,85, 67,149,49,158,98,78,96,58, 74,105,154,86,85,104,70,106, 71,139,144,112,70,87,62,57, 61,52,121,154,38,91,135,69, 50,69,82,123,119,105,113,111, 94,87,99,91,73,100,97,82, 110,100,136,69,126,142,55,51, 74,69,108,46,132,141,110,157, 133,69,143,44,100,133,144,154, 148,71,78,118,106,110,142,141, 77,145,112,124,118,87,69,36, 55,94,65,106,116,57,117,82, 111,82,114,127,58,134,115,141, 151,122,124,60,133,57,158,91, 139,85,137,75,157,84,128,56, 59,132,91,110,40,123,69,72, 156,84,95,148,88,151,121,95, 59,132,143,80,88,128,94,95, 76,120,121,149,98,86,94,91, 63,124,105,95,61,107,107,129, 65,159,114,147,62,170,118,134, 140,104,135,145,113,123,129,67, 107,117,135,114,64,66,85,147, 65,101,84,63,70,103,113,106, 138,80,159,36,114,114,86,133, 93,102,95,90,159,137,73,65, 75,126,75,50,154,87,101,119, }; static const uint8 ced_hires_4[1024] = { 125,128,119,118,134,121,118,117, 121,123,122,116,128,124,115,120, 123,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,133, 89,125,49,76,12,21,28,18, 21,36,39,85,85,24,34,27, 45,91,39,57,98,41,58,61, 34,65,57,69,88,91,63,51, 88,107,83,89,76,130,128,123, 123,120,114,104,121,106,102,107, 111,122,121,124,104,124,105,123, 75,193,173,183,166,161,151,140, 57,123,96,99,90,98,90,87, 92,100,90,86,102,110,91,100, 111,104,117,127,115,104,104,107, 93,107,76,126,75,129,66,99, 132,140,43,135,109,85,142,143, 142,123,145,142,88,114,151,140, 111,113,116,119,86,108,108,99, 125,132,66,121,102,103,162,139, 127,140,45,144,105,38,131,121, 150,137,124,119,85,120,100,111, 132,147,116,143,129,149,144,158, 121,139,129,132,129,144,150,135, 118,171,152,134,113,134,101,109, 118,121,117,117,163,115,111,113, 122,144,155,132,114,158,126,133, 170,108,78,105,109,94,91,87, 107,128,102,85,100,86,92,85, 99,107,95,79,99,102,94,112, 103,175,150,158,143,171,161,149, 134,158,157,149,157,163,156,163, 109,134,92,99,79,88,99,96, 113,116,109,96,117,109,94,107, 109,117,140,123,112,109,118,129, 82,99,110,93,90,120,93,105, 174,130,49,65,96,52,55,98, 100,54,66,43,94,53,51,88, 117,70,89,96,67,74,69,96, 111,61,42,98,52,58,55,82, 104,127,95,100,95,101,95,103, 111,102,126,112,114,120,101,120, 111,128,128,120,116,125,119,128, 87,104,85,98,95,101,98,94, 127,145,120,137,126,116,135,123, 128,134,149,145,134,137,137,135, 138,172,148,150,144,142,146,155, 116,128,113,126,123,128,126,122, 127,149,116,132,127,126,132,129, 142,132,146,137,136,137,141,133, 138,152,166,158,154,155,150,158, 104,121,102,120,112,119,115,111, 147,147,113,127,121,115,115,109, 131,129,132,124,135,125,120,129, 126,150,153,163,145,131,145,157, 122,128,120,128,128,128,128,128, 132,146,128,118,123,118,136,128, 140,142,131,133,128,133,123,134, 135,144,155,144,129,141,146,152, 119,128,117,129,127,128,128,126, 136,161,124,119,112,127,127,117, 125,135,136,116,159,139,127,131, 135,144,151,151,142,140,146,158, 121,128,119,128,128,128,128,128, 56,117,131,52,109,89,49,75, 81,137,58,134,87,143,104,64, 67,158,68,113,116,101,108,155, 107,161,107,92,127,123,72,117, 86,78,40,98,54,51,93,94, 146,77,132,88,105,47,86,121, 62,41,132,68,70,140,41,104, 135,103,110,99,123,62,88,138, 101,108,91,108,121,139,137,42, 81,139,135,123,107,124,135,85, 101,65,99,90,94,85,106,115, 139,139,64,101,103,134,95,143, 70,126,127,75,75,101,140,147, 87,164,107,104,165,99,81,128, 127,71,73,92,129,93,149,99, 116,117,63,116,99,109,92,116, 76,80,61,56,75,111,73,103, 101,107,139,145,119,80,146,97, 80,85,92,153,99,90,106,97, 63,145,46,83,77,87,100,104, 146,115,124,137,168,42,104,127, 143,56,58,87,91,127,81,104, 84,80,65,78,61,37,98,132, 153,100,149,107,103,115,86,77, 130,158,89,75,83,106,85,85, 154,103,67,119,146,96,127,133, 57,111,108,142,164,78,117,83, 96,129,56,73,114,66,45,67, 144,99,131,129,98,141,102,131, 94,130,123,75,85,40,91,109, 73,161,102,81,53,102,161,124, 69,88,72,127,111,144,48,90, 63,71,74,140,135,125,89,112, 80,139,117,97,84,70,104,105, 134,91,113,99,91,128,126,100, 80,119,115,145,82,39,81,166, 114,92,92,84,94,122,49,104, 105,137,124,110,127,85,72,101, 21,83,117,52,78,79,102,69, 159,137,104,143,160,134,95,104, 121,128,79,153,100,154,100,103, 107,108,78,130,91,172,136,158, 103,65,53,145,51,100,86,107, 108,103,136,103,149,108,105,77, 79,64,42,108,78,77,129,65, 55,77,109,88,67,93,68,52, 53,94,114,121,109,121,106,60, 146,113,83,116,96,136,58,100, 84,132,50,139,86,86,148,141, 107,91,140,68,130,131,107,42, 102,135,166,160,54,62,91,126, 79,136,52,161,124,123,100,71, 70,99,52,78,44,116,54,121, 67,112,82,59,164,83,92,133, 108,81,120,156,91,84,129,131, 107,110,139,91,122,128,82,92, 118,77,72,119,66,133,131,40, 125,123,54,65,72,159,54,65, 84,86,68,142,68,101,155,79, 102,155,56,134,117,163,131,155, 66,82,99,78,48,100,154,96, 81,163,89,132,131,155,126,110, 54,98,82,94,51,152,112,120, 138,77,149,127,74,99,109,80, }; static const uint8 ced_hires_5[1024] = { 128,127,124,128,128,147,138,139, 162,124,125,126,127,127,152,184, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 59,56,52,84,74,62,105,50, 75,46,54,59,89,56,113,130, 119,132,110,115,136,127,123,76, 85,121,121,94,112,104,106,128, 126,117,109,74,77,123,124,119, 122,105,96,86,86,78,87,79, 94,169,180,158,166,149,129,116, 113,117,109,100,100,85,105,128, 59,98,77,92,84,100,75,88, 93,94,54,78,89,98,98,106, 103,65,103,95,118,105,93,113, 76,102,66,54,135,52,60,128, 114,126,138,119,130,83,102,112, 141,139,142,144,138,118,52,132, 48,39,161,146,26,1,0,0, 0,6,0,43,34,8,25,128, 137,140,115,130,111,132,114,131, 105,143,147,144,140,142,33,132, 35,41,72,166,126,73,105,0, 0,0,0,53,3,50,23,128, 112,128,104,79,120,147,178,100, 105,85,90,74,80,77,120,87, 130,112,180,83,120,100,91,85, 85,95,84,102,99,90,92,128, 162,138,147,153,157,142,131,128, 132,128,118,111,103,136,145,120, 140,154,95,87,111,106,97,91, 91,101,86,97,105,96,98,128, 96,79,91,123,95,99,109,128, 124,80,77,74,81,79,85,86, 101,94,91,83,107,102,93,87, 87,97,91,93,101,92,94,128, 130,76,66,68,64,65,77,111, 81,61,51,63,45,76,57,136, 63,56,53,46,77,64,62,49, 49,59,123,97,63,54,56,128, 86,86,81,86,91,131,96,85, 96,81,82,79,84,117,90,91, 106,99,96,88,112,107,98,92, 95,102,87,98,113,97,99,128, 114,112,109,114,116,119,125,113, 127,111,110,121,112,112,118,119, 128,127,124,116,128,128,126,120, 120,128,115,126,140,125,127,128, 103,101,98,103,105,118,105,102, 113,98,99,96,101,101,107,108, 147,116,113,105,128,124,115,109, 109,119,104,115,136,114,116,128, 121,119,116,121,123,142,128,128, 128,116,117,114,119,119,125,126, 128,128,128,123,128,128,128,127, 127,128,122,128,128,128,128,128, 118,116,113,118,120,127,150,122, 139,118,114,111,116,116,122,123, 128,128,128,120,128,128,128,124, 124,128,119,128,128,128,128,128, 127,118,115,120,139,136,123,124, 134,127,116,113,118,118,124,125, 128,128,128,122,128,128,128,126, 126,128,121,128,128,128,128,128, 144,113,79,134,119,150,168,110, 109,123,87,135,164,70,123,153, 60,128,94,93,119,96,90,82, 80,91,52,120,157,65,95,128, 152,77,95,138,152,63,122,108, 72,111,161,80,53,163,71,71, 154,47,85,88,86,124,118,33, 115,126,72,98,91,95,82,128, 128,146,140,137,59,123,98,75, 133,154,41,39,133,67,133,64, 115,98,30,37,84,76,58,26, 78,73,153,84,82,120,63,128, 106,93,89,71,142,126,122,109, 127,113,101,74,47,71,102,125, 99,87,54,87,115,144,165,81, 99,49,47,81,86,139,114,128, 95,47,91,59,105,149,149,123, 89,57,69,124,88,133,119,156, 141,64,149,165,107,86,69,108, 135,57,146,122,119,128,82,128, 44,75,63,157,128,38,92,158, 41,77,129,36,81,96,88,54, 44,93,58,46,115,99,80,131, 96,65,76,87,70,72,83,128, 165,111,57,90,104,46,83,56, 72,75,68,75,96,118,139,55, 81,118,70,56,99,104,83,106, 143,142,105,139,81,83,155,128, 86,127,119,93,103,124,116,150, 118,69,88,93,98,72,109,119, 122,130,119,64,126,86,111,57, 87,131,74,125,103,69,156,128, 98,68,93,126,62,132,161,123, 149,72,93,84,65,65,112,144, 101,154,60,90,129,83,167,144, 140,140,113,105,164,79,61,128, 112,113,139,157,96,91,153,68, 106,113,83,60,100,103,74,71, 111,102,68,110,41,73,115,67, 93,107,158,143,83,149,120,128, 95,117,116,117,99,81,87,114, 115,118,121,91,142,90,110,101, 82,114,128,148,135,125,105,70, 80,91,110,89,129,99,140,128, 85,169,69,133,73,49,110,60, 96,123,99,77,114,72,157,121, 140,133,145,94,106,142,90,139, 96,154,153,76,95,136,38,128, 144,125,98,54,162,77,113,95, 108,88,42,67,143,69,97,30, 68,71,136,64,127,135,138,72, 107,115,59,137,148,97,158,128, 122,156,149,122,108,71,79,147, 128,144,38,68,131,98,99,121, 164,143,123,52,140,126,130,91, 154,67,95,124,146,43,91,128, 124,62,79,123,127,91,91,135, 121,69,95,76,76,128,74,47, 52,71,100,47,105,141,145,88, 123,140,106,86,152,110,91,128, 123,121,138,108,94,76,62,115, 57,128,70,49,149,129,153,78, 71,120,117,115,74,80,143,95, 64,35,73,80,92,79,49,128, }; static const uint8 ced_hires_6[1024] = { 131,89,116,77,83,97,102,136, 133,105,111,105,87,87,87,105, 108,118,117,124,140,105,110,104, 68,96,93,87,81,101,115,102, 17,136,152,147,132,68,100,48, 56,48,81,53,20,72,87,102, 143,155,79,74,108,84,137,154, 76,94,89,93,83,102,92,87, 66,79,73,41,49,115,104,62, 46,89,89,70,100,49,89,121, 91,76,85,75,125,76,65,130, 119,156,144,96,123,158,156,118, 20,106,67,42,24,96,44,57, 144,132,70,77,156,109,89,83, 121,135,126,114,134,111,112,128, 91,109,152,125,78,102,101,136, 43,96,88,68,104,16,25,125, 72,107,35,59,22,13,0,14, 89,145,128,73,85,131,89,165, 108,108,98,155,106,124,167,120, 128,81,99,82,73,82,85,63, 69,94,110,62,46,48,43,56, 155,167,150,139,160,127,125,138, 97,126,85,77,73,94,89,89, 67,136,152,100,83,91,124,114, 106,89,92,124,146,131,103,110, 120,137,118,86,122,92,116,123, 90,103,95,79,104,103,104,97, 122,74,119,104,124,104,96,98, 90,118,93,81,76,100,118,130, 143,123,120,167,152,126,138,151, 125,120,83,101,102,118,116,108, 79,88,103,83,60,34,70,38, 92,77,94,49,116,95,82,88, 43,144,139,131,133,98,98,121, 86,94,95,101,96,80,109,97, 88,98,105,102,82,110,51,104, 115,100,128,93,119,80,46,69, 110,117,74,90,120,121,93,128, 119,85,83,79,94,103,104,110, 89,75,115,84,121,92,114,102, 122,90,122,128,106,108,84,118, 107,133,113,126,141,123,115,158, 103,135,99,112,107,138,121,141, 94,79,115,97,115,104,113,108, 122,102,110,119,95,109,90,121, 119,127,118,122,154,126,117,158, 112,137,104,112,113,135,125,129, 121,83,109,77,84,83,62,98, 104,84,113,116,93,81,73,85, 118,113,99,96,123,96,108,131, 95,111,79,75,101,113,113,103, 140,66,86,79,79,90,80,94, 100,88,90,93,77,79,74,87, 118,152,103,106,142,108,110,143, 111,131,122,106,115,147,126,135, 166,67,85,78,78,89,79,93, 99,87,89,92,76,78,73,86, 130,127,102,124,155,105,121,151, 123,149,123,109,120,162,148,136, 154,75,95,88,88,99,89,103, 109,97,99,102,86,88,83,96, 149,130,112,108,140,112,120,145, 114,125,119,102,115,145,139,135, 31,150,134,141,48,120,36,27, 151,116,122,82,89,136,91,28, 119,68,44,150,145,40,107,55, 36,92,23,66,46,41,24,59, 41,45,12,0,141,58,83,30, 9,9,61,106,0,45,9,16, 14,23,66,152,39,5,42,56, 144,155,123,64,151,84,75,33, 107,62,98,81,89,126,87,70, 167,111,120,112,104,100,108,129, 72,124,176,74,96,72,84,77, 115,63,29,72,108,97,111,154, 85,144,123,65,80,95,99,66, 65,55,176,121,104,135,27,146, 62,44,158,114,101,106,105,126, 60,80,72,160,55,126,113,101, 36,0,87,20,72,44,8,0, 67,127,87,121,10,84,77,51, 34,21,68,32,57,64,38,24, 9,14,132,0,17,87,36,41, 67,104,95,43,73,154,82,100, 126,72,76,68,26,71,58,32, 24,45,36,21,55,166,135,135, 134,126,7,36,81,101,84,170, 75,82,59,49,43,129,38,169, 67,116,63,94,69,64,52,101, 133,117,129,120,66,52,28,69, 66,82,50,119,104,83,74,71, 47,131,113,126,57,142,116,109, 99,107,76,126,9,6,123,152, 96,136,103,126,142,67,90,109, 102,148,97,101,76,87,83,95, 49,8,75,129,53,138,158,150, 98,83,101,27,3,66,159,125, 128,114,158,134,119,126,153,139, 137,128,35,126,84,61,108,84, 34,0,18,21,24,22,93,33, 38,1,18,168,88,79,156,105, 149,47,24,56,50,69,76,64, 20,102,71,68,46,62,48,58, 30,53,84,128,83,135,48,120, 32,36,94,29,44,92,100,149, 138,79,46,24,153,61,30,49, 158,143,56,138,115,118,110,93, 74,93,20,31,73,44,42,111, 52,105,68,74,46,43,29,66, 45,67,37,7,76,88,82,101, 52,70,30,45,51,78,66,100, 54,32,43,64,72,117,82,71, 69,29,37,29,4,167,126,75, 26,161,51,143,53,30,104,121, 74,79,144,27,157,129,153,117, 55,53,53,87,24,19,80,75, 68,63,40,42,111,20,59,68, 72,114,50,26,138,29,70,86, 43,51,156,34,99,130,66,103, 53,0,46,31,71,79,87,57, 59,51,34,39,24,0,25,66, 1,47,140,45,144,92,34,50, 90,75,50,2,24,40,147,114, 63,150,105,113,95,108,52,72, 62,157,153,73,141,125,32,38, 104,104,25,64,137,147,31,105, 16,139,27,46,1,90,101,23, }; static const uint8 ced_hires_7[1024] = { 120,127,110,107,125,119,124,105, 127,128,122,128,102,123,102,99, 129,154,113,122,107,119,106,109, 116,98,104,108,120,117,116,111, 91,83,50,46,97,86,122,78, 99,143,61,80,78,80,62,52, 17,15,56,62,51,91,64,93, 138,118,150,133,136,119,114,121, 173,162,166,159,148,141,205,123, 204,166,143,146,120,144,133,153, 134,173,138,140,103,106,108,117, 108,108,71,103,148,151,114,164, 86,147,121,122,141,130,130,109, 132,142,124,133,108,143,112,113, 130,102,125,146,122,120,113,107, 113,92,86,127,123,136,75,107, 137,141,85,124,139,117,115,121, 96,81,80,124,153,77,61,54, 173,171,86,199,83,61,48,51, 58,40,46,50,62,59,58,53, 145,149,144,119,151,127,147,125, 167,161,116,130,99,120,128,128, 128,103,131,112,106,147,108,130, 151,83,89,93,105,102,101,96, 129,134,99,103,101,147,132,118, 111,96,87,94,100,88,67,64, 93,74,78,87,72,84,86,74, 81,63,69,73,85,82,81,76, 125,123,130,99,124,109,144,109, 111,115,106,113,93,107,93,83, 92,101,134,122,117,122,132,121, 100,122,88,92,104,101,112,95, 117,129,112,84,103,101,127,90, 87,91,82,100,75,179,112,185, 110,132,107,115,106,185,103,103, 136,103,135,134,129,86,137,125, 139,147,101,95,125,132,138,134, 114,118,109,116,89,113,94,123, 98,96,100,109,94,106,93,96, 103,85,91,95,107,104,103,98, 159,165,129,148,166,141,172,150, 179,163,171,181,122,149,165,145, 138,128,145,149,124,146,132,127, 143,122,121,133,144,135,162,148, 171,165,133,151,163,146,162,148, 172,168,156,165,126,154,137,132, 143,140,143,155,135,156,140,142, 142,127,130,137,149,145,153,146, 132,133,96,93,127,105,110,92, 113,117,108,115,88,109,88,85, 94,169,171,176,140,166,165,125, 134,143,158,156,158,166,150,158, 169,154,126,147,134,128,175,148, 138,128,128,128,118,128,118,115, 124,125,128,128,123,128,122,125, 128,114,120,124,128,128,128,127, 160,159,125,129,155,136,156,153, 149,128,128,128,117,128,117,114, 123,124,128,128,122,128,121,124, 128,113,119,123,128,128,128,126, 168,147,128,128,128,139,128,143, 141,128,128,128,127,128,127,124, 128,128,128,128,128,128,128,128, 128,123,128,128,128,128,128,128, 26,71,23,0,18,145,93,129, 88,129,0,160,78,145,20,29, 21,64,41,28,155,90,68,73, 46,65,128,9,130,142,83,131, 59,84,81,102,49,55,8,132, 69,48,0,80,0,123,0,36, 37,33,0,62,129,121,64,162, 123,122,0,154,69,160,143,89, 155,85,24,119,133,127,86,100, 126,180,98,119,16,37,81,98, 82,71,113,46,31,50,30,33, 70,148,98,135,141,102,162,99, 94,74,90,98,122,40,42,20, 72,125,152,93,42,97,112,5, 103,130,75,82,21,65,120,149, 107,58,80,48,61,150,41,63, 118,82,161,115,70,0,55,0, 13,151,100,56,59,0,25,151, 102,102,94,0,133,95,68,98, 35,166,95,80,163,108,138,85, 47,27,46,3,18,108,113,138, 156,140,109,142,22,49,123,83, 98,107,78,74,32,109,58,60, 83,0,109,0,1,0,105,55, 71,49,44,31,49,30,38,141, 120,37,96,114,14,14,14,21, 22,111,109,31,70,103,7,100, 17,109,62,65,72,49,18,128, 40,154,151,137,126,105,104,61, 119,144,127,42,0,0,164,141, 135,126,95,119,107,112,29,0, 0,0,99,11,15,13,9,0, 108,133,116,95,53,149,107,100, 56,66,115,79,15,100,65,0, 1,0,7,140,111,132,101,0, 95,4,92,92,46,22,161,72, 58,38,113,14,88,36,11,97, 67,63,27,39,143,108,133,82, 135,0,52,60,72,93,90,149, 109,147,143,103,45,159,148,153, 132,115,1,88,45,51,72,56, 44,62,5,83,23,28,153,121, 167,37,147,101,0,82,26,76, 97,99,17,1,1,0,40,86, 83,46,30,15,41,21,26,83, 78,66,41,84,84,78,0,41, 50,103,63,122,73,69,0,61, 48,0,97,105,70,96,62,90, 85,84,93,6,54,125,46,123, 102,62,7,71,96,44,54,0, 54,4,166,155,31,144,107,0, 87,55,65,143,79,47,0,5, 163,95,121,171,161,163,63,142, 100,152,141,64,95,125,105,56, 0,89,99,83,64,43,95,89, 83,50,23,0,68,0,0,76, 92,65,42,71,88,88,176,120, 171,105,154,154,18,44,54,106, 112,92,134,139,0,134,133,130, 116,101,84,51,64,46,90,155, 152,122,117,113,19,86,30,51, 85,122,99,90,18,146,45,102, 58,13,43,75,104,119,101,0, 77,0,0,0,146,0,119,0, }; static const uint8 ced_hires_8[1024] = { 130,127,155,168,146,193,173,178, 138,176,189,169,199,152,146,172, 128,127,128,122,128,128,109,122, 115,128,126,128,120,128,128,128, 142,160,113,159,112,138,145,87, 133,125,100,110,109,101,70,134, 52,81,111,42,63,48,9,22, 34,44,34,64,45,60,106,128, 98,91,146,105,104,134,59,53, 74,82,71,49,70,51,52,76, 77,69,81,64,94,79,51,64, 57,75,68,77,62,74,106,128, 90,132,91,134,101,123,97,99, 109,125,92,97,124,114,109,140, 123,84,137,120,149,126,95,134, 90,124,96,82,140,78,116,128, 68,69,88,133,99,128,124,111, 101,105,137,125,134,111,84,138, 137,75,81,64,111,89,60,64, 57,75,68,77,62,215,110,128, 111,181,158,179,148,178,161,155, 155,149,184,172,200,153,139,187, 156,138,159,137,153,154,108,115, 129,118,111,120,105,117,128,128, 91,101,111,146,104,81,82,70, 84,86,94,72,93,74,75,99, 100,92,104,87,117,102,74,87, 80,98,91,100,85,97,128,128, 137,111,137,155,136,166,170,156, 138,140,168,155,174,149,139,169, 119,111,123,106,128,121,93,106, 99,117,110,119,104,116,128,128, 127,121,128,160,166,147,149,173, 185,181,184,160,174,149,143,166, 164,138,146,126,151,136,178,115, 117,182,167,95,80,92,124,128, 113,114,134,159,120,170,172,178, 160,151,180,174,185,158,134,167, 122,114,126,109,128,124,181,188, 193,130,119,145,158,155,152,128, 155,164,146,164,148,177,155,147, 159,166,174,167,174,147,135,174, 105,97,186,168,122,107,79,92, 85,103,96,105,90,102,128,128, 161,164,146,176,146,180,170,159, 156,165,177,172,179,155,145,171, 111,103,162,180,176,113,104,98, 91,109,102,111,96,108,128,128, 187,159,158,190,172,180,181,159, 155,156,183,160,177,165,170,171, 148,172,125,108,128,141,95,108, 101,119,112,121,126,118,128,128, 128,128,120,133,128,128,128,121, 128,128,128,123,128,125,126,128, 128,128,128,128,128,128,125,128, 166,128,128,128,131,128,128,128, 128,128,119,128,128,128,128,122, 129,131,128,122,128,124,125,128, 128,128,128,128,128,128,124,128, 128,128,128,128,128,128,128,128, 128,128,128,154,128,128,133,128, 142,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 128,128,128,128,128,128,128,128, 20,141,64,92,31,78,151,53, 145,20,53,48,65,154,102,114, 93,115,27,0,49,93,58,115, 144,65,153,88,149,88,17,128, 84,40,161,60,108,42,125,33, 139,68,83,54,43,81,132,82, 69,84,108,0,122,85,6,2, 53,70,102,0,36,34,41,128, 100,104,66,145,69,110,103,89, 76,65,98,98,84,63,121,133, 106,95,152,44,168,45,122,127, 129,38,117,149,53,137,128,128, 134,104,149,56,114,62,74,104, 71,45,50,137,132,122,110,44, 112,56,54,136,150,128,59,0, 0,81,103,3,0,0,33,128, 81,17,22,151,126,101,49,126, 22,36,76,149,81,76,40,83, 64,111,53,68,65,145,96,0, 110,0,87,0,39,98,99,128, 104,20,78,59,26,158,114,116, 105,158,62,77,97,99,149,60, 158,104,111,51,111,77,41,70, 35,124,61,140,87,83,139,128, 89,103,71,128,99,85,122,108, 62,50,67,61,120,64,44,79, 43,9,107,179,176,163,107,154, 141,87,110,163,2,37,115,128, 0,162,20,49,20,47,97,121, 95,83,96,88,115,58,47,97, 61,11,73,19,29,17,0,0, 0,148,82,94,111,89,40,128, 120,92,69,58,56,38,49,120, 38,153,95,56,69,140,92,44, 157,155,88,91,145,0,89,50, 109,97,0,66,0,18,97,128, 114,13,57,120,93,77,153,77, 152,135,99,80,88,24,69,60, 107,53,43,2,13,0,131,78, 141,49,121,0,119,153,135,128, 0,4,6,55,124,56,65,29, 21,40,149,41,100,137,17,39, 3,163,111,111,140,0,52,59, 72,113,76,118,116,81,92,128, 47,32,26,62,0,51,45,166, 142,38,168,49,140,20,96,145, 124,74,90,169,73,151,143,89, 64,116,26,75,20,162,143,128, 0,0,91,31,9,39,39,26, 90,29,42,35,53,27,112,56, 58,67,4,76,79,51,153,115, 122,50,137,120,19,114,123,128, 78,120,61,100,65,59,85,52, 72,57,93,54,61,10,72,78, 56,75,77,0,33,34,43,38, 0,0,14,44,0,44,24,128, 151,95,67,85,59,72,70,135, 53,60,105,54,54,25,160,139, 142,61,116,126,90,1,104,159, 139,115,141,100,41,62,100,128, 0,0,16,46,152,103,55,43, 56,47,60,148,157,92,133,148, 0,0,158,50,138,103,111,67, 150,157,47,12,78,21,146,128, }; static const uint8 ced_hires_9[1024] = { 130,71,129,141,137,60,133,127, 113,78,80,127,94,127,117,51, 103,62,119,129,148,68,133,101, 38,42,158,125,112,190,163,124, 139,45,127,155,132,105,145,125, 136,78,127,128,145,136,141,61, 122,142,128,129,137,97,140,143, 1,3,145,120,131,129,135,62, 124,125,104,88,80,128,69,72, 68,127,36,103,135,92,101,131, 77,126,132,112,51,143,88,87, 94,151,72,95,120,110,80,161, 81,123,101,98,60,133,79,54, 52,155,28,125,46,72,67,101, 90,70,86,76,45,128,37,119, 86,129,81,86,102,49,41,88, 96,132,92,99,114,136,90,108, 121,130,15,114,132,93,122,129, 135,112,129,111,82,133,131,124, 119,129,105,108,112,39,105,147, 115,68,124,132,149,103,109,139, 127,72,144,126,137,143,146,76, 122,99,138,142,133,69,134,126, 32,11,131,145,107,148,126,61, 77,126,72,78,49,124,127,85, 75,135,43,82,121,79,83,143, 74,43,129,98,111,130,44,45, 87,106,101,92,138,51,52,89, 95,126,67,51,135,116,72,112, 51,131,24,106,133,97,111,143, 71,33,136,82,68,135,62,78, 22,49,63,84,114,36,104,82, 46,129,63,71,69,93,73,121, 119,140,58,72,114,107,136,142, 96,57,126,112,97,126,48,117, 55,54,76,101,134,53,81,140, 139,93,114,144,122,123,128,130, 146,120,146,137,129,138,134,101, 109,151,120,136,133,78,129,131, 0,6,154,131,126,122,151,58, 103,57,111,129,142,74,122,99, 101,56,40,136,131,124,138,107, 93,87,91,150,153,48,74,96, 29,52,125,155,90,119,156,95, 71,137,72,129,58,106,76,87, 65,135,10,79,127,82,98,139, 95,29,127,121,126,138,126,104, 58,30,84,95,111,27,55,91, 148,128,84,57,100,136,84,113, 74,138,28,114,116,81,111,129, 86,138,17,107,80,134,130,64, 160,116,80,94,104,93,101,84, 76,131,112,98,55,135,114,120, 76,132,40,106,110,135,121,131, 146,114,77,99,59,136,66,90, 106,140,89,78,129,75,105,92, 119,136,75,128,125,129,141,113, 81,139,14,124,57,64,124,132, 74,124,75,119,117,122,73,70, 119,145,101,93,142,120,105,136, 111,62,156,130,141,107,139,152, 124,103,148,125,129,141,131,71, 138,116,130,137,129,82,139,148, 0,0,125,133,142,126,134,55, 72,116,48,77,48,122,93,65, 57,115,22,108,127,51,83,142, 87,100,151,86,87,131,39,43, 86,113,70,90,98,53,85,72, 149,20,138,146,143,112,62,118, 158,65,125,130,127,150,129,33, 114,116,113,124,140,58,141,141, 24,20,165,129,84,163,122,98, 106,140,115,104,111,132,132,124, 123,125,23,112,87,134,120,128, 118,121,93,124,114,141,143,116, 117,135,106,137,107,90,103,86, 104,114,115,105,103,116,131,80, 117,119,30,147,132,120,108,122, 147,136,106,132,147,127,81,123, 134,114,71,127,123,66,120,147, 106,131,95,77,65,135,100,63, 69,133,8,113,86,81,116,133, 74,114,131,122,67,128,53,135, 151,132,60,61,111,92,110,88, 161,88,152,116,143,105,115,146, 136,61,114,137,128,126,120,44, 151,90,132,138,125,54,155,126, 8,28,138,144,121,160,160,75, 87,124,98,82,154,145,88,92, 46,138,32,132,81,107,138,90, 81,34,84,103,27,129,104,81, 109,61,73,49,116,47,121,91, 72,136,72,95,97,132,49,95, 111,125,35,117,129,103,124,133, 112,95,117,134,95,115,67,97, 102,148,126,135,108,97,99,123, 165,12,134,132,98,115,126,113, 92,122,36,138,34,110,157,63, 107,139,40,148,113,22,79,71, 31,22,127,133,78,127,95,90, 38,12,112,64,133,138,43,108, 175,16,168,125,147,148,91,8, 100,54,87,106,121,17,106,130, 17,47,101,161,65,95,131,83, 119,144,110,98,143,110,64,120, 43,121,32,102,111,138,133,123, 86,119,120,80,52,126,109,143, 98,130,90,84,85,38,91,148, 95,124,58,99,38,144,76,50, 77,139,32,143,125,91,120,110, 106,28,108,77,132,126,36,92, 136,57,38,62,101,62,40,90, 47,23,65,73,87,20,162,94, 103,127,100,162,133,118,116,37, 117,60,94,98,151,51,49,98, 24,20,116,121,117,51,42,90, 54,123,33,45,31,151,56,33, 42,145,36,29,25,35,119,81, 32,43,48,22,12,118,44,43, 149,32,38,50,76,65,37,95, 46,130,41,34,22,145,59,49, 59,134,20,125,111,79,130,70, 69,37,81,47,140,127,73,75, 123,43,61,147,80,46,72,78, 115,32,81,74,58,149,102,67, 71,46,65,60,49,57,61,30, 68,174,54,51,45,52,72,53, 57,53,71,79,105,84,67,123, }; static const uint8 ced_hires_10[1024] = { 58,122,143,128,136,100,142,138, 75,129,136,141,139,140,49,124, 126,129,133,99,142,134,152,137, 120,138,45,14,25,143,136,140, 125,108,87,90,85,127,88,79, 128,11,95,136,93,104,132,81, 132,106,62,140,86,72,90,83, 121,114,149,146,89,121,124,118, 133,75,100,96,92,129,79,127, 127,44,117,130,100,119,132,110, 114,131,93,115,52,110,92,107, 134,108,137,144,103,119,70,100, 129,70,93,99,140,110,67,56, 133,40,103,132,85,100,142,72, 134,84,77,132,70,53,62,94, 79,31,106,60,43,131,68,32, 132,100,125,106,118,135,136,106, 130,30,113,134,97,123,128,124, 125,111,84,130,80,106,89,109, 111,56,133,127,111,123,95,111, 67,126,128,140,149,99,132,133, 69,144,128,139,143,147,68,121, 136,137,133,67,119,131,136,128, 136,149,79,10,23,96,114,96, 125,102,73,98,152,143,106,80, 137,19,128,84,119,136,89,83, 74,107,89,132,74,58,81,126, 52,49,110,73,108,116,88,42, 142,113,137,119,142,109,104,86, 122,38,105,107,137,130,124,108, 116,84,69,126,79,79,97,100, 101,51,133,133,97,103,115,109, 96,116,125,136,124,122,129,150, 119,148,137,131,138,134,97,111, 120,136,131,74,132,148,147,147, 126,125,57,11,16,101,139,150, 64,113,99,105,134,74,84,122, 61,63,130,131,122,139,112,93, 90,147,154,53,127,109,126,145, 147,109,83,59,31,99,68,83, 137,90,110,94,59,103,126,88, 132,21,84,127,93,105,137,97, 124,122,120,138,85,68,128,65, 88,44,132,42,58,106,79,34, 124,85,81,119,108,133,128,91, 138,36,114,116,86,113,128,87, 26,102,87,132,98,77,76,98, 95,93,108,117,161,118,149,141, 131,125,92,102,68,135,80,85, 131,41,104,110,136,120,132,145, 74,100,62,135,119,73,95,106, 84,72,119,134,102,130,74,113, 136,71,72,117,124,128,73,106, 138,23,122,64,52,124,130,76, 75,120,120,120,127,85,126,105, 103,120,93,146,119,110,119,124, 59,156,145,150,141,110,137,123, 104,147,127,129,138,125,77,138, 130,135,130,87,148,123,129,136, 129,131,48,15,26,124,110,114, 115,51,73,57,54,120,36,57, 115,11,101,125,70,76,140,93, 150,94,84,126,85,49,83,103, 85,56,128,111,78,103,71,102, 137,112,116,124,112,131,132,116, 126,33,113,86,134,122,127,115, 94,124,117,137,127,116,110,91, 128,86,117,135,114,119,99,120, 116,104,122,83,102,118,81,68, 114,12,145,131,124,108,121,145, 103,127,145,127,115,112,108,119, 140,58,140,108,123,116,98,134, 131,98,133,63,58,136,35,61, 131,29,113,81,78,117,131,74, 128,121,76,127,101,71,79,105, 70,83,126,131,150,127,103,111, 95,145,124,149,145,102,158,144, 73,115,137,128,126,118,39,154, 127,136,124,85,112,136,102,157, 149,155,63,39,21,131,157,85, 121,75,41,91,52,123,59,122, 133,55,87,113,80,75,144,80, 121,95,110,126,123,72,70,79, 101,39,94,99,84,136,68,51, 127,76,124,126,75,95,60,87, 130,36,76,111,110,138,142,109, 125,113,92,127,77,120,87,88, 92,44,116,59,67,146,52,55, 124,94,127,65,59,135,31,83, 154,42,119,47,70,56,99,85, 70,79,69,127,80,57,107,42, 77,38,108,135,113,116,94,95, 134,58,90,56,42,142,76,51, 134,21,125,102,78,135,80,81, 78,60,137,122,61,53,43,84, 147,45,82,70,120,107,56,52, 125,58,101,70,50,142,31,51, 142,44,142,128,93,121,116,115, 115,88,119,127,79,67,100,81, 78,68,109,74,131,115,109,34, 128,20,41,24,44,151,46,58, 143,31,53,37,38,115,104,35, 49,13,50,110,40,29,34,32, 52,77,75,38,140,67,53,62, 30,102,98,113,102,138,130,139, 39,47,119,112,103,104,37,128, 128,103,110,33,80,102,106,125, 86,137,98,43,38,91,95,175, 21,105,132,102,123,141,110,109, 31,168,125,139,150,92,18,94, 86,105,122,38,63,172,77,132, 155,93,48,68,35,60,65,79, 28,139,76,117,98,118,79,120, 117,45,140,50,110,154,88,110, 45,147,116,36,127,99,132,98, 137,124,54,34,56,82,164,143, 35,74,103,109,98,33,86,125, 55,113,149,141,121,121,50,122, 113,105,152,60,154,113,84,61, 128,49,72,16,20,144,58,61, 82,126,110,148,135,61,143,155, 65,78,116,108,135,109,46,91, 122,125,145,67,103,116,124,162, 127,185,84,36,46,110,131,52, 42,137,146,121,136,110,144,167, 67,120,128,125,146,130,34,118, 111,122,138,47,72,152,133,119, 127,160,56,29,36,97,143,120, }; static const uint8 ced_hires_11[1024] = { 129,46,102,93,87,61,93,55, 96,48,77,76,65,67,91,46, 64,58,113,75,57,62,82,91, 106,70,112,123,68,70,75,108, 113,55,138,144,134,87,155,40, 138,123,135,133,127,142,137,53, 147,126,126,136,132,133,154,124, 123,43,142,128,28,86,28,104, 122,134,145,124,106,123,46,119, 48,128,47,146,45,45,47,127, 41,140,89,43,38,100,46,40, 62,104,61,104,126,110,126,124, 91,125,26,136,96,129,23,115, 19,144,133,118,113,115,63,132, 59,137,94,51,29,117,36,127, 39,136,46,74,118,107,102,110, 89,128,72,40,74,135,21,135, 34,144,57,55,66,55,51,129, 53,127,93,50,32,126,63,29, 37,128,44,72,113,117,128,118, 77,69,127,126,130,77,123,31, 130,136,133,130,123,130,153,82, 138,132,127,134,127,137,125,128, 123,115,114,116,75,59,43,117, 113,116,62,47,39,142,82,137, 41,119,39,88,88,58,47,136, 28,38,72,11,27,108,35,44, 65,155,73,100,130,105,132,111, 93,34,108,139,100,55,67,50, 146,50,129,131,153,145,111,31, 105,138,137,151,137,51,116,127, 146,30,74,76,15,37,10,59, 98,133,33,28,17,143,30,136, 41,115,34,100,131,73,38,123, 12,134,69,24,4,134,39,29, 52,118,53,81,110,140,124,88, 82,128,133,117,145,106,126,85, 134,68,159,123,131,130,125,127, 111,117,130,146,125,44,111,141, 127,118,87,70,96,9,66,50, 92,145,86,40,68,123,37,120, 71,114,90,126,74,74,28,128, 73,120,89,54,119,118,68,72, 51,112,35,63,137,116,114,104, 98,123,104,91,72,135,54,139, 112,130,98,141,114,67,63,136, 86,42,87,61,112,117,101,58, 106,134,41,69,123,123,123,117, 85,137,150,37,54,142,42,126, 36,124,60,30,130,98,12,132, 135,24,89,53,49,98,125,57, 119,105,38,66,134,116,118,107, 98,141,79,89,141,133,98,129, 133,130,72,83,48,92,48,131, 38,31,95,107,139,113,59,69, 40,143,37,65,112,132,107,111, 112,118,69,50,46,149,49,152, 39,130,45,42,40,30,66,118, 54,26,75,14,107,112,49,54, 65,116,73,100,115,143,78,91, 91,69,145,144,140,88,104,98, 127,131,122,136,136,132,115,76, 134,134,127,139,121,152,149,142, 144,83,166,167,31,77,39,99, 82,130,53,59,64,129,54,110, 44,118,48,133,87,91,27,140, 84,148,91,51,122,101,61,86, 50,134,46,84,126,106,112,112, 84,135,121,143,124,127,87,121, 113,142,112,75,123,109,90,133, 90,98,88,84,123,123,125,129, 92,141,44,70,118,108,114,104, 134,108,127,101,121,121,98,125, 121,115,125,94,128,88,98,112, 124,82,126,112,130,134,126,138, 101,122,105,119,92,85,86,126, 77,117,116,48,78,138,27,142, 122,120,126,63,134,48,25,112, 112,39,86,120,154,143,120,143, 28,123,36,63,109,110,108,101, 71,131,58,45,30,128,122,146, 62,130,49,95,90,25,18,143, 48,127,97,99,74,119,33,43, 22,146,30,57,118,112,106,106, 95,104,131,129,128,72,131,81, 132,75,120,142,143,138,133,92, 155,132,138,149,139,63,128,144, 160,88,119,81,75,7,47,66, 102,128,48,47,57,119,70,107, 140,130,80,106,65,90,32,136, 116,123,82,61,117,132,66,43, 55,154,61,89,127,128,105,122, 110,129,58,13,38,138,30,112, 136,126,30,98,89,135,39,126, 55,147,70,32,117,122,68,87, 58,145,57,84,130,114,103,117, 118,115,58,40,45,141,61,156, 51,109,30,30,37,33,59,110, 34,25,81,42,99,147,71,54, 97,128,88,115,120,107,128,103, 102,62,107,133,115,63,64,42, 135,82,88,103,135,156,108,60, 147,137,139,149,144,30,125,110, 68,80,128,101,53,14,38,71, 127,100,145,84,145,70,134,37, 72,39,175,114,120,112,75,120, 76,99,111,119,117,48,91,106, 110,125,102,128,84,56,63,90, 129,77,130,151,138,88,126,88, 117,82,96,136,127,108,124,80, 155,101,115,124,94,99,175,159, 129,107,129,129,106,107,112,114, 98,9,84,76,73,44,76,33, 73,22,61,73,76,66,62,27, 84,63,137,71,74,28,80,84, 106,47,83,88,29,18,15,66, 102,23,80,68,70,48,77,40, 82,24,57,72,77,67,80,46, 70,66,135,70,62,10,75,87, 108,64,76,91,16,23,22,74, 105,19,61,52,70,26,63,47, 80,27,40,55,73,79,73,33, 71,69,127,73,72,12,72,69, 65,55,77,93,18,43,34,72, 104,44,77,65,69,48,79,52, 74,47,58,58,60,52,78,46, 61,55,123,55,55,61,74,74, 89,67,93,106,71,67,69,73, }; static const uint8 ced_hires_12[1024] = { 79,129,118,114,118,130,135,136, 122,129,124,105,133,117,122,111, 134,119,65,123,122,86,117,114, 121,123,136,124,126,111,73,121, 134,116,126,128,129,122,119,131, 131,128,98,130,123,67,131,120, 126,125,137,42,120,129,124,126, 132,124,121,124,126,120,89,121, 112,133,109,133,111,132,130,71, 99,133,71,58,135,135,120,135, 124,96,123,110,95,72,54,65, 130,119,105,127,127,103,105,127, 118,122,128,106,129,130,78,100, 80,135,92,115,113,114,117,119, 117,117,148,147,127,77,100,118, 129,121,108,127,127,101,91,127, 135,132,136,125,118,124,139,134, 122,120,34,135,116,109,141,104, 122,131,129,5,132,82,135,130, 120,130,119,128,123,119,103,118, 126,133,130,135,119,105,128,126, 122,109,135,125,129,124,128,144, 130,124,127,128,125,138,129,123, 129,123,141,114,116,100,75,111, 126,110,99,100,152,132,105,74, 73,128,77,140,108,97,135,114, 115,76,102,86,74,55,93,128, 128,65,82,127,127,109,97,127, 83,137,114,142,118,131,144,118, 104,132,68,106,127,101,119,118, 124,123,62,94,123,122,117,132, 123,130,118,127,145,96,99,127, 115,129,121,73,117,134,107,125, 107,139,57,129,133,75,111,122, 115,108,124,112,115,65,89,120, 136,89,100,127,127,107,91,162, 116,124,116,129,125,122,126,120, 126,115,136,128,123,153,120,132, 126,124,119,124,121,125,124,127, 124,129,124,115,117,98,87,112, 110,93,120,88,101,100,92,100, 101,103,193,110,109,83,98,97, 81,85,93,129,84,120,83,96, 93,94,86,127,127,127,127,127, 130,129,102,125,118,128,139,116, 89,126,144,112,143,114,130,139, 137,125,99,129,122,105,77,70, 122,122,127,127,144,123,84,127, 140,124,123,126,138,124,114,136, 125,129,136,130,115,106,135,110, 119,120,124,115,130,112,127,128, 111,122,116,121,123,113,80,118, 109,106,107,107,110,111,111,99, 109,127,112,107,106,162,102,138, 105,111,114,99,121,103,86,90, 93,107,100,127,127,170,152,127, 129,122,126,129,130,127,131,138, 125,126,108,134,116,77,116,126, 127,138,131,43,123,110,137,129, 121,138,123,121,123,110,70,118, 108,114,111,100,106,124,104,100, 108,110,114,106,106,96,119,162, 90,141,96,108,93,105,112,107, 100,92,93,127,127,144,144,127, 119,102,134,125,132,132,111,116, 139,135,118,123,93,104,109,107, 109,137,126,109,126,113,120,127, 111,127,122,127,127,96,84,127, 108,121,133,121,111,125,73,107, 148,128,119,114,117,108,124,100, 119,106,116,170,155,38,84,144, 123,58,113,127,127,105,99,154, 57,128,109,135,124,126,134,42, 110,124,72,117,140,133,125,114, 124,133,85,97,99,143,140,113, 129,122,120,127,127,99,87,127, 93,88,77,107,97,101,91,104, 98,96,155,103,106,69,77,79, 81,137,97,206,81,184,134,112, 92,116,64,127,127,127,127,127, 118,85,115,94,120,133,99,119, 127,125,107,92,120,53,74,109, 133,143,137,92,89,114,118,130, 145,133,124,127,127,100,88,127, 93,97,96,121,91,124,100,109, 94,125,112,118,104,82,100,96, 123,97,112,138,108,200,107,142, 135,117,94,127,127,127,127,127, 130,129,119,115,125,130,53,116, 116,133,51,40,120,97,122,101, 108,62,141,108,137,124,103,105, 138,40,104,127,127,109,97,127, 111,131,74,122,129,132,85,105, 144,128,63,62,121,83,101,114, 133,139,115,123,125,105,139,99, 136,139,110,127,127,106,92,127, 132,119,131,119,128,131,116,120, 132,131,135,136,87,90,112,113, 116,132,115,124,125,154,127,132, 94,130,122,127,127,108,106,127, 127,129,109,98,125,122,112,115, 115,128,120,126,142,114,126,103, 132,96,127,105,124,69,102,122, 128,103,120,127,127,98,112,127, 121,120,145,97,119,126,115,132, 89,127,134,127,112,113,133,129, 130,102,128,127,135,64,118,140, 138,124,104,127,127,129,118,127, 127,127,127,127,127,122,127,127, 127,122,127,127,127,127,127,127, 127,127,127,127,127,127,127,127, 127,127,127,127,127,127,127,127, 127,127,127,127,127,118,127,127, 127,118,127,127,127,127,127,127, 145,127,127,127,127,127,127,127, 127,127,127,127,127,127,127,127, 121,124,104,109,109,81,110,97, 104,77,120,119,111,92,119,106, 100,107,107,127,117,127,112,104, 89,124,89,127,127,197,184,127, 115,99,101,103,110,78,92,110, 84,142,93,113,91,65,122,79, 105,120,109,104,120,113,97,90, 86,115,97,127,127,182,217,127, 127,127,127,127,127,122,127,127, 127,124,127,127,127,127,127,127, 127,127,127,127,127,127,127,127, 127,127,127,127,127,127,127,127, }; static const uint8 ced_hires_13[1024] = { 79,36,84,88,70,26,101,101, 57,93,76,44,82,95,88,77, 79,102,93,112,76,86,62,31, 126,102,50,102,97,110,99,131, 52,43,113,117,112,51,119,123, 107,86,124,118,123,119,119,49, 114,113,112,125,118,105,132,18, 125,60,129,75,77,71,51,90, 99,65,124,123,98,65,96,121, 107,100,76,93,112,140,131,73, 92,127,90,86,132,109,81,54, 57,124,94,100,98,115,106,112, 81,31,42,63,61,107,26,43, 32,76,44,28,57,75,56,165, 61,40,75,79,77,82,47,21, 39,68,76,80,81,88,78,107, 53,55,83,115,118,88,124,129, 135,116,109,113,126,117,121,71, 103,69,120,116,124,140,113,25, 116,121,78,69,55,61,52,95, 75,63,96,27,126,105,92,121, 78,64,55,123,122,101,117,34, 107,33,121,105,112,47,100,18, 60,36,113,61,64,87,64,99, 70,75,100,78,116,77,119,135, 81,90,103,129,128,106,113,57, 91,57,132,124,117,87,117,49, 60,46,37,98,75,96,77,107, 104,148,95,50,41,136,45,51, 72,150,86,83,112,103,30,141, 59,39,43,55,90,129,56,44, 57,84,26,104,80,110,75,126, 72,54,96,117,102,69,79,123, 44,79,60,58,105,135,103,47, 69,152,129,129,112,72,124,24, 118,59,89,72,68,75,69,97, 49,104,110,125,122,126,125,119, 116,94,112,92,115,120,104,110, 129,129,113,124,117,103,117,22, 126,38,90,48,80,82,62,97, 76,70,64,110,64,64,46,62, 48,63,80,67,84,137,129,30, 93,115,59,121,142,110,109,61, 115,61,70,84,90,95,95,95, 100,63,73,65,82,99,97,66, 73,125,80,83,138,86,127,52, 78,109,102,98,105,78,103,62, 112,76,108,111,109,108,113,111, 111,114,86,93,91,76,81,78, 85,82,114,98,92,112,111,94, 98,94,75,90,95,93,90,72, 91,82,103,151,113,118,141,119, 49,138,104,130,121,72,113,92, 114,38,101,119,105,122,105,109, 107,112,87,116,119,68,115,8, 83,24,113,61,68,71,56,94, 114,52,76,101,85,55,85,54, 85,94,75,85,117,114,135,41, 81,88,76,85,140,64,70,51, 76,101,82,105,98,101,102,103, 114,111,126,117,134,117,113,90, 68,92,84,110,117,110,122,91, 91,164,90,122,124,100,108,120, 102,94,88,118,111,108,113,111, 101,137,103,32,71,95,111,96, 97,145,123,85,103,96,79,61, 52,54,86,108,68,157,102,41, 69,71,61,101,99,107,96,119, 73,150,20,28,25,114,26,26, 37,112,46,33,31,22,13,156, 23,49,1,30,13,101,28,20, 32,47,30,71,90,77,68,96, 105,79,95,84,96,64,96,113, 63,97,73,68,104,114,113,65, 121,104,111,119,80,88,85,63, 121,61,65,125,108,129,103,127, 42,53,109,91,120,40,90,107, 68,92,130,92,111,108,134,29, 112,80,111,94,96,54,105,150, 132,48,101,55,61,61,49,94, 106,68,93,88,93,69,69,61, 73,98,117,78,128,133,126,94, 114,78,82,97,141,98,102,65, 75,66,104,102,89,122,99,112, 107,83,114,50,97,149,84,90, 128,149,119,100,113,91,105,79, 132,52,98,96,108,142,94,37, 91,66,96,111,86,94,85,107, 46,66,107,104,113,66,126,117, 117,92,123,126,115,109,116,65, 119,42,129,113,104,53,118,79, 78,127,128,50,61,72,51,99, 121,71,63,62,64,61,69,65, 74,70,74,66,65,54,63,58, 71,84,44,54,50,87,74,66, 113,81,60,152,130,138,134,138, 84,83,129,39,123,95,106,128, 82,84,142,138,113,108,107,57, 118,38,127,106,107,90,120,60, 59,142,45,75,98,85,68,107, 105,90,94,88,71,76,71,67, 72,101,88,64,81,91,95,66, 85,76,67,85,79,82,82,58, 109,96,81,127,113,121,114,123, 73,100,141,107,128,71,80,84, 100,85,121,103,123,126,115,69, 119,72,94,128,109,59,112,26, 83,59,116,115,83,89,73,94, 104,73,90,91,87,88,89,78, 90,76,102,101,111,102,89,43, 82,81,118,96,146,75,100,50, 87,96,96,113,113,106,109,114, 66,58,131,124,106,86,118,114, 132,74,68,119,117,117,117,35, 102,36,125,106,106,24,98,35, 71,128,128,81,81,80,47,96, 73,41,118,138,109,28,78,48, 115,45,110,113,95,133,88,35, 121,38,106,109,103,103,117,18, 44,86,119,71,77,86,76,105, 94,137,71,54,52,142,72,61, 72,154,145,98,92,97,38,93, 58,58,95,69,85,132,127,42, 91,123,55,108,102,106,97,140, 113,65,76,58,62,92,85,62, 80,69,57,64,67,66,51,59, 80,72,50,69,62,68,58,73, 71,60,58,101,115,108,109,118, }; static const uint8 ced_hires_14[1024] = { 127,73,147,96,119,88,105,109, 120,113,103,118,88,140,101,79, 110,127,68,112,151,94,90,83, 125,83,125,127,127,127,127,127, 88,49,130,116,118,52,139,140, 125,89,134,128,134,134,134,59, 124,140,131,139,131,105,148,19, 145,52,137,100,89,91,77,99, 131,71,141,122,104,66,116,138, 125,103,87,103,122,155,146,83, 102,154,109,100,144,109,97,55, 77,116,102,118,110,122,130,121, 134,25,93,100,106,94,68,101, 54,113,93,18,111,141,103,68, 142,68,136,117,127,146,99,18, 62,18,121,110,88,106,105,109, 87,60,100,113,123,88,143,145, 153,119,119,122,136,131,136,80, 113,95,138,130,136,140,128,26, 136,113,85,93,67,79,77,103, 127,99,154,57,97,71,91,93, 125,69,89,116,117,76,110,81, 149,113,85,77,84,90,75,68, 110,72,120,127,127,120,127,123, 107,127,106,67,34,132,96,32, 46,138,56,96,38,110,100,88, 74,63,26,39,49,130,29,120, 45,34,49,93,90,113,96,118, 140,153,112,49,46,136,65,67, 90,152,96,92,122,118,45,150, 69,64,61,68,102,129,71,44, 77,75,33,128,92,127,99,134, 74,133,89,64,55,143,71,52, 72,150,122,145,125,84,137,124, 106,53,105,97,125,131,90,27, 24,49,71,72,81,88,67,109, 83,109,127,124,128,126,144,135, 134,97,122,101,125,134,119,119, 139,155,131,138,129,102,132,22, 146,29,97,71,91,102,87,105, 88,4,133,137,142,3,28,140, 12,31,52,141,80,31,31,20, 149,46,21,114,133,20,2,90, 69,0,136,73,62,95,79,102, 126,68,90,64,87,99,117,82, 91,127,90,92,147,101,142,60, 88,136,120,111,116,77,118,62, 130,67,116,128,121,114,137,119, 79,15,89,109,132,0,34,27, 136,25,159,134,135,122,132,40, 105,35,121,133,141,23,146,2, 28,0,125,76,68,108,72,91, 84,143,121,128,126,72,133,108, 132,41,111,128,115,136,120,118, 117,138,105,130,131,68,130,9, 103,16,120,86,80,91,80,101, 144,57,93,100,91,55,105,70, 103,96,85,94,127,129,150,50, 91,114,94,98,152,63,85,51, 96,92,89,120,109,108,123,111, 121,154,45,60,63,64,68,39, 59,85,56,120,31,120,40,125, 43,86,21,83,136,120,56,36, 80,36,43,124,106,113,123,115, 121,150,74,14,27,151,56,36, 50,150,69,55,34,102,58,106, 39,82,28,56,34,160,40,31, 75,45,39,131,101,109,119,112, 104,54,77,132,55,34,31,18, 17,42,46,106,0,82,44,80, 36,49,0,155,40,40,6,33, 43,19,25,91,101,99,89,114, 112,141,38,57,37,72,43,25, 101,67,64,150,25,96,40,152, 26,69,15,132,116,149,27,18, 62,32,26,112,97,105,106,108, 78,60,127,91,126,42,111,125, 87,96,141,103,122,124,150,40, 122,106,129,108,108,54,120,151, 152,40,108,78,73,81,74,102, 140,74,110,87,99,70,89,78, 91,102,128,88,139,149,142,104, 123,104,100,110,153,97,117,66, 94,57,111,124,100,129,123,119, 112,104,136,78,126,105,142,117, 127,127,143,142,137,115,105,119, 116,69,120,135,123,76,130,29, 62,18,144,114,88,105,106,108, 82,72,125,103,119,67,146,134, 136,96,134,136,126,124,132,75, 129,68,147,127,116,53,133,80, 97,119,135,74,72,91,76,106, 131,76,81,61,69,61,88,82, 92,73,84,76,75,69,78,66, 81,110,61,67,61,85,87,66, 132,71,67,154,139,145,139,146, 84,133,98,52,42,158,37,23, 89,160,53,107,63,86,87,104, 70,38,30,103,87,98,78,0, 32,26,51,80,58,80,75,91, 95,14,130,98,109,14,63,29, 116,13,156,109,122,149,89,39, 70,49,106,128,105,19,149,25, 43,4,137,91,82,95,86,110, 109,107,159,107,134,73,101,102, 119,89,132,114,134,142,131,80, 129,98,112,142,121,59,127,27, 103,51,123,138,94,108,99,102, 123,108,129,80,86,116,133,102, 135,85,156,146,124,112,121,59, 80,90,122,135,124,64,156,40, 93,40,143,127,110,116,125,119, 102,64,148,123,112,87,139,131, 152,77,79,129,128,132,133,45, 111,62,143,119,118,22,113,35, 90,119,135,104,92,99,72,104, 109,48,136,138,115,29,99,66, 134,49,121,124,106,149,104,46, 131,63,124,123,115,103,132,19, 63,78,126,96,88,105,101,112, 117,136,38,70,20,133,49,30, 43,174,47,36,24,27,9,70, 34,75,10,15,28,140,32,25, 69,25,32,117,95,106,112,109, 136,54,77,34,51,77,76,61, 86,49,60,57,54,66,64,51, 69,93,44,77,50,54,57,55, 81,42,72,112,121,115,118,126, }; static const uint8 ced_hires_15[1024] = { 128,67,142,105,122,81,101,108, 115,105,99,113,90,139,98,75, 108,127,69,108,148,90,86,94, 122,79,127,128,128,128,128,128, 69,43,125,125,121,45,135,139, 120,81,130,123,135,133,130,54, 122,137,129,135,128,100,144,30, 140,48,139,91,84,84,66,98, 115,65,136,131,106,59,112,137, 120,95,82,98,123,154,142,78, 100,151,107,96,141,104,93,66, 72,112,103,112,105,119,121,120, 117,20,88,109,109,87,64,100, 48,105,89,13,112,140,99,63, 140,65,134,113,124,141,95,29, 57,14,123,101,83,100,94,108, 68,54,95,122,126,81,139,144, 148,111,115,117,137,130,132,75, 111,92,136,126,133,135,124,37, 131,109,87,85,62,73,66,102, 128,93,149,66,99,65,86,92, 121,64,84,111,119,76,106,76, 146,112,85,74,81,85,71,79, 108,70,121,126,126,117,128,122, 88,121,101,75,36,126,91,31, 42,131,51,91,40,109,96,83, 71,59,25,36,46,125,25,131, 41,30,50,84,85,105,85,117, 121,147,107,57,49,130,60,66, 85,145,91,87,124,117,41,145, 66,61,60,65,99,124,67,55, 72,71,35,119,87,122,89,133, 57,127,84,73,58,136,67,51, 67,142,118,140,126,83,133,119, 104,49,103,93,122,126,86,38, 19,45,73,63,77,81,56,108, 65,103,122,132,130,120,140,134, 129,89,118,96,126,133,115,114, 137,152,130,134,126,97,128,34, 141,25,99,63,86,95,76,104, 69,0,128,145,144,0,23,138, 6,23,47,135,81,30,27,14, 146,42,19,110,129,14,0,100, 64,0,137,63,57,87,67,101, 115,62,85,72,89,93,112,81, 86,120,86,87,149,100,138,56, 85,132,119,108,113,72,114,73, 126,63,117,122,116,111,127,118, 60,9,84,117,134,0,29,27, 131,18,154,129,137,121,128,35, 102,31,120,130,138,19,142,14, 24,0,126,67,63,101,61,91, 65,137,116,137,129,65,129,107, 127,33,107,123,116,135,116,113, 115,135,103,126,128,63,126,20, 98,12,122,77,75,84,70,100, 130,51,88,108,93,49,100,69, 98,89,80,89,129,128,146,44, 88,110,92,95,149,58,81,63, 91,88,91,114,104,105,116,110, 111,148,40,69,66,57,65,38, 55,77,52,115,34,119,36,120, 41,83,19,79,133,115,53,47, 75,32,45,118,101,111,112,114, 109,144,70,22,29,145,51,35, 45,143,64,50,37,101,54,101, 36,78,28,54,31,155,37,42, 71,41,40,124,96,106,108,111, 84,47,72,141,57,27,25,15, 12,34,40,100,1,81,40,74, 33,45,0,151,36,34,1,42, 38,14,26,81,95,91,77,113, 96,135,34,65,40,66,38,23, 96,60,59,145,27,95,36,147, 23,65,15,129,113,144,24,29, 58,28,27,104,92,101,95,107, 59,54,122,100,129,35,107,124, 82,88,137,98,123,123,146,35, 120,103,127,104,105,49,116,162, 147,36,110,70,68,74,63,101, 123,67,105,95,101,63,84,76, 86,94,123,82,140,147,138,98, 120,100,98,106,149,91,112,76, 89,52,112,117,95,126,112,118, 96,98,131,86,128,99,137,116, 122,120,138,137,139,114,101,114, 113,65,119,132,120,71,126,41, 58,14,145,105,83,101,95,107, 63,66,120,112,122,60,142,133, 131,88,130,131,127,123,128,70, 127,65,145,123,113,48,129,91, 92,115,137,65,68,84,65,105, 132,70,76,69,72,54,84,81, 87,66,80,71,77,68,74,62, 78,106,61,63,58,81,84,77, 127,67,68,155,136,142,140,145, 65,127,93,61,45,151,33,22, 84,152,49,102,64,85,83,99, 68,35,28,99,84,93,74,2, 27,22,53,71,53,74,64,90, 76,8,125,107,112,8,59,28, 111,6,152,104,123,148,85,34, 68,46,104,124,102,13,145,36, 38,2,139,82,77,88,75,110, 90,101,154,116,137,66,97,101, 114,81,128,109,135,141,127,75, 127,95,110,138,118,54,123,38, 98,47,125,130,89,101,88,102, 117,102,124,88,89,109,129,101, 130,77,152,141,125,111,117,55, 79,87,120,131,121,58,152,51, 90,36,145,122,105,113,116,118, 83,58,143,132,115,81,134,130, 147,70,74,124,129,131,129,40, 109,59,141,116,115,18,109,46, 85,115,137,95,87,92,61,103, 90,42,131,147,118,23,95,65, 129,41,117,119,107,148,100,41, 129,60,122,119,112,98,128,30, 59,74,128,87,83,99,90,112, 102,130,34,79,23,126,45,29, 38,166,43,32,26,27,5,65, 30,72,8,11,24,135,28,36, 64,21,34,108,90,103,101,108, 121,48,73,42,53,70,71,61, 81,41,56,52,55,65,60,46, 67,89,42,73,48,49,53,67, 76,38,74,106,116,112,115,125, }; static const uint8 ced_hires_16[1024] = { 126,77,94,99,85,77,105,111, 93,98,106,78,81,99,92,92, 100,116,99,119,82,86,89,94, 132,90,87,127,125,126,126,131, 97,47,126,130,125,63,130,137, 117,95,136,122,124,126,123,57, 128,120,120,134,123,99,146,65, 132,56,132,97,96,97,97,110, 143,93,132,131,106,93,114,132, 110,112,123,95,107,141,130,103, 112,132,92,86,131,103,106,111, 132,107,103,143,142,143,143,130, 128,105,112,105,109,106,116,109, 113,112,120,113,104,107,99,110, 114,124,100,102,105,111,112,115, 125,111,116,128,128,128,128,128, 97,58,96,127,131,95,134,142, 146,126,121,116,127,123,126,86, 117,87,128,126,128,135,126,65, 123,114,81,98,96,97,97,110, 157,107,120,109,115,107,128,115, 124,121,137,109,95,107,86,117, 126,146,89,100,96,117,120,125, 146,116,117,157,156,157,157,139, 157,107,120,109,115,107,128,115, 124,121,137,109,95,107,86,117, 126,146,89,100,96,117,120,125, 146,116,117,157,156,157,157,139, 120,155,109,72,78,142,91,78, 87,159,100,85,112,108,49,156, 89,109,52,63,93,123,83,88, 109,79,80,120,119,120,120,118, 119,70,107,128,115,75,90,135, 86,88,99,71,105,140,107,80, 93,159,136,138,115,79,136,87, 118,78,88,120,118,119,119,118, 92,112,123,137,135,133,135,132, 127,104,124,95,116,126,108,126, 143,137,121,134,121,97,130,60, 133,51,92,93,91,92,92,106, 130,80,93,121,88,80,101,88, 97,94,110,82,83,142,131,90, 104,119,62,128,144,100,121,98, 119,89,90,130,129,130,130,123, 148,98,111,100,106,98,119,106, 115,127,128,100,131,98,124,108, 117,137,102,96,97,108,111,116, 137,107,108,148,147,148,148,135, 149,100,112,101,108,100,120,107, 116,113,129,101,88,99,99,110, 118,139,82,93,88,109,112,117, 138,108,110,150,148,149,149,139, 98,145,117,142,133,78,123,105, 125,62,112,122,105,128,109,124, 120,119,94,125,123,58,128,66, 97,57,115,98,97,98,98,112, 145,96,108,110,104,96,116,103, 112,109,125,97,110,112,132,106, 114,135,78,89,137,105,108,113, 134,104,106,146,144,145,145,132, 153,111,124,118,134,108,124,111, 120,117,133,105,101,103,113,113, 122,159,85,115,115,113,116,121, 142,112,113,153,152,153,153,136, 128,112,119,112,116,113,123,116, 120,119,127,120,111,114,106,117, 120,128,106,108,111,117,118,121, 128,117,122,128,128,128,128,128, 120,158,83,72,78,121,91,78, 87,121,100,72,58,70,49,172, 88,108,51,62,58,95,82,87, 108,78,79,119,118,119,119,122, 146,96,109,98,104,96,117,120, 113,110,126,98,94,116,108,106, 130,134,109,118,84,105,108,113, 134,104,105,145,144,145,145,137, 98,58,122,104,132,48,101,121, 75,101,142,96,111,115,138,58, 126,86,118,103,100,57,118,161, 139,56,102,97,96,97,97,111, 139,89,102,96,102,89,110,97, 106,103,124,91,124,135,126,104, 122,127,80,99,141,98,106,106, 127,97,98,138,137,138,138,129, 155,105,128,107,113,105,126,113, 122,119,135,107,93,105,84,115, 133,143,86,97,93,114,117,122, 143,113,114,154,153,154,154,139, 99,72,121,117,126,72,137,131, 129,103,136,130,116,116,121,79, 134,87,137,123,109,58,132,89, 87,121,131,98,97,98,98,111, 154,104,117,106,112,104,125,112, 121,118,134,106,92,104,83,114, 122,142,85,96,92,113,116,121, 142,112,113,153,152,153,153,139, 156,106,119,108,114,106,127,114, 123,120,136,108,94,106,85,116, 124,144,87,98,94,115,118,123, 144,114,115,155,154,155,155,140, 150,101,113,102,109,101,121,108, 117,114,130,102,89,100,80,111, 118,139,82,93,88,109,112,117, 138,108,110,150,148,149,149,140, 118,107,154,120,140,68,89,96, 111,92,132,106,123,133,119,78, 133,106,101,137,113,77,125,85, 106,76,118,122,116,117,117,121, 149,99,112,101,107,99,120,107, 116,113,129,101,102,99,83,109, 117,137,115,96,139,108,111,116, 137,107,108,148,147,148,148,135, 102,62,144,137,119,94,129,128, 144,82,82,123,118,124,122,62, 116,90,133,116,111,61,112,69, 90,121,131,101,100,101,101,110, 156,106,119,108,114,106,127,114, 123,120,136,108,94,106,85,116, 124,144,87,98,94,115,118,123, 144,114,115,155,154,155,155,140, 156,106,119,108,114,106,127,114, 123,120,136,108,94,106,85,116, 124,144,87,98,94,115,118,123, 144,114,115,155,154,155,155,140, 137,88,100,89,96,96,108,95, 104,101,117,89,76,87,67,98, 105,126,69,80,75,96,99,104, 125,95,97,137,135,136,136,123, }; static const uint8 ced_hires_17[1024] = { 89,91,92,133,130,37,125,74, 42,95,144,140,137,137,121,42, 123,75,132,124,133,87,128,83, 74,53,119,94,87,91,93,108, 102,61,121,126,115,65,141,137, 130,96,110,126,137,135,142,73, 128,143,129,129,127,116,147,95, 154,82,141,107,100,103,106,114, 152,89,132,131,102,84,114,134, 128,107,81,104,125,155,153,95, 103,154,108,87,139,120,95,146, 137,146,100,157,150,154,156,136, 130,66,62,72,62,122,86,62, 83,84,58,60,65,91,78,190, 73,115,92,83,85,91,68,123, 115,94,83,135,128,131,134,127, 103,75,93,124,121,103,146,143, 159,127,96,121,140,133,145,96, 118,98,137,121,133,153,128,96, 146,146,90,108,101,104,107,114, 111,83,105,33,129,120,114,135, 102,75,39,131,136,117,141,54, 122,96,138,110,121,62,115,104, 96,75,125,116,109,112,115,120, 131,94,108,84,119,91,141,148, 104,99,90,137,142,121,136,74, 104,117,149,128,125,99,131,125, 116,95,74,136,129,133,135,128, 109,71,69,85,106,85,106,131, 62,57,93,110,101,126,73,52, 116,94,127,130,102,60,143,102, 94,73,52,114,107,118,113,119, 100,147,79,74,50,157,72,48, 76,157,98,143,128,85,145,139, 110,85,103,87,121,143,89,93, 85,84,74,105,98,101,104,112, 97,124,119,134,125,141,147,132, 139,104,99,100,129,135,127,134, 143,159,130,128,125,115,131,91, 155,61,101,102,95,99,101,109, 101,37,124,147,139,33,57,137, 54,39,29,139,83,34,39,44, 153,86,16,104,129,52,39,151, 86,65,140,106,99,102,105,116, 159,95,91,81,81,113,115,91, 112,133,87,89,150,97,149,102, 102,144,118,100,111,110,113,152, 144,123,117,164,157,160,163,142, 86,23,75,47,132,18,43,105, 39,54,141,105,128,124,110,29, 89,72,105,147,131,38,115,80, 71,50,78,91,84,88,90,107, 103,158,113,138,124,86,135,105, 137,41,88,127,119,137,128,133, 120,142,104,120,127,81,129,97, 111,67,124,108,101,105,107,116, 156,93,94,108,84,88,113,88, 109,99,85,92,130,128,156,99, 99,142,88,85,147,108,94,150, 141,120,99,161,154,158,160,138, 98,50,162,115,131,30,54,149, 51,46,135,121,106,128,119,41, 135,83,109,116,138,49,147,91, 83,62,136,103,96,99,102,111, 160,171,92,82,82,172,116,92, 113,164,88,90,85,109,82,129, 97,139,69,66,71,175,92,147, 139,118,97,159,152,155,158,137, 129,176,77,84,94,159,85,102, 82,160,57,105,70,85,71,176, 89,108,48,73,73,173,81,116, 108,87,76,128,121,124,127,122, 180,139,119,109,109,119,143,119, 140,135,125,117,112,120,109,130, 124,166,112,93,98,160,119,174, 166,145,124,180,179,177,180,152, 156,139,88,78,116,166,138,88, 109,177,94,86,81,89,111,115, 93,135,95,88,77,162,98,171, 135,114,93,155,148,151,154,133, 156,92,106,103,101,88,112,88, 114,119,110,91,149,156,157,125, 129,135,101,102,152,114,117,143, 135,114,116,155,148,151,154,133, 152,109,131,74,109,171,109,112, 159,167,115,117,135,115,136,115, 148,132,118,103,119,157,112,140, 131,110,109,151,144,148,150,134, 112,94,124,121,124,90,156,139, 149,111,118,142,137,133,148,98, 137,91,149,121,116,67,136,145, 107,155,143,111,104,107,110,113, 180,119,115,104,105,114,139,114, 135,120,111,113,108,115,104,125, 119,162,92,88,93,128,114,170, 161,140,119,178,174,174,178,149, 128,111,146,50,134,118,137,150, 112,103,137,155,135,132,138,87, 135,108,147,113,118,105,137,126, 107,169,65,127,120,124,126,122, 109,46,52,31,32,41,66,41, 62,47,127,60,65,52,41,52, 46,89,19,130,30,55,41,97, 88,67,66,108,101,105,107,132, 131,129,158,124,139,93,111,106, 131,102,116,120,145,150,146,102, 136,111,114,135,120,77,129,119, 110,89,130,146,123,127,129,123, 171,107,103,101,93,108,127,103, 124,109,99,114,130,122,116,114, 108,150,135,102,155,116,111,158, 150,129,108,170,163,166,169,141, 115,87,147,141,117,109,149,136, 164,92,64,135,139,141,148,71, 119,94,145,113,118,60,116,102, 99,155,143,114,107,110,113,112, 180,125,121,120,111,120,145,120, 141,126,117,119,130,121,126,131, 125,168,98,94,99,134,120,176, 167,146,125,180,179,177,180,152, 108,45,99,103,139,40,96,117, 61,87,85,145,139,127,138,51, 127,88,152,133,136,64,131,96, 87,66,135,107,100,104,106,112, 157,94,95,80,80,109,114,90, 119,96,86,88,83,91,80,101, 95,137,67,64,69,103,90,145, 137,116,95,154,150,150,154,125, }; static const uint8 ced_hires_18[1024] = { 100,47,105,106,88,37,119,122, 76,90,99,47,87,103,100,98, 95,121,106,126,89,84,80,50, 146,101,49,119,100,126,121,130, 74,55,134,135,131,65,138,145, 126,83,147,122,129,128,131,71, 130,133,126,138,131,103,151,36, 145,59,129,97,84,83,73,90, 123,78,145,142,117,80,115,143, 127,97,99,98,117,149,143,95, 108,146,104,100,145,107,101,72, 83,123,94,119,107,123,126,111, 102,42,63,81,78,121,44,64, 50,73,66,32,62,84,68,187, 77,62,89,92,89,80,66,40, 63,66,76,102,89,103,100,106, 72,67,105,133,136,102,142,150, 155,114,132,117,131,125,133,93, 119,88,133,130,137,139,132,46, 137,120,78,89,64,76,73,94, 94,75,117,44,144,118,110,142, 98,61,78,127,127,109,129,55, 123,48,134,119,125,45,118,38, 80,35,112,83,72,101,83,96, 95,87,122,95,134,91,137,156, 101,88,126,133,133,114,125,79, 107,76,145,138,130,85,136,69, 79,46,38,117,85,112,100,104, 124,160,116,69,60,150,64,73, 92,147,109,87,118,112,42,163, 75,62,57,68,103,128,75,63, 80,83,28,120,89,124,96,125, 94,66,118,135,120,83,97,144, 63,76,82,62,110,143,115,69, 85,171,142,143,125,71,143,43, 138,58,89,97,78,95,93,94, 67,116,131,143,140,140,143,140, 136,91,135,96,120,128,115,131, 145,148,127,138,130,101,135,42, 146,37,89,70,86,94,79,96, 101,82,86,128,82,78,65,84, 68,60,103,72,89,145,141,49, 109,135,73,134,155,108,128,81, 135,61,70,108,97,107,117,96, 123,75,94,83,100,113,116,87, 92,122,102,87,143,94,139,71, 93,129,116,111,117,75,121,80, 131,72,108,126,118,118,133,111, 125,126,107,111,110,90,98,100, 104,78,136,102,98,121,122,116, 113,113,88,103,108,91,109,90, 113,82,103,166,118,129,154,121, 71,150,125,148,139,85,131,113, 134,35,124,123,110,130,117,130, 123,131,100,130,132,66,133,26, 103,24,112,82,78,81,75,92, 134,66,98,119,103,70,104,77, 104,91,98,89,123,122,146,64, 97,108,89,98,153,65,88,72, 98,100,82,121,109,113,126,105, 134,123,148,135,153,131,131,112, 86,89,109,114,122,118,134,113, 106,183,104,135,137,97,127,140, 120,93,88,129,122,120,132,113, 95,138,100,94,128,146,84,59, 64,158,26,72,140,108,64,96, 48,37,129,66,66,162,79,20, 36,60,93,75,70,90,70,98, 95,163,41,47,45,129,41,47, 56,110,67,38,37,31,25,179, 45,69,19,50,32,105,52,43, 62,51,33,101,100,101,98,98, 122,92,117,103,114,78,115,136, 82,95,96,73,110,123,125,87, 143,128,130,139,99,92,109,87, 147,65,68,148,119,143,129,127, 68,66,131,110,138,55,109,130, 88,90,153,97,117,117,146,52, 134,105,130,114,115,58,129,176, 158,53,106,82,71,82,78,96, 129,80,114,106,112,83,88,82, 92,96,140,82,134,142,139,116, 135,103,101,116,160,101,127,91, 102,70,110,124,105,134,125,113, 123,95,135,69,116,163,102,112, 149,147,143,105,119,100,118,101, 153,80,118,115,127,146,119,62, 116,70,102,133,102,113,117,109, 70,78,129,122,132,80,145,139, 137,90,147,130,121,118,129,87, 141,67,148,133,123,58,143,105, 104,132,134,80,74,95,79,100, 136,82,86,79,83,76,90,87, 92,67,102,69,70,65,74,80, 92,115,66,71,68,91,96,94, 140,85,71,156,136,150,142,140, 104,96,151,58,141,110,125,150, 102,82,165,143,118,117,119,80, 140,61,146,125,125,94,144,85, 85,147,50,100,110,107,95,109, 122,103,115,106,89,90,88,87, 92,99,110,70,86,100,108,86, 107,107,86,104,98,85,106,87, 134,101,84,138,122,134,133,128, 93,113,163,126,146,86,99,107, 120,83,144,108,129,135,127,92, 141,96,113,148,128,63,136,50, 109,64,121,140,95,106,100,97, 128,86,112,109,106,102,108,101, 111,75,126,105,117,111,101,66, 104,108,137,116,165,81,125,82, 114,102,102,129,126,121,134,116, 89,71,152,143,125,101,137,136, 153,72,92,124,123,126,129,57, 123,62,145,126,125,29,123,61, 97,133,134,107,94,103,79,98, 99,71,108,117,119,66,122,99, 108,25,83,132,126,131,130,88, 120,83,124,123,119,71,105,40, 88,140,139,89,119,109,90,120, 109,146,119,71,82,143,99,110, 107,147,49,135,131,127,53,105, 80,80,69,92,140,135,125,42, 60,114,37,69,92,91,80,109, 129,78,95,77,81,106,104,83, 99,66,82,66,73,73,63,80, 101,97,69,88,80,74,80,98, 98,65,64,114,130,119,121,120, }; static const uint8 ced_hires_19[1024] = { 98,93,104,135,134,69,120,71, 84,99,150,144,141,141,121,77, 123,96,135,127,139,85,130,83, 94,88,120,97,97,97,97,113, 110,85,134,128,119,81,138,142, 127,104,115,130,141,138,142,90, 128,119,133,131,132,117,148,95, 129,101,142,109,109,109,109,119, 145,120,126,112,107,116,133,123, 131,123,115,115,110,142,136,124, 123,143,99,95,128,132,120,130, 141,135,125,144,144,144,144,134, 134,109,115,93,96,120,122,107, 120,112,104,104,99,106,91,186, 112,132,88,84,92,121,109,119, 130,124,114,133,133,133,133,130, 111,86,102,124,125,107,142,148, 156,131,104,126,144,136,144,90, 119,109,140,123,138,153,129,96, 122,136,91,110,110,110,110,118, 118,93,119,78,133,123,107,139, 104,97,88,134,139,118,140,98, 122,117,141,111,125,105,113,103, 114,109,123,117,117,117,117,124, 135,110,116,95,117,106,124,148, 121,114,105,136,141,117,132,115, 114,134,148,125,126,122,125,120, 131,126,115,134,134,134,134,130, 117,92,98,86,109,98,105,136, 103,95,97,112,105,129,74,96, 110,115,130,131,106,104,144,102, 113,107,97,116,116,116,116,123, 108,150,89,67,70,160,96,81, 94,161,103,147,132,80,144,139, 109,106,105,88,126,143,83,93, 104,98,88,107,107,107,107,117, 106,127,132,135,129,144,143,138, 136,107,104,103,133,139,126,134, 143,136,133,131,131,114,133,91, 130,96,102,105,105,105,105,114, 109,84,137,148,143,80,97,142, 95,87,79,143,84,81,66,88, 152,107,63,106,134,96,84,104, 105,99,141,108,108,108,108,120, 146,121,127,106,108,117,135,119, 132,125,116,116,133,118,126,126, 125,145,101,96,104,133,121,131, 142,137,126,145,145,145,145,136, 95,70,86,54,136,66,83,111, 81,73,147,109,132,128,110,74, 88,93,108,151,137,82,117,80, 91,85,75,94,94,94,94,111, 112,161,124,140,127,83,131,110, 135,90,92,132,123,141,128,133, 120,110,106,123,133,99,130,97, 108,102,125,111,111,111,111,121, 145,120,126,105,107,116,134,118, 131,124,115,115,115,117,137,125, 124,144,100,95,132,132,120,130, 141,136,125,144,144,144,144,135, 148,123,129,107,115,119,136,121, 134,126,118,118,113,120,115,127, 126,146,102,103,111,135,123,133, 144,138,128,147,147,147,147,136, 147,153,128,106,109,118,135,120, 133,153,117,117,112,119,104,126, 126,146,102,108,106,165,123,133, 144,138,128,147,147,147,147,136, 132,174,113,92,94,156,121,105, 118,160,102,102,97,104,90,172, 112,132,88,83,91,175,108,118, 129,124,113,132,132,132,132,127, 152,127,133,112,114,123,141,125, 138,131,122,122,117,124,110,132, 132,152,108,103,111,140,128,138, 149,144,133,152,152,152,152,138, 117,92,136,107,132,88,105,132, 103,110,127,110,134,133,162,96, 133,116,138,108,116,105,127,176, 144,108,118,117,117,117,117,120, 148,123,129,107,110,119,136,121, 134,126,118,118,135,141,139,127, 127,147,103,99,147,136,124,134, 145,139,129,148,148,148,148,134, 148,123,129,107,110,162,136,121, 144,159,118,118,123,120,120,127, 142,147,113,99,117,151,124,134, 145,139,129,148,148,148,148,135, 117,92,133,120,125,98,149,141, 144,116,122,143,138,132,145,97, 142,117,157,127,125,105,141,103, 114,150,148,117,117,117,117,120, 153,128,134,112,115,124,141,126, 139,131,123,123,118,125,110,132, 132,152,108,104,112,141,129,139, 150,144,134,153,153,153,153,138, 132,107,153,92,134,113,121,151, 118,111,137,154,135,129,133,112, 140,132,153,117,125,120,141,118, 129,163,113,132,132,132,132,127, 113,88,94,73,75,84,102,86, 99,92,127,83,78,85,71,93, 93,113,69,135,72,101,89,99, 110,105,94,113,113,113,113,129, 135,125,166,120,137,106,124,108, 121,114,115,115,143,149,142,115, 138,135,119,140,128,123,131,121, 132,127,131,135,135,135,135,129, 151,126,132,111,113,122,140,124, 137,130,121,121,116,123,109,131, 131,151,114,102,138,139,127,137, 148,143,132,151,151,151,151,137, 120,95,157,140,118,108,142,138, 158,99,90,136,140,141,145,100, 121,120,153,120,127,108,119,106, 117,149,148,120,120,120,120,119, 136,111,140,151,118,107,124,109, 137,114,106,126,111,155,113,115, 138,135,129,118,120,124,137,122, 133,127,132,136,136,136,136,131, 151,146,132,110,113,145,139,124, 137,154,121,121,116,123,108,130, 130,150,106,102,110,139,127,137, 148,142,132,151,151,151,151,137, 146,121,127,105,108,117,134,119, 132,124,116,116,111,118,103,125, 125,145,101,97,105,134,122,132, 143,137,127,146,146,146,146,131, }; static const uint8 ced_hires_20[1024] = { 111,51,50,66,67,37,61,60, 62,52,151,76,117,107,89,44, 64,85,123,112,43,48,109,55, 80,47,73,105,103,120,107,126, 99,78,66,40,113,81,103,136, 51,33,85,110,79,133,68,53, 121,80,125,133,107,49,144,49, 79,46,58,104,94,114,94,119, 82,89,103,144,141,45,125,85, 60,80,142,139,139,140,118,46, 133,65,134,127,134,77,126,29, 65,28,130,79,73,84,74,99, 148,112,111,112,105,115,135,114, 133,109,103,112,104,109,99,132, 123,145,97,101,94,117,110,138, 144,123,128,148,147,147,148,137, 97,70,96,138,128,103,151,149, 163,109,95,119,143,133,146,96, 122,107,138,122,134,143,125,67, 141,129,98,104,95,92,94,114, 112,73,108,62,136,120,118,141, 105,57,53,129,139,116,142,70, 126,92,139,111,122,64,111,67, 100,63,134,104,102,110,102,119, 126,53,74,82,77,64,78,76, 74,51,58,72,68,60,68,61, 85,102,50,148,65,58,59,77, 97,64,90,122,116,120,117,129, 94,50,95,141,134,56,69,127, 60,37,151,133,141,146,122,58, 115,74,138,121,145,52,105,44, 78,35,128,96,85,89,89,105, 93,143,83,89,63,158,83,60, 83,139,98,142,132,86,147,141, 115,84,105,89,123,134,85,67, 69,69,82,94,100,99,89,116, 92,119,122,149,133,142,152,139, 144,87,98,98,132,136,128,136, 148,160,131,130,127,105,129,63, 151,58,111,91,104,103,95,113, 148,106,116,121,106,102,130,108, 127,89,97,117,103,117,112,113, 133,145,97,94,107,111,109,132, 144,121,140,148,147,147,148,137, 96,26,70,54,136,23,56,118, 57,39,143,109,136,129,114,24, 102,75,104,149,132,26,115,40, 62,32,99,95,91,85,89,104, 122,116,63,61,63,156,88,58, 77,162,52,66,68,77,80,112, 84,106,43,53,46,123,55,75, 100,67,77,125,117,120,120,120, 137,128,86,79,104,158,111,95, 93,154,68,90,84,84,82,113, 113,121,63,81,93,155,94,91, 115,82,99,136,132,131,136,128, 91,40,166,130,139,40,74,156, 53,33,137,119,108,132,120,47, 139,70,109,117,140,49,148,47, 74,31,142,89,83,85,84,103, 113,165,84,84,91,133,107,85, 101,142,80,94,94,82,76,158, 92,97,86,89,67,171,112,67, 91,63,89,116,108,115,112,117, 84,151,102,50,102,126,72,103, 59,149,74,148,115,116,104,148, 125,78,106,107,133,146,137,43, 60,158,87,85,79,92,80,104, 115,72,78,158,69,65,71,53, 67,50,47,103,38,82,62,99, 72,98,29,152,56,69,47,84, 93,67,72,118,125,119,113,127, 116,167,96,89,95,156,80,88, 85,135,64,95,66,79,70,161, 97,98,65,84,85,166,84,67, 92,59,94,117,117,113,112,116, 95,66,122,116,132,60,119,129, 93,85,117,101,129,126,160,66, 136,118,134,105,111,69,122,180, 161,71,127,101,101,101,96,115, 148,107,121,119,120,108,132,120, 135,112,126,122,123,123,121,115, 140,147,122,115,120,131,127,129, 146,120,138,149,149,149,149,138, 145,100,125,89,108,164,120,114, 156,141,106,107,130,110,130,109, 154,126,119,105,123,147,113,96, 136,98,123,146,132,131,136,131, 96,81,121,129,125,83,154,139, 147,86,111,134,134,126,142,92, 143,98,152,124,120,68,135,108, 111,140,154,101,101,106,99,117, 148,101,97,103,91,93,119,102, 119,82,86,90,96,95,97,105, 112,145,87,80,83,109,104,119, 153,110,113,160,153,158,154,146, 96,28,42,33,46,35,53,45, 49,31,126,40,50,53,52,43, 68,80,39,131,35,47,41,50, 74,51,47,99,104,105,97,134, 148,137,108,111,112,125,128,118, 139,87,95,116,95,112,110,149, 117,147,86,88,103,140,105,130, 146,146,127,149,149,149,149,138, 148,129,121,142,101,121,132,114, 128,114,99,114,126,128,120,128, 126,147,104,99,97,132,116,156, 146,121,126,149,149,149,149,138, 94,39,97,117,138,45,88,117, 67,38,75,139,136,117,133,55, 139,78,153,138,143,54,128,55, 79,53,151,97,89,100,92,107, 108,73,144,149,117,103,147,136, 162,65,59,127,136,135,143,70, 126,97,148,117,122,55,115,79, 109,140,154,117,114,112,100,115, 148,128,120,108,115,137,133,110, 129,119,99,112,110,115,116,137, 127,147,98,107,93,131,122,130, 146,149,127,149,149,149,149,138, 90,141,92,62,123,145,98,94, 71,157,54,115,84,131,112,151, 121,73,99,126,103,146,129,51, 68,144,73,93,87,100,88,107, 137,80,87,78,75,97,105,85, 110,75,63,75,82,82,81,90, 99,126,66,86,72,87,81,105, 118,85,106,131,142,134,137,133, }; static const uint8 ced_hires_21[1024] = { 83,35,83,86,68,31,99,99, 55,99,74,45,80,93,87,75, 79,100,91,111,76,86,61,33, 125,101,49,100,98,111,105,129, 59,43,112,116,111,56,117,121, 105,92,122,118,122,117,117,48, 113,112,111,124,119,105,131,14, 124,58,128,80,75,64,53,89, 102,65,123,122,96,71,94,119, 105,106,73,93,110,138,129,71, 91,126,89,85,132,109,80,55, 63,122,92,108,98,117,104,108, 87,29,40,62,58,112,27,40, 29,82,41,27,55,73,54,164, 60,39,74,78,77,82,45,14, 40,65,75,85,83,89,81,104, 56,54,82,113,116,92,121,126, 133,122,107,112,124,114,119,69, 102,67,118,115,124,140,111,23, 115,119,76,70,57,61,58,92, 78,62,95,25,124,109,90,119, 76,70,53,123,120,99,116,31, 107,29,119,104,112,46,98,15, 58,34,111,65,65,82,61,97, 81,74,99,75,114,81,117,133, 79,96,101,129,126,104,112,55, 91,50,130,123,117,86,115,48, 57,41,32,98,76,95,82,105, 107,147,94,49,39,141,43,49, 70,156,84,83,111,101,28,140, 58,35,42,54,90,129,55,41, 53,82,24,102,79,105,77,124, 75,53,95,115,100,73,77,121, 43,85,59,58,103,133,102,46, 69,150,127,128,112,72,122,25, 117,58,87,80,75,79,76,97, 52,103,109,123,121,131,123,117, 114,100,110,92,113,118,102,108, 129,127,111,123,117,103,115,21, 125,36,88,52,79,81,65,95, 87,70,63,109,62,69,46,61, 46,69,77,67,83,135,128,27, 93,114,58,120,143,110,108,59, 114,61,69,92,90,96,100,95, 109,61,71,65,81,104,96,64, 70,131,79,83,136,84,125,49, 77,107,101,97,105,80,101,61, 111,75,106,115,115,112,116,109, 112,114,84,92,90,82,79,75, 83,89,111,97,91,110,108,93, 97,93,73,90,96,92,89,68, 88,77,101,154,114,122,143,121, 53,137,103,128,119,76,111,90, 112,44,99,119,103,120,104,107, 107,110,85,115,119,68,113,4, 82,21,111,63,72,62,54,91, 115,54,75,100,84,61,84,54, 83,100,70,85,116,112,133,43, 80,88,74,84,141,60,68,52, 81,99,81,113,103,108,109,105, 120,111,126,115,133,122,111,89, 67,99,81,110,116,108,120,90, 90,163,89,121,125,100,107,119, 103,94,88,124,116,114,122,112, 102,136,101,31,69,99,109,94, 95,151,120,85,100,94,78,59, 51,53,85,107,69,157,101,38, 64,67,59,99,103,108,95,116, 79,150,19,27,24,119,22,24, 34,118,44,32,28,19,11,155, 18,43,0,29,14,101,25,9, 34,44,25,79,93,78,75,98, 109,79,94,83,94,67,94,111, 63,103,71,67,102,112,111,62, 121,102,109,118,80,89,83,60, 119,63,60,126,109,130,110,127, 52,53,108,90,118,45,88,105, 66,98,128,92,109,106,132,29, 112,78,109,93,96,54,103,149, 131,47,99,57,55,61,53,92, 113,67,91,86,91,74,66,59, 71,104,115,78,126,131,125,92, 113,78,81,96,142,98,101,64, 76,66,103,108,98,123,99,112, 107,81,112,47,95,153,81,88, 126,155,117,100,111,89,104,77, 131,53,97,95,109,142,93,38, 90,63,95,109,89,98,95,108, 53,65,106,102,111,70,124,115, 115,98,121,126,113,107,115,63, 119,40,128,113,105,54,117,78, 77,126,127,58,62,74,59,98, 130,70,67,61,62,63,68,65, 77,75,76,63,59,56,60,58, 74,89,44,52,52,89,72,70, 112,74,65,152,122,141,139,137, 87,83,128,38,121,100,104,126, 80,90,140,138,111,106,105,56, 118,38,125,105,107,90,118,59, 57,141,42,74,97,86,75,106, 113,89,93,86,69,80,73,66, 73,107,89,65,79,88,93,67, 86,81,65,83,79,83,81,62, 108,93,80,129,114,126,119,125, 72,100,140,106,126,76,78,82, 98,91,119,103,121,124,113,68, 119,69,92,127,109,58,110,23, 82,57,114,116,85,81,78,92, 114,71,89,89,85,92,85,77, 88,84,100,100,109,99,87,42, 81,78,116,95,146,76,98,54, 89,93,94,119,114,113,115,110, 73,57,129,122,104,91,116,112, 130,80,66,119,115,115,115,33, 101,33,124,105,107,25,97,34, 70,127,127,84,81,81,57,94, 74,41,117,137,107,32,76,46, 113,50,108,113,93,131,86,33, 121,33,104,108,103,103,115,9, 34,85,117,79,74,86,80,101, 105,136,69,50,52,146,69,59, 68,160,143,98,90,95,36,91, 54,64,94,68,86,132,126,39, 89,121,50,110,105,109,106,138, 119,64,72,56,60,96,83,58, 74,75,59,61,65,63,48,59, 78,73,49,68,62,65,54,71, 69,57,57,111,119,111,115,117, }; ================================================ FILE: third_party/ced/compact_enc_det/compact_enc_det_hint_code.cc ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #include "compact_enc_det/compact_enc_det_hint_code.h" #include // for isalpha #include // for NULL, memchr, strlen, etc #include "util/basictypes.h" // for uint8, uint32 #include "util/string_util.h" // Upper to lower, keep digits, everything else to minus '-' (2d) static const char kCharsetToLowerTbl[256] = { 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, 0x38,0x39,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x61,0x62,0x63,0x64,0x65,0x66,0x67, 0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, 0x78,0x79,0x7a,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x61,0x62,0x63,0x64,0x65,0x66,0x67, 0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f, 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, 0x78,0x79,0x7a,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, 0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d,0x2d, }; static const char kIsAlpha[256] = { 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,0,0,0,0,0, 0,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }; static const char kIsDigit[256] = { 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1, 1,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, }; static const char* kFakeEncodingName[] = { "FakeEnc100", "FakeEnc101", "FakeEnc102", "FakeEnc103", "FakeEnc104", "FakeEnc105", "FakeEnc106", "FakeEnc107", "FakeEnc108", "FakeEnc109", "FakeEnc110", "FakeEnc111", "FakeEnc112", "FakeEnc113", "FakeEnc114", "FakeEnc115", "FakeEnc116", "FakeEnc117", "FakeEnc118", "FakeEnc119", }; static const char* kFakeEncodingName2[] = { "FakeEnc_0", "FakeEnc_1", "FakeEnc_2", "FakeEnc_3", "FakeEnc_4", }; // Return name for extended encoding const char* MyEncodingName(Encoding enc) { if (enc < 0) { return "~"; } if (enc == ISO_8859_1) { return "Latin1"; // I can't stand "ASCII" for this } if (enc < NUM_ENCODINGS) { return EncodingName(enc); } // allow fake names, for exploration if ((NUM_ENCODINGS <= enc) && (enc < (NUM_ENCODINGS + 4))) { return kFakeEncodingName2[enc - NUM_ENCODINGS]; } if ((100 <= enc) && (enc < 120)) { return kFakeEncodingName[enc - 100]; } return "~"; } // Normalize ASCII string to first 4 alphabetic chars and last 4 digit chars // Letters are forced to lowercase ASCII // Used to normalize charset= values string MakeChar44(const string& str) { string res("________"); // eight underscores int l_ptr = 0; int d_ptr = 0; for (uint32 i = 0; i < str.size(); ++i) { uint8 uc = static_cast(str[i]); if (kIsAlpha[uc]) { if (l_ptr < 4) { // Else ignore res[l_ptr] = kCharsetToLowerTbl[uc]; l_ptr++; } } else if (kIsDigit[uc]) { if (d_ptr < 4) { res[4 + d_ptr] = kCharsetToLowerTbl[uc]; } else { // Keep last 4 digits by shifting left res[4] = res[5]; res[5] = res[6]; res[6] = res[7]; res[7] = kCharsetToLowerTbl[uc]; } d_ptr++; } // If neither letter nor digit, drop entirely } return res; } // Normalize ASCII string to first 8 alphabetic/digit chars // Letters are forced to lowercase ASCII // Used to normalize TLD values string MakeChar4(const string& str) { string res("____"); // four underscores int l_ptr = 0; for (uint32 i = 0; i < str.size(); ++i) { uint8 uc = static_cast(str[i]); if (kIsAlpha[uc] | kIsDigit[uc]) { if (l_ptr < 4) { // Else ignore res[l_ptr] = kCharsetToLowerTbl[uc]; l_ptr++; } } } return res; } // Normalize ASCII string to first 8 alphabetic/digit chars // Letters are forced to lowercase ASCII // Used to normalize TLD values string MakeChar8(const string& str) { string res("________"); // eight dots int l_ptr = 0; for (uint32 i = 0; i < str.size(); ++i) { uint8 uc = static_cast(str[i]); if (kIsAlpha[uc] | kIsDigit[uc]) { if (l_ptr < 8) { // Else ignore res[l_ptr] = kCharsetToLowerTbl[uc]; l_ptr++; } } } return res; } ================================================ FILE: third_party/ced/compact_enc_det/compact_enc_det_hint_code.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef COMPACT_ENC_DET_COMPACT_ENC_DET_HINT_CODE_H_ #define COMPACT_ENC_DET_COMPACT_ENC_DET_HINT_CODE_H_ #include // for string #include "util/basictypes.h" // for uint32 #include "util/encodings/encodings.h" // for Encoding using std::string; // Return name for extended encoding const char* MyEncodingName(Encoding enc); // Normalize ASCII string to first 4 alphabetic chars and last 4 digit chars // Letters are forced to lowercase ASCII // Used to normalize charset= values string MakeChar44(const string& str); // Normalize ASCII string to first 4 alphabetic/digit chars // Letters are forced to lowercase ASCII // Used to normalize TLD values string MakeChar4(const string& str); // Normalize ASCII string to first 8 alphabetic/digit chars // Letters are forced to lowercase ASCII // Used to normalize other values string MakeChar8(const string& str); #endif // COMPACT_ENC_DET_COMPACT_ENC_DET_HINT_CODE_H_ ================================================ FILE: third_party/ced/compact_enc_det/compact_enc_det_unittest.cc ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #include "compact_enc_det/compact_enc_det.h" #include // for fprintf, stderr, FILE, etc #include // for strlen, NULL #include // for string #include "gtest/gtest.h" #include "util/basictypes.h" #include "util/commandlineflags.h" #include "util/varsetter.h" // for VarSetter using std::string; DECLARE_bool(enc_detect_detail); DECLARE_bool(ced_allow_utf8utf8); DEFINE_int32(trackme, -1, "Track this encoding in --enc_detect_detail output"); static const char kDetailHead[] = #include "compact_enc_det/detail_head_string.inc" // IWYU pragma: keep ; // escape PostScript string (no parens) string PsStr(const char* str) { string res(""); for (size_t i = 0; i < strlen(str); ++i) { char c = str[i]; if (c == '(') {res.append("\\(");} else if (c == ')') {res.append("\\)");} else if (c == '\\') {res.append("\\\\");} else {res.append(1, c);} } return res; } void PsCopyHeader(FILE* psfile) { // Write all but the trailing NUL fwrite(kDetailHead, 1, sizeof(kDetailHead) - 1, psfile); if (FLAGS_trackme >= 0) { fprintf(psfile, "/track-me %d def\n\n", FLAGS_trackme); } } void PsEndfile(FILE* psfile, int pagenum) { fprintf(psfile, "showpage\n\n"); } // Test strings. These are all included here to make the unit test self-contained. const char* kTeststr00 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/pt_wikipedia_org_clean__ASCII.txt " a Al-Qaeda causa a morte a 202 pessoas. 2003 - Michael Schumacher, conq" "uista o Hexa na F\xF3""rmula 1. Nasceram neste dia... 1537 - Rei Eduardo" " VI de Inglaterra (m. 1553) 1798 - Imperador Pedro I do Brasil (Pedro IV" " de Portugal, foto). 1923 - Fernando Sabino, escritor e jornalista brasi" "leiro (m. 2004) 1935 - Luciano Pavarotti, cantor l\xED""rico italiano Fa" "leceram neste dia... 638 - Papa Hon\xF3""rio I 1965 - Paul Hermann M\xFC""" "ller, qu\xED""mico su\xED""\xE7""o (n. 1899) 1992 - Ulysses Guimar\xE3""" "es, pol\xED""tico brasileiro (n. 1916) Outros dias: 10 \xB7"" 11 \xB7"" " "12 \xB7"" 13 \xB7"" 14 | ver todos... Sabia que... Durante 400 anos, n\xE3""" "o choveu no deserto do Atacama? E que esse \xE9"" o maior per\xED""odo s" "em chuvas j\xE1"" registrado? Fala, o c\xE3""o do presidente Franklin Ro" "osevelt, tornou-se um soldado raso honor\xE1""rio do Ex\xE9""rcito Ameri" "cano ao \"contribuir\" com um d\xF3""lar para o esfor\xE7""o de guerra p" "ara cada dia do ano? O primeiro presidente da Academia Brasileira de Let" "ras foi Machado de Assis, aclamado em 15 de Dezembro de 1896? O visual d" "os personagens Princesa Jasmine e Aladdin, do filme Aladdin, cl\xE1""ssi" "co de anima\xE7""\xE3""o da Disney de 1992, foi inspirado no visual da a" "triz Jennifer Connelly e do ator Tom Cruise? Llanfairpwllgwyngyllgogeryc" "hwyrndrobwllllantysiliogogogoch \xE9"" a cidade com o maior n\xFA""mero " "de letras do mundo, com 58 letras? A escritora brasileira Clarice Lispec" "tor nasceu na Ucr\xE2""nia? arquivo Eventos recentes O escritor turco Or" "han Pamuk \xE9"" galardoado com o Pr\xE9""mio Nobel da Literatura. Avi\xE3""" "o particular do jogador de basebol Cory Lidle colide com pr\xE9""dio res" "idencial em Nova Iorque. Google adquire o maior servi\xE7""o de v\xED""d" "eos da internet, o YouTube, por 1,65 bilh\xE3""o de d\xF3""lares. Coreia" " do Norte realiza pela primeira vez um teste nuclear subterr\xE2""neo, a" "lvo de fortes cr\xED""ticas pela comunidade internacional. Erup\xE7""\xE3""" "o de vulc\xE3""o causa p\xE2""nico na Papua Nova Guin\xE9""; o calor e o" "s ventos causados foram respons\xE1""veis pelo estilha\xE7""amento das j" "anelas de resid\xEA""ncias num raio de at\xE9"" doze quil\xF3""metros. A" "nna Politkovskaia, jornalista russa conhecida pelas cr\xED""ticas ao gov" "erno de Vladimir Putin, foi assassinada em Moscovo. T\xEA""m in\xED""cio" " os primeiros Jogos da Lusofonia em Macau. OTAN assume comando das tropa" "s no Afeganist\xE3""o. Brasil decidir\xE1"" em segundo turno a" ; // By design, this is the most sensitive test of the bunch, i.e. the most // likely to fail when the encoding detector is changed. // On a good day, Latin4 will be only about 2**2 more likely than Latin2. // In real input, Latin4 is almost always accompanied by a charset= hint // const char* kTeststr03 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/lt_wikipedia_org_clean__Latin4.txt // Hand-edit to boost Latin4 by small amounts. Bigrams here must differ or // CED will ignore duplicates. ", kuria neteko vis\xF9"". savo va" ", kuria neteko vis\xF9""j savo va" "Kor\xEC""jai " "\xE7""vykiai " "kra\xB9""tus " "Pr\xFE""sija " "t\xFE""k " // end hand-edit " yra interneto enciklopedija, kuri\xB1"" skaityti, tobulinti ir pildyti " "gali visi \xBE""mon\xEC""s, be joki\xF9"" apribojim\xF9"" ar mokes\xE8""" "i\xF9"". Vikipedij\xB1"" galima skaityti daugiau nei \xB9""imtu kalb\xF9""" "; lietuvi\xB9""kuosiuose puslapiuose apra\xB9""ytos daugiau nei 30 t\xFE""" "kstan\xE8""i\xF9"" tem\xF9"", skai\xE8""ius nuolat auga. Daugiau informa" "cijos apie Vikipedij\xB1"" Spalio 12 dienos \xE7""vykiai Lietuvoje infor" "macija ruo\xB9""iama Pasaulyje informacija ruo\xB9""iama Keisti M\xEC""n" "esio \xB9""alis \xA9""io m\xEC""nesio \xB9""alies projektas skirtas \xA9""" "iaur\xEC""s Kor\xEC""jai ir Tad\xBE""ikistanui. Labai pra\xB9""ome prisi" "d\xEC""ti prie straipsni\xF9"" apie \xB9""iuos kra\xB9""tus vystymo. Kei" "sti Savait\xEC""s iniciatyva \xA9""iaur\xEC""s karas \xE7""vyko tarp Rus" "ijos, Danijos-Norvegijos ir Saksonijos-Abiej\xF9"" Taut\xF9"" Respubliko" "s unijos koalicijos (nuo 1715 m. prie jos prisijung\xEC"" Pr\xFE""sija i" "r Hanoveris) ir \xA9""vedijos nuo 1700 iki 1721 m. Karo pasekm\xEC""s - " "\xA9""vedijos \xE7""taka Baltijos j\xFE""roje smarkiai suma\xBE""\xEC""j" "o, \xB9""vedams praradarus teritorijas j\xFE""ros pakrant\xEC""je (Livon" "ijoje, Estijoje, Vokietijoje), tuo tarpu Rusija tapo viena i\xB9"" did\xBE""" "i\xF9""j\xF9"" Europos valstybi\xF9"". 1721 m. \xA9""vedija buvo privers" "ta pasira\xB9""yti taik\xB1"", kuria neteko vis\xF9"" savo va" ; const char* kTeststr04 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/av_wikipedia_org_clean__ISO-8859-5.txt "ed for the creation of a Wikipedia in the Avar (\xB0""\xD2""\xD0""\xE0""" ") language. There are currently 150 articles (mostly stubs). \xB2""\xE1""" "\xD5"" \xE1""\xE2""\xE0""\xD0""\xDD""\xD8""\xE6""\xEB"" / All pages \xB4""" "\xD0""\xD3""\xEA""\xD8""\xE1""\xE2""\xD0""\xDD"" \xDC""\xD0""\xD3""I\xD0""" "\xE0""\xE3""\xDB"" \xDC""\xD0""\xE6""I \xDC""\xD0""\xD3""I\xD0""\xE0""\xE3""" "\xDB""\xD0""\xDB"" \xB1""\xE3""\xD9""\xDD""\xD0""\xE5""\xEA""\xE1""\xDA""" " \xC1""\xE3""\xDB""\xD0""\xE5""\xEA"" \xC6""I\xDE""\xD1""\xDE""\xDA""\xEC""" " \xB1""\xD0""\xE2""\xD0""\xE1""\xE3""\xDD""\xD0"" \xB0""\xD7""\xD5""\xE0""" "\xD1""\xD0""\xD9""\xD4""\xD6""\xD0""\xDD"" \xB1""\xD0""\xDA""\xE3"" \xC0""" "\xDE""\xE1""\xE1""\xD8""\xEF""\xDB""\xEA""\xE3""\xDB"" \xC4""\xD5""\xD4""" "\xD5""\xE0""\xD0""\xE6""\xD8""\xEF"" \xD3""I\xE3""\xE0""\xE3""\xE1"" \xDC""" "\xD0""\xE6""I \xBD""\xE3""\xD6""\xD5""\xD4""\xD0""\xD3""\xD8"" \xDA""I\xDE""" "\xDB""\xD0"" \xDC""\xD0""\xD3""I\xD0""\xE0""\xE3""\xDB"" \xDC""\xD0""\xE6""" "I\xD0""\xDB""\xD4""\xD0"" \xB2""\xD8""\xDA""\xD8""\xDF""\xD5""\xD4""\xD8""" "\xEF"" \xE6""\xD5""\xD1""\xD5""\xE2""I\xD5""\xD7""\xD0""\xD1""\xD8""\xEF""" "\xDB""\xD4""\xD0"" \xD3""\xEA""\xDE""\xE0""\xDB""\xEA"" \xD3""I\xD0""\xE5""" "\xEC""\xD0""\xDB""\xDB""\xEA""\xD8""\xD7""\xD5""!\xC9""\xD8""\xD1""\xD0""" "\xD1"" \xD3""\xEC""\xE3""\xDC""\xD5""\xE0""\xD0""\xDB""\xD4""\xD0"" \xE2""" "I\xD0""\xD4"" \xD1""\xE3""\xD3""\xDE"" \"\xE5""\xD8""\xE1""\xD8""\xD7""\xD0""" "\xD1""\xD5""\" \xE1""\xE1""\xEB""\xDB""\xDA""\xD0"": \xDC""\xD0""\xDA""\xEA""" "\xD0""\xDB""\xD0""\xEF""\xDB""\xD4""\xD0"" \xE2""I\xD0""\xD4""\xD5"" \xD6""" "\xDE"" \xD6""\xE3""\xD1""\xD0""\xDB""\xD0"" \xD2""\xD0"" \xE6""I\xE3""\xDD""" "\xE3""\xDB""\xD0"", \xB3""\xEC""\xD5""\xDB""\xD4""\xD0""\xDB""\xEA""\xE3""" "\xDD"" \xE2""I\xE3""\xD1""\xD0""\xDB""\xD0"". \xB2""\xDE""\xE0""\xD5""\xE5""" "\xD0"" \xDD""\xE3""\xD6""\xD5""\xE0""\xD3""\xDE"" \xE6""I\xD0""\xE0"" \xD1""" "\xD8""\xE6""\xD8""\xDD""\xD5"" \xDA""I\xDE""\xE7""\xDE""\xDD""\xD3""\xD5""" "(\xE1""\xE1""\xEB""\xDB""\xDA""\xD0"" \xD1""\xE3""\xD3""\xDE"" \xE2""I\xD0""" "\xD4"" \xDA""\xD2""\xD0""\xE0""\xD0""\xDD""\xD8""\xD4""\xD0"")! \xB3""\xEC""" "\xD5""\xD1"" \xE5""I\xD0""\xD6""\xD0""\xDB""\xEA""\xE3""\xDB""\xD0"" \xDD""" "\xE3""\xD6""\xD5""\xE0""\xD3""\xE3""\xDD"" \xD1""\xE3""\xE5""\xEC""\xD5""" "\xDD"" \xD3""\xEC""\xD0""\xD1""\xD8""\xD7""\xD5""! \xBD""\xE3""\xD6""\xD5""" "\xD4""\xD0""\xD3""\xDE"" \xE5""\xEA""\xD2""\xD0""\xD2""\xE3""\xDB"" \xDC""" "\xD0""\xD3""I\xD0""\xE0""\xE3""\xDB"" \xDC""\xD0""\xE6""I \xDB""\xEA""\xD0""" "\xEF""\xDB""\xD4""\xD0"" \xE8""\xD0""\xDA""\xDB""\xEA""\xD8"" \xD1""\xD0""" "\xE2""\xD0""\xDD""\xD8"", \xE5""I\xD0""\xDB""\xD1""\xD8""\xE5""\xEC""\xD5""" " \"\xC6""I\xE3""\xDC""\xD0""\xD4""\xD0""\" \xE1""\xD0""\xD9""\xE2""\xD0""" "\xDB""\xEA""\xE3""\xDB"" \xDC""\xD0""\xE2""\xD5""\xE0""\xD8""\xD0""\xDB""" "\xD0""\xD7""\xD4""\xD0"" \xE2""I\xD0""\xD4"" \xE5""I\xD0""\xDB""\xE2""I\xD8""" " \xD3""\xEC""\xD0""\xD1""\xD8""\xD7""\xD5"". If you come across pages th" "at shouldn't be here, replace their content with {{db|reasonfordeletion}" "} so that when someone who speaks the language \"adopts\" the Avar Wikip" "edia t" ; const char* kTeststr05 = // aka ISO-8859-6 // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/ar_wikipedia_org_clean__Arabic.txt " \xC8""\xC7""\xE4""\xE4""\xDA""\xC9"" \xC7""\xE4""\xC2""\xD1""\xC7""\xE5""" "\xEA""\xC9"". \xEA""\xD3""\xE8""\xD9"" \xC8""\xC7""\xE4""\xD9""\xC8""\xD1""" "\xEA""\xC9"" \xCA""\xE6""\xD7""\xE2"" \xEA""\xD4""\xE8""\xD9"" \xE8""\xE5""" "\xD9""\xE6""\xC7""\xE7""\xC7"" \xC7""\xE4""\xCD""\xD1""\xE1""\xEA"" \"\xEA""" "\xE7""\xE8""\xE7"" \xD4""\xE8""\xD9""\" \xC3""\xE9"" \"\xC7""\xE4""\xE4""" "\xE7"" \xEA""\xCE""\xE4""\xD5""\". \xC7""\xE4""\xE5""\xD3""\xEA""\xCD"" " "\xCD""\xD3""\xC8"" \xC7""\xE4""\xE3""\xCA""\xC7""\xC8"" \xC7""\xE4""\xE5""" "\xE2""\xCF""\xD3"" \xE7""\xE8"" \xC7""\xC8""\xE6"" \xC7""\xE4""\xE4""\xE7""" " . \xE4""\xC7""\xEA""\xC4""\xE5""\xE6"" \xC7""\xE4""\xEA""\xE7""\xE8""\xCF""" " \xC8""\xEA""\xD3""\xE8""\xD9"" \xE8""\xEA""\xD1""\xE1""\xD6""\xE8""\xE6""" " \xE1""\xE3""\xD1""\xC9"" \xCA""\xC3""\xE4""\xE7""\xE7"" \xE8"" \xC8""\xC3""" "\xE6""\xE7"" \xCC""\xD2""\xC1"" \xE5""\xE6"" \xCB""\xC7""\xE4""\xE8""\xCB""" " \xC7""\xE4""\xE7""\xEA"" \xAC"" \xE8""\xC7""\xE4""\xEA""\xE7""\xE8""\xCF""" "\xEA""\xC9"" \xC3""\xEA""\xD6""\xC7"" \xE4""\xC7""\xCA""\xD9""\xCA""\xD1""" "\xE1"" \xC8""\xE3""\xE8""\xE6"" \xEA""\xD3""\xE8""\xD9"" \xE7""\xE8"" \xC7""" "\xE4""\xE5""\xD3""\xEA""\xC7"" \xC3""\xE8"" \xC7""\xE4""\xE5""\xD3""\xEA""" "\xCD"" \xC7""\xE4""\xE5""\xE6""\xCA""\xD8""\xD1"" \xAC"" \xE4""\xC3""\xE6""" "\xE7"" \xE8""\xCD""\xD3""\xC8"" \xC7""\xD9""\xCA""\xE2""\xC7""\xCF""\xE7""" "\xE5"" \xE4""\xE5"" \xEA""\xCA""\xE5""\xE5"" \xC7""\xE4""\xE6""\xC8""\xE8""" "\xC7""\xCA"" \xC7""\xE4""\xCA""\xEA"" \xCA""\xCD""\xCF""\xCB""\xCA"" \xD9""" "\xE6"" \xC7""\xE4""\xE5""\xD3""\xEA""\xCD"" \xE8""\xD9""\xE6"" \xC7""\xE4""" "\xD9""\xD5""\xD1"" \xC7""\xE4""\xE5""\xD3""\xEA""\xCD""\xC7""\xE6""\xEA""" " \xC7""\xE4""\xD0""\xEA"" \xD3""\xEA""\xCC""\xE4""\xC8""\xE7"" \xE5""\xD9""" "\xE7"" . \xE1""\xEA"" \xCD""\xEA""\xE6"" \xEA""\xD5""\xE1"" \xC7""\xE4""" "\xE2""\xD1""\xC2""\xE6"" \xD9""\xEA""\xD3""\xE9"" \xC8""\xC3""\xE6""\xE7""" " \xE3""\xE4""\xE5""\xC9"" \xC7""\xE4""\xE4""\xE7"" \xC7""\xE4""\xCA""\xEA""" " \xC3""\xE4""\xE2""\xC7""\xE7""\xC7"" \xC5""\xE4""\xE9"" \xE5""\xD1""\xEA""" "\xE5"" \xC8""\xE6""\xCA"" \xD9""\xE5""\xD1""\xC7""\xE6"". \xEA""\xD0""\xE3""" "\xD1"" \xC7""\xE4""\xE2""\xD1""\xC7""\xE6"" \xC3""\xE6"" \xD9""\xEA""\xD3""" "\xE9"" \xC8""\xD4""\xD1"" \xE3""\xE3""\xE4"" \xC7""\xE4""\xC8""\xD4""\xD1""" " \xE8""\xC3""\xE6"" \xC7""\xE4""\xE4""\xE7"" \xCE""\xE4""\xE2""\xE7"" \xE3""" "\xE5""\xC7"" \xCE""\xE4""\xE2"" \xC2""\xCF""\xE5"" \xE5""\xE6"" \xCA""\xD1""" "\xC7""\xC8"" \xCB""\xE5"" \xE2""\xC7""\xE4"" \xE4""\xE7"" \xE3""\xE6"" \xE1""" "\xEA""\xE3""\xE8""\xE6""\xAC"" \xE8"" \xC3""\xE5""\xE7"" \xD5""\xCF""\xEA""" "\xE2""\xC9"" \xE8"" \xE7""\xEA"" \xC7""\xE4""\xD3""\xEA""\xCF""\xC9"" \xE5""" "\xD1""\xEA""\xE5"" \xC7""\xE4""\xD9""\xD0""\xD1""\xC7""\xC1"" \xC7""\xE4""" "\xCA""\xEA"" \xC7""\xCE""\xCA""\xC7""\xD1""\xE7""\xC7"" \xC7""\xE4""\xE4""" "\xE7"" \xE4""\xE5""\xD9""\xCC""\xD2""\xCA""\xE7"" \xC8""\xE8""\xE4""\xC7""" "\xCF""\xC9"" \xD9""\xEA""\xD3""\xE9"". \xE4""\xE4""\xE5""\xD2""\xEA""\xCF""" " | \xC7""\xE4""\xE5""\xE2""\xC7""\xE4"" \xC7""\xE4""\xE5""\xCE""\xCA""\xC7""" "\xD1"" \xC7""\xE4""\xD3""\xC7""\xC8""\xE2"" | \xE2""\xC7""\xC6""\xE5""\xC9""" " \xE5""\xE2""\xC7""\xE4""\xC7""\xCA"" \xE5""\xCE""\xCA""\xC7""\xD1""\xC9""" " \xE5""\xE2""\xC7""\xE4""\xC9"" \xC7""\xE4""\xC3""\xD3""\xC8""\xE8""\xD9""" " \xC8""\xEA""\xEA""\xD1"" \xCF""\xEA"" \xE3""\xE8""\xC8""\xEA""\xD1""\xCA""" "\xC7""\xE6"" (1 \xEA""\xE6""\xC7""\xEA""\xD1"" 1863 - 2 \xD3""\xC8""\xCA""" "\xE5""\xC8""\xD1"" 1937) \xEA""\xD9""\xD1""\xE1"" \xC3""\xEA""\xD6""\xC7""" " \xC8""\xE0""(\xC8""\xEA""\xEA""\xD1"" \xCF""\xEA"" \xE1""\xD1""\xEA""\xCF""" "\xEA"") \xE8"" \xE7""\xE8"" \xE5""\xE3""\xCA""\xD4""\xE1"" \xC7""\xE4""\xC3""" "\xE4""\xD9""\xC7""\xC8"" \xC7""\xE4""\xC3""\xE8""\xE4""\xE5""\xC8""\xEA""" "\xC9"" \xC7""\xE4""\xCD""\xCF""\xEA""\xCB""\xC9"". \xCF""\xD1""\xD3"" \xC7""" "\xE4""\xE5""\xCD""\xC7""\xE5""\xC7""\xC9"" \xCB""\xE5"" \xCA""\xD1""\xE3""" "\xE7""\xC7"" \xE8""\xCF""\xCE""\xE4"" \xC7""\xE4""\xE5""\xE4""\xE3""\xEA""" "\xC9"" \xC7""\xE4""\xD9""\xD3""\xE3""\xD1""\xEA""\xC9"" \xE1""\xEA"" (\xC7""" "\xE4""\xD3""\xC7""\xE6""\xD3""\xEA""\xD1"") \xE8""\xE5""\xE6""\xE7""\xC7""" " \xCA""\xCD""\xE8""\xE4"" \xC5""\xE4""\xE9"" \xC7""\xE4""\xCA""\xD1""\xC8""" "\xEA""\xC9"" \xE8""\xC7""\xE4""\xD1""\xEA""\xC7""\xD6""\xC9"" , \xE8""\xE5""" "\xD9"" \xD9""\xD4""\xE2""\xE7"" \xE4""\xE4""\xCA""\xC7""\xD1""\xEA""\xCE""" " \xC7""\xE4""\xEA""\xE8""\xE6""\xC7""\xE6""\xEA"" \xC7""\xE4""\xE2""\xCF""" "\xEA""\xE5"" \xE6""\xC7""\xCF""\xE9"" \xE1""\xEA"" 25 \xE6""\xE8""\xE1""" "\xE5""\xC8""\xD1"" 1892 \xC3""\xEA"" \xD9""\xE6""\xCF""\xE5""\xC7"" \xE3""" "\xC7""\xE6"" \xE1""\xEA"" \xD3""\xE6"" \xC7""\xE4""\xCA""\xC7""\xD3""\xD9""" "\xC9"" \xE8""\xC7""\xE4""\xD9""\xD4""\xD1""\xEA""\xE6"" \xC8""\xC5""\xCD""" "\xEA""\xC7""\xC1"" \xC7""\xE4""\xC3""\xE4""\xD9""\xC7""\xC8"" \xC7""\xE4""" "\xC3""\xE8""\xE4""\xE5""\xC8""\xEA""\xC9"" \xC7""\xE4""\xE2""\xCF""\xEA""" "\xE5""\xC9"" \xC7""\xE4""\xCA""\xEA"" \xC3""\xD7""\xE4""\xE2""\xE7""\xC7""" " (\xC5""\xEA""\xE1""\xEA""\xE6""\xE8""\xD3"") \xE5""\xE4""\xE3"" \xE4""\xEA""" "\xCF""\xEA""\xC7"" \xD9""\xC7""\xE5"" 776 \xE2""\xC8""\xE4"" \xC7""\xE4""" "\xE5""\xEA""\xE4""\xC7""\xCF"" \xE1""\xEA"" \xC3""\xE8""\xE4""\xE5""\xC8""" "\xEA""\xC7"" \xD9""\xE4""\xE9"" \xE5""\xD4""\xC7""\xD1""\xE1"" \xC3""\xCB""" "\xEA""\xE6""\xC7"" \xC8""\xD9""\xCF""\xE5""\xC7"" \xC7""\xD3""\xCA""\xD4""" "\xC7""\xD1"" \xC7""\xE4""\xC2""\xE4""\xE7""\xC9"" \xE8""\xE4""\xCA""\xE3""" "\xE8""\xE6"" \xE7""\xCF""\xE6""\xC9"" \xE4""\xE4""\xCD""\xD1""\xE8""\xC8""" " \xC7""\xE4""\xE5""\xD3""\xCA""\xE5""\xD1""\xC9"" \xC8""\xEA""\xE6"" \xC8""" "\xE4""\xC7""\xCF"" \xC7""\xE4""\xC5""\xDA""\xD1""\xEA""\xE2"" (\xC7""\xE4""" "\xEA""\xE8""\xE6""\xC7""\xE6""\xEA""\xE8""\xE6"" \xC7""\xE4""\xE2""\xCF""" "\xE5""\xC7""\xC1""). \xCF""\xEA"" \xE3""\xE8""\xC8""\xEA""\xD1""\xCA""\xC7""" "\xE6"" | \xE5""\xCE""\xCA""\xC7""\xD1""\xC7""\xCA"" \xC7""\xE4""\xC3""\xD3""" "\xC7""\xC8""\xEA""\xD9"" \xC7""\xE4""\xD3""\xC7""\xC8""\xE2""\xC9"" \xE5""" "\xCC""\xCA""\xE5""\xD9"" \xE8""\xEA""\xE3""\xEA""\xC8""\xEA""\xCF""\xEA""" "\xC7"" \xE8""\xEA""\xE3""\xEA""\xC8""\xEA""\xCF""\xEA""\xC7"" \xE5""\xD4""" "\xD1""\xE8""\xD9"" \xEA""\xD9""\xCA""\xE5""\xCF"" \xD9""\xE4""\xE9"" \xE6""" "\xD5""\xE8""\xD5"" \xCD""\xD1""\xC9"" \xC7""\xE4""\xCA""\xD9""\xCF""\xEA""" "\xE4"" \xE5""\xCA""\xC7""\xCD""\xC9"" \xE4""\xE4""\xCC""\xE5""\xEA""\xD9""" "\xAC"" \xD1""\xCC""\xC7""\xC1""\xEB"" \xE4""\xC7"" \xCA""\xE6""\xD3""\xCE""" " \xC3""\xEA"" \xE6""\xD5"" \xE5""\xE8""\xCC""\xE8""\xCF"" \xD9""\xE4""\xE9""" " \xC7""\xE4""\xE8""\xEA""\xC8"" \xC3""\xE8"" \xC3""\xEA"" \xD9""\xE5""\xE4""" " \xD0""\xEA"" \xCD""\xE2""\xE8""\xE2"" \xCA""\xC3""\xE4""\xEA""\xE1"" \xE8""" "\xE6""\xD4""\xD1"" \xE5""\xCD""\xE1""\xE8""\xD8""\xC9"". \xC5""\xD0""\xC7""" " \xE3""\xE6""\xCA"" \xCA""\xD1""\xDA""\xC8"" \xC8""\xC7""\xE4""\xE5""\xD3""" "\xC7""\xD9""\xCF""\xC9""\xAC"" \xC7""\xE4""\xE2""\xF0"" \xE6""\xD8""\xD1""" "\xC9"" \xD9""\xE4""\xE9"" \xE5""\xD4""\xD1""\xE8""\xD9"" \xEA""\xE8""\xE5""" " \xE8""\xEA""\xE3""\xEA""\xC8""\xEA""\xCF""\xEA""\xC7"" \xC7""\xE4""\xD9""" "\xD1""\xC8""\xEA""\xC9""\xAC"" \xE4""\xD7""\xE4""\xC8"" \xE5""\xD3""\xC7""" "\xD9""\xCF""\xC9"" \xE5""\xE6"" \xC7""\xE4""\xE5""\xD4""\xC7""\xD1""\xE3""" "\xEA""\xE6"" \xE4""\xC7"" \xCA""\xCA""\xD1""\xCF""\xCF""\xE8""\xC7"" \xC8""" "\xC7""\xE4""\xCA""\xE8""\xCC""\xE7"" \xC5""\xE4""\xE9"" \xE5""\xEA""\xCF""" "\xC7""\xE6"" \xE8""\xEA""\xE3""\xEA""\xC8""\xEA""\xCF""\xEA""\xC7"". \xE4""" "\xE5""\xD9""\xD1""\xE1""\xC9"" \xC2""\xCE""\xD1"" \xC3""\xCE""\xC8""\xC7""" "\xD1"" \xC7""\xE4""\xE5""\xE8""\xD3""\xE8""\xD9""\xC9""\xAC"" \xC7""\xE4""" "\xD1""\xCC""\xC7""\xC1"" \xC7""\xE4""\xD0""\xE7""\xC7""\xC8"" \xC5""\xE4""" "\xE9"" \xC8""\xE8""\xC7""\xC8""\xC9"" \xC7""\xE4""\xE5""\xCC""\xCA""\xE5""" "\xD9"". \xC5""\xD0""\xC7"" \xE3""\xC7""\xE6"" \xE4""\xCF""\xEA""\xE3"" \xD3""" "\xC4""\xC7""\xE4""\xC7""\xEB"" \xE4""\xE5"" \xCA""\xCC""\xCF"" \xCC""\xE8""" "\xC7""\xC8""\xE7"" \xE1""\xEA"" \xE8""\xEA""\xE3""\xEA""\xC8""\xEA""\xCF""" "\xEA""\xC7""\xAC"" \xE4""\xC7"" \xCA""\xCA""\xD1""\xCF""\xCF"" \xE1""\xEA""" " \xE3""\xCA""\xC7""\xC8""\xC9"" \xD3""\xC4""\xC7""\xE4""\xE3"" \xE7""\xE6""" "\xC7"". \xE8""\xEA""\xE3""\xEA""\xC8""\xEA""\xCF""\xEA""\xC7"" \xE4""\xEA""" "\xD3""\xCA"" \xE4""\xE6""\xD4""\xD1"" \xC7""\xE4""\xD9""\xE2""\xC7""\xC6""" "\xCF"" \xE8""\xC7""\xE4""\xE5""\xD9""\xCA""\xE2""\xCF""\xC7""\xCA""\xAC""" " \xE8""\xC7""\xE4""\xC2""\xD1""\xC7""\xC1"" \xC7""\xE4""\xD4""\xCE""\xD5""" "\xEA""\xC9""\xAC"" \xE8""\xC7""\xE4""\xD3""\xEA""\xD1"" \xC7""\xE4""\xD0""" "\xC7""\xCA""\xEA""\xC9""\xAC"" \xE8""\xD4""\xCC""\xD1""\xC7""\xCA"" \xC7""" "\xE4""\xD9""\xC7""\xC6""\xE4""\xC9"" \xE8""\xC7""\xE4""\xC3""\xE6""\xD3""" "\xC7""\xC8"". \xC7""\xE2""\xD1""\xC3"" \xE8""\xEA""\xE3""\xEA""\xC8""\xEA""" "\xCF""\xEA""\xC7"" \xE4""\xEA""\xD3""\xCA"". \xE4""\xC7"" \xCA""\xE6""\xD4""" "\xC6"" \xE5""\xE2""\xC7""\xE4""\xC7""\xEB"" \xE5""\xCA""\xCD""\xEA""\xD2""" "\xC7""\xEB"" \xD9""\xE6"" \xE6""\xD3""\xC8"" \xC3""\xE8"" \xD9""\xC7""\xC6""" "\xE4""\xC9"" \xC3""\xE8"" \xE2""\xC8""\xEA""\xE4""\xC9""\xAC"" \xD0""\xE3""" "\xD1"" \xC7""\xE4""\xD9""\xC7""\xC6""\xE4""\xC7""\xCA"" \xE8""\xC7""\xE4""" "\xE2""\xC8""\xC7""\xC6""\xE4"" \xEA""\xCA""\xE5"" \xE1""\xE2""\xD7"" \xD6""" "\xE5""\xE6"" \xD3""\xEA""\xC7""\xE2"" \xCA""\xC7""\xD1""\xEA""\xCE""\xEA""" " \xC3""\xE8"" \xD3""\xEA""\xC7""\xD3""\xEA"" \xE5""\xD9""\xEA""\xE6"". \xCD""" "\xE8""\xE4"" \xC7""\xE4""\xE5""\xD4""\xD1""\xE8""\xD9"": \xCD""\xE8""\xE4""" " \xE8""\xEA""\xE3""\xEA""\xC8""\xEA""\xCF""\xEA""\xC7"" - \xD3""\xEA""\xC7""" "\xD3""\xC7""\xCA"" \xE8""\xCA""\xD9""\xE4""\xEA""\xE5""\xC7""\xCA"" \xE8""" "\xEA""\xE3""\xEA""\xC8""\xEA""\xCF""\xEA""\xC7"" - \xC3""\xD3""\xC6""\xE4""" "\xC9"" \xE5""\xCA""\xE3""\xD1""\xD1""\xC9"" - \xC7""\xE4""\xE5""\xEA""\xCF""" "\xC7""\xE6"" - \xC8""\xC7""\xC8""\xE4"" - \xCD""\xE2""\xE8""\xE2"" \xC7""" "\xE4""\xCA""\xC3""\xE4""\xEA""\xE1"" \xE8""\xC7""\xE4""\xE6""\xD4""\xD1""" " - \xE3""\xEA""\xE1""\xEA""\xC9"" \xCA""\xCD""\xD1""\xEA""\xD1"" \xC7""\xE4""" "\xD5""\xE1""\xCD""\xC7""\xCA"" - \xCA""\xD3""\xE5""\xEA""\xC9"" \xC7""\xE4""" "\xE5""\xE8""\xC7""\xD6""\xEA""\xD9"" - \xCA""\xD5""\xE6""\xEA""\xE1"" \xC7""" "\xE4""\xE5""\xE8""\xC7""\xD6""\xEA""\xD9"" - \xE5""\xE8""\xC7""\xD6""\xEA""" "\xD9"" \xE5""\xE2""\xCA""\xD1""\xCD""\xC9"". \xEA""\xE5""\xE3""\xE6""\xE3""" " \xC3""\xE6"" \xCA""\xD3""\xC7""\xD9""\xCF"" \xE1""\xEA"" \xCA""\xCD""\xD3""" "\xEA""\xE6"" \xC7""\xE4""\xE5""\xE2""\xC7""\xE4""\xC7""\xCA"" \xC7""\xE4""" "\xE2""\xD5""\xEA""\xD1""\xC9"" \xE1""\xEA"" \xE8""\xEA""\xE3""\xEA""\xC8""" "\xEA""\xCF""\xEA""\xC7"". \xC7""\xE6""\xD8""\xD1"" \xC3""\xEA""\xD6""\xC7""" "\xEB"" \xC7""\xE4""\xCA""\xD5""\xE8""\xEA""\xCA""\xC7""\xCA"" \xE8""\xC7""" "\xE4""\xE5""\xD4""\xC7""\xD1""\xEA""\xD9"" \xC7""\xE4""\xE5""\xD7""\xD1""" "\xE8""\xCD""\xC9"". \xCA""\xD5""\xE8""\xEA""\xCA""\xC7""\xCA"" \xCC""\xC7""" "\xD1""\xEA""\xC9"" \xD3""\xC7""\xE7""\xE5"" \xC8""\xD5""\xE8""\xCA""\xE3""" " \xC3""\xE8"" \xD1""\xC3""\xEA""\xE3"" \xE1""\xEA"": \xE6""\xE2""\xC7""\xD4""" " \xCD""\xE8""\xE4"" \xE2""\xE8""\xC7""\xE4""\xC8"" \xC7""\xE4""\xC3""\xCF""" "\xEA""\xC7""\xE6"". \xCA""\xD5""\xE8""\xEA""\xCA"" \xE4""\xE4""\xCD""\xD0""" "\xE1"". \xCA""\xD1""\xD4""\xEA""\xCD""\xC7""\xCA"" \xC7""\xE4""\xE5""\xE2""" "\xC7""\xE4""\xC9"" \xC7""\xE4""\xE5""\xCE""\xCA""\xC7""\xD1""\xC9"". \xCA""" "\xD9""\xC7""\xE8""\xE6"" \xC7""\xE4""\xC3""\xD3""\xC8""\xE8""\xD9"". \xCA""" "\xD9""\xC7""\xE8""\xE6"" \xC7""\xE4""\xC3""\xD3""\xC8""\xE8""\xD9"" \xE4""" "\xE3""\xD1""\xC9""" ; const char* kTeststr06 = // aka ISO-8859-7 Greek // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/el_wikipedia_org_clean__CP1253.txt " \xE3""\xE9""\xE1"" \xF4""\xE7""\xED"" \xF0""\xE5""\xF1""\xE9""\xE3""\xF1""" "\xE1""\xF6""\xDE"" \xE3""\xE5""\xF9""\xE3""\xF1""\xE1""\xF6""\xE9""\xEA""" "\xFE""\xED"", \xF0""\xEF""\xEB""\xE9""\xF4""\xE9""\xEA""\xFE""\xED"" \xEA""" "\xE1""\xE9"" \xE9""\xF3""\xF4""\xEF""\xF1""\xE9""\xEA""\xFE""\xED"" \xF0""" "\xE5""\xF1""\xE9""\xEF""\xF7""\xFE""\xED"", \xE3""\xEB""\xF9""\xF3""\xF3""" "\xFE""\xED"" \xEA""\xE1""\xE9"" \xEB""\xE1""\xFE""\xED"". \xCF""\xE9"" \xE5""" "\xE8""\xED""\xFC""\xF4""\xE7""\xF4""\xE5""\xF2"" \xF0""\xEF""\xF5"" \xEA""" "\xE1""\xF4""\xEF""\xE9""\xEA""\xEF""\xFD""\xED"" \xF3""\xF4""\xE7""\xED""" " \xF0""\xE5""\xF1""\xE9""\xEF""\xF7""\xDE"" \xF7""\xF1""\xE7""\xF3""\xE9""" "\xEC""\xEF""\xF0""\xEF""\xE9""\xEF""\xFD""\xED"" \xE4""\xE9""\xE1""\xF6""" "\xEF""\xF1""\xE5""\xF4""\xE9""\xEA""\xDE"" \xEF""\xF1""\xEF""\xEB""\xEF""" "\xE3""\xDF""\xE1"" \xE3""\xE9""\xE1"" \xF4""\xE7""\xED"" \xDF""\xE4""\xE9""" "\xE1"" \xEF""\xED""\xF4""\xFC""\xF4""\xE7""\xF4""\xE1"", \xE5""\xDF""\xF4""" "\xE5"" \xDF""\xE4""\xE9""\xE1"" \xEF""\xF1""\xEF""\xEB""\xEF""\xE3""\xDF""" "\xE1"" \xE3""\xE9""\xE1"" \xE4""\xE9""\xE1""\xF6""\xEF""\xF1""\xE5""\xF4""" "\xE9""\xEA""\xDD""\xF2"" \xEF""\xED""\xF4""\xFC""\xF4""\xE7""\xF4""\xE5""" "\xF2"", \xF0""\xF1""\xDC""\xE3""\xEC""\xE1"" \xF3""\xF5""\xF7""\xED""\xDC""" " \xF0""\xE5""\xF1""\xDF""\xF0""\xEB""\xEF""\xEA""\xEF"" \xE3""\xE9""\xE1""" " \xF4""\xEF""\xF5""\xF2"" \xF5""\xF0""\xFC""\xEB""\xEF""\xE9""\xF0""\xEF""" "\xF5""\xF2"" \xEA""\xE1""\xF4""\xEF""\xDF""\xEA""\xEF""\xF5""\xF2"" \xF4""" "\xE7""\xF2"" \xF0""\xE5""\xF1""\xE9""\xEF""\xF7""\xDE""\xF2"" \xEA""\xE1""" "\xE9"" \xE1""\xEA""\xFC""\xEC""\xE7"" \xF0""\xE5""\xF1""\xE9""\xF3""\xF3""" "\xFC""\xF4""\xE5""\xF1""\xEF"" \xE3""\xE9""\xE1"" \xF4""\xEF""\xF5""\xF2""" " \xEE""\xDD""\xED""\xEF""\xF5""\xF2"". (\xF0""\xE5""\xF1""\xE9""\xF3""\xF3""" "\xFC""\xF4""\xE5""\xF1""\xE1""...) \xA2""\xEB""\xEB""\xE1"" \xE5""\xF0""" "\xE9""\xEB""\xE5""\xE3""\xEC""\xDD""\xED""\xE1"" \xDC""\xF1""\xE8""\xF1""" "\xE1""... \xCA""\xFD""\xEA""\xEB""\xEF""\xF2"" \xDC""\xF1""\xE8""\xF1""\xF9""" "\xED"" \xCF"" \xEA""\xFD""\xEA""\xEB""\xEF""\xF2"" \xDC""\xF1""\xE8""\xF1""" "\xF9""\xED"" \xF4""\xE7""\xF2"" \xC2""\xE9""\xEA""\xE9""\xF0""\xE1""\xDF""" "\xE4""\xE5""\xE9""\xE1""\xF2"" \xE5""\xDF""\xED""\xE1""\xE9"" \xEC""\xE9""" "\xE1"" \xF3""\xE5""\xE9""\xF1""\xDC"" \xE1""\xF0""\xFC"" \xEB""\xDE""\xEC""" "\xEC""\xE1""\xF4""\xE1"" \xF3""\xF5""\xE3""\xEA""\xE5""\xEA""\xF1""\xE9""" "\xEC""\xDD""\xED""\xE7""\xF2"" \xE8""\xE5""\xEC""\xE1""\xF4""\xEF""\xEB""" "\xEF""\xE3""\xDF""\xE1""\xF2"". \xCF"" \xF0""\xE1""\xF1""\xFE""\xED"" \xEA""" "\xFD""\xEA""\xEB""\xEF""\xF2"" \xE5""\xDF""\xED""\xE1""\xE9"" \xE1""\xF6""" "\xE9""\xE5""\xF1""\xF9""\xEC""\xDD""\xED""\xEF""\xF2"" \xF3""\xE5"" \xEC""" "\xEF""\xF5""\xF3""\xE9""\xEA""\xEF""\xFD""\xF2"" \xF4""\xE7""\xF2"" \xF4""" "\xE6""\xE1""\xE6"". \xC5""\xF0""\xE9""\xEB""\xE5""\xE3""\xEC""\xDD""\xED""" "\xE1"" \xDC""\xF1""\xE8""\xF1""\xE1"": \xCB""\xEF""\xFD""\xE9""\xF2"" \xA2""" "\xF1""\xEC""\xF3""\xF4""\xF1""\xEF""\xED""\xE3""\xEA"", \xCD""\xF4""\xDF""" "\xE6""\xE9"" \xC3""\xEA""\xE9""\xEB""\xDD""\xF3""\xF0""\xE9"", \xCD""\xF4""" "\xE9""\xEF""\xFD""\xEA"" \xB8""\xEB""\xE9""\xED""\xE3""\xEA""\xF4""\xEF""" "\xED"", \xD4""\xF3""\xDC""\xF1""\xEB""\xE9"" \xD0""\xDC""\xF1""\xEA""\xE5""" "\xF1"", \xCD""\xDF""\xED""\xE1"" \xD3""\xE9""\xEC""\xFC""\xED"", \xD4""\xE6""" "\xEF""\xED"" \xCA""\xEF""\xEB""\xF4""\xF1""\xDD""\xE9""\xED"", \xC5""\xF1""" "\xEB"" \xD7""\xDC""\xE9""\xED""\xF2"", \xCA""\xFC""\xEB""\xEC""\xE1""\xED""" " \xD7""\xFC""\xEA""\xE9""\xED""\xF2"", \xD6""\xEB""\xDD""\xF4""\xF3""\xE5""" "\xF1"" \xD7""\xDD""\xED""\xF4""\xE5""\xF1""\xF3""\xEF""\xED"" \xC7""\xEC""" "\xE5""\xF1""\xEF""\xEB""\xFC""\xE3""\xE9""\xEF"" 12 \xCF""\xEA""\xF4""\xF9""" "\xE2""\xF1""\xDF""\xEF""\xF5"" \xC5""\xF0""\xE9""\xEB""\xE5""\xE3""\xEC""" "\xDD""\xED""\xE1"" \xE3""\xE5""\xE3""\xEF""\xED""\xFC""\xF4""\xE1"": 199" "9 - \xD0""\xE5""\xE8""\xE1""\xDF""\xED""\xE5""\xE9"" \xEF"" Wilt Chamber" "lain, \xDD""\xED""\xE1""\xF2"" \xE1""\xF0""\xFC"" \xF4""\xEF""\xF5""\xF2""" " \xEA""\xE1""\xEB""\xFD""\xF4""\xE5""\xF1""\xEF""\xF5""\xF2"" \xEA""\xE1""" "\xEB""\xE1""\xE8""\xEF""\xF3""\xF6""\xE1""\xE9""\xF1""\xE9""\xF3""\xF4""" "\xDD""\xF2"" \xF0""\xEF""\xF5"" \xDD""\xE6""\xE7""\xF3""\xE1""\xED"" \xF0""" "\xEF""\xF4""\xDD"", \xE1""\xF0""\xFC"" \xEA""\xE1""\xF1""\xE4""\xE9""\xE1""" "\xEA""\xDE"" \xF0""\xF1""\xEF""\xF3""\xE2""\xEF""\xEB""\xDE"" \xF3""\xF4""" "\xEF"" \xF3""\xF0""\xDF""\xF4""\xE9"" \xF4""\xEF""\xF5"" \xF3""\xF4""\xEF""" " Bel Air, California. ..\xD0""\xE5""\xF1""\xE9""\xF3""\xF3""\xFC""\xF4""" "\xE5""\xF1""\xE1"" \xC5""\xE3""\xEA""\xF5""\xEA""\xEB""\xEF""\xF0""\xE1""" "\xDF""\xE4""\xE5""\xE9""\xE1"" \xC8""\xE5""\xEC""\xE1""\xF4""\xE9""\xEA""" "\xFC""\xF2"" \xEA""\xE1""\xF4""\xDC""\xEB""\xEF""\xE3""\xEF""\xF2"" \xD0""" "\xEF""\xEB""\xE9""\xF4""\xE9""\xF3""\xEC""\xFC""\xF2"" \xEA""\xE1""\xE9""" " \xD4""\xDD""\xF7""\xED""\xE5""\xF2"" \xC6""\xF9""\xE3""\xF1""\xE1""\xF6""" "\xE9""\xEA""\xDE"" \xB7"" \xC8""\xDD""\xE1""\xF4""\xF1""\xEF"" \xB7"" \xCA""" "\xE9""\xED""\xE7""\xEC""\xE1""\xF4""\xEF""\xE3""\xF1""\xDC""\xF6""\xEF""" "\xF2"" \xB7"" \xCB""\xEF""\xE3""\xEF""\xF4""\xE5""\xF7""\xED""\xDF""\xE1""" " \xB7"" \xCC""\xEF""\xF5""\xF3""\xE9""\xEA""\xDE"" \xB7"" \xC1""\xF1""\xF7""" "\xE9""\xF4""\xE5""\xEA""\xF4""\xEF""\xED""\xE9""\xEA""\xDE"" \xB7"" \xC3""" "\xEB""\xF5""\xF0""\xF4""\xE9""\xEA""\xDE"" \xB7"" \xC1""\xE8""\xEB""\xE7""" "\xF4""\xE9""\xF3""\xEC""\xFC""\xF2"" \xB7"" \xCC""\xF5""\xE8""\xEF""\xEB""" "\xEF""\xE3""\xDF""\xE1"" \xB7"" \xC8""\xF1""\xE7""\xF3""\xEA""\xE5""\xDF""" "\xE1"" \xC8""\xE5""\xF4""\xE9""\xEA""\xDD""\xF2"" \xC5""\xF0""\xE9""\xF3""" "\xF4""\xDE""\xEC""\xE5""\xF2"" \xC1""\xED""\xE8""\xF1""\xF9""\xF0""\xEF""" "\xEB""\xEF""\xE3""\xDF""\xE1"" \xB7"" \xC1""\xF3""\xF4""\xF1""\xEF""\xED""" "\xEF""\xEC""\xDF""\xE1"" \xB7"" \xC2""\xE9""\xEF""\xEB""\xEF""\xE3""\xDF""" "\xE1"" \xB7"" \xC3""\xE5""\xF9""\xEB""\xEF""\xE3""\xDF""\xE1"" \xB7"" \xC5""" "\xF0""\xE9""\xF3""\xF4""\xDE""\xEC""\xE7"" \xF5""\xF0""\xEF""\xEB""\xEF""" "\xE3""\xE9""\xF3""\xF4""\xFE""\xED""\xB7"" \xCC""\xE1""\xE8""\xE7""\xEC""" "\xE1""\xF4""\xE9""\xEA""\xDC"" \xB7"" \xD4""\xE5""\xF7""\xED""\xEF""\xEB""" "\xEF""\xE3""\xDF""\xE1"" \xB7"" \xD6""\xF5""\xF3""\xE9""\xEA""\xDE"" \xB7""" " \xD7""\xE7""\xEC""\xE5""\xDF""\xE1"" \xB7"" \xC9""\xE1""\xF4""\xF1""\xE9""" "\xEA""\xDE"" \xB7"" \xCC""\xE5""\xF4""\xE5""\xF9""\xF1""\xEF""\xEB""\xEF""" "\xE3""\xDF""\xE1"" \xC3""\xE5""\xF9""\xE3""\xF1""\xE1""\xF6""\xDF""\xE1""" " \xC1""\xF3""\xDF""\xE1"" \xB7"" \xC1""\xF6""\xF1""\xE9""\xEA""\xDE"" \xB7""" " \xC5""\xF5""\xF1""\xFE""\xF0""\xE7""" ; const char* kTeststr07 = // aka ISO-8859-8-I Hebrew in logical order // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/he_wikipedia_org_clean__CP1255.txt " \xF2""\xF8""\xEB""\xE9""\xED"" \xF2""\xE6""\xF8""\xE4"": \xF2""\xE6""\xF8""" "\xE4"" - \xF9""\xE0""\xEC""\xE5""\xFA"" \xE5""\xFA""\xF9""\xE5""\xE1""\xE5""" "\xFA"" - \xEB""\xEC"" \xE3""\xF4""\xE9"" \xE4""\xF2""\xE6""\xF8""\xE4"" " "- \xE0""\xF8""\xE2""\xE6"" \xE7""\xE5""\xEC"" \xEC""\xF0""\xF1""\xE9""\xE5""" "\xF0""\xE5""\xFA"" \xF2""\xF8""\xE9""\xEB""\xE4"" \xEE""\xFA""\xF7""\xF4""" "\xFA"" \xE0""\xE9""\xEB""\xE5""\xFA"" \xE5""\xE9""\xF7""\xE9""\xF4""\xE3""" "\xE9""\xE4"" \xE4""\xF2""\xE1""\xF8""\xE9""\xFA"" \xEE""\xF8""\xEB""\xE6""" "\xFA"" \xE1""\xE9""\xEE""\xE9""\xED"" \xE0""\xEC""\xE4"" \xEE""\xE0""\xEE""" "\xF5"" \xE1""\xEE""\xFA""\xF7""\xF4""\xFA"" \xE0""\xE9""\xEB""\xE5""\xFA""" " \xE1""\xF0""\xE5""\xF9""\xE0"" \xEC""\xE1""\xF0""\xE5""\xEF"". \xEB""\xEC""" " \xE0""\xE7""\xE3"" \xE9""\xEB""\xE5""\xEC"" \xEC""\xF1""\xE9""\xE9""\xF2""" ". \xF2""\xE6""\xF8""\xE5"" \xEC""\xE4""\xE1""\xE8""\xE9""\xE7"" \xE0""\xFA""" " \xE4""\xF6""\xEC""\xE7""\xFA""\xE4""! \xF2""\xF8""\xEA"" \xEE""\xE5""\xEE""" "\xEC""\xF5"" \xE4""\xE4""\xFA""\xF0""\xE2""\xE3""\xE5""\xFA"" \xE4""\xE2""" "\xF8""\xEE""\xF0""\xE9""\xFA"" \xEC""\xF0""\xE0""\xF6""\xE9""\xE6""\xED""" " \xE4""\xF7""\xE9""\xF4""\xE4"" \xE9""\xE7""\xE9""\xE3""\xE9""\xED"" \xE5""" "\xF7""\xE1""\xE5""\xF6""\xE5""\xFA"" \xE1""\xE2""\xF8""\xEE""\xF0""\xE9""" "\xE4"" \xE4""\xF0""\xE0""\xF6""\xE9""\xFA"" \xE0""\xF9""\xF8"" \xE4""\xFA""" "\xF0""\xE2""\xE3""\xE5"" \xEC""\xEE""\xF9""\xE8""\xF8""\xE5"" \xF9""\xEC""" " \xE0""\xE3""\xE5""\xEC""\xF3"" \xE4""\xE9""\xE8""\xEC""\xF8"" \xE5""\xEC""" "\xF9""\xEC""\xE8""\xE5""\xEF"" \xE4""\xE0""\xE9""\xEE""\xE9""\xED"" \xF9""" "\xEC"" \xE4""\xEE""\xF4""\xEC""\xE2""\xE4"" \xE4""\xF0""\xE0""\xF6""\xE9""" "\xFA"" \xE1""\xE9""\xEF"" \xE4""\xF9""\xF0""\xE9""\xED"" 1933 - 1945. \xE7""" "\xEC""\xF7"" \xEE""\xE0""\xF0""\xF9""\xE9"" \xE4""\xFA""\xF0""\xE5""\xF2""" "\xE4"" \xE4""\xE9""\xE5"" \xEE""\xF2""\xE5""\xF8""\xE1""\xE9""\xED"" \xE1""" "\xF0""\xE9""\xF1""\xE9""\xE5""\xF0""\xE5""\xFA"" \xEC""\xE4""\xE3""\xE9""" "\xE7"" \xE0""\xFA"" \xE4""\xE9""\xE8""\xEC""\xF8"" \xE5""\xFA""\xF0""\xE5""" "\xF2""\xFA""\xE5"" \xEE""\xE4""\xF9""\xEC""\xE8""\xE5""\xEF"", \xF0""\xE9""" "\xF1""\xE9""\xE5""\xF0""\xE5""\xFA"" \xF9""\xE4""\xE2""\xE9""\xF2""\xE5""" " \xEC""\xF9""\xE9""\xE0"" \xE1""\xF7""\xF9""\xF8"" \xE4""\xF2""\xF9""\xF8""" "\xE9""\xED"" \xE1""\xE9""\xE5""\xEC""\xE9"", \xF9""\xE1""\xE5"" \xF0""\xE9""" "\xF1""\xFA""\xE4"" \xF7""\xE1""\xE5""\xF6""\xE4"" \xEE""\xE0""\xE5""\xF8""" "\xE2""\xF0""\xFA"", \xF9""\xE4""\xFA""\xE1""\xF1""\xF1""\xE4"" \xF2""\xEC""" " \xE0""\xF0""\xF9""\xE9"" \xF6""\xE1""\xE0"" \xE1""\xEB""\xE9""\xF8""\xE9""" "\xED"" \xE1""\xE5""\xE5""\xF8""\xEE""\xE0""\xEB""\xE8"", \xEC""\xE4""\xFA""" "\xF0""\xF7""\xF9"" \xE1""\xE7""\xE9""\xE9"" \xE4""\xE9""\xE8""\xEC""\xF8""" ", \xE5""\xEC""\xE4""\xE7""\xEC""\xE9""\xF3"" \xE0""\xFA"" \xF9""\xEC""\xE8""" "\xE5""\xEF"" \xE4""\xEE""\xF4""\xEC""\xE2""\xE4"" \xE4""\xF0""\xE0""\xF6""" "\xE9""\xFA"" \xE1""\xF9""\xEC""\xE8""\xE5""\xEF"" \xF6""\xE1""\xE0""\xE9""" " \xE5""\xE0""\xE6""\xF8""\xE7""\xE9"" \xE1""\xF8""\xE0""\xF9""\xE5"" \xE9""" "\xF2""\xEE""\xE3""\xE5"" \xE4""\xE2""\xF0""\xF8""\xEC"" \xE1""\xE3""\xE9""" "\xEE""\xE5""\xF1"" \xEC""\xE5""\xE3""\xE5""\xE5""\xE9""\xE2"" \xE1""\xF7""" ", \xE5""\xF8""\xE0""\xF9"" \xF2""\xE9""\xF8""\xE9""\xFA"" \xEC""\xE9""\xE9""" "\xF4""\xF6""\xE9""\xE2"", \xF7""\xF8""\xEC"" \xF4""\xF8""\xE9""\xE3""\xF8""" "\xE9""\xEA"" \xE2""\xF8""\xE3""\xEC""\xF8"". \xEB""\xF9""\xEC""\xE5""\xF0""" "\xE5"" \xF9""\xEC"" \xE4""\xF7""\xF9""\xF8"" \xE4""\xE1""\xE9""\xE0"" \xEC""" "\xE2""\xEC"" \xEE""\xF2""\xF6""\xF8""\xE9""\xED"" \xE5""\xE4""\xE5""\xF6""" "\xE0""\xE5""\xFA"" \xEC""\xE4""\xE5""\xF8""\xE2"", \xE0""\xF9""\xF8"" \xE7""" "\xE9""\xF1""\xEC"", \xEC""\xEE""\xF2""\xF9""\xE4"", \xE0""\xFA"" \xE4""\xE4""" "\xFA""\xF0""\xE2""\xE3""\xE5""\xFA"" \xE4""\xEE""\xE0""\xE5""\xF8""\xE2""" "\xF0""\xFA"" \xEC""\xEE""\xF9""\xE8""\xF8""\xE5"" \xF9""\xEC"" \xE4""\xE9""" "\xE8""\xEC""\xF8"", \xF2""\xE3"" \xEC""\xF1""\xE5""\xF3"" \xE9""\xEE""\xE9""" " \xE4""\xF8""\xE9""\xE9""\xEA"" \xE4""\xF9""\xEC""\xE9""\xF9""\xE9"", \xEB""" "\xFA""\xF9""\xF2""\xE4"" \xE7""\xE5""\xE3""\xF9""\xE9""\xED"" \xEC""\xE0""" "\xE7""\xF8"" \xEE""\xEB""\xEF"". \xEC""\xF2""\xF8""\xEA"" \xE4""\xEE""\xEC""" "\xE0"" - \xEE""\xE5""\xEE""\xEC""\xF6""\xE9""\xED"" \xF0""\xE5""\xF1""\xF4""" "\xE9""\xED"" \xE4""\xE9""\xE3""\xF2""\xFA""? \xE1""\xF9""\xF0""\xFA"" 19" "61, \xF9""\xE1""\xE4"" \xE4""\xE9""\xE5"" \xE7""\xE9""\xEC""\xE5""\xF4""" "\xE9"" \xEE""\xF9""\xE8""\xF8"" \xE1""\xF1""\xE5""\xF8""\xE9""\xE4"" \xE5""" "\xE4""\xE0""\xE9""\xE7""\xE5""\xE3"" \xF2""\xED"" \xEE""\xF6""\xF8""\xE9""" "\xED"", \xE4""\xF8""\xF4""\xE5""\xE1""\xEC""\xE9""\xF7""\xE4"" \xE4""\xF2""" "\xF8""\xE1""\xE9""\xFA"" \xE4""\xEE""\xE0""\xE5""\xE7""\xE3""\xFA"", \xF4""" "\xE5""\xF8""\xF7"", \xF0""\xC6""\xE0""\xC1""\xF1""\xC8""\xF8"" \xE7""\xE0""" "\xF4""\xE6"" \xE0""\xEC""-\xE0""\xF1""\xE3"", \xEC""\xE9""\xEE""\xE9""\xED""" " \xF0""\xF9""\xE9""\xE0"" \xF1""\xE5""\xF8""\xE9""\xE4"", \xE5""\xF0""\xEB""" "\xEC""\xE0"" \xEC""\xEE""\xF9""\xEA"" \xE7""\xE5""\xE3""\xF9"" \xE1""\xEE""" "\xF6""\xF8""\xE9""\xED"", \xE5""\xEC""\xE0""\xE7""\xF8"" \xEE""\xEB""\xEF""" " \xF0""\xEE""\xEC""\xE8"" \xEC""\xEC""\xE1""\xF0""\xE5""\xEF"", \xE5""\xE2""" "\xED"" \xF9""\xED"" \xE4""\xE5""\xF9""\xEC""\xEA"" \xE0""\xEC"" \xE4""\xEB""" "\xEC""\xE0"". ... \xF8""\xE5""\xF6""\xE4"" \xEC""\xE3""\xF2""\xFA"" \xF2""" "\xE5""\xE3""? \xE4""\xE9""\xE5""\xED"" \xE1""\xE4""\xE9""\xF1""\xE8""\xE5""" "\xF8""\xE9""\xE4"" 1492 - \xEB""\xF8""\xE9""\xF1""\xE8""\xE5""\xF4""\xF8""" " \xF7""\xE5""\xEC""\xE5""\xEE""\xE1""\xE5""\xF1"" \xEE""\xE2""\xEC""\xE4""" " \xE0""\xFA"" \xE9""\xE1""\xF9""\xFA"" \xE0""\xEE""\xF8""\xE9""\xF7""\xE4""" " 1537 - \xE1""\xEF"" \xE6""\xEB""\xF8"" \xF0""\xE5""\xEC""\xE3"" \xEC""\xE4""" "\xF0""\xF8""\xE9"" \xE4""\xF9""\xEE""\xE9""\xF0""\xE9"" 1899 - \xF4""\xE5""" "\xF8""\xF6""\xFA"" \xEE""\xEC""\xE7""\xEE""\xFA"" \xE4""\xE1""\xE5""\xF8""" "\xE9""\xED"" \xE4""\xF9""\xF0""\xE9""\xE4"" \xEC""\xE0""\xE7""\xF8"" \xF9""" "\xE4""\xE1""\xE5""\xF8""\xE9""\xED""" ; // This is just the above text brute-force byte reversed. const char* kTeststr07v = // aka ISO-8859-8 Hebrew in visual order // Produced by stringify.cc on 2007-04-04 12:17 from file wikifiles/he_wikipedia_org_clean__visual.txt "\xED""\xE9""\xF8""\xE5""\xE1""\xE4""\xF9"" \xF8""\xE7""\xE0""\xEC"" \xE4""" "\xE9""\xF0""\xF9""\xE4"" \xED""\xE9""\xF8""\xE5""\xE1""\xE4"" \xFA""\xEE""" "\xE7""\xEC""\xEE"" \xFA""\xF6""\xF8""\xE5""\xF4"" - 9981 \xE9""\xF0""\xE9""" "\xEE""\xF9""\xE4"" \xE9""\xF8""\xF0""\xE4""\xEC"" \xE3""\xEC""\xE5""\xF0""" " \xF8""\xEB""\xE6"" \xEF""\xE1"" - 7351 \xE4""\xF7""\xE9""\xF8""\xEE""\xE0""" " \xFA""\xF9""\xE1""\xE9"" \xFA""\xE0"" \xE4""\xEC""\xE2""\xEE"" \xF1""\xE5""" "\xE1""\xEE""\xE5""\xEC""\xE5""\xF7"" \xF8""\xF4""\xE5""\xE8""\xF1""\xE9""" "\xF8""\xEB"" - 2941 \xE4""\xE9""\xF8""\xE5""\xE8""\xF1""\xE9""\xE4""\xE1""" " \xED""\xE5""\xE9""\xE4"" ?\xE3""\xE5""\xF2"" \xFA""\xF2""\xE3""\xEC"" \xE4""" "\xF6""\xE5""\xF8"" ... .\xE0""\xEC""\xEB""\xE4"" \xEC""\xE0"" \xEA""\xEC""" "\xF9""\xE5""\xE4"" \xED""\xF9"" \xED""\xE2""\xE5"" ,\xEF""\xE5""\xF0""\xE1""" "\xEC""\xEC"" \xE8""\xEC""\xEE""\xF0"" \xEF""\xEB""\xEE"" \xF8""\xE7""\xE0""" "\xEC""\xE5"" ,\xED""\xE9""\xF8""\xF6""\xEE""\xE1"" \xF9""\xE3""\xE5""\xE7""" " \xEA""\xF9""\xEE""\xEC"" \xE0""\xEC""\xEB""\xF0""\xE5"" ,\xE4""\xE9""\xF8""" "\xE5""\xF1"" \xE0""\xE9""\xF9""\xF0"" \xED""\xE9""\xEE""\xE9""\xEC"" ,\xE3""" "\xF1""\xE0""-\xEC""\xE0"" \xE6""\xF4""\xE0""\xE7"" \xF8""\xC8""\xF1""\xC1""" "\xE0""\xC6""\xF0"" ,\xF7""\xF8""\xE5""\xF4"" ,\xFA""\xE3""\xE7""\xE5""\xE0""" "\xEE""\xE4"" \xFA""\xE9""\xE1""\xF8""\xF2""\xE4"" \xE4""\xF7""\xE9""\xEC""" "\xE1""\xE5""\xF4""\xF8""\xE4"" ,\xED""\xE9""\xF8""\xF6""\xEE"" \xED""\xF2""" " \xE3""\xE5""\xE7""\xE9""\xE0""\xE4""\xE5"" \xE4""\xE9""\xF8""\xE5""\xF1""" "\xE1"" \xF8""\xE8""\xF9""\xEE"" \xE9""\xF4""\xE5""\xEC""\xE9""\xE7"" \xE5""" "\xE9""\xE4"" \xE4""\xE1""\xF9"" ,1691 \xFA""\xF0""\xF9""\xE1"" ?\xFA""\xF2""" "\xE3""\xE9""\xE4"" \xED""\xE9""\xF4""\xF1""\xE5""\xF0"" \xED""\xE9""\xF6""" "\xEC""\xEE""\xE5""\xEE"" - \xE0""\xEC""\xEE""\xE4"" \xEA""\xF8""\xF2""\xEC""" " .\xEF""\xEB""\xEE"" \xF8""\xE7""\xE0""\xEC"" \xED""\xE9""\xF9""\xE3""\xE5""" "\xE7"" \xE4""\xF2""\xF9""\xFA""\xEB"" ,\xE9""\xF9""\xE9""\xEC""\xF9""\xE4""" " \xEA""\xE9""\xE9""\xF8""\xE4"" \xE9""\xEE""\xE9"" \xF3""\xE5""\xF1""\xEC""" " \xE3""\xF2"" ,\xF8""\xEC""\xE8""\xE9""\xE4"" \xEC""\xF9"" \xE5""\xF8""\xE8""" "\xF9""\xEE""\xEC"" \xFA""\xF0""\xE2""\xF8""\xE5""\xE0""\xEE""\xE4"" \xFA""" "\xE5""\xE3""\xE2""\xF0""\xFA""\xE4""\xE4"" \xFA""\xE0"" ,\xE4""\xF9""\xF2""" "\xEE""\xEC"" ,\xEC""\xF1""\xE9""\xE7"" \xF8""\xF9""\xE0"" ,\xE2""\xF8""\xE5""" "\xE4""\xEC"" \xFA""\xE5""\xE0""\xF6""\xE5""\xE4""\xE5"" \xED""\xE9""\xF8""" "\xF6""\xF2""\xEE"" \xEC""\xE2""\xEC"" \xE0""\xE9""\xE1""\xE4"" \xF8""\xF9""" "\xF7""\xE4"" \xEC""\xF9"" \xE5""\xF0""\xE5""\xEC""\xF9""\xEB"" .\xF8""\xEC""" "\xE3""\xF8""\xE2"" \xEA""\xE9""\xF8""\xE3""\xE9""\xF8""\xF4"" \xEC""\xF8""" "\xF7"" ,\xE2""\xE9""\xF6""\xF4""\xE9""\xE9""\xEC"" \xFA""\xE9""\xF8""\xE9""" "\xF2"" \xF9""\xE0""\xF8""\xE5"" ,\xF7""\xE1"" \xE2""\xE9""\xE5""\xE5""\xE3""" "\xE5""\xEC"" \xF1""\xE5""\xEE""\xE9""\xE3""\xE1"" \xEC""\xF8""\xF0""\xE2""" "\xE4"" \xE5""\xE3""\xEE""\xF2""\xE9"" \xE5""\xF9""\xE0""\xF8""\xE1"" \xE9""" "\xE7""\xF8""\xE6""\xE0""\xE5"" \xE9""\xE0""\xE1""\xF6"" \xEF""\xE5""\xE8""" "\xEC""\xF9""\xE1"" \xFA""\xE9""\xF6""\xE0""\xF0""\xE4"" \xE4""\xE2""\xEC""" "\xF4""\xEE""\xE4"" \xEF""\xE5""\xE8""\xEC""\xF9"" \xFA""\xE0"" \xF3""\xE9""" "\xEC""\xE7""\xE4""\xEC""\xE5"" ,\xF8""\xEC""\xE8""\xE9""\xE4"" \xE9""\xE9""" "\xE7""\xE1"" \xF9""\xF7""\xF0""\xFA""\xE4""\xEC"" ,\xE8""\xEB""\xE0""\xEE""" "\xF8""\xE5""\xE5""\xE1"" \xED""\xE9""\xF8""\xE9""\xEB""\xE1"" \xE0""\xE1""" "\xF6"" \xE9""\xF9""\xF0""\xE0"" \xEC""\xF2"" \xE4""\xF1""\xF1""\xE1""\xFA""" "\xE4""\xF9"" ,\xFA""\xF0""\xE2""\xF8""\xE5""\xE0""\xEE"" \xE4""\xF6""\xE5""" "\xE1""\xF7"" \xE4""\xFA""\xF1""\xE9""\xF0"" \xE5""\xE1""\xF9"" ,\xE9""\xEC""" "\xE5""\xE9""\xE1"" \xED""\xE9""\xF8""\xF9""\xF2""\xE4"" \xF8""\xF9""\xF7""" "\xE1"" \xE0""\xE9""\xF9""\xEC"" \xE5""\xF2""\xE9""\xE2""\xE4""\xF9"" \xFA""" "\xE5""\xF0""\xE5""\xE9""\xF1""\xE9""\xF0"" ,\xEF""\xE5""\xE8""\xEC""\xF9""" "\xE4""\xEE"" \xE5""\xFA""\xF2""\xE5""\xF0""\xFA""\xE5"" \xF8""\xEC""\xE8""" "\xE9""\xE4"" \xFA""\xE0"" \xE7""\xE9""\xE3""\xE4""\xEC"" \xFA""\xE5""\xF0""" "\xE5""\xE9""\xF1""\xE9""\xF0""\xE1"" \xED""\xE9""\xE1""\xF8""\xE5""\xF2""" "\xEE"" \xE5""\xE9""\xE4"" \xE4""\xF2""\xE5""\xF0""\xFA""\xE4"" \xE9""\xF9""" "\xF0""\xE0""\xEE"" \xF7""\xEC""\xE7"" .5491 - 3391 \xED""\xE9""\xF0""\xF9""" "\xE4"" \xEF""\xE9""\xE1"" \xFA""\xE9""\xF6""\xE0""\xF0""\xE4"" \xE4""\xE2""" "\xEC""\xF4""\xEE""\xE4"" \xEC""\xF9"" \xED""\xE9""\xEE""\xE9""\xE0""\xE4""" " \xEF""\xE5""\xE8""\xEC""\xF9""\xEC""\xE5"" \xF8""\xEC""\xE8""\xE9""\xE4""" " \xF3""\xEC""\xE5""\xE3""\xE0"" \xEC""\xF9"" \xE5""\xF8""\xE8""\xF9""\xEE""" "\xEC"" \xE5""\xE3""\xE2""\xF0""\xFA""\xE4"" \xF8""\xF9""\xE0"" \xFA""\xE9""" "\xF6""\xE0""\xF0""\xE4"" \xE4""\xE9""\xF0""\xEE""\xF8""\xE2""\xE1"" \xFA""" "\xE5""\xF6""\xE5""\xE1""\xF7""\xE5"" \xED""\xE9""\xE3""\xE9""\xE7""\xE9""" " \xE4""\xF4""\xE9""\xF7""\xE4"" \xED""\xE6""\xE9""\xF6""\xE0""\xF0""\xEC""" " \xFA""\xE9""\xF0""\xEE""\xF8""\xE2""\xE4"" \xFA""\xE5""\xE3""\xE2""\xF0""" "\xFA""\xE4""\xE4"" \xF5""\xEC""\xEE""\xE5""\xEE"" \xEA""\xF8""\xF2"" !\xE4""" "\xFA""\xE7""\xEC""\xF6""\xE4"" \xFA""\xE0"" \xE7""\xE9""\xE8""\xE1""\xE4""" "\xEC"" \xE5""\xF8""\xE6""\xF2"" .\xF2""\xE9""\xE9""\xF1""\xEC"" \xEC""\xE5""" "\xEB""\xE9"" \xE3""\xE7""\xE0"" \xEC""\xEB"" .\xEF""\xE5""\xF0""\xE1""\xEC""" " \xE0""\xF9""\xE5""\xF0""\xE1"" \xFA""\xE5""\xEB""\xE9""\xE0"" \xFA""\xF4""" "\xF7""\xFA""\xEE""\xE1"" \xF5""\xEE""\xE0""\xEE"" \xE4""\xEC""\xE0"" \xED""" "\xE9""\xEE""\xE9""\xE1"" \xFA""\xE6""\xEB""\xF8""\xEE"" \xFA""\xE9""\xF8""" "\xE1""\xF2""\xE4"" \xE4""\xE9""\xE3""\xF4""\xE9""\xF7""\xE9""\xE5"" \xFA""" "\xE5""\xEB""\xE9""\xE0"" \xFA""\xF4""\xF7""\xFA""\xEE"" \xE4""\xEB""\xE9""" "\xF8""\xF2"" \xFA""\xE5""\xF0""\xE5""\xE9""\xF1""\xF0""\xEC"" \xEC""\xE5""" "\xE7"" \xE6""\xE2""\xF8""\xE0"" - \xE4""\xF8""\xE6""\xF2""\xE4"" \xE9""\xF4""" "\xE3"" \xEC""\xEB"" - \xFA""\xE5""\xE1""\xE5""\xF9""\xFA""\xE5"" \xFA""\xE5""" "\xEC""\xE0""\xF9"" - \xE4""\xF8""\xE6""\xF2"" :\xE4""\xF8""\xE6""\xF2"" " "\xED""\xE9""\xEB""\xF8""\xF2"" " ; const char* kTeststr08 = // aka ISO-8859-9 // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/mus_wikipedia_org_clean__Latin5.txt " language and think it would be cool to have your own Encyclopedia then " "you can make it. Go ahead. Translate this page and start working on your" " Encyclopedia. For more information go to the main website Other wikis M" "eta-Wikipedia/Meta-Vicipaedia | Wikitonary/Victionaria | Wikibooks/Vicil" "ibraria | Wikiquote/Viciquotas | Wikisource | Wikitravel A\xFE""k Arkada" "\xFE""l\xFD""k Dostluk \xDE""iirler sevgili Av Videolar\xFD"" Av K\xF6""" "pekleri Sat\xFD""l\xFD""k Av T\xFC""fekleri Bal\xFD""k Av\xFD"" Tav\xFE""" "an Av\xFD"" Domuz Av\xFD"" Av Oyunlar\xFD"" A\xFE""k Arkada\xFE""l\xFD""" "k Dostluk \xDE""iirler sevgili Retrieved from \"http://mus.wikipedia.org" "/wiki/Main_Page\" Views Article Discussion Edit History Personal tools L" "og in / create account if (window.isMSIE55) fixalpha(); Navigation Main " "Page Community portal Current events Recent changes Random page Help Don" "ations Search Toolbo" ; const char* kTeststr10 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/ja_wikipedia_org_clean__EUC-JP.txt " \xCB""\xCC""\xB3""\xA4""\xC6""\xBB""\xC6""\xFC""\xCB""\xDC""\xA5""\xCF""" "\xA5""\xE0""\xA5""\xD5""\xA5""\xA1""\xA5""\xA4""\xA5""\xBF""\xA1""\xBC""" "\xA5""\xBA""\xA4""\xAC""\xA5""\xBD""\xA5""\xD5""\xA5""\xC8""\xA5""\xD0""" "\xA5""\xF3""\xA5""\xAF""\xA4""\xC8""\xA4""\xCE""\xA5""\xD7""\xA5""\xEC""" "\xA1""\xBC""\xA5""\xAA""\xA5""\xD5""\xA4""\xF2""\xC0""\xA9""\xA4""\xB7""" "\xA1""\xA2""25\xC7""\xAF""\xA4""\xD6""\xA4""\xEA""3\xC5""\xD9""\xCC""\xDC""" "\xA4""\xCE""\xA5""\xD1""\xA5""\xB7""\xA5""\xD5""\xA5""\xA3""\xA5""\xC3""" "\xA5""\xAF""\xA1""\xA6""\xA5""\xEA""\xA1""\xBC""\xA5""\xB0""\xCD""\xA5""" "\xBE""\xA1""\xA1""\xA3"" \xCB""\xCC""\xC4""\xAB""\xC1""\xAF""\xB3""\xCB""" "\xBC""\xC2""\xB8""\xB3""\xA4""\xCB""\xC2""\xD0""\xA4""\xB9""\xA4""\xEB""" "\xB7""\xD0""\xBA""\xD1""\xC0""\xA9""\xBA""\xDB""\xA4""\xC7""\xC6""\xFC""" "\xCB""\xDC""\xC6""\xC8""\xBC""\xAB""\xA4""\xCE""\xC4""\xC9""\xB2""\xC3""" "\xC0""\xA9""\xBA""\xDB""\xA4""\xF2""\xB7""\xE8""\xC4""\xEA""\xA1""\xA3""" " \xA5""\xC7""\xA5""\xA3""\xA1""\xBC""\xA5""\xD7""\xA5""\xA4""\xA5""\xF3""" "\xA5""\xD1""\xA5""\xAF""\xA5""\xC8""\xA4""\xAC""\xC7""\xAF""\xC6""\xE2""" "\xA4""\xC7""\xB0""\xFA""\xC2""\xE0""\xA4""\xB9""\xA4""\xEB""\xA4""\xC8""" "\xC8""\xAF""\xC9""\xBD""\xA1""\xA3""\xA2""\xAA""\xA5""\xA6""\xA5""\xA3""" "\xA5""\xAD""\xA5""\xCB""\xA5""\xE5""\xA1""\xBC""\xA5""\xB9"" Google\xA4""" "\xAC""Google Docs & Spreadsheets\xA1""\xCA""Google\xC8""\xC7""\xA1""\xD6""" "Office\xA1""\xD7""\xA1""\xA2""\xA5""\xD9""\xA1""\xBC""\xA5""\xBF""\xC8""" "\xC7""\xA1""\xCB""\xA4""\xCE""\xC4""\xF3""\xB6""\xA1""\xA4""\xF2""\xB3""" "\xAB""\xBB""\xCF""\xA1""\xA3"" [\xA5""\xA6""\xA5""\xA3""\xA5""\xAD""\xA5""" "\xCB""\xA5""\xE5""\xA1""\xBC""\xA5""\xB9""] [\xBA""\xC7""\xB6""\xE1""\xA4""" "\xCE""\xBD""\xD0""\xCD""\xE8""\xBB""\xF6""\xC1""\xB4""\xCA""\xB8""] \xC5""" "\xEA""\xC9""\xBC""\xA1""\xA6""\xBF""\xE4""\xC1""\xA6"" \xB5""\xA8""\xC0""" "\xE1""\xA4""\xCE""\xCF""\xC3""\xC2""\xEA"" \xBD""\xA9"" - \xB1""\xBF""\xC6""" "\xB0""\xB2""\xF1"" - \xB0""\xF2""\xBC""\xD1""\xB2""\xF1"" - \xA5""\xB5""" "\xA5""\xF3""\xA5""\xDE"" - \xA5""\xD6""\xA5""\xC9""\xA5""\xA6"" - \xA5""" "\xAD""\xA5""\xF3""\xA5""\xE2""\xA5""\xAF""\xA5""\xBB""\xA5""\xA4"" - \xA4""" "\xC9""\xA4""\xF3""\xA4""\xB0""\xA4""\xEA"" - \xBD""\xE9""\xB4""\xA7""\xC0""" "\xE3"" - \xBD""\xA9""\xA4""\xCE""\xCD""\xBC""\xBE""\xC6""\xA4""\xB1""(*)" " - \xBE""\xBE""\xC2""\xFB"" \xBA""\xA3""\xC6""\xFC""\xA4""\xCE""\xA4""\xB3""" "\xA4""\xE8""\xA4""\xDF"" \xB5""\xEC""\xCE""\xF1"":8\xB7""\xEE""22\xC6""\xFC""" " - \xC2""\xE7""\xB0""\xC2"" - \xC6""\xFC""\xA4""\xCE""\xB4""\xB3""\xBB""" "\xD9"":\xB2""\xB5""\xB0""\xE7"" - \xB6""\xE5""\xC0""\xB1"":\xBB""\xCD""\xCE""" "\xD0""\xCC""\xDA""\xC0""\xB1"" - \xC6""\xF3""\xBD""\xBD""\xC8""\xAC""\xBD""" "\xC9"":\xD0""\xB6""\xBD""\xC9"" - \xBD""\xBD""\xC6""\xF3""\xC4""\xBE"":\xBD""" "\xFC"" - \xC0""\xE1""\xB5""\xA4"":\xB4""\xA8""\xCF""\xAA""\xA1""\xA2""\xC1""" "\xFA""\xB9""\xDF""\xA4""\xDE""\xA4""\xC7""10\xC6""\xFC"" - \xC1""\xAA""\xC6""" "\xFC"":\xC2""\xE7""\xC8""\xC8""\xC5""\xDA"" \xBA""\xA3""\xC6""\xFC""\xA4""" "\xCF""\xB2""\xBF""\xA4""\xCE""\xC6""\xFC"" \xA5""\xB0""\xA5""\xEA""\xA5""" "\xCB""\xA5""\xC3""\xA5""\xB8""\xC5""\xB7""\xCA""\xB8""\xC2""\xE6""\xA4""" "\xF2""\xC4""\xCC""\xA4""\xEB""\xB7""\xD0""\xC0""\xFE""\xA4""\xF2""0\xC5""" "\xD9""\xA4""\xC8""\xC4""\xEA""\xA4""\xE1""\xA4""\xEB""\xA1""\xCA""1884\xC7""" "\xAF""\xA1""\xCB"" 11\xB5""\xDC""\xB2""\xC8""51\xBF""\xCD""\xA4""\xCE""\xB9""" "\xC4""\xC2""\xB2""\xCE""\xA5""\xC3""\xA6""\xA4""\xAC""\xB7""\xE8""\xC4""" "\xEA""\xA1""\xCA""1947\xC7""\xAF""\xA1""\xCB"" \xA5""\xD6""\xA5""\xE9""\xA5""" "\xC3""\xA5""\xAF""\xA1""\xA6""\xA5""\xC1""\xA5""\xE5""\xA1""\xBC""\xA5""" "\xBA""\xA5""\xC7""\xA1""\xBC""\xA1""\xCA""1989\xC7""\xAF""\xA1""\xCB"" \xC2""" "\xE7""\xB9""\xBE""\xB7""\xF2""\xBB""\xB0""\xCF""\xBA""\xA4""\xCE""\xA5""" "\xCE""\xA1""\xBC""\xA5""\xD9""\xA5""\xEB""\xCA""\xB8""\xB3""\xD8""\xBE""" "\xDE""\xBC""\xF5""\xBE""\xDE""\xA4""\xAC""\xB7""\xE8""\xC4""\xEA""\xA1""" "\xCA""1994\xC7""\xAF""\xA1""\xCB"" \xEB""\xBE""\xCA""\xF3"" \xA5""\xB3""" "\xA5""\xEA""\xA1""\xBC""\xA1""\xA6""\xA5""\xE9""\xA5""\xA4""\xA5""\xC9""" "\xA5""\xEB""\xA1""\xCA""Cory Lidle,10\xB7""\xEE""11\xC6""\xFC""\xDD""\xC7""" "\xA1""\xCB"" - \xA5""\xCB""\xA5""\xE5""\xA1""\xBC""\xA5""\xE8""\xA1""\xBC""" "\xA5""\xAF""\xA1""\xA6""\xA5""\xE4""\xA5""\xF3""\xA5""\xAD""\xA1""\xBC""" "\xA5""\xB9""\xA4""\xCE""\xC5""\xEA""\xBC""\xEA"" \xBB""\xCD""\xC2""\xE5""" "\xCC""\xDC""\xCC""\xF8""\xB2""\xC8""\xBE""\xAE""\xA4""\xBB""\xA4""\xF3""" "\xA1""\xCA""10\xB7""\xEE""10\xC6""\xFC""\xDD""\xC7""\xA1""\xCB"" - \xCD""" "\xEE""\xB8""\xEC""\xB2""\xC8"" \xA5""\xDE""\xA5""\xEC""\xA5""\xAF""\xA1""" "\xA6""\xA5""\xB0""\xA5""\xEC""\xA5""\xD5""\xA5""\xBF""\xA1""\xCA""Marek " "Grechuta,10\xB7""\xEE""9\xC6""\xFC""\xDD""\xC7""\xA1""\xCB"" - \xA5""\xDD""" "\xA1""\xBC""\xA5""\xE9""\xA5""\xF3""\xA5""\xC9""\xA4""\xCE""\xB2""\xCE""" "\xBC""\xEA"" \xC0""\xBE""\xBB""\xB3""\xC5""\xD0""\xBB""\xD6""\xCD""\xBA""" "\xA1""\xCA""10\xB7""\xEE""9\xC6""\xFC""\xDD""\xC7""\xA1""\xCB"" - \xB8""" "\xB5""\xC5""\xEC""\xC9""\xF0""\xC6""\xB0""\xCA""\xAA""\xB8""\xF8""\xB1""" "\xE0""\xB1""\xE0""\xC4""\xB9""\xA1""\xCA""\xA1""\xD6""\xA5""\xAB""\xA5""" "\xD0""\xB1""\xE0""\xC4""\xB9""\xA1""\xD7""\xA1""\xCB"" \xA5""\xA4""\xA1""" "\xBC""\xA5""\xB4""\xA5""\xEA""\xA1""\xA6""\xA5""\xE9""\xA5""\xC6""\xA5""" "\xA3""\xA5""\xB7""\xA5""\xA7""\xA5""\xD5""\xA1""\xCA""10\xB7""\xEE""6\xC6""" "\xFC""\xDD""\xC7""\xA1""\xCB"" - \xA5""\xED""\xA5""\xB7""\xA5""\xA2""\xA4""" "\xCE""\xC6""\xFC""\xCB""\xDC""\xB8""\xA6""\xB5""\xE6""\xB2""\xC8""\xA1""" "\xA2""\xB8""\xB5""\xA5""\xBD""\xA5""\xD3""\xA5""\xA8""\xA5""\xC8""\xCF""" "\xA2""\xCB""\xAE""\xB6""\xA6""\xBB""\xBA""\xC5""\xDE""\xB5""\xA1""\xB4""" "\xD8""\xBB""\xE6""\xA5""\xD7""\xA5""\xE9""\xA5""\xA6""\xA5""\xC0""\xC5""" "\xEC""\xB5""\xFE""\xBB""\xD9""\xB6""\xC9""\xC4""\xB9"" \xC9""\xB4""\xB2""" "\xCA""\xBB""\xF6""\xC5""\xB5"" \xBC""\xD2""\xB2""\xF1"" \xCB""\xA1""\xCE""" "\xA7"" - \xCE""\xD1""\xCD""\xFD"" - \xC0""\xAF""\xBC""\xA3"" - \xB9""\xD4""" "\xC0""\xAF"" - \xB7""\xD0""\xBA""\xD1"" - \xBB""\xBA""\xB6""\xC8"" - \xBF""" "\xA6""\xB6""\xC8"" - \xB6""\xB5""\xB0""\xE9"" - \xCE""\xF2""\xBB""\xCB""" " - \xCA""\xA1""\xBB""\xE3"" - \xB0""\xE5""\xCE""\xC5"" - \xBB""\xD4""\xCC""" "\xB1""\xB3""\xE8""\xC6""\xB0"" - \xCA""\xBF""\xCF""\xC2"" - \xC0""\xEF""" "\xC1""\xE8"" - \xB7""\xB3""\xBB""\xF6"" \xB7""\xDD""\xBD""\xD1""\xA4""\xC8""" "\xCA""\xB8""\xB2""\xBD"" \xBF""\xA9"" - \xB8""\xC0""\xB8""\xEC"" - \xBD""" "\xA1""\xB6""\xB5"" - \xB7""\xDD""\xC7""\xBD"" - \xC0""\xB8""\xB3""\xE8""" " - \xB8""\xE4""\xB3""\xDA"" - \xCA""\xB8""\xB3""\xD8"" - \xB2""\xBB""\xB3""" "\xDA"" - \xC8""\xFE""\xBD""\xD1"" - \xC9""\xF1""\xC2""\xE6""\xB7""\xDD""" "\xBD""\xD1"" - \xB1""\xC7""\xB2""\xE8"" - \xCC""\xA1""\xB2""\xE8"" - \xA5""" "\xA2""\xA5""\xCB""\xA5""\xE1"" - \xA5""\xB9""\xA5""\xDD""\xA1""\xBC""\xA5""" "\xC4"" - \xA5""\xB2""\xA1""\xBC""\xA5""\xE0"" - \xA5""\xE1""\xA5""\xC7""" "\xA5""\xA3""\xA5""\xA2"" - \xA5""\xC6""\xA5""\xEC""\xA5""\xD3"" - \xA5""" "\xE9""\xA5""\xB8""\xA5""\xAA"" - \xBD""\xF1""\xCA""\xAA"" - \xC9""\xF7""" "\xC2""\xAF"" - \xC5""\xC1""\xBE""\xB5"" - \xC7""\xAF""\xC3""\xE6""\xB9""" "\xD4""\xBB""\xF6"" \xC0""\xA4""\xB3""\xA6"" \xA5""\xA2""\xA5""\xB8""\xA5""" "\xA2"" - \xA5""\xA2""\xA5""\xD5""\xA5""\xEA""\xA5""\xAB"" - \xA5""\xAA""" "\xA5""\xBB""\xA5""\xA2""\xA5""\xCB""\xA5""\xA2"" - \xCB""\xCC""\xA5""\xA2""" "\xA5""\xE1""\xA5""\xEA""\xA5""\xAB"" - \xC6""\xEE""\xA5""\xA2""\xA5""\xE1""" "\xA5""\xEA""\xA5""\xAB"" - \xA5""\xE8""\xA1""\xBC""\xA5""\xED""\xA5""\xC3""" "\xA5""\xD1"" \xC6""\xFC""\xCB""\xDC"" \xCB""\xCC""\xB3""\xA4""\xC6""\xBB""" " - \xC5""\xEC""\xCB""\xCC"" - \xB4""\xD8""\xC5""\xEC"" - \xC3""\xE6""\xC9""" "\xF4"" - \xB6""\xE1""\xB5""\xA6"" - \xC3""\xE6""\xB9""\xF1"" - \xBB""\xCD""" "\xB9""\xF1"" - \xB6""\xE5""\xBD""\xA3"" - \xB2""\xAD""\xC6""\xEC"" \xBC""" "\xAB""\xC1""\xB3"" \xCA""\xAA""\xBC""\xC1"" - \xA5""\xA8""\xA5""\xCD""\xA5""" "\xEB""\xA5""\xAE""\xA1""\xBC"" - \xB1""\xA7""\xC3""\xE8"" - \xC3""\xCF""" "\xB5""\xE5"" - \xB4""\xC4""\xB6""\xAD"" - \xB5""\xA4""\xBE""\xDD"" - \xBA""" "\xD2""\xB3""\xB2"" - \xB3""\xA4""\xCD""\xCE"" - \xC2""\xE7""\xCE""\xA6""" "\xA1""\xA2""\xC5""\xE7"" - \xC0""\xB8""\xA4""\xAD""\xCA""\xAA""\xA4""\xC8""" "\xBC""\xAB""\xC1""\xB3"" - \xBF""\xA2""\xCA""\xAA"" - \xC6""\xB0""\xCA""" "\xAA"" - \xBF""\xCD""\xB4""\xD6"" - \xB9""\xDB""\xCA""\xAA"" \xB5""\xBB""" "\xBD""\xD1"" \xA5""\xB3""\xA5""\xF3""\xA5""\xD4""\xA5""\xE5""\xA1""\xBC""" "\xA5""\xBF"" - \xA5""\xA4""\xA5""\xF3""\xA5""\xBF""\xA1""\xBC""\xA5""\xCD""" "\xA5""\xC3""\xA5""\xC8"" - \xA5""\xA8""\xA5""\xEC""\xA5""\xAF""\xA5""\xC8""" "\xA5""\xED""\xA5""\xCB""\xA5""\xAF""\xA5""\xB9"" - \xA5""\xD0""\xA5""\xA4""" "\xA5""\xAA""\xA5""\xC6""\xA5""\xAF""\xA5""\xCE""\xA5""\xED""\xA5""\xB8""" "\xA1""\xBC"" - \xB8""\xF2""\xC4""\xCC"" - \xC5""\xB4""\xC6""\xBB"" - \xBC""" "\xAB""\xC6""\xB0""\xBC""\xD6"" - \xB7""\xFA""\xC3""\xDB"" - \xBE""\xF0""" "\xCA""\xF3"" - \xC4""\xCC""\xBF""\xAE"" - \xBB""\xF1""\xB8""\xBB"" - \xB8""" "\xB6""\xBB""\xD2""\xCE""\xCF"" - \xBF""\xF4""\xB3""\xD8""\xA4""\xC8""\xBC""" "\xAB""\xC1""\xB3""\xB2""\xCA""\xB3""\xD8"" \xBF""\xF4""\xB3""\xD8"" - \xCA""" "\xAA""\xCD""\xFD""\xB3""\xD8"" - \xB2""\xBD""\xB3""\xD8"" - \xC0""\xB8""" "\xCA""\xAA""\xB3""\xD8"" - \xC0""\xB8""\xC2""\xD6""\xB3""\xD8"" - \xC3""" "\xCF""\xB5""\xE5""\xB2""\xCA""\xB3""\xD8"" - \xC5""\xB7""\xCA""\xB8""\xB3""" "\xD8"" \xBF""\xCD""\xCA""\xB8""\xB2""\xCA""\xB3""\xD8""\xA4""\xC8""\xBC""" "\xD2""\xB2""\xF1""\xB2""\xCA""\xB3""\xD8"" \xCA""\xB8""\xB3""\xD8"" - \xB8""" "\xC0""\xB8""\xEC""\xB3""\xD8"" - \xC5""\xAF""\xB3""\xD8"" - \xCF""\xC0""" "\xCD""\xFD""\xB3""\xD8"" - \xBD""\xA1""\xB6""\xB5""\xB3""\xD8"" - \xBF""" "\xB4""\xCD""\xFD""\xB3""\xD8"" - \xC8""\xFE""\xB3""\xD8"" - \xBC""\xD2""" "\xB2""\xF1""\xB3""\xD8"" - \xCB""\xA1""\xB3""\xD8"" - \xCE""\xF2""\xBB""" "\xCB""\xB3""\xD8"" - \xB9""\xCD""\xB8""\xC5""\xB3""\xD8"" - \xCC""\xB1""" "\xC2""\xAF""\xB3""\xD8"" - \xB6""\xB5""\xB0""\xE9""\xB3""\xD8"" - \xC0""" "\xAF""\xBC""\xA3""\xB3""\xD8"" - \xB7""\xD0""\xBA""\xD1""\xB3""\xD8"" - " "\xB7""\xD0""\xB1""\xC4""\xB3""\xD8"" \xB1""\xFE""\xCD""\xD1""\xB2""\xCA""" "\xB3""\xD8""\xA4""\xC8""\xC1""\xED""\xB9""\xE7""\xB2""\xCA""\xB3""\xD8""" " \xBE""\xF0""\xCA""\xF3""\xB3""\xD8"" - \xB4""\xC4""\xB6""\xAD""\xB3""\xD8""" " - \xC3""\xCF""\xCD""\xFD""\xB3""\xD8"" - \xBF""\xCD""\xCE""\xE0""\xB3""" "\xD8"" - \xB0""\xE5""\xB3""\xD8"" - \xBC""\xD2""\xB2""\xF1""\xCA""\xA1""" "\xBB""\xE3""\xB3""\xD8"" - \xCC""\xF4""\xB3""\xD8"" - \xC7""\xC0""\xB3""" "\xD8"" - \xB9""\xA9""\xB3""\xD8"" \xBB""\xF1""\xCE""\xC1"" \xBA""\xF7""\xB0""" "\xFA"" - \xC7""\xAF""\xC9""\xBD"" - \xCE""\xF1"" - 365\xC6""\xFC"" - \xC3""" "\xCF""\xBF""\xDE"" - \xBF""\xF4""\xA4""\xCE""\xB0""\xEC""\xCD""\xF7"" - " "\xBF""\xCD""\xCC""\xBE""\xB0""\xEC""\xCD""\xF7"" - \xB0""\xEC""\xCD""\xF7""" "\xA4""\xCE""\xB0""\xEC""\xCD""\xF7"" - \xC0""\xA4""\xB3""\xA6""\xB3""\xC6""" "\xB9""\xF1""\xB4""\xD8""\xB7""\xB8""\xB5""\xAD""\xBB""\xF6"" \xA5""\xA6""" "\xA5""\xA3""\xA5""\xAD""\xA5""\xDD""\xA1""\xBC""\xA5""\xBF""\xA5""\xEB""" " \xA5""\xA2""\xA5""\xCB""\xA5""\xE1"" - \xB0""\xE5""\xB3""\xD8""\xA4""\xC8""" "\xB0""\xE5""\xCE""\xC5"" - \xC0""\xB8""\xA4""\xAD""\xCA""\xAA""\xA4""\xC8""" "\xBC""\xAB""\xC1""\xB3"" - \xB1""\xC7""\xB2""\xE8"" - \xA5""\xA8""\xA5""" "\xEC""\xA5""\xAF""\xA5""\xC8""\xA5""\xED""\xA5""\xCB""\xA5""\xAF""\xA5""" "\xB9"" - \xB2""\xBB""\xB3""\xDA"" - \xB2""\xB9""\xC0""\xF4"" - \xB2""\xBD""" "\xB3""\xD8"" - \xB4""\xC4""\xB6""\xAD"" - \xCB""\xCC""\xA5""\xA2""\xA5""" "\xE1""\xA5""\xEA""\xA5""\xAB"" - \xB6""\xB5""\xB0""\xE9"" - \xB7""\xB3""" "\xBB""\xF6"" - \xA5""\xAF""\xA5""\xE9""\xA5""\xB7""\xA5""\xC3""\xA5""\xAF""" "\xB2""\xBB""\xB3""\xDA"" - \xB7""\xD0""\xBA""\xD1""\xB3""\xD8"" - \xA5""" "\xB2""\xA1""\xBC""\xA5""\xE0"" - \xB8""\xC0""\xB8""\xEC""\xB3""\xD8"" - " "\xA5""\xB3""\xA5""\xEA""\xA5""\xA2"" - \xA5""\xB3""\xA5""\xF3""\xA5""\xD4""" "\xA5""\xE5""\xA1""\xBC""\xA5""\xBF"" - \xBA""\xD2""\xB3""\xB2"" - \xBC""" "\xAB""\xC6""\xB0""\xBC""\xD6"" - \xBF""\xA9"" - \xBF""\xA2""\xCA""\xAA""" " - \xBF""\xC0""\xC6""\xBB"" - \xA5""\xB9""\xA5""\xDD""\xA1""\xBC""\xA5""" "\xC4"" - \xC0""\xB8""\xCA""\xAA""\xB3""\xD8"" - \xC0""\xA4""\xB3""\xA6""" "\xB0""\xE4""\xBB""\xBA"" - \xC0""\xEF""\xC1""\xE8"" - \xC2""\xE8""\xBB""" "\xB0""\xC4""\xEB""\xB9""\xF1"" - \xC2""\xE7""\xC5""\xEC""\xB0""\xA1""\xB6""" "\xA6""\xB1""\xC9""\xB7""\xF7"" - \xC3""\xCF""\xB5""\xE5""\xB2""\xCA""\xB3""" "\xD8"" - \xC3""\xE6""\xB9""\xF1"" - \xC3""\xCF""\xCD""\xFD""\xB3""\xD8""" " - \xC5""\xAF""\xB3""\xD8"" - \xC5""\xB4""\xC6""\xBB"" - \xA5""\xC6""\xA5""" "\xEC""\xA5""\xD3"" - \xC5""\xB7""\xCA""\xB8""\xB3""\xD8"" - \xC6""\xFC""" "\xCB""\xDC"" - \xC6""\xFC""\xCB""\xDC""\xA4""\xCE""\xC5""\xD4""\xC6""\xBB""" "\xC9""\xDC""\xB8""\xA9"" - \xA5""\xD0""\xA5""\xB9"" - \xC8""\xFE""\xBD""" "\xD1"" - \xC9""\xF1""\xC2""\xE6""\xB7""\xDD""\xBD""\xD1"" - \xCA""\xA9""" "\xB6""\xB5"" - \xCA""\xAA""\xCD""\xFD""\xB3""\xD8"" - \xA5""\xD5""\xA5""" "\xE9""\xA5""\xF3""\xA5""\xB9"" - \xCA""\xB8""\xB3""\xD8"" - \xCA""\xBF""" "\xCF""\xC2"" - \xCC""\xA1""\xB2""\xE8"" - \xA5""\xE8""\xA1""\xBC""\xA5""" "\xED""\xA5""\xC3""\xA5""\xD1"" - \xA5""\xE9""\xA5""\xB8""\xA5""\xAA"" - " "\xCE""\xF2""\xBB""\xCB"" - \xCE""\xF2""\xBB""\xCB""\xC7""\xA7""\xBC""\xB1""" "\xA4""\xC8""\xC0""\xEF""\xB8""\xE5""\xBD""\xE8""\xCD""\xFD"" \xA5""\xAB""" "\xA5""\xC6""\xA5""\xB4""\xA5""\xEA"" \xB0""\xEC""\xCD""\xF7"" - \xA5""\xA6""" "\xA5""\xA3""\xA5""\xAD""\xA5""\xDA""\xA5""\xC7""\xA5""\xA3""\xA5""\xA2""" " - \xA5""\xA6""\xA5""\xA3""\xA5""\xAD""\xA5""\xE1""\xA5""\xC7""\xA5""\xA3""" "\xA5""\xA2""\xA1""\xA6""\xA5""\xD7""\xA5""\xED""\xA5""\xB8""\xA5""\xA7""" "\xA5""\xAF""\xA5""\xC8"" -" ; const char* kTeststr11 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/ja_wikipedia_org_clean__SJS.txt " \x96""k\x8A""C\x93""\xB9""\x93""\xFA""\x96""{\x83""n\x83""\x80""\x83""t" "\x83""@\x83""C\x83""^\x81""[\x83""Y\x82""\xAA""\x83""\\\x83""t\x83""g\x83""" "o\x83""\x93""\x83""N\x82""\xC6""\x82""\xCC""\x83""v\x83""\x8C""\x81""[\x83""" "I\x83""t\x82""\xF0""\x90""\xA7""\x82""\xB5""\x81""A25\x94""N\x82""\xD4""" "\x82""\xE8""3\x93""x\x96""\xDA""\x82""\xCC""\x83""p\x83""V\x83""t\x83""B" "\x83""b\x83""N\x81""E\x83""\x8A""\x81""[\x83""O\x97""D\x8F""\x9F""\x81""" "B \x96""k\x92""\xA9""\x91""N\x8A""j\x8E""\xC0""\x8C""\xB1""\x82""\xC9""\x91""" "\xCE""\x82""\xB7""\x82""\xE9""\x8C""o\x8D""\xCF""\x90""\xA7""\x8D""\xD9""" "\x82""\xC5""\x93""\xFA""\x96""{\x93""\xC6""\x8E""\xA9""\x82""\xCC""\x92""" "\xC7""\x89""\xC1""\x90""\xA7""\x8D""\xD9""\x82""\xF0""\x8C""\x88""\x92""" "\xE8""\x81""B \x83""f\x83""B\x81""[\x83""v\x83""C\x83""\x93""\x83""p\x83""" "N\x83""g\x82""\xAA""\x94""N\x93""\xE0""\x82""\xC5""\x88""\xF8""\x91""\xDE""" "\x82""\xB7""\x82""\xE9""\x82""\xC6""\x94""\xAD""\x95""\\\x81""B\x81""\xA8""" "\x83""E\x83""B\x83""L\x83""j\x83""\x85""\x81""[\x83""X Google\x82""\xAA""" "Google Docs & Spreadsheets\x81""iGoogle\x94""\xC5""\x81""uOffice\x81""v\x81""" "A\x83""x\x81""[\x83""^\x94""\xC5""\x81""j\x82""\xCC""\x92""\xF1""\x8B""\x9F""" "\x82""\xF0""\x8A""J\x8E""n\x81""B [\x83""E\x83""B\x83""L\x83""j\x83""\x85""" "\x81""[\x83""X] [\x8D""\xC5""\x8B""\xDF""\x82""\xCC""\x8F""o\x97""\x88""" "\x8E""\x96""\x91""S\x95""\xB6""] \x93""\x8A""\x95""[\x81""E\x90""\x84""\x91""" "E \x8B""G\x90""\xDF""\x82""\xCC""\x98""b\x91""\xE8"" \x8F""H - \x89""^\x93""" "\xAE""\x89""\xEF"" - \x88""\xF0""\x8E""\xCF""\x89""\xEF"" - \x83""T\x83""" "\x93""\x83""} - \x83""u\x83""h\x83""E - \x83""L\x83""\x93""\x83""\x82""\x83""" "N\x83""Z\x83""C - \x82""\xC7""\x82""\xF1""\x82""\xAE""\x82""\xE8"" - \x8F""" "\x89""\x8A""\xA5""\x90""\xE1"" - \x8F""H\x82""\xCC""\x97""[\x8F""\xC4""\x82""" "\xAF""(*) - \x8F""\xBC""\x91""\xF9"" \x8D""\xA1""\x93""\xFA""\x82""\xCC""" "\x82""\xB1""\x82""\xE6""\x82""\xDD"" \x8B""\x8C""\x97""\xEF"":8\x8C""\x8E""" "22\x93""\xFA"" - \x91""\xE5""\x88""\xC0"" - \x93""\xFA""\x82""\xCC""\x8A""" "\xB1""\x8E""x:\x89""\xB3""\x88""\xE5"" - \x8B""\xE3""\x90""\xAF"":\x8E""" "l\x97""\xCE""\x96""\xD8""\x90""\xAF"" - \x93""\xF1""\x8F""\\\x94""\xAA""" "\x8F""h:\x98""\xB4""\x8F""h - \x8F""\\\x93""\xF1""\x92""\xBC"":\x8F""\x9C""" " - \x90""\xDF""\x8B""C:\x8A""\xA6""\x98""I\x81""A\x91""\x9A""\x8D""~\x82""" "\xDC""\x82""\xC5""10\x93""\xFA"" - \x91""I\x93""\xFA"":\x91""\xE5""\x94""" "\xC6""\x93""y \x8D""\xA1""\x93""\xFA""\x82""\xCD""\x89""\xBD""\x82""\xCC""" "\x93""\xFA"" \x83""O\x83""\x8A""\x83""j\x83""b\x83""W\x93""V\x95""\xB6""" "\x91""\xE4""\x82""\xF0""\x92""\xCA""\x82""\xE9""\x8C""o\x90""\xFC""\x82""" "\xF0""0\x93""x\x82""\xC6""\x92""\xE8""\x82""\xDF""\x82""\xE9""\x81""i188" "4\x94""N\x81""j 11\x8B""{\x89""\xC6""51\x90""l\x82""\xCC""\x8D""c\x91""\xB0""" "\x97""\xA3""\x92""E\x82""\xAA""\x8C""\x88""\x92""\xE8""\x81""i1947\x94""" "N\x81""j \x83""u\x83""\x89""\x83""b\x83""N\x81""E\x83""`\x83""\x85""\x81""" "[\x83""Y\x83""f\x81""[\x81""i1989\x94""N\x81""j \x91""\xE5""\x8D""]\x8C""" "\x92""\x8E""O\x98""Y\x82""\xCC""\x83""m\x81""[\x83""x\x83""\x8B""\x95""\xB6""" "\x8A""w\x8F""\xDC""\x8E""\xF3""\x8F""\xDC""\x82""\xAA""\x8C""\x88""\x92""" "\xE8""\x81""i1994\x94""N\x81""j \xE6""]\x95""\xF1"" \x83""R\x83""\x8A""\x81""" "[\x81""E\x83""\x89""\x83""C\x83""h\x83""\x8B""\x81""iCory Lidle,10\x8C""" "\x8E""11\x93""\xFA""\x9F""f\x81""j - \x83""j\x83""\x85""\x81""[\x83""\x88""" "\x81""[\x83""N\x81""E\x83""\x84""\x83""\x93""\x83""L\x81""[\x83""X\x82""" "\xCC""\x93""\x8A""\x8E""\xE8"" \x8E""l\x91""\xE3""\x96""\xDA""\x96""\xF6""" "\x89""\xC6""\x8F""\xAC""\x82""\xB9""\x82""\xF1""\x81""i10\x8C""\x8E""10\x93""" "\xFA""\x9F""f\x81""j - \x97""\x8E""\x8C""\xEA""\x89""\xC6"" \x83""}\x83""" "\x8C""\x83""N\x81""E\x83""O\x83""\x8C""\x83""t\x83""^\x81""iMarek Grechu" "ta,10\x8C""\x8E""9\x93""\xFA""\x9F""f\x81""j - \x83""|\x81""[\x83""\x89""" "\x83""\x93""\x83""h\x82""\xCC""\x89""\xCC""\x8E""\xE8"" \x90""\xBC""\x8E""" "R\x93""o\x8E""u\x97""Y\x81""i10\x8C""\x8E""9\x93""\xFA""\x9F""f\x81""j -" " \x8C""\xB3""\x93""\x8C""\x95""\x90""\x93""\xAE""\x95""\xA8""\x8C""\xF6""" "\x89""\x80""\x89""\x80""\x92""\xB7""\x81""i\x81""u\x83""J\x83""o\x89""\x80""" "\x92""\xB7""\x81""v\x81""j \x83""C\x81""[\x83""S\x83""\x8A""\x81""E\x83""" "\x89""\x83""e\x83""B\x83""V\x83""F\x83""t\x81""i10\x8C""\x8E""6\x93""\xFA""" "\x9F""f\x81""j - \x83""\x8D""\x83""V\x83""A\x82""\xCC""\x93""\xFA""\x96""" "{\x8C""\xA4""\x8B""\x86""\x89""\xC6""\x81""A\x8C""\xB3""\x83""\\\x83""r\x83""" "G\x83""g\x98""A\x96""M\x8B""\xA4""\x8E""Y\x93""}\x8B""@\x8A""\xD6""\x8E""" "\x86""\x83""v\x83""\x89""\x83""E\x83""_\x93""\x8C""\x8B""\x9E""\x8E""x\x8B""" "\xC7""\x92""\xB7"" \x95""S\x89""\xC8""\x8E""\x96""\x93""T \x8E""\xD0""\x89""" "\xEF"" \x96""@\x97""\xA5"" - \x97""\xCF""\x97""\x9D"" - \x90""\xAD""\x8E""" "\xA1"" - \x8D""s\x90""\xAD"" - \x8C""o\x8D""\xCF"" - \x8E""Y\x8B""\xC6""" " - \x90""E\x8B""\xC6"" - \x8B""\xB3""\x88""\xE7"" - \x97""\xF0""\x8E""j " "- \x95""\x9F""\x8E""\x83"" - \x88""\xE3""\x97""\xC3"" - \x8E""s\x96""\xAF""" "\x8A""\x88""\x93""\xAE"" - \x95""\xBD""\x98""a - \x90""\xED""\x91""\x88""" " - \x8C""R\x8E""\x96"" \x8C""|\x8F""p\x82""\xC6""\x95""\xB6""\x89""\xBB""" " \x90""H - \x8C""\xBE""\x8C""\xEA"" - \x8F""@\x8B""\xB3"" - \x8C""|\x94""" "\\ - \x90""\xB6""\x8A""\x88"" - \x8C""\xE2""\x8A""y - \x95""\xB6""\x8A""" "w - \x89""\xB9""\x8A""y - \x94""\xFC""\x8F""p - \x95""\x91""\x91""\xE4""" "\x8C""|\x8F""p - \x89""f\x89""\xE6"" - \x96""\x9F""\x89""\xE6"" - \x83""" "A\x83""j\x83""\x81"" - \x83""X\x83""|\x81""[\x83""c - \x83""Q\x81""[\x83""" "\x80"" - \x83""\x81""\x83""f\x83""B\x83""A - \x83""e\x83""\x8C""\x83""r " "- \x83""\x89""\x83""W\x83""I - \x8F""\x91""\x95""\xA8"" - \x95""\x97""\x91""" "\xAD"" - \x93""`\x8F""\xB3"" - \x94""N\x92""\x86""\x8D""s\x8E""\x96"" \x90""" "\xA2""\x8A""E \x83""A\x83""W\x83""A - \x83""A\x83""t\x83""\x8A""\x83""J " "- \x83""I\x83""Z\x83""A\x83""j\x83""A - \x96""k\x83""A\x83""\x81""\x83""" "\x8A""\x83""J - \x93""\xEC""\x83""A\x83""\x81""\x83""\x8A""\x83""J - \x83""" "\x88""\x81""[\x83""\x8D""\x83""b\x83""p \x93""\xFA""\x96""{ \x96""k\x8A""" "C\x93""\xB9"" - \x93""\x8C""\x96""k - \x8A""\xD6""\x93""\x8C"" - \x92""\x86""" "\x95""\x94"" - \x8B""\xDF""\x8B""E - \x92""\x86""\x8D""\x91"" - \x8E""l\x8D""" "\x91"" - \x8B""\xE3""\x8F""B - \x89""\xAB""\x93""\xEA"" \x8E""\xA9""\x91""" "R \x95""\xA8""\x8E""\xBF"" - \x83""G\x83""l\x83""\x8B""\x83""M\x81""[ - " "\x89""F\x92""\x88"" - \x92""n\x8B""\x85"" - \x8A""\xC2""\x8B""\xAB"" - \x8B""" "C\x8F""\xDB"" - \x8D""\xD0""\x8A""Q - \x8A""C\x97""m - \x91""\xE5""\x97""" "\xA4""\x81""A\x93""\x87"" - \x90""\xB6""\x82""\xAB""\x95""\xA8""\x82""\xC6""" "\x8E""\xA9""\x91""R - \x90""A\x95""\xA8"" - \x93""\xAE""\x95""\xA8"" - \x90""" "l\x8A""\xD4"" - \x8D""z\x95""\xA8"" \x8B""Z\x8F""p \x83""R\x83""\x93""\x83""" "s\x83""\x85""\x81""[\x83""^ - \x83""C\x83""\x93""\x83""^\x81""[\x83""l\x83""" "b\x83""g - \x83""G\x83""\x8C""\x83""N\x83""g\x83""\x8D""\x83""j\x83""N\x83""" "X - \x83""o\x83""C\x83""I\x83""e\x83""N\x83""m\x83""\x8D""\x83""W\x81""[" " - \x8C""\xF0""\x92""\xCA"" - \x93""S\x93""\xB9"" - \x8E""\xA9""\x93""\xAE""" "\x8E""\xD4"" - \x8C""\x9A""\x92""z - \x8F""\xEE""\x95""\xF1"" - \x92""\xCA""" "\x90""M - \x8E""\x91""\x8C""\xB9"" - \x8C""\xB4""\x8E""q\x97""\xCD"" - \x90""" "\x94""\x8A""w\x82""\xC6""\x8E""\xA9""\x91""R\x89""\xC8""\x8A""w \x90""\x94""" "\x8A""w - \x95""\xA8""\x97""\x9D""\x8A""w - \x89""\xBB""\x8A""w - \x90""" "\xB6""\x95""\xA8""\x8A""w - \x90""\xB6""\x91""\xD4""\x8A""w - \x92""n\x8B""" "\x85""\x89""\xC8""\x8A""w - \x93""V\x95""\xB6""\x8A""w \x90""l\x95""\xB6""" "\x89""\xC8""\x8A""w\x82""\xC6""\x8E""\xD0""\x89""\xEF""\x89""\xC8""\x8A""" "w \x95""\xB6""\x8A""w - \x8C""\xBE""\x8C""\xEA""\x8A""w - \x93""N\x8A""w" " - \x98""_\x97""\x9D""\x8A""w - \x8F""@\x8B""\xB3""\x8A""w - \x90""S\x97""" "\x9D""\x8A""w - \x94""\xFC""\x8A""w - \x8E""\xD0""\x89""\xEF""\x8A""w - " "\x96""@\x8A""w - \x97""\xF0""\x8E""j\x8A""w - \x8D""l\x8C""\xC3""\x8A""w" " - \x96""\xAF""\x91""\xAD""\x8A""w - \x8B""\xB3""\x88""\xE7""\x8A""w - \x90""" "\xAD""\x8E""\xA1""\x8A""w - \x8C""o\x8D""\xCF""\x8A""w - \x8C""o\x89""c\x8A""" "w \x89""\x9E""\x97""p\x89""\xC8""\x8A""w\x82""\xC6""\x91""\x8D""\x8D""\x87""" "\x89""\xC8""\x8A""w \x8F""\xEE""\x95""\xF1""\x8A""w - \x8A""\xC2""\x8B""" "\xAB""\x8A""w - \x92""n\x97""\x9D""\x8A""w - \x90""l\x97""\xDE""\x8A""w " "- \x88""\xE3""\x8A""w - \x8E""\xD0""\x89""\xEF""\x95""\x9F""\x8E""\x83""" "\x8A""w - \x96""\xF2""\x8A""w - \x94""_\x8A""w - \x8D""H\x8A""w \x8E""\x91""" "\x97""\xBF"" \x8D""\xF5""\x88""\xF8"" - \x94""N\x95""\\ - \x97""\xEF"" -" " 365\x93""\xFA"" - \x92""n\x90""} - \x90""\x94""\x82""\xCC""\x88""\xEA""" "\x97""\x97"" - \x90""l\x96""\xBC""\x88""\xEA""\x97""\x97"" - \x88""\xEA""" "\x97""\x97""\x82""\xCC""\x88""\xEA""\x97""\x97"" - \x90""\xA2""\x8A""E\x8A""" "e\x8D""\x91""\x8A""\xD6""\x8C""W\x8B""L\x8E""\x96"" \x83""E\x83""B\x83""" "L\x83""|\x81""[\x83""^\x83""\x8B"" \x83""A\x83""j\x83""\x81"" - \x88""\xE3""" "\x8A""w\x82""\xC6""\x88""\xE3""\x97""\xC3"" - \x90""\xB6""\x82""\xAB""\x95""" "\xA8""\x82""\xC6""\x8E""\xA9""\x91""R - \x89""f\x89""\xE6"" - \x83""G\x83""" "\x8C""\x83""N\x83""g\x83""\x8D""\x83""j\x83""N\x83""X - \x89""\xB9""\x8A""" "y - \x89""\xB7""\x90""\xF2"" - \x89""\xBB""\x8A""w - \x8A""\xC2""\x8B""\xAB""" " - \x96""k\x83""A\x83""\x81""\x83""\x8A""\x83""J - \x8B""\xB3""\x88""\xE7""" " - \x8C""R\x8E""\x96"" - \x83""N\x83""\x89""\x83""V\x83""b\x83""N\x89""\xB9""" "\x8A""y - \x8C""o\x8D""\xCF""\x8A""w - \x83""Q\x81""[\x83""\x80"" - \x8C""" "\xBE""\x8C""\xEA""\x8A""w - \x83""R\x83""\x8A""\x83""A - \x83""R\x83""\x93""" "\x83""s\x83""\x85""\x81""[\x83""^ - \x8D""\xD0""\x8A""Q - \x8E""\xA9""\x93""" "\xAE""\x8E""\xD4"" - \x90""H - \x90""A\x95""\xA8"" - \x90""_\x93""\xB9""" " - \x83""X\x83""|\x81""[\x83""c - \x90""\xB6""\x95""\xA8""\x8A""w - \x90""" "\xA2""\x8A""E\x88""\xE2""\x8E""Y - \x90""\xED""\x91""\x88"" - \x91""\xE6""" "\x8E""O\x92""\xE9""\x8D""\x91"" - \x91""\xE5""\x93""\x8C""\x88""\x9F""\x8B""" "\xA4""\x89""h\x8C""\x97"" - \x92""n\x8B""\x85""\x89""\xC8""\x8A""w - \x92""" "\x86""\x8D""\x91"" - \x92""n\x97""\x9D""\x8A""w - \x93""N\x8A""w - \x93""" "S\x93""\xB9"" - \x83""e\x83""\x8C""\x83""r - \x93""V\x95""\xB6""\x8A""w " "- \x93""\xFA""\x96""{ - \x93""\xFA""\x96""{\x82""\xCC""\x93""s\x93""\xB9""" "\x95""{\x8C""\xA7"" - \x83""o\x83""X - \x94""\xFC""\x8F""p - \x95""\x91""" "\x91""\xE4""\x8C""|\x8F""p - \x95""\xA7""\x8B""\xB3"" - \x95""\xA8""\x97""" "\x9D""\x8A""w - \x83""t\x83""\x89""\x83""\x93""\x83""X - \x95""\xB6""\x8A""" "w - \x95""\xBD""\x98""a - \x96""\x9F""\x89""\xE6"" - \x83""\x88""\x81""[" "\x83""\x8D""\x83""b\x83""p - \x83""\x89""\x83""W\x83""I - \x97""\xF0""\x8E""" "j - \x97""\xF0""\x8E""j\x94""F\x8E""\xAF""\x82""\xC6""\x90""\xED""\x8C""" "\xE3""\x8F""\x88""\x97""\x9D"" \x83""J\x83""e\x83""S\x83""\x8A"" \x88""\xEA""" "\x97""\x97"" - \x83""E\x83""B\x83""L\x83""y\x83""f\x83""B\x83""A - \x83""" "E\x83""B\x83""L\x83""\x81""\x83""f\x83""B\x83""A\x81""E\x83""v\x83""\x8D""" "\x83""W\x83""F\x83""N\x83""g -" ; const char* kTeststr12 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/ja_wikipedia_org_clean__JIS.txt " \x1B""$BKL3$F;F|K\\%O%`%U%!%$%?!<%:$,%=%U%H%P%s%/$H$N%W%l!<%*%U$r@)$7!\"" "\x1B""(B25\x1B""$BG/$V$j\x1B""(B3\x1B""$BEYL\\$N%Q%7%U%#%C%/!&%j!<%0M%>!" "!#\x1B""(B \x1B""$BKLD+A/3KF$1" "\x1B""(B(*) - \x1B""$B>>B{\x1B""(B \x1B""$B:#F|$N$3$h$_\x1B""(B \x1B""$B" "5lNq\x1B""(B:8\x1B""$B7n\x1B""(B22\x1B""$BF|\x1B""(B - \x1B""$BBg0B\x1B""" "(B - \x1B""$BF|$N43;Y\x1B""(B:\x1B""$B250g\x1B""(B - \x1B""$B6e@1\x1B""(" "B:\x1B""$B;MNPLZ@1\x1B""(B - \x1B""$BFs==H,=I\x1B""(B:\x1B""$BP6=I\x1B""" "(B - \x1B""$B==FsD>\x1B""(B:\x1B""$B=|\x1B""(B - \x1B""$B@a5$\x1B""(B:\x1B""" "$B4(O*!\"Az9_$^$G\x1B""(B10\x1B""$BF|\x1B""(B - \x1B""$BA*F|\x1B""(B:\x1B""" "$BBgHHEZ\x1B""(B \x1B""$B:#F|$O2?$NF|\x1B""(B \x1B""$B%0%j%K%C%8E7J8Bf$r" "DL$k7P@~$r\x1B""(B0\x1B""$BEY$HDj$a$k!J\x1B""(B1884\x1B""$BG/!K\x1B""(B " "11\x1B""$B5\\2H\x1B""(B51\x1B""$B?M$N9DB2N%C&$,7hDj!J\x1B""(B1947\x1B""$" "BG/!K\x1B""(B \x1B""$B%V%i%C%/!&%A%e!<%:%G!7r;0O:$N%N!<%Y%kJ83X>^^$,7hDj!J\x1B""(B1994\x1B""$BG/!" "K\x1B""(B \x1B""$Bk>Js\x1B""(B \x1B""$B%3%j!.$;$s!J\x1B""(B10\x1B""$B7" "n\x1B""(B10\x1B""$BF|]G!K\x1B""(B - \x1B""$BMn8l2H\x1B""(B \x1B""$B%^%l%" "/!&%0%l%U%?!J\x1B""(BMarek Grechuta,10\x1B""$B7n\x1B""(B9\x1B""$BF|]G!K\x1B""" "(B - \x1B""$B%]!<%i%s%I$N2N;3EP;VM:!J\x1B""(B10\x1B""" "$B7n\x1B""(B9\x1B""$BF|]G!K\x1B""(B - \x1B""$B85ElIpF0J*8x1`1`D9!J!V%+%P" "1`D9!W!K\x1B""(B \x1B""$B%$!<%4%j!&%i%F%#%7%'%U!J\x1B""(B10\x1B""$B7n\x1B""" "(B6\x1B""$BF|]G!K\x1B""(B - \x1B""$B%m%7%\"$NF|K\\8&5f2H!\"85%=%S%(%HO\"" "K.6&;:E^5!4X;f%W%i%&%@El5~;Y6ID9\x1B""(B \x1B""$BI42J;vE5\x1B""(B \x1B""" "$B5\x1B""(B - \x1B""$BG/Cf9T;v\x1B""(B \x1B""$B@$3&\x1B""(B \x1B""$B%\"%" "8%\"\x1B""(B - \x1B""$B%\"%U%j%+\x1B""(B - \x1B""$B%*%;%\"%K%\"\x1B""(B " "- \x1B""$BKL%\"%a%j%+\x1B""(B - \x1B""$BFn%\"%a%j%+\x1B""(B - \x1B""$B%h" "!<%m%C%Q\x1B""(B \x1B""$BF|K\\\x1B""(B \x1B""$BKL3$F;\x1B""(B - \x1B""$B" "ElKL\x1B""(B - \x1B""$B4XEl\x1B""(B - \x1B""$BCfIt\x1B""(B - \x1B""$B6a5" "&\x1B""(B - \x1B""$BCf9q\x1B""(B - \x1B""$B;M9q\x1B""(B - \x1B""$B6e=#\x1B""" "(B - \x1B""$B2-Fl\x1B""(B \x1B""$B<+A3\x1B""(B \x1B""$BJ*]\x1B""(B - \x1B""$B:R32\x1B""(B - \x1B""$B3" "$MN\x1B""(B - \x1B""$BBgN&!\"Eg\x1B""(B - \x1B""$B@8$-J*$H<+A3\x1B""(B -" " \x1B""$B?\"J*\x1B""(B - \x1B""$BF0J*\x1B""(B - \x1B""$B?M4V\x1B""(B - \x1B""" "$B9[J*\x1B""(B \x1B""$B5;=Q\x1B""(B \x1B""$B%3%s%T%e!<%?\x1B""(B - \x1B""" "$B%$%s%?!<%M%C%H\x1B""(B - \x1B""$B%(%l%/%H%m%K%/%9\x1B""(B - \x1B""$B%P" "%$%*%F%/%N%m%8!<\x1B""(B - \x1B""$B8rDL\x1B""(B - \x1B""$BE4F;\x1B""(B -" " \x1B""$B<+F0pJs\x1B""(B - " "\x1B""$BDL?.\x1B""(B - \x1B""$B;q8;\x1B""(B - \x1B""$B86;RNO\x1B""(B - \x1B""" "$B?t3X$H<+A32J3X\x1B""(B \x1B""$B?t3X\x1B""(B - \x1B""$BJ*M}3X\x1B""(B -" " \x1B""$B2=3X\x1B""(B - \x1B""$B@8J*3X\x1B""(B - \x1B""$B@8BV3X\x1B""(B " "- \x1B""$BCO5e2J3X\x1B""(B - \x1B""$BE7J83X\x1B""(B \x1B""$B?MJ82J3X$HpJs3X\x1B""(B - \x1B""$B4D6-3X\x1B""(B - \x1B""$BCOM}3X\x1B""" "(B - \x1B""$B?MN`3X\x1B""(B - \x1B""$B0e3X\x1B""(B - \x1B""$B0lMw\x1B""(B - \x1B""$B0lMw$N0lMw\x1B""(B -" " \x1B""$B@$3&3F9q4X785-;v\x1B""(B \x1B""$B%&%#%-%]!<%?%k\x1B""(B \x1B""$" "B%\"%K%a\x1B""(B - \x1B""$B0e3X$H0eNE\x1B""(B - \x1B""$B@8$-J*$H<+A3\x1B""" "(B - \x1B""$B1G2h\x1B""(B - \x1B""$B%(%l%/%H%m%K%/%9\x1B""(B - \x1B""$B2" ";3Z\x1B""(B - \x1B""$B29@t\x1B""(B - \x1B""$B2=3X\x1B""(B - \x1B""$B4D6-" "\x1B""(B - \x1B""$BKL%\"%a%j%+\x1B""(B - \x1B""$B650i\x1B""(B - \x1B""$B" "73;v\x1B""(B - \x1B""$B%/%i%7%C%/2;3Z\x1B""(B - \x1B""$B7P:Q3X\x1B""(B -" " \x1B""$B%2!<%`\x1B""(B - \x1B""$B8@8l3X\x1B""(B - \x1B""$B%3%j%\"\x1B""" "(B - \x1B""$B%3%s%T%e!<%?\x1B""(B - \x1B""$B:R32\x1B""(B - \x1B""$B<+F0<" "V\x1B""(B - \x1B""$B?)\x1B""(B - \x1B""$B?\"J*\x1B""(B - \x1B""$B?@F;\x1B""" "(B - \x1B""$B%9%]!<%D\x1B""(B - \x1B""$B@8J*3X\x1B""(B - \x1B""$B@$3&0d;" ":\x1B""(B - \x1B""$B@oAh\x1B""(B - \x1B""$BBh;0Dk9q\x1B""(B - \x1B""$BBg" "El0!6&1I7w\x1B""(B - \x1B""$BCO5e2J3X\x1B""(B - \x1B""$BCf9q\x1B""(B - \x1B""" "$BCOM}3X\x1B""(B - \x1B""$BE/3X\x1B""(B - \x1B""$BE4F;\x1B""(B - \x1B""$" "B%F%l%S\x1B""(B - \x1B""$BE7J83X\x1B""(B - \x1B""$BF|K\\\x1B""(B - \x1B""" "$BF|K\\$NETF;I\\8)\x1B""(B - \x1B""$B%P%9\x1B""(B - \x1B""$BH~=Q\x1B""(B" " - \x1B""$BIqBf7]=Q\x1B""(B - \x1B""$BJ)65\x1B""(B - \x1B""$BJ*M}3X\x1B""" "(B - \x1B""$B%U%i%s%9\x1B""(B - \x1B""$BJ83X\x1B""(B - \x1B""$BJ?OB\x1B""" "(B - \x1B""$BL!2h\x1B""(B - \x1B""$B%h!<%m%C%Q\x1B""(B - \x1B""$B%i%8%*\x1B""" "(B - \x1B""$BNr;K\x1B""(B - \x1B""$BNr;KG'<1$H@o8e=hM}\x1B""(B \x1B""$B%" "+%F%4%j\x1B""(B \x1B""$B0lMw\x1B""(B - \x1B""$B%&%#%-%Z%G%#%\"\x1B""(B -" " \x1B""$B%&%#%-%a%G%#%\"!&%W%m%8%'%/%H\x1B""(B -" ; const char* kTeststr13 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/zh-classical_wikipedia_org_clean__BIG5_HKSCS.txt " \xA1""E \xA4""V\xB6""q\xBC""\xC6""\xA6""r \xA1""E \xB8""U\xB0""\xEA""\xA8""" "\xF3""\xA7""@ \xA1""E \xAC""\xC9""\xAD""\xB1""\xC2""\xBD""\xC4""\xB6"" \xB5""" "\xB4""\xA7""\xAE""\xA6""n\xA4""\xE5"" \xB6""\xB5""\xC4""y\xAA""\xCC""\xA1""" "A\xA4""U\xAC""\xDB""\xA4""H\xA4""]\xA1""A\xA6""r\xA6""\xD0""\xA1""C\xAA""" "\xEC""\xB0""_\xAE""\xC9""\xA1""A\xA6""~\xA4""G\xA4""Q\xA5""|\xA1""C\xA8""" "\xE4""\xA9""u\xA4""\xF7""\xB6""\xB5""\xB1""\xE7""\xA1""A\xB1""\xE7""\xA4""" "\xF7""\xA7""Y\xB7""\xA1""\xB1""N\xB6""\xB5""\xBF""P\xA1""A\xAC""\xB0""\xAF""" "\xB3""\xB1""N\xA4""\xFD""\xE6""\xF9""\xA9""\xD2""\xBC""\xAE""\xAA""\xCC""" "\xA4""]\xA1""C\xB6""\xB5""\xA4""\xF3""\xA5""@\xA5""@\xAC""\xB0""\xB7""\xA1""" "\xB1""N\xA1""A\xAB""\xCA""\xA9""\xF3""\xB6""\xB5""\xA1""A\xAC""G\xA9""m\xB6""" "\xB5""\xA4""\xF3""\xA1""C \xA4""\xD3""\xA5""v\xA4""\xBD""\xA4""\xEA""\xA1""" "G\xA7""^\xBB""D\xA4""\xA7""\xA9""P\xA5""\xCD""\xA4""\xEA""\xA1""u\xB5""\xCF""" "\xA5""\xD8""\xBB""\\\xAD""\xAB""\xC0""\xFB""\xA4""l\xA1""v\xA1""A\xA4""S" "\xBB""D\xB6""\xB5""\xA6""\xD0""\xA5""\xE7""\xAD""\xAB""\xC0""\xFB""\xA4""" "l\xA1""C\xA6""\xD0""\xB0""Z\xA8""\xE4""\xAD""]\xB8""\xC7""\xA8""\xB8""\xA1""" "H\xA6""\xF3""\xBF""\xB3""\xA4""\xA7""\xBC""\xC9""\xA4""]\xA1""I\xA4""\xD2""" "\xAF""\xB3""\xA5""\xA2""\xA8""\xE4""\xAC""F\xA1""A\xB3""\xAF""\xAF""A\xAD""" "\xBA""\xC3""\xF8""\xA1""A\xBB""\xA8""\xB3""\xC7""\x95""|\xB0""_\xA1""A\xAC""" "\xDB""\xBB""P\xA8""\xC3""\xAA""\xA7""\xA1""A\xA4""\xA3""\xA5""i\xB3""\xD3""" "\xBC""\xC6""\xA1""C\xB5""M\xA6""\xD0""\xAB""D\xA6""\xB3""\xA4""\xD8""\xA4""" "o\xAD""\xBC""\xD4""\xB0""\xA1""A\xB0""_\xC3""\xF7""\xAF""a\xA4""\xA7""\xA4""" "\xA4""\xA1""A\xA4""T\xA6""~\xA1""A\xB9""E\xB1""N\xA4""\xAD""\xBD""\xD1""" "\xAB""J\xB7""\xC0""\xAF""\xB3""\xA1""A\xA4""\xC0""\xB5""\xF5""\xA4""\xD1""" "\xA4""U\xA1""A\xA6""\xD3""\xAB""\xCA""\xA4""\xFD""\xAB""J\xA1""A\xAC""F\xA5""" "\xD1""\xA6""\xD0""\xA5""X\xA1""A\xB8""\xB9""\xAC""\xB0""\xA1""u\xC5""Q\xA4""" "\xFD""\xA1""v\xA1""A\xA6""\xEC""\xC1""\xF6""\xA4""\xA3""\xB2""\xD7""\xA1""" "A\xAA""\xF1""\xA5""j\xA5""H\xA8""\xD3""\xA5""\xBC""\xB9""\xC1""\xA6""\xB3""" "\xA4""]\xA1""C\xA4""\xCE""\xA6""\xD0""\xAD""I\xC3""\xF6""\xC3""h\xB7""\xA1""" "\xA1""A\xA9""\xF1""\xB3""v\xB8""q\xAB""\xD2""\xA6""\xD3""\xA6""\xDB""\xA5""" "\xDF""\xA1""A\xAB""\xE8""\xA4""\xFD""\xAB""J\xAB""q\xA4""v\xA1""A\xC3""\xF8""" "\xA8""o\xA1""C\xA6""\xDB""\xAC""\xE1""\xA5""\\\xA5""\xEF""\xA1""A\xBE""\xC4""" "\xA8""\xE4""\xA8""p\xB4""\xBC""\xA6""\xD3""\xA4""\xA3""\xAE""v\xA5""j\xA1""" "A\xBF""\xD7""\xC5""Q\xA4""\xFD""\xA4""\xA7""\xB7""~\xA1""A\xB1""\xFD""\xA5""" "H\xA4""O\xA9""\xBA""\xB8""g\xC0""\xE7""\xA4""\xD1""\xA4""U\xA1""A\xA4""\xAD""" "\xA6""~\xA8""\xF2""\xA4""`\xA8""\xE4""\xB0""\xEA""\xA1""A\xA8""\xAD""\xA6""" "\xBA""\xAA""F\xAB""\xB0""\xA1""A\xA9""|\xA4""\xA3""\xC4""\xB1""\xB9""\xED""" "\xA6""\xD3""\xA4""\xA3""\xA6""\xDB""\xB3""d\xA1""A\xB9""L\xA8""o\xA1""C\xA4""" "D\xA4""\xDE""\xA1""u\xA4""\xD1""\xA4""`\xA7""\xDA""\xA1""A\xAB""D\xA5""\xCE""" "\xA7""L\xA4""\xA7""\xB8""o\xA4""]\xA1""v\xA1""A\xB0""Z\xA4""\xA3""\xC2""" "\xD5""\xAB""v\xA1""I \xA6""~\xA4""\xBA""\xB5""\xB4""\xA7""\xAE""\xA6""n\xA4""" "\xE5"" \xA1""E \xB5""\xB4""\xA7""\xAE""\xA6""n\xA4""\xE5""\xA4""@\xC4""\xFD""" " \xA6""\xBC""\xAA""\xBE""\xA4""\xA7""\xA5""G\xA1""H \xA6""\xBC""\xA5""i\xAA""" "\xBE""\xB1""E\xAC""\xB0""\xA4""\xA4""\xB5""\xD8""\xA5""\xC1""\xB1""\xDA""" "\xA9""l\xAF""\xAA""\xA1""H\xA1""]\xB9""\xCF""\xA1""^" ; const char* kTeststr14 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/wuu_wikipedia_org_clean__GB.txt " \xD4""\xC2""\xB1""\xFD""\xB7""\xA2""\xD5""\xB9""\xB5""\xBD""\xBD""\xF1""" "\xB3""\xAF""\xA3""\xAC""\xC6""\xB7""\xD6""\xD6""\xB7""\xB1""\xB6""\xE0""" "\xA3""\xAC""\xB7""\xE7""\xCE""\xB6""\xD2""\xF2""\xB5""\xD8""\xB6""\xF8""" "\xD2""\xEC""\xA1""\xA3""\xEB""\xA1""\xC0""\xEF""\xCF""\xF2""\xBE""\xA9""" "\xCA""\xBD""\xA1""\xA2""\xCB""\xD5""\xCA""\xBD""\xA1""\xA2""\xB9""\xE3""" "\xCA""\xBD""\xA1""\xA2""\xB3""\xB1""\xCA""\xBD""\xB5""\xC8""\xCF""\xE0""" "\xB5""\xB1""\xD3""\xD0""\xCC""\xD8""\xC9""\xAB""\xA3""\xAC""\xB2""\xA6""" "\xC0""\xAD""\xB9""\xE3""\xB4""\xF3""\xC0""\xCF""\xB0""\xD9""\xD0""\xD5""" "\xCB""\xF9""\xBB""\xB6""\xCF""\xB2""\xA1""\xA3"" \x82""\x99""\xB0""\xA2""" "\xCF""\xFE""\xB5""\xC3""... \xCE""\xE2""\xD3""\xEF""\xC0""\xD5""\xC0""\xAD""" "\xCA""\xC0""\xBD""\xE7""\xC0""\xCB""\xC4""\xB8""\xD3""\xEF""\xC8""\xCB""" "\xBF""\xDA""\xC5""\xC5""\xB5""\xBD""\xB5""\xDA""\xBC""\xB8""\xA3""\xBF""" " \xCE""\xE2""\xD3""\xEF""\xB5""\xD8""\xB7""\xBD""\xCF""\xB7""\xCE""\xFD""" "\xBE""\xE7""\xCA""\xC7""\xC4""\xC4""\xBA""\xE0""\xB7""\xA2""\xD5""\xB9""" "\xB3""\xF6""\xC0""\xB4""\xB8""\xF6""\xA3""\xBF"" \xD7""\xF6""\xB9""\xFD""" "\xC7""\xB0""\xD6""\xD0""\xB9""\xFA""\xB9""\xFA""\xBC""\xD2""\xB8""\xB1""" "\xD6""\xF7""\xCF""\xAF""\xB8""\xF6""\xA1""\xB0""\xBA""\xEC""\xC9""\xAB""" "\xD7""\xCA""\xB1""\xBE""\xBC""\xD2""\xA1""\xB1""\xCA""\xC7""\xC9""\xB6""" "\xC8""\xCB""\xA3""\xBF"" \xC1""\xBA""\xB3""\xAF""\xCE""\xB0""\xA1""\xA2""" "\xC1""\xF5""\xBC""\xCE""\xC1""\xE1""\xB5""\xC8""\xD6""\xF7""\xD1""\xDD""" "\xB8""\xF6""\xCE""\xE2""\xD3""\xEF""\xB5""\xE7""\xD3""\xB0""\xA1""\xB0""" "\xBA""\xA3""\xC9""\xCF""\xBB""\xA8""\xA1""\xB1""\xBD""\xB2""\xD1""\xDB""" "\xC9""\xB6""\xA3""\xBF"" \xC0""\xD5""1983\xB0""\xE6""\xB5""\xE7""\xCA""\xD3""" "\xC1""\xAC""\xD0""\xF8""\xBE""\xE7""\xA1""\xB0""\xC9""\xE4""\xB5""\xF1""" "\xD3""\xA2""\xD0""\xDB""\xB4""\xAB""\xA1""\xB1""\xC0""\xEF""\xCF""\xF2""" "\xB3""\xF6""\xD1""\xDD""\xC5""\xAE""\xD6""\xF7""\xBD""\xC7""\xB8""\xF6""" "\xCA""\xC7""\xC9""\xB6""\xC8""\xCB""\xA3""\xBF"" \xD0""\xC2""\xCE""\xC5""" "\xC0""\xCB""\xCF""\xF2"" Roger D. Kornberg \xD2""\xF2""\xCE""\xAA""\xD9""" "\xB5""\xC0""\xD5""\xD2""\xC5""\xB4""\xAB""\xD7""\xAA""\xC2""\xBC""\xC9""" "\xCF""\xCD""\xB7""\xB8""\xF6""\xB9""\xA4""\xD7""\xF7""\xBB""\xF1""\xB5""" "\xC3""2006\xC4""\xEA""\xB6""\xC8""\xB8""\xF6""\xC5""\xB5""\xB1""\xB4""\xB6""" "\xFB""\xBB""\xAF""\xD1""\xA7""\xBD""\xB1""\xA1""\xA3"" \xB3""\xAF""\xCF""" "\xCA""\xD0""\xFB""\xB2""\xBC""\xD2""\xAA""\xBD""\xF8""\xD0""\xD0""\xBA""" "\xCB""\xCA""\xD4""\xD1""\xE9""\xA3""\xAC""\xB2""\xA2""\xC9""\xF9""\xD1""" "\xD4""\xB8""\xA5""\xBB""\xE1""\xCA""\xD7""\xCF""\xC8""\xCA""\xB9""\xD3""" "\xC3""\xBA""\xCB""\xCE""\xE4""\xC6""\xF7""\xA1""\xA3"" \xCE""\xE2""\xD3""" "\xEF""\xCE""\xAC""\xBB""\xF9""\xB0""\xD9""\xBF""\xC6""\xC0""\xD5""2006\xC4""" "\xEA""10\xD4""\xC2""1\xBA""\xC5""\xD5""\xFD""\xCA""\xBD""\xB3""\xC9""\xC1""" "\xA2""\xA1""\xA3"" \xC5""\xB5""\xB1""\xB4""\xB6""\xFB""\xBD""\xB1""\xCE""" "\xAF""\xD4""\xB1""\xBB""\xE1""\xD0""\xFB""\xB2""\xBC""\xC4""\xC3""2006\xC4""" "\xEA""\xB6""\xC8""\xB8""\xF6""\xC5""\xB5""\xB1""\xB4""\xB6""\xFB""\xCE""" "\xEF""\xC0""\xED""\xD1""\xA7""\xBD""\xB1""\xCA""\xDA""\xB2""\xA6""\xC1""" "\xBD""\xCE""\xBB""\xC3""\xC0""\xB9""\xFA""\xBF""\xC6""\xD1""\xA7""\xBC""" "\xD2"" John " ; const char* kTeststr22 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/se_wikipedia_org_clean__UTF8.txt "tnegirjji gosa gii beare s\xC3""\xA1""htt\xC3""\xA1"" \xC4""\x8D""\xC3""" "\xA1""llit artihkkaliid. Maid don s\xC3""\xA1""ht\xC3""\xA1""t dievasmah" "ttit ja divvut juo \xC4""\x8D""\xC3""\xA1""llojuvvon artihkkaliid dahje " "\xC4""\x8D""\xC3""\xA1""lligoahttit aibbas o\xC4""\x91""\xC4""\x91""a ar" "tihkkala muhtun f\xC3""\xA1""tt\xC3""\xA1""s. S\xC3""\xA1""megielat Wiki" "pedias leat d\xC3""\xA1""l 1,042 artihkkala. Wikipedia v\xC3""\xA1""ldos" "iiddus leat eambbo die\xC4""\x91""ut Mo don s\xC3""\xA1""ht\xC3""\xA1""t" " veahkehit Wikipedia d\xC3""\xA1""rbba\xC5""\xA1""a du veahkki! Rukses l" "i\xC5""\x8B""ka mearkka\xC5""\xA1""a dan, ahte f\xC3""\xA1""tt\xC3""\xA1""" "s ii leat vel \xC3""\xA1""lgg\xC3""\xA1""huvvon artihkal. Don s\xC3""\xA1""" "ht\xC3""\xA1""t veahkehit omd. nu ahte \xC4""\x8D""\xC3""\xA1""l\xC3""\xA1""" "t artihkkala, muhtun siidus\xC3""\xA1""valdagain. \xC3""\x81""lgg\xC3""\xA1""" "t o\xC4""\x91""\xC4""\x91""a artihkkala : Siida | Luossa | Durkkagiella " "| Deatnu | M\xC3""\xA1""notbadji | Euro | Skandin\xC3""\xA1""vala\xC5""\xA1""" " gielat | Rainier III | Ovttastuvvan N\xC3""\xA1""\xC5""\xA1""uvnnat | A" "rthur Miller | John F. Kennedy Lasi artihkals\xC3""\xA1""valdagat \xC3""" "\x81""igeguovdil Template:O\xC4""\x91""\xC4""\x91""asiiguin Loga lasi o\xC4""" "\x91""\xC4""\x91""asiid golggotm\xC3""\xA1""nu 13. beaivi Template:Golgg" "otm\xC3""\xA1""nu 13. Geah\xC4""\x8D""a ear\xC3""\xA1"" beivviid Dihtetg" "o, ahte... Template:Dihtetgo ahte Lasi unna die\xC4""\x91""ut Wikipediij" "a ear\xC3""\xA1"" gielain S\xC3""\xA1""meguovllu riikkaid gielain Girjed" "\xC3""\xA1""rog" ; const char* kTeststr25 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/ru-sib_wikipedia_org_clean__KOI8R.txt ": \xE1""\xCD""\xC9""\xD4""\xC1""\xCE""\xCF""\xDA""\xCE""\xC1""\xCA""\xD3""" "\xD7""\xCF"" - \xE4""\xC1""\xCC""\xC1""\xC5""\xDA""\xCE""\xC1""\xCA""\xD3""" "\xD7""\xCF"" - \xE4""\xCF""\xCD""\xCF""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""" "\xCF"" - \xF6""\xD9""\xD3""\xD4""\xC5""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""" "\xCF"" - \xFA""\xD7""\xD8""\xCF""\xDA""\xC4""\xCF""\xDA""\xCE""\xC1""\xCA""" "\xD3""\xD7""\xCF"" - \xFA""\xC5""\xCD""\xC5""\xDA""\xCE""\xC1""\xCA""\xD3""" "\xD7""\xCF"" - \xED""\xC1""\xD4""\xC5""\xCD""\xC1""\xD4""\xC9""\xCB""\xC1""" " - \xED""\xC9""\xD2""\xCF""\xCB""\xCF""\xCC""\xCF""\xDA""\xCE""\xC1""\xCA""" "\xD3""\xD7""\xCF"" - \xF0""\xD2""\xC9""\xD2""\xCF""\xC4""\xCF""\xDA""\xCE""" "\xC1""\xCA""\xD3""\xD7""\xCF"" - \xF3""\xD4""\xC1""\xD4""\xC9""\xD3""\xD4""" "\xC9""\xCB""\xC1"" - \xF4""\xD2""\xC1""\xD7""\xCF""\xDA""\xCE""\xC1""\xCA""" "\xD3""\xD7""\xCF"" - \xE8""\xC9""\xCD""\xC9""\xD1"" \xED""\xD5""\xC4""\xD2""" "\xD8""\xCF""\xCE""\xCF""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""\xCF"" \xC4""" "\xC1"" \xE1""\xD2""\xD4""\xC5""\xCC""\xD8""\xCE""\xD9"" \xD7""\xC5""\xC4""" "\xD9"": \xE1""\xD2""\xD4""\xC5""\xCC""\xC5""\xDA""\xCE""\xC1""\xCA""\xD3""" "\xD7""\xCF"" - \xE2""\xC1""\xDB""\xCC""\xD9""\xCB""\xCF""\xDA""\xCE""\xC1""" "\xCA""\xD3""\xD7""\xCF"" - \xF7""\xC5""\xD2""\xC1"" - \xF7""\xD8""\xCF""" "\xD4""\xCF""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""\xCF"" - \xE7""\xCF""\xD7""" "\xCF""\xD2""\xCF""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""\xCF"" - \xE4""\xC5""" "\xD1""\xCE""\xCE""\xC9"" - \xE4""\xCF""\xCD""\xCF""\xD7""\xDB""\xD9""\xCE""" "\xC1"" - \xE4""\xD5""\xDB""\xC5""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""\xCF""" " - \xFA""\xC5""\xCD""\xC5""\xD0""\xC9""\xD3""\xC1""\xCE""\xCE""\xC5"" - " "\xEB""\xCF""\xCE""\xCF""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""\xCF"" - \xEC""" "\xC1""\xC4"" - \xEC""\xC0""\xC4""\xC5""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""" "\xCF"" - \xEC""\xC0""\xC4""\xCE""\xC9""\xCB""\xC9"" - \xED""\xD5""\xC4""" "\xD2""\xD8""\xCF""\xCE""\xCF""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""\xCF""" " - \xEE""\xC1""\xD2""\xCF""\xC4""\xCF""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""" "\xCF"" - \xF0""\xD2""\xC1""\xD7""\xC9""\xCC""\xD8""\xCE""\xD1"" - \xF0""" "\xD2""\xCF""\xCD""\xD9""\xD3""\xC5""\xCC"" \xF2""\xCF""\xC2""\xCF""\xD4""" "\xCE""\xD9"" \xD7""\xC5""\xC4""\xD9"": \xF7""\xC5""\xD3""\xD3""\xC5""\xDA""" "\xCE""\xC1""\xCA""\xD3""\xD7""\xCF"" - \xF7""\xD2""\xC1""\xDE""\xC5""\xC2""" "\xD3""\xD7""\xCF"" - \xE4""\xC5""\xD2""\xD8""\xCF""\xD7""\xC5""\xCE""\xDB""" "\xD9""\xCE""\xC1"" - \xED""\xC5""\xD6""\xD5""\xC7""\xC9""\xCD""\xC7""\xC1""" " (\xE9""\xCE""\xD4""\xC5""\xD2""\xCE""\xC5""\xD4"") - \xEE""\xC1""\xDE""" "\xCF""\xD4""\xCE""\xC9""\xDE""\xC5""\xD3""\xD7""\xCF"" - \xF0""\xCF""\xD7""" "\xD1""\xDA""\xCB""\xC9"" - \xF2""\xC1""\xC4""\xC9""\xD7""\xCF"" - \xF4""" "\xC5""\xC8""\xCE""\xCF""\xDA""\xCE""\xC1""\xCA""\xD3""\xD7""\xCF"" - \xF4""" "\xCF""\xD2""\xC7""\xCF""\xD7""\xCC""\xD1"" - \xF5""\xD3""\xD4""\xD2""\xCF""" "\xCA""\xDB""\xD9""\xD3""\xD7""\xCF"" \xF5""\xDA""\xCF""\xD2""\xCF""\xDE""" "\xDE""\xC5"" \xC4""\xC1"" \xF6""\xD9""\xDA""\xCE""\xC5""\xD7""\xD2""\xD1""" "\xC4"": \xE2""\xC1""\xD3""\xCE""\xC5""\xD0""\xC9""\xD3""\xC1""\xCE""\xCE""" "\xC5"" - \xE7""\xD5""\xCC""\xD8""\xC2""\xC1"" - \xFA""\xCF""\xC4""\xDE""" "\xC5""\xD3""\xD7""\xCF"" - \xEB""\xD2""\xC1""\xD3""\xCE""\xCF""\xD3""\xCC""" "\xCF""\xD7""\xD7""\xC5"" - \xEC""\xC5""\xD0""\xCF""\xCC""\xC1""\xC4"" - " "\xEE""\xC1""\xD7""\xCF""\xC2""\xD9""\xCB""\xC9"" - \xF0""\xC1""\xD7""\xCE""" "\xC9""\xC3""\xC1"" - \xF0""\xCC""\xD1""\xD3""\xCF""\xDE""\xCB""\xC9"" - " "\xF0""\xCF""\xDA""\xD9""\xD2""\xC9""\xDB""\xDB""\xC5"" - \xF0""\xCF""\xD3""" "\xCB""\xD5""\xCC""\xCB""\xC9"" - \xF5""\xDA""\xCF""\xD2""\xCF""\xDE""\xDE""" "\xC5"" \xE4""\xC5""\xD1""\xCE""\xD3""\xCB""\xC1"" \xDE""\xC5""\xD2""\xC5""" "\xC4""\xC1"" \xC7""\xCF""\xC4""\xCF""\xD7"" - \xF0""\xC5""\xD3""\xD4""\xC5""" "\xC7""\xC1"" \xC4""\xC5""\xD1""\xCE""\xD3""\xCB""\xC9""\xC8"" \xC4""\xC1""" "\xCE""\xCF""\xCB"" - \xF0""\xC5""\xD3""\xD4""\xC5""\xC7""\xC1"" \xCB""\xD2""" "\xC1""\xCA""\xCF""\xD7"" \xF2""\xCF""\xC2""\xCF""\xD4""\xC1"" \xD3""\xC5""" "\xC4""\xD8""\xCD""\xC9""\xC3""\xD9"" \xEE""\xC1"" \xC5""\xD4""\xCF""\xCA""" " \xD3""\xC5""\xC4""\xD8""\xCD""\xC9""\xC3""\xC5"" \xD2""\xCF""\xC2""\xC9""" "\xCD"" \xE2""\xC9""\xC2""\xCC""\xC9""\xC0"" \xEE""\xCF""\xD7""\xCF""\xD3""" "\xC9"" 9 \xD3""\xC5""\xD2""\xD8""\xD0""\xCE""\xD1"" \xE9""\xDA""\xC4""\xC5""" "\xD1""\xCE""\xC1"" \xCE""\xCF""\xD7""\xC1"" \xCB""\xD2""\xC1""\xD3""\xCF""" "\xD4""\xC9""\xDB""\xDB""\xC1"" \xC7""\xCF""\xCC""\xCF""\xD7""\xCE""\xCF""" "\xCA""" ; const char* kTeststr26 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/bg_wikipedia_org_clean__CP1251.txt " \x96"" \xD4""\xE8""\xEB""\xEE""\xF1""\xEE""\xF4""\xE8""\xFF"" \x96"" \xEE""" "\xF9""\xE5""... \xD2""\xE5""\xF5""\xED""\xE8""\xF7""\xE5""\xF1""\xEA""\xE8""" " \xE8"" \xEF""\xF0""\xE8""\xEB""\xEE""\xE6""\xED""\xE8"" \xEE""\xE1""\xEB""" "\xE0""\xF1""\xF2""\xE8"" \xC7""\xE5""\xEC""\xE5""\xE4""\xE5""\xEB""\xE8""" "\xE5"" \x96"" \xC8""\xED""\xF2""\xE5""\xF0""\xED""\xE5""\xF2"" \x96"" \xCA""" "\xEE""\xEC""\xF3""\xED""\xE8""\xEA""\xE0""\xF6""\xE8""\xE8"" \x96"" \xCC""" "\xE5""\xE4""\xE8""\xF6""\xE8""\xED""\xE0"" \x96"" \xCE""\xE1""\xF0""\xE0""" "\xE7""\xEE""\xE2""\xE0""\xED""\xE8""\xE5"" \x96"" \xCF""\xF0""\xE0""\xE2""" "\xEE"" \x96"" \xCF""\xF0""\xEE""\xEC""\xE8""\xF8""\xEB""\xE5""\xED""\xEE""" "\xF1""\xF2"" \x96"" \xD1""\xF2""\xF0""\xEE""\xE8""\xF2""\xE5""\xEB""\xF1""" "\xF2""\xE2""\xEE"" \x96"" \xD2""\xE5""\xF5""\xED""\xE8""\xEA""\xE0"" \x96""" " \xD2""\xF0""\xE0""\xED""\xF1""\xEF""\xEE""\xF0""\xF2"" \x96"" \xEE""\xF9""" "\xE5""... \xCA""\xF3""\xEB""\xF2""\xF3""\xF0""\xE0"" \xE8"" \xE8""\xE7""" "\xEA""\xF3""\xF1""\xF2""\xE2""\xEE"" \xCF""\xEE"" \xF1""\xE2""\xE5""\xF2""" "\xE0"" \x96"" \xCB""\xE8""\xF2""\xE5""\xF0""\xE0""\xF2""\xF3""\xF0""\xE0""" " \x96"" \xCA""\xE8""\xED""\xEE"" \x96"" \xCC""\xF3""\xE7""\xE8""\xEA""\xE0""" " \x96"" \xCC""\xE5""\xE4""\xE8""\xE8"" \x96"" \xC0""\xF0""\xF5""\xE8""\xF2""" "\xE5""\xEA""\xF2""\xF3""\xF0""\xE0"" \x96"" \xC6""\xE8""\xE2""\xEE""\xEF""" "\xE8""\xF1"" \x96"" \xD2""\xE5""\xE0""\xF2""\xFA""\xF0"" \x96"" \xD0""\xE5""" "\xEB""\xE8""\xE3""\xE8""\xFF"" \x96"" \xEE""\xF9""\xE5""... \xCE""\xE1""" "\xF9""\xE5""\xF1""\xF2""\xE2""\xEE"" \xCE""\xF0""\xE3""\xE0""\xED""\xE8""" "\xE7""\xE0""\xF6""\xE8""\xE8"" \x96"" \xCA""\xF3""\xEB""\xF2""\xF3""\xF0""" "\xE0"" \x96"" \xD0""\xE5""\xEB""\xE8""\xE3""\xE8""\xFF"" \x96"" \xCF""\xF0""" "\xE5""\xE4""\xF0""\xE0""\xE7""\xF1""\xFA""\xE4""\xFA""\xF6""\xE8"" \x96""" " \xD1""\xE8""\xE3""\xF3""\xF0""\xED""\xEE""\xF1""\xF2"" \x96"" \xCF""\xEE""" "\xEB""\xE8""\xF2""\xE8""\xEA""\xE0"" \x96"" \xCD""\xE0""\xF3""\xEA""\xE0""" " \x96"" \xEE""\xF9""\xE5""... \xC6""\xE8""\xE2""\xEE""\xF2"" \xE8"" \xE7""" "\xE0""\xE1""\xE0""\xE2""\xEB""\xE5""\xED""\xE8""\xFF"" \xC3""\xEE""\xF2""" "\xE2""\xE0""\xF0""\xF1""\xF2""\xE2""\xEE"" \x96"" \xC7""\xE4""\xF0""\xE0""" "\xE2""\xE5"" \x96"" \xC8""\xE3""\xF0""\xE8"" \x96"" \xD1""\xE5""\xEA""\xF1""" "\xF3""\xE0""\xEB""\xED""\xEE""\xF1""\xF2"" \x96"" \xD1""\xEF""\xEE""\xF0""" "\xF2"" \x96"" \xD2""\xF3""\xF0""\xE8""\xE7""\xFA""\xEC"" \x96"" \xEE""\xF9""" "\xE5""... \xC4""\xF0""\xF3""\xE3""\xE8"" \xEA""\xE0""\xF2""\xE5""\xE3""\xEE""" "\xF0""\xE8""\xE8"" \xC2""\xF1""\xE8""\xF7""\xEA""\xE8"" \xF1""\xF2""\xE0""" "\xF2""\xE8""\xE8"" \x96"" \xCD""\xEE""\xE2""\xE8"" \xF1""\xF2""\xE0""\xF2""" "\xE8""\xE8"" \x96"" \xD1""\xEF""\xE8""\xF1""\xFA""\xEA"" \xED""\xE0"" \xF1""" "\xEF""\xE8""\xF1""\xFA""\xF6""\xE8""\xF2""\xE5"" \x96"" \xD1""\xEF""\xE8""" "\xF1""\xFA""\xEA"" \xED""\xE0"" \xF1""\xF2""\xF0""\xE0""\xED""\xE8""\xF2""" "\xE5"" \xEF""\xEE"" \xF1""\xE2""\xE5""\xF2""\xE0"" \x96"" \xCA""\xE0""\xEB""" "\xE5""\xED""\xE4""\xE0""\xF0"" \x96"" \xC1""\xE8""\xEE""\xE3""\xF0""\xE0""" "\xF4""\xE8""\xE8"" \x96"" \xCA""\xE0""\xF0""\xF2""\xE8""\xED""\xEA""\xE8""" " \xCF""\xF0""\xE5""\xE3""\xEB""\xE5""\xE4"" \xED""\xE0"" \xF1""\xF2""\xE0""" "\xF2""\xE8""\xE8""\xF2""\xE5"": \xEF""\xEE"" \xE0""\xE7""\xE1""\xF3""\xF7""" "\xE5""\xED"" \xF0""\xE5""\xE4"" | \xEF""\xEE"" \xEA""\xE0""\xF2""\xE5""\xE3""" "\xEE""\xF0""\xE8""\xE8"" | \xEF""\xEE""\xF0""\xF2""\xE0""\xEB""\xED""\xE8""" " \xF1""\xF2""\xF0""\xE0""\xED""\xE8""\xF6""\xE8"" \xD3""\xE8""\xEA""\xE8""" "\xEF""\xE5""\xE4""\xE8""\xFF"" \xED""\xE0"" \xE4""\xF0""\xF3""\xE3""\xE8""" " \xE5""\xE7""\xE8""\xF6""\xE8"" \xCF""\xEE""\xEC""\xEE""\xF9"" \xCF""\xEE""" "\xEC""\xEE""\xF9"": \xC2""\xFA""\xE2""\xE5""\xE4""\xE5""\xED""\xE8""\xE5""" " \x96"" \xCD""\xE0""\xF0""\xFA""\xF7""\xED""\xE8""\xEA"" \x96"" \xCF""\xFF""" "\xF1""\xFA""\xF7""\xED""\xE8""\xEA"" \x96"" \xC1""\xFA""\xF0""\xE7""\xE0""" " \xEF""\xEE""\xEC""\xEE""\xF9"" \x96"" \xCD""\xE0""\xF1""\xF2""\xF0""\xEE""" "\xE9""\xEA""\xE8"" \x96"" \xCF""\xEE""\xEB""\xE5""\xE7""\xED""\xE8"" \xF1""" "\xFA""\xE2""\xE5""\xF2""\xE8"" \x96"" \xCA""\xE0""\xEA"" \xF1""\xE5"" \xF0""" "\xE5""\xE4""\xE0""\xEA""\xF2""\xE8""\xF0""\xE0"" \x96"" \xD7""\xC7""\xC2""" " \x96"" \xD0""\xE0""\xE7""\xE3""\xEE""\xE2""\xEE""\xF0""\xE8"" \x96"" \xEE""" "\xF9""\xE5"" \xBB"" \xCF""\xEE""\xF0""\xF2""\xE0""\xEB""\xED""\xE8"" \xF1""" "\xF2""\xF0""\xE0""\xED""\xE8""\xF6""\xE8"": \xC0""\xF1""\xF2""\xF0""\xEE""" "\xED""\xEE""\xEC""\xE8""\xFF"" \x96"" \xC1""\xE8""\xEE""\xEB""\xEE""\xE3""" "\xE8""\xFF"" \x96"" \xC5""\xE3""\xE8""\xEF""\xF2""\xEE""\xEF""\xE5""\xE4""" "\xE8""\xFF"" \x96"" \xCB""\xE8""\xF2""\xE5""\xF0""\xE0""\xF2""\xF3""\xF0""" "\xE0"" \x96"" \xD1""\xE5""\xEA""\xF1""\xF3""\xE0""\xEB""\xED""\xEE""\xF1""" "\xF2"" \x96"" \xD1""\xEB""\xE0""\xE2""\xFF""\xED""\xE8"" \x96"" \xD1""\xF2""" "\xF0""\xE0""\xED""\xE8""\xF2""\xE5"" \xE2"" \xF1""\xE2""\xE5""\xF2""\xE0""" " \x96"" \xD4""\xE5""\xED""\xF2""\xFA""\xE7""\xE8"" \x96"" \xD4""\xE8""\xEB""" "\xEC""\xE8"" \x96"" \xD4""\xEE""\xF0""\xEC""\xF3""\xEB""\xE0"" 1 \x96"" " "\xEE""\xF9""\xE5"" \xBB"" \xC8""\xE7""\xE1""\xF0""\xE0""\xED""\xE0"" \xF1""" "\xF2""\xE0""\xF2""\xE8""\xFF"" \xCC""\xE5""\xE6""\xE4""\xF3""\xED""\xE0""" "\xF0""\xEE""\xE4""\xED""\xE0""\xF2""\xE0"" \xF1""\xE8""\xF1""\xF2""\xE5""" "\xEC""\xE0"" \xE5""\xE4""\xE8""\xED""\xE8""\xF6""\xE8"", \xF1""\xFA""\xEA""" "\xF0""\xE0""\xF9""\xE0""\xE2""\xE0""\xED""\xE0"" SI, \xE5"" \xED""\xE0""" "\xE9""-\xF8""\xE8""\xF0""\xEE""\xEA""\xEE"" \xE8""\xE7""\xEF""\xEE""\xEB""" "\xE7""\xE2""\xE0""\xED""\xE0""\xF2""\xE0"" \xF1""\xE8""\xF1""\xF2""\xE5""" "\xEC""\xE0"" \xEE""\xF2"" \xE5""\xE4""\xE8""\xED""\xE8""\xF6""\xE8"" \xE2""" " \xF6""\xE5""\xEB""\xE8""\xFF"" \xF1""\xE2""\xFF""\xF2"". \xC7""\xE0""\xE5""" "\xE4""\xED""\xEE"" \xF1"" \xEF""\xEE""-\xF1""\xF2""\xE0""\xF0""\xE0""\xF2""" "\xE0"" \xF1""\xE8""\xF1""\xF2""\xE5""\xEC""\xE0"" \xF1""\xE0""\xED""\xF2""" "\xE8""\xEC""\xE5""\xF2""\xFA""\xF0""-\xE3""\xF0""\xE0""\xEC""-\xF1""\xE5""" "\xEA""\xF3""\xED""\xE4""\xE0"", SI \xE5"" \xED""\xE0""\xF0""\xE8""\xF7""" "\xE0""\xED""\xE0"" \xEF""\xEE""\xED""\xFF""\xEA""\xEE""\xE3""\xE0"" \"\xEC""" "\xE5""\xF2""\xF0""\xE8""\xF7""\xED""\xE0"" \xF1""\xE8""\xF1""\xF2""\xE5""" "\xEC""\xE0""\". \xC5""\xE4""\xE8""\xED""\xE8""\xF6""\xE8""\xF2""\xE5"" \xED""" "\xE0"" \xF1""\xE8""\xF1""\xF2""\xE5""\xEC""\xE0""\xF2""\xE0"" SI \xF1""\xE0""" " \xEE""\xEF""\xF0""\xE5""\xE4""\xE5""\xEB""\xE5""\xED""\xE8"" \xED""\xE0""" " \xEC""\xE5""\xE6""\xE4""\xF3""\xED""\xE0""\xF0""\xEE""\xE4""\xED""\xE8""" " \xEA""\xEE""\xED""\xF4""\xE5""\xF0""\xE5""\xED""\xF6""\xE8""\xE8"", \xEE""" "\xF0""\xE3""\xE0""\xED""\xE8""\xE7""\xE8""\xF0""\xE0""\xED""\xE8"" \xEE""" "\xF2"" \xCC""\xE5""\xE6""\xE4""\xF3""\xED""\xE0""\xF0""\xEE""\xE4""\xED""" "\xEE""\xF2""\xEE"" \xE1""\xFE""\xF0""\xEE"" \xE7""\xE0"" \xEC""\xE5""\xF0""" "\xEA""\xE8"" \xE8"" \xF2""\xE5""\xE3""\xEB""\xE8""\xEB""\xEA""\xE8"" (Bu" "reau International des Poids et Mesures, BIPM). \xC8""\xEC""\xE5""\xF2""" "\xEE"" \xED""\xE0"" \xF1""\xE8""\xF1""\xF2""\xE5""\xEC""\xE0""\xF2""\xE0""" " \xE5"" \xE4""\xE0""\xE4""\xE5""\xED""\xEE"" \xEF""\xF0""\xE5""\xE7"" 19" "60 \xE3"". \xCC""\xE5""\xE6""\xE4""\xF3""\xED""\xE0""\xF0""\xEE""\xE4""\xED""" "\xE0""\xF2""\xE0"" \xF1""\xE8""\xF1""\xF2""\xE5""\xEC""\xE0"" SI \xE5"" " "\xE8""\xE7""\xE3""\xF0""\xE0""\xE4""\xE5""\xED""\xE0"" \xE2""\xFA""\xF0""" "\xF5""\xF3"" \xF1""\xE5""\xE4""\xE5""\xEC"" \xEE""\xF1""\xED""\xEE""\xE2""" "\xED""\xE8"" \xE5""\xE4""\xE8""\xED""\xE8""\xF6""\xE8"" \xEA""\xE0""\xF2""" "\xEE"" \xEA""\xE8""\xEB""\xEE""\xE3""\xF0""\xE0""\xEC""\xE0"" \xE8"" \xEC""" "\xE5""\xF2""\xFA""\xF0""\xE0"". \xD7""\xF0""\xE5""\xE7"" \xF2""\xFF""\xF5""" " \xF1""\xE5"" \xEE""\xEF""\xF0""\xE5""\xE4""\xE5""\xEB""\xFF""\xF2"" \xF0""" "\xE0""\xE7""\xEB""\xE8""\xF7""\xED""\xE8"" \xEF""\xF0""\xEE""\xE8""\xE7""" "\xE2""\xEE""\xE4""\xED""\xE8"" \xE5""\xE4""\xE8""\xED""\xE8""\xF6""\xE8""" ". \xD1""\xE8""\xF1""\xF2""\xE5""\xEC""\xE0""\xF2""\xE0"" \xF1""\xFA""\xF9""" "\xEE"" \xEE""\xEF""\xF0""\xE5""\xE4""\xE5""\xEB""\xFF"" \xED""\xFF""\xEA""" "\xEE""\xE8"" \xEF""\xF0""\xE5""\xE4""\xF1""\xF2""\xE0""\xE2""\xEA""\xE8""" ", \xF7""\xF0""\xE5""\xE7"" \xEA""\xEE""\xE8""\xF2""\xEE"" \xF1""\xE5"" \xEE""" "\xE1""\xF0""\xE0""\xE7""\xF3""\xE2""\xE0""\xF2"" \xEA""\xF0""\xE0""\xF2""" "\xED""\xE8"" \xE8""\xEB""\xE8"" \xE4""\xF0""\xEE""\xE1""\xED""\xE8"" \xED""" "\xE0"" \xE5""\xE4""\xE8""\xED""\xE8""\xF6""\xE8""\xF2""\xE5""." ; const char* kTeststr27 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/de_wikipedia_org_clean__CP1252.txt " auf der Computermesse Systems in M\xFC""nchen vertreten (Halle A3.542)." " Artikel des Tages Das Weinbaugebiet Bordeaux, auf franz\xF6""sisch Bord" "elais, ist das gr\xF6""\xDF""te zusammenh\xE4""ngende Anbaugebiet der We" "lt f\xFC""r Qualit\xE4""tswein. Es gibt etwa 4000 Ch\xE2""teaux genannte" " Weing\xFC""ter, die die weltber\xFC""hmten Weine erzeugen. Ein differen" "ziertes System von subregionalen und kommunalen Appellationen und Klassi" "fikationen schafft unter ihnen eine qualitative Hierarchie. Die einzelne" "n Lagen spielen demgegen\xFC""ber eine untergeordnete Rolle. Ihre Stelle" " nimmt das Ch\xE2""teau ein, zu dem sie geh\xF6""ren. Im Jahr 2002 wurde" "n auf gut 120.000 Hektar Anbaufl\xE4""che insgesamt 5,74 Millionen Hekto" "liter Qualit\xE4""tswein erzeugt. mehr Fr\xFC""here Artikel des Tages \xB7""" " Weitere exzellente Artikel Was geschah am 13. Oktober? 1781 \x96"" Jose" "phinismus: Mit seinem Toleranzpatent hebt Joseph II. im Erzherzogtum \xD6""" "sterreich das Glaubensmonopol der Katholischen Kirche auf. 1806 \x96"" I" "n Berlin wird die Preu\xDF""isch-K\xF6""nigliche Blindenanstalt unter Le" "itung von Johann August Zeune er\xF6""ffnet \x96"" Deutschlands erste Bl" "indenschule. 1806 \x96"" Otto Unverdorben, der 1826 Anilin, ein fl\xFC""" "ssiges Zersetzungsprodukt von Indigo, entdecken wird, wird geboren. 1906" " \x96"" Karl Holzamer, Gr\xFC""ndungsintendant des ZDF, wird" ; const char* kTeststr28 = // http://www.mon.gov.ua/books/ann.php?id=193 // Produced by stringify.cc on 2007-04-10 14:21 from file koi8u.html "\n\n \n \xE1""\xCE""\xCF""\xD4""\xC1""\xC3""\xA6""\xD1""" " | \xED""i\xCE""i\xD3""\xD4""\xC5""\xD2""\xD3""\xD4""\xD7""\xCF"" \xCF""" "\xD3""\xD7""i\xD4""\xC9"" \xA6"" \xCE""\xC1""\xD5""\xCB""\xC9"" \xF5""\xCB""" "\xD2""\xC1""\xA7""\xCE""\xC9""\n\n\n\xF0""\xCF""\xCC""" "\xA6""\xDD""\xD5""\xCB"" \xF7"". \xF0"".
\xE2""\xC4""\xD6""\xA6""\xCC""" "\xD8""\xCE""\xC9""\xC3""\xD4""\xD7""\xCF""
\xF7""\xC9""" "\xC4""\xC1""\xD7""\xCE""\xC9""\xC3""\xD4""\xD7""\xCF"" \"\xF7""\xC9""\xDD""" "\xC1"" \xDB""\xCB""\xCF""\xCC""\xC1""\", 2001 - 287c.

\xF7""\xC9""" "\xD3""\xD7""\xA6""\xD4""\xCC""\xC5""\xCE""\xCF"" \xC7""\xCF""\xD3""\xD0""" "\xCF""\xC4""\xC1""\xD2""\xD3""\xD8""\xCB""\xC5"" \xDA""\xCE""\xC1""\xDE""" "\xC5""\xCE""\xCE""\xD1"" \xC2""\xC4""\xD6""\xA6""\xCC""\xD8""\xCE""\xC9""" "\xC3""\xD4""\xD7""\xC1"", \xCA""\xCF""\xC7""\xCF"" \xD2""\xCF""\xDA""\xD7""" "\xC9""\xD4""\xCF""\xCB"" \xA6"" \xD3""\xD5""\xDE""\xC1""\xD3""\xCE""\xC9""" "\xCA"" \xD3""\xD4""\xC1""\xCE"", \xC2""\xA6""\xCF""\xCC""\xCF""\xC7""\xA6""" "\xC0"" \xC2""\xC4""\xD6""\xCF""\xCC""\xC9""\xCE""\xCF""\xA7"" \xD3""\xA6""" "\xCD""'\xA7"", \xD0""\xC9""\xD4""\xC1""\xCE""\xCE""\xD1"" \xC7""\xCF""\xC4""" "\xA6""\xD7""\xCC""\xA6"", \xD5""\xD4""\xD2""\xC9""\xCD""\xC1""\xCE""\xCE""" "\xD1"" \xA6"" \xD2""\xCF""\xDA""\xD7""\xC5""\xC4""\xC5""\xCE""\xCE""\xD1""" " \xC2""\xC4""\xD6""\xA6""\xCC"". \xEF""\xD0""\xC9""\xD3""\xC1""\xCE""\xCF""" " \xD4""\xC9""\xD0""\xC9"" \xD7""\xD5""\xCC""\xC9""\xCB""\xA6""\xD7"" \xA6""" " \xD0""\xC1""\xD3""\xA6""\xDE""\xCE""\xC9""\xC8"" \xC2""\xD5""\xC4""\xA6""" "\xD7""\xC5""\xCC""\xD8"", \xD0""\xC1""\xD3""\xA6""\xDE""\xCE""\xC9""\xC3""" "\xD8""\xCB""\xC9""\xCA"" \xA6""\xCE""\xD7""\xC5""\xCE""\xD4""\xC1""\xD2""" " \xD4""\xC1"" \xCD""\xC5""\xC8""\xC1""\xCE""\xA6""\xDA""\xC1""\xC3""\xA6""" "\xC0"" \xD7""\xC9""\xD2""\xCF""\xC2""\xCE""\xC9""\xDE""\xC9""\xC8"" \xD0""" "\xD2""\xCF""\xC3""\xC5""\xD3""\xA6""\xD7"", \xCD""\xC5""\xC4""\xCF""\xCE""" "\xCF""\xD3""\xCE""\xD5"" \xC2""\xC1""\xDA""\xD5"" \xA6"" \xDA""\xC1""\xD0""" "\xC9""\xCC""\xC5""\xCE""\xCE""\xD1"" \xC5""\xCE""\xD4""\xCF""\xCD""\xCF""" "\xC6""\xA6""\xCC""\xD8""\xCE""\xC9""\xC8"" \xCB""\xD5""\xCC""\xD8""\xD4""" "\xD5""\xD2"", \xD4""\xC5""\xC8""\xCE""\xCF""\xCC""\xCF""\xC7""\xA6""\xC0""" " \xD7""\xC9""\xD2""\xCF""\xC2""\xCE""\xC9""\xC3""\xD4""\xD7""\xC1"" \xD0""" "\xD2""\xCF""\xC4""\xD5""\xCB""\xD4""\xA6""\xD7"" \xC2""\xC4""\xD6""\xA6""" "\xCC""\xD8""\xCE""\xC9""\xC3""\xD4""\xD7""\xC1"", \xC8""\xD7""\xCF""\xD2""" "\xCF""\xC2""\xC9"" \xA6"" \xDB""\xCB""\xA6""\xC4""\xCE""\xC9""\xCB""\xC9""" " \xC2""\xC4""\xD6""\xA6""\xCC"", \xC5""\xCB""\xCF""\xCE""\xCF""\xCD""\xA6""" "\xCB""\xD5"" \xD4""\xC1"" \xCF""\xD2""\xC7""\xC1""\xCE""\xA6""\xDA""\xC1""" "\xC3""\xA6""\xC0"" \xC7""\xC1""\xCC""\xD5""\xDA""\xA6"", \xCE""\xC1""\xD7""" "\xC5""\xC4""\xC5""\xCE""\xCF"" \xCC""\xC1""\xC2""\xCF""\xD2""\xC1""\xD4""" "\xCF""\xD2""\xCE""\xCF""-\xD0""\xD2""\xC1""\xCB""\xD4""\xC9""\xDE""\xCE""" "\xA6"" \xD2""\xCF""\xC2""\xCF""\xD4""\xC9"".\r\n\xE4""\xCC""\xD1"" \xD5""" "\xDE""\xCE""\xA6""\xD7"" \xD0""\xD2""\xCF""\xC6""\xC5""\xD3""\xA6""\xCA""" "\xCE""\xCF""-\xD4""\xC5""\xC8""\xCE""\xA6""\xDE""\xCE""\xC9""\xC8"" \xCE""" "\xC1""\xD7""\xDE""\xC1""\xCC""\xD8""\xCE""\xC9""\xC8"" \xDA""\xC1""\xCB""" "\xCC""\xC1""\xC4""\xA6""\xD7"".

18\n\xC7""\xD2""\xCE"".

\n" ; const char* kTeststr29 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/pl_wikipedia_org_clean__CP1250.txt "kroekonomicznej\". ( Wikinews) Bie\xBF""\xB9""ce wydarzenia: w Wikipedii" ", w Wikinews Aktualno\x9C""ci sportowe: w Wikipedii, w Wikinews Czy wies" "z, \xBF""e... Z najnowszych artyku\xB3""\xF3""w Wikipedii: ... zdobywca " "pierwszego polskiego medalu olimpijskiego Adam Kr\xF3""likiewicz zmar\xB3""" " po wypadku na planie filmu Andrzeja Wajdy Popio\xB3""y? ... wydany w 19" "99 album Tori Amos To Venus and Back by\xB3"" pierwszym albumem tej arty" "stki od 1992, kt\xF3""ry nie dosta\xB3"" si\xEA"" do pierwszej dziesi\xB9""" "tki na brytyjskiej li\x9C""cie najpopularniejszych p\xB3""yt? ... emisja" " audycji radiowej W Jezioranach rozpocz\xEA""\xB3""a si\xEA"" w 1960? .." ". w czasie bitwy w Sundzie holenderski 28-dzia\xB3""owy okr\xEA""t Breda" " by\xB3"" zdobyty dwukrotnie? ... tramwaje Tatra T6A2 u\xBF""ywane s\xB9""" " mi\xEA""dzy innymi w w\xEA""gierskim mie\x9C""cie Szeged? Archiwum | Na" "pisz nowy artyku\xB3"" Wybrane rocznice 12 pa\x9F""dziernika: imieniny o" "bchodz\xB9"" Maksymilian, Serafin, Witolda 1492 - Krzysztof Kolumb dop\xB3""" "yn\xB9""\xB3"" do archipelagu Baham\xF3""w; oficjalna data odkrycia Amer" "yki 1891 - urodzi\xB3""a si\xEA"" Edyta Stein, znana jako \x9C""w. Teres" "a Benedykta od Krzy\xBF""a, filozof, \x9C""wi\xEA""ta Ko\x9C""cio\xB3""a" " rzymskokatolickiego 1920 - wojna polsko-bolszewicka: podpisanie rozejmu" "; gen. Lucjan \xAF""eligowski zaj\xB9""\xB3"" Wilno i proklamowa\xB3"" u" "tworzenie Litwy \x8C""rodkowej. 1924 - zmar\xB3"" Anatole France, pisarz" " francuski 1943 - rozpocz\xEA""\xB3""a si\xEA"" bitwa pod Lenino Inne ro" "cznice: 11 pa\x9F""dziernika - 12 pa\x9F""dziernika - 13 pa\x9F""dzierni" "ka Archiwum | Kalendarium Artyku\xB3"" na medal Wielka w\xEA""dr\xF3""wk" "a lud\xF3""w \x96"" okres masowych migracji plemion barbarzy\xF1""skich," " w szczeg\xF3""lno\x9C""ci Hun\xF3""w i German\xF3""w, na ziemie cesarst" "wa rzymskiego u schy\xB3""ku staro\xBF""ytno\x9C""ci i w pocz\xB9""tkach" " \x9C""redniowiecza (IV-VI wiek). Proces ten radykalnie odmieni\xB3"" ob" "raz kontynentu europejskiego \x96"" doprowadzi\xB3"" do zmian etnicznych" " na du\xBF""ych obszarach, wyz" ; const char* kTeststr32 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/lv_wikipedia_org_clean__CP1257.txt " neaizvietojamu materi\xE2""lu ar \xEF""oti pla\xF0""u pielietojumu. Dim" "ants ir tradicion\xE2""li visv\xE7""rt\xEE""g\xE2""kais d\xE2""rgakmens." " Izcil\xE2""s fizik\xE2""l\xE2""s \xEE""pa\xF0""\xEE""bas padara dimantu" " par lielisku abraz\xEE""vu \x96"" vien\xEE""g\xE2""s vielas, ar kur\xE2""" "m var ieskr\xE2""p\xE7""t dimantu, ir cits dimants, borazons, ultracieta" "is fuller\xEE""ts vai dimanta nanostien\xEE""\xF0""i. Tas noz\xEE""m\xE7""" " ar\xEE"" to, ka dimants lieliski saglab\xE2"" virsmas pul\xE7""jumu \x96""" " savu izcilo sp\xEE""dumu. Las\xEE""t vair\xE2""k... Iepriek\xF0""\xE7""" "jie raksti: Bizantijas imp\xE7""rija, Delartisk\xE2"" kom\xE7""dija, Iro" "nija, Naudas v\xE7""sture, 1905. gada revol\xFB""cija Vai tu zin\xE2""ji" "... No latvie\xF0""u Vikip\xE7""dijas jaun\xE2""kajiem rakstiem: ... ka " "viens no liel\xE2""kajiem v\xE2""rsm\xE2""s rakst\xEE""tajiem darbiem li" "terat\xFB""ras v\xE7""stur\xE7"" ir senindie\xF0""u eposs \"Mah\xE2""bh\xE2""" "rata\"? ... ka v\xE2""rda \"ebrejs\" v\xE7""sturisk\xE2"" noz\xEE""me ir" " \"tie, kas klejo no vietas uz vietu\"? ... ka feni\xED""ie\xF0""i bija " "pirmie, kas jau 598-595. g. p.m.\xE7"". apku\xEC""oju\xF0""i apk\xE2""rt" " \xC2""frikai, dom\xE2""dami gan, ka pieveiku\xF0""i tikai L\xEE""biju? " "... ka nosaukums \"jaunlatvie\xF0""i\" pirm\xE2""s atmodas laik\xE2"" ra" "dies no V\xE2""cij\xE2"" izveidoju\xF0""\xE2""s liter\xE2""tu liber\xE2""" "listisk\xE2""s kust\xEE""bas \"Junges Deutschland\", kuras pamatidejas b" "ija l\xEE""dz\xEE""gas jaunlatvie\xF0""u kust\xEE""bai? ... ka m\xFB""ra" " \xE7""kas ar koka p\xE2""rsegumu Rietumeirop\xE2"" s\xE2""ka b\xFB""v\xE7""" "t Karolingu renesanses laik\xE2""? Vikip\xE7""dija cit\xE2""s valod\xE2""" "s Vikip\xE7""dijas, kur\xE2""s i" ; const char* kTeststr33 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/th_wikipedia_org_clean__ISO-8859-11.txt " \xE0""\xBE""\xD7""\xE8""\xCD""\xB6""\xC7""\xD2""\xC2""\xCA""\xD1""\xB5""" "\xC2""\xEC""\xBB""\xAF""\xD4""\xAD""\xD2""\xB3"" \xA1""\xE8""\xCD""\xB9""" "\xE0""\xA2""\xE9""\xD2""\xC3""\xD1""\xBA""\xCB""\xB9""\xE9""\xD2""\xB7""" "\xD5""\xE8"" \xE0""\xA1""\xD2""\xCB""\xC5""\xD5""\xE0""\xCB""\xB9""\xD7""" "\xCD""\xBB""\xC3""\xD0""\xA1""\xD2""\xC8""\xC7""\xE8""\xD2""\xB5""\xB9""" "\xBB""\xC3""\xD0""\xCA""\xBA""\xA4""\xC7""\xD2""\xC1""\xCA""\xD3""\xE0""" "\xC3""\xE7""\xA8"" \xE3""\xB9""\xA1""\xD2""\xC3""\xB7""\xB4""\xC5""\xCD""" "\xA7""\xC3""\xD0""\xE0""\xBA""\xD4""\xB4""\xB9""\xD4""\xC7""\xE0""\xA4""" "\xC5""\xD5""\xC2""\xC3""\xEC""\xE3""\xB5""\xE9""\xB4""\xD4""\xB9"" \xC1""" "\xD2""\xE0""\xC5""\xE0""\xAB""\xD5""\xC2"" \xBB""\xC3""\xD0""\xA1""\xD2""" "\xC8""\xE0""\xB5""\xD7""\xCD""\xB9""\xCD""\xD1""\xB9""\xB5""\xC3""\xD2""" "\xC2""\xCA""\xD3""\xCB""\xC3""\xD1""\xBA""\xA1""\xD2""\xC3""\xE0""\xB4""" "\xD4""\xB9""\xE0""\xC3""\xD7""\xCD""\xE3""\xB9""\xAA""\xE8""\xCD""\xA7""" "\xE1""\xA4""\xBA""\xC1""\xD0""\xC5""\xD0""\xA1""\xD2"" \xA2""\xB3""\xD0""" "\xB7""\xD5""\xE8""\xCB""\xC1""\xCD""\xA1""\xA4""\xC7""\xD1""\xB9""\xA8""" "\xD2""\xA1""\xE4""\xBF""\xBB""\xE8""\xD2""\xE3""\xB9""\xCD""\xD4""\xB9""" "\xE2""\xB4""\xB9""\xD5""\xE0""\xAB""\xD5""\xC2"" \xE0""\xA2""\xE9""\xD2""" "\xBB""\xA1""\xA4""\xC5""\xD8""\xC1""\xCB""\xC5""\xD2""\xC2""\xBE""\xD7""" "\xE9""\xB9""\xB7""\xD5""\xE8""\xE3""\xB9""\xE0""\xCD""\xE0""\xAA""\xD5""" "\xC2""\xB5""\xD0""\xC7""\xD1""\xB9""\xCD""\xCD""\xA1""\xE0""\xA9""\xD5""" "\xC2""\xA7""\xE3""\xB5""\xE9"" \xCA""\xB6""\xD2""\xBA""\xD1""\xB9""\xB7""" "\xD5""\xE8""\xB7""\xD3""\xCB""\xB9""\xE9""\xD2""\xB7""\xD5""\xE8""\xCA""" "\xC3""\xC3""\xCB""\xD2""\xBC""\xD9""\xE9""\xE4""\xB4""\xE9""\xC3""\xD1""" "\xBA""\xC3""\xD2""\xA7""\xC7""\xD1""\xC5""\xE2""\xB9""\xE0""\xBA""\xC5""" " \xB7""\xC2""\xCD""\xC2""\xBB""\xC3""\xD0""\xA1""\xD2""\xC8""\xC3""\xD2""" "\xC2""\xAA""\xD7""\xE8""\xCD""\xBC""\xD9""\xE9""\xE4""\xB4""\xE9""\xC3""" "\xD1""\xBA""\xC3""\xD2""\xA7""\xC7""\xD1""\xC5""\xBB""\xC3""\xD0""\xA8""" "\xD3""\xBB""\xD5"" \xBE"".\xC8"". 2549 \xE0""\xCB""\xB5""\xD8""\xA1""\xD2""" "\xC3""\xB3""\xEC""\xBB""\xD1""\xA8""\xA8""\xD8""\xBA""\xD1""\xB9"" \xC3""" "\xD9""\xE9""\xE4""\xCB""\xC1""\xC7""\xE8""\xD2""\x85"" \xA8""\xD2""\xA1""" "\xBA""\xB7""\xA4""\xC7""\xD2""\xC1""\xC5""\xE8""\xD2""\xCA""\xD8""\xB4""" "\xA2""\xCD""\xA7""\xC7""\xD4""\xA1""\xD4""\xBE""\xD5""\xE0""\xB4""\xD5""" "\xC2"" : ...\xBE""\xC3""\xD0""\xE0""\xA8""\xE9""\xD2""\xE2""\xCD""\xC1""" "\xD9""\xA1""\xD2""\xC1""\xD2""\xE2""\xCD""\xE2""\xC2"" \xCD""\xD6""\xB9""" "\xC2""\xD4""\xC1""\xBA""\xD2"" \xA1""\xD2""\xBA""\xD2""\xC1""\xBA""\xD2""" " \xCD""\xD4""\xA1""\xD9""\xC3""\xD9"" \xC3""\xD9""\xA1""\xD4""\xB4""\xD5""" "\xB7""\xD5""\xE8"" 4 \xE1""\xCB""\xE8""\xA7""\xE2""\xB5""\xE2""\xC3""\xE3""" "\xB9""\xC2""\xD9""\xA1""\xD1""\xB9""\xB4""\xD2"" \xB7""\xC3""\xA7""\xE0""" "\xBB""\xE7""\xB9""\xBE""\xC3""\xD0""\xC1""\xCB""\xD2""\xA1""\xC9""\xD1""" "\xB5""\xC3""\xD4""\xC2""\xEC""\xB7""\xD5""\xE8""\xC1""\xD5""\xBE""\xC3""" "\xD0""\xAA""\xB9""\xC1""\xD2""\xC2""\xD8""\xB9""\xE9""\xCD""\xC2""\xB7""" "\xD5""\xE8""\xCA""\xD8""\xB4""\xE3""\xB9""\xE2""\xC5""\xA1"" ...\xBE""\xC3""" "\xD0""\xBB""\xC3""\xD0""\xC1""\xD8""\xA2""\xE1""\xCB""\xE8""\xA7""\xC3""" "\xD1""\xB0""\xC1""\xD2""\xC5""\xD5""\xE0""\xCD""\xB5""\xD1""\xC7"" \xB5""" "\xD2""\xB9""\xD8""\xC1""\xD2""\xBF""\xD4""\xC5""\xD4""\xB7""\xD5""\xE8""" " 2 \xE1""\xCB""\xE8""\xA7""\xC3""\xD1""\xB0""\xE0""\xCD""\xA1""\xC3""\xD2""" "\xAA""\xAB""\xD2""\xC1""\xD1""\xC7"" \xB7""\xC3""\xA7""\xE0""\xBB""\xE7""" "\xB9""\xBE""\xC3""\xD0""\xC1""\xCB""\xD2""\xA1""\xC9""\xD1""\xB5""\xC3""" "\xD4""\xC2""\xB7""\xD5""\xE8""\xB7""\xC3""\xA7""\xC1""\xD5""\xBE""\xC3""" "\xD0""\xAA""\xB9""\xC1""\xD2""\xC2""\xD8""\xC1""\xD2""\xA1""\xB7""\xD5""" "\xE8""\xCA""\xD8""\xB4"" \xE3""\xB9""\xBA""\xC3""\xC3""\xB4""\xD2""\xBC""" "\xD9""\xE9""\xB9""\xD3""\xBB""\xC3""\xD0""\xE0""\xB7""\xC8""\xB7""\xD1""" "\xE8""\xC7""\xE2""\xC5""\xA1"" \xE1""\xC5""\xD0""\xB7""\xC3""\xA7""\xA4""" "\xC3""\xCD""\xA7""\xC3""\xD2""\xAA""\xC2""\xEC""\xE3""\xB9""\xB0""\xD2""" "\xB9""\xD0""\xE4""\xC1""\xE8""\xE3""\xAA""\xE8""\xBB""\xC3""\xD0""\xC1""" "\xD8""\xA2""\xE1""\xCB""\xE8""\xA7""\xC3""\xD1""\xB0"" \xB7""\xD5""\xE8""" "\xC2""\xD2""\xC7""\xB9""\xD2""\xB9""\xB7""\xD5""\xE8""\xCA""\xD8""\xB4""" "\xE3""\xB9""\xE2""\xC5""\xA1"" ...\xBF""\xD2""\xE2""\xC3""\xCB""\xEC""\xE0""" "\xBB""\xBB""\xD4""\xB7""\xD5""\xE8"" 2 \xE0""\xB9""\xE0""\xBF""\xCD""\xC3""" "\xEC""\xA1""\xD2""\xE0""\xC3"" \xE1""\xCB""\xE8""\xA7""\xCD""\xD5""\xC2""" "\xD4""\xBB""\xB5""\xEC""\xE2""\xBA""\xC3""\xD2""\xB3"" \xB7""\xC3""\xA7""" "\xE0""\xBB""\xE7""\xB9""\xBE""\xC3""\xD0""\xC1""\xCB""\xD2""\xA1""\xC9""" "\xD1""\xB5""\xC3""\xD4""\xC2""\xEC""\xB7""\xD5""\xE8""\xB7""\xC3""\xA7""" "\xA4""\xC3""\xCD""\xA7""\xC3""\xD2""\xAA""\xC2""\xEC""\xC2""\xD2""\xC7""" "\xB9""\xD2""\xB9""\xB7""\xD5""\xE8""\xCA""\xD8""\xB4"" \xE3""\xB9""\xBB""" "\xC3""\xD0""\xC7""\xD1""\xB5""\xD4""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC""" "\xE2""\xC5""\xA1"" ...\xBF""\xD8""\xB5""\xBA""\xCD""\xC5""\xE3""\xB9""\xBB""" "\xC3""\xD0""\xE0""\xB7""\xC8""\xE4""\xB7""\xC2""\xC1""\xD5""\xC5""\xD5""" "\xA1""\xBF""\xD8""\xB5""\xBA""\xCD""\xC5""\xCD""\xD2""\xAA""\xD5""\xBE""" " 2 \xC5""\xD5""\xA1"" \xA4""\xD7""\xCD"" \xE4""\xB7""\xC2""\xC5""\xD5""\xA1""" "\xE1""\xC5""\xD0""\xE2""\xBB""\xC3""\xC5""\xD5""\xA1"" \xB7""\xD5""\xE8""" "\xE0""\xA1""\xE7""\xBA""\xB6""\xD2""\xC7""\xC3"" \x96"" \xCA""\xC3""\xE9""" "\xD2""\xA7""\xBA""\xB7""\xA4""\xC7""\xD2""\xC1""\xE3""\xCB""\xC1""\xE8""" " \xCA""\xD2""\xC3""\xD2""\xB9""\xD8""\xA1""\xC3""\xC1"" \xC7""\xD4""\xB7""" "\xC2""\xD2""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC""\xB8""\xC3""\xC3""\xC1""" "\xAA""\xD2""\xB5""\xD4"" \xE1""\xC5""\xD0""\xA4""\xB3""\xD4""\xB5""\xC8""" "\xD2""\xCA""\xB5""\xC3""\xEC"" \xBF""\xD4""\xCA""\xD4""\xA1""\xCA""\xEC""" " \x96"" \xB4""\xD2""\xC3""\xD2""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC"" \x96""" " \xC7""\xD4""\xB7""\xC2""\xD2""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC""\xCA""" "\xD8""\xA2""\xC0""\xD2""\xBE"" \x96"" \xAA""\xD5""\xC7""\xC7""\xD4""\xB7""" "\xC2""\xD2"" \x96"" \xE0""\xA4""\xC1""\xD5"" \x96"" \xAA""\xD5""\xC7""\xE0""" "\xA4""\xC1""\xD5"" \x96"" \xC7""\xD4""\xB7""\xC2""\xD2""\xC8""\xD2""\xCA""" "\xB5""\xC3""\xEC""\xE2""\xC5""\xA1"" \x96"" \xB8""\xC3""\xB3""\xD5""\xC7""" "\xD4""\xB7""\xC2""\xD2"" \x96"" \xB9""\xD4""\xE0""\xC7""\xC8""\xC7""\xD4""" "\xB7""\xC2""\xD2"" \x96"" \xA4""\xB3""\xD4""\xB5""\xC8""\xD2""\xCA""\xB5""" "\xC3""\xEC"" \x96"" \xCA""\xB6""\xD4""\xB5""\xD4""\xC8""\xD2""\xCA""\xB5""" "\xC3""\xEC"" \xC7""\xD4""\xB7""\xC2""\xD2""\xA1""\xD2""\xC3"" \xC7""\xD4""" "\xB7""\xC2""\xD2""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC""\xBB""\xC3""\xD0""" "\xC2""\xD8""\xA1""\xB5""\xEC"" \xE1""\xC5""\xD0""\xC7""\xD4""\xC8""\xC7""" "\xA1""\xC3""\xC3""\xC1"" \xA1""\xD2""\xC3""\xA2""\xB9""\xCA""\xE8""\xA7""" " \x96"" \xA1""\xD2""\xC3""\xCA""\xD7""\xE8""\xCD""\xCA""\xD2""\xC3"" \x96""" " \xA1""\xD2""\xC3""\xE0""\xC1""\xD7""\xCD""\xA7"" \x96"" \xA1""\xD2""\xC3""" "\xBB""\xA1""\xA4""\xC3""\xCD""\xA7"" \x96"" \xB9""\xD4""\xB5""\xD4""\xC8""" "\xD2""\xCA""\xB5""\xC3""\xEC"" \x96"" \xC3""\xD1""\xB0""\xA1""\xD4""\xA8""" " \x96"" \xB8""\xD8""\xC3""\xA1""\xD4""\xA8"" \x96"" \xE0""\xA1""\xC9""\xB5""" "\xC3""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC"" \x96"" \xE0""\xB7""\xA4""\xE2""" "\xB9""\xE2""\xC5""\xC2""\xD5""\xAA""\xD5""\xC7""\xC0""\xD2""\xBE"" \x96""" " \xE1""\xBE""\xB7""\xC2""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC"" \x96"" \xBE""" "\xC2""\xD2""\xBA""\xD2""\xC5""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC"" \x96""" " \xC8""\xD6""\xA1""\xC9""\xD2""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC"" \x96""" " \xBA""\xC3""\xC3""\xB3""\xD2""\xC3""\xD1""\xA1""\xC9""\xC8""\xD2""\xCA""" "\xB5""\xC3""\xEC""\xE1""\xC5""\xD0""\xC7""\xD4""\xB7""\xC2""\xD2""\xA1""" "\xD2""\xC3""\xCA""\xD2""\xC3""\xCA""\xB9""\xE0""\xB7""\xC8"" \x96"" \xC7""" "\xD4""\xB7""\xC2""\xD2""\xA1""\xD2""\xC3""\xA4""\xCD""\xC1""\xBE""\xD4""" "\xC7""\xE0""\xB5""\xCD""\xC3""\xEC"" \x96"" \xC7""\xD4""\xC8""\xC7""\xA1""" "\xC3""\xC3""\xC1""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC"" \xCB""\xC1""\xC7""" "\xB4""\xCB""\xC1""\xD9""\xE8"" \xA4""\xE9""\xB9""\xCB""\xD2"" \x97"" \xCA""" "\xB6""\xD2""\xB9""\xD5""\xC2""\xE8""\xCD""\xC2"" \x97"" \xCB""\xC1""\xC7""" "\xB4""\xCB""\xC1""\xD9""\xE8""\xCB""\xC5""\xD1""\xA1"" \x96"" \xCB""\xC1""" "\xC7""\xB4""\xCB""\xC1""\xD9""\xE8""\xB7""\xD1""\xE9""\xA7""\xCB""\xC1""" "\xB4"" \x96"" \xB7""\xD8""\xA1""\xCB""\xD1""\xC7""\xA2""\xE9""\xCD"" \x97""" " \xB5""\xD2""\xC1""\xE0""\xC7""\xC5""\xD2"" \x96"" \xC8""\xB5""\xC7""\xC3""" "\xC3""\xC9"" \x96"" \xBB""\xAF""\xD4""\xB7""\xD4""\xB9"" \x97"" \xCD""\xE9""" "\xD2""\xA7""\xCD""\xD4""\xA7"" \x96"" \xB4""\xD1""\xAA""\xB9""\xD5""\xC3""" "\xD2""\xC2""\xAA""\xD7""\xE8""\xCD"" \x97"" \xBA""\xD8""\xA4""\xA4""\xC5""" "\xCA""\xD3""\xA4""\xD1""\xAD""\xA2""\xCD""\xA7""\xE4""\xB7""\xC2"", \xA2""" "\xCD""\xA7""\xE2""\xC5""\xA1"" \x97"" \xBB""\xC3""\xD0""\xE0""\xB7""\xC8""" " \x96"" \xA8""\xD1""\xA7""\xCB""\xC7""\xD1""\xB4""\xE3""\xB9""\xBB""\xC3""" "\xD0""\xE0""\xB7""\xC8""\xE4""\xB7""\xC2"" \xC7""\xD1""\xB2""\xB9""\xB8""" "\xC3""\xC3""\xC1"" \xC7""\xD4""\xA8""\xD4""\xB5""\xC3""\xC8""\xD4""\xC5""" "\xBB""\xEC"" \xE1""\xC5""\xD0""\xAA""\xD5""\xC7""\xD4""\xB5""\xBB""\xC3""" "\xD0""\xA8""\xD3""\xC7""\xD1""\xB9"" \xA1""\xD2""\xC3""\xB7""\xD3""\xCD""" "\xD2""\xCB""\xD2""\xC3"" \x96"" \xA1""\xD2""\xC3""\xA8""\xD1""\xB4""\xCA""" "\xC7""\xB9"" \x96"" \xE4""\xC1""\xE9""\xB4""\xCD""\xA1""\xE4""\xC1""\xE9""" "\xBB""\xC3""\xD0""\xB4""\xD1""\xBA"" \x96"" \xCB""\xD1""\xB5""\xB6""\xA1""" "\xC3""\xC3""\xC1"" \x96"" \xA7""\xD2""\xB9""\xCD""\xB4""\xD4""\xE0""\xC3""" "\xA1"" \x96"" \xC0""\xD2""\xBE""\xC2""\xB9""\xB5""\xC3""\xEC"" \x96"" \xC7""" "\xD4""\xB7""\xC2""\xD8"" \x96"" \xE2""\xB7""\xC3""\xB7""\xD1""\xC8""\xB9""" "\xEC"" \x96"" \xCD""\xD4""\xB9""\xE0""\xB7""\xCD""\xC3""\xEC""\xE0""\xB9""" "\xE7""\xB5"" \x96"" \xA4""\xCD""\xC1""\xBE""\xD4""\xC7""\xE0""\xB5""\xCD""" "\xC3""\xEC"" \x96"" \xA1""\xD5""\xCC""\xD2"" \x96"" \xE0""\xA1""\xC1"" \x96""" " \xB9""\xD1""\xB9""\xB7""\xB9""\xD2""\xA1""\xD2""\xC3"" \x96"" \xA1""\xD2""" "\xC3""\xBA""\xD1""\xB9""\xE0""\xB7""\xD4""\xA7"" \x96"" \xB4""\xB9""\xB5""" "\xC3""\xD5"" \x96"" \xCD""\xD8""\xBB""\xC3""\xD2""\xA1""\xC3"" \x96"" \xB9""" "\xD2""\xAF""\xC8""\xD4""\xC5""\xBB""\xEC"" \x96"" \xC7""\xC3""\xC3""\xB3""" "\xA1""\xC3""\xC3""\xC1"" \x96"" \xA8""\xD4""\xB5""\xC3""\xA1""\xC3""\xC3""" "\xC1"" \x96"" \xB7""\xD1""\xC8""\xB9""\xC8""\xD4""\xC5""\xBB""\xEC""\xE1""" "\xC5""\xD0""\xA1""\xD2""\xC3""\xCD""\xCD""\xA1""\xE1""\xBA""\xBA"" \x96""" " \xA1""\xD2""\xC3""\xB6""\xE8""\xD2""\xC2""\xC0""\xD2""\xBE"" \x96"" \xC7""" "\xD1""\xB4""\xE4""\xB7""\xC2"" \x96"" \xCA""\xB6""\xD2""\xBB""\xD1""\xB5""" "\xC2""\xA1""\xC3""\xC3""\xC1""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC"" \x96""" " \xA1""\xD2""\xC3""\xB7""\xE8""\xCD""\xA7""\xE0""\xB7""\xD5""\xE8""\xC2""" "\xC7"" \xC1""\xB9""\xD8""\xC9""\xC2""\xEC"" \xCA""\xD1""\xA7""\xA4""\xC1""" " \xE1""\xC5""\xD0""\xBB""\xC3""\xD1""\xAA""\xAD""\xD2"" \xBB""\xC3""\xD1""" "\xAA""\xAD""\xD2"" \x96"" \xA8""\xD4""\xB5""\xC7""\xD4""\xB7""\xC2""\xD2""" " \x96"" \xCA""\xD1""\xA7""\xA4""\xC1""\xC7""\xD4""\xB7""\xC2""\xD2"" \x96""" " \xC1""\xD2""\xB9""\xD8""\xC9""\xC2""\xC7""\xD4""\xB7""\xC2""\xD2"" \x96""" " \xE2""\xBA""\xC3""\xD2""\xB3""\xA4""\xB4""\xD5"" \x96"" \xBB""\xD8""\xC3""" "\xD2""\xB3""\xC7""\xD4""\xB7""\xC2""\xD2"" \x96"" \xBB""\xC3""\xD0""\xC7""" "\xD1""\xB5""\xD4""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC"" \x96"" \xBB""\xC3""" "\xD0""\xC7""\xD1""\xB5""\xD4""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC""\xA2""" "\xCD""\xA7""\xC7""\xD4""\xB7""\xC2""\xD2""\xC8""\xD2""\xCA""\xB5""\xC3""" "\xEC""\xE1""\xC5""\xD0""\xE0""\xB7""\xA4""\xE2""\xB9""\xE2""\xC5""\xC2""" "\xD5"" \x96"" \xC0""\xD9""\xC1""\xD4""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC""" " \x96"" \xC0""\xD2""\xC9""\xD2"" \x96"" \xC0""\xD2""\xC9""\xD2""\xE4""\xB7""" "\xC2"" \x96"" \xC0""\xD2""\xC9""\xD2""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC""" " \x96"" \xE0""\xC8""\xC3""\xC9""\xB0""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC""" " \x96"" \xC3""\xD1""\xB0""\xC8""\xD2""\xCA""\xB5""\xC3""\xEC"" \x96"" \xC8""" "\xD2""\xCA""\xB9""\xD2"" \x96"" \xE4""\xCA""\xC2""\xC8""\xD2""\xCA""\xB5""" "\xC3""\xEC"" \xCB""\xD1""\xC7""\xA2""\xE9""\xCD""\xBE""\xD4""\xE0""\xC8""" "\xC9"" \xB7""\xE8""\xD2""\xCD""\xD2""\xA1""\xD2""\xC8""\xC2""\xD2""\xB9""" "\xCA""\xD8""\xC7""\xC3""\xC3""\xB3""\xC0""\xD9""\xC1""\xD4"" \x97"" \xBE""" "\xC3""\xD0""\xC1""\xCB""\xD2""\xA1""\xC9""\xD1""\xB5""\xC3""\xD4""\xC2""" "\xEC""\xE4""\xB7""\xC2"" \x97"" \xC3""\xD2""\xC2""\xAA""\xD7""\xE8""\xCD""" "\xC2""\xD5""\xE8""\xCB""\xE9""\xCD""\xE4""\xB7""\xC2""" ; const char* kTeststr35 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/so_wikipedia_org_clean__CP1256.txt " \xE3""\xCE""\xD5""\xE6""\xD5"" \xE1""\xDF""\xCA""\xC7""\xC8""\xC9"" \xC7""" "\xE1""\xE3""\xE6""\xD3""\xE6""\xDA""\xC9"" \xC7""\xE1""\xCD""\xD1""\xC9""" " \"\xE6""\xED""\xDF""\xED""\xC8""\xED""\xCF""\xED""\xC7""\" \xC8""\xC7""" "\xE1""\xE1""\xDB""\xC9"" \xC7""\xE1""\xD5""\xE6""\xE3""\xC7""\xE1""\xED""" "\xC9"". \xDF""\xE1"" \xDE""\xC7""\xD1""\xC6"" \xED""\xD3""\xCA""\xD8""\xED""" "\xDA"" \xC3""\xE4"" \xED""\xDF""\xCA""\xC8"" \xC3""\xED"" \xE3""\xDE""\xC7""" "\xE1"": \xDD""\xC7""\xE1""\xED""\xD6""\xDB""\xD8"" \xDA""\xE1""\xEC"" \"" "edit\" \xE6""\xED""\xDF""\xCA""\xC8""! \xE1""\xE1""\xE3""\xD3""\xC7""\xDA""" "\xCF""\xC9"" \xC5""\xDE""\xD1""\xC3"" \xC7""\xE1""\xE6""\xED""\xDF""\xED""" "\xC8""\xED""\xCF""\xED""\xC7"" \xC7""\xE1""\xDA""\xD1""\xC8""\xED""\xC9""" ". Questa \xE8"" la pagina principale di Wikipedia in lingua somala, un'e" "nciclopedia libera in cui tutti possono scrivere articoli. Per vedere co" ; const char* kTeststr42 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/ru-sib_wikipedia_org_clean__CP866.txt ": \x80""\xAC""\xA8""\xE2""\xA0""\xAD""\xAE""\xA7""\xAD""\xA0""\xA9""\xE1""" "\xA2""\xAE"" - \x84""\xA0""\xAB""\xA0""\xA5""\xA7""\xAD""\xA0""\xA9""\xE1""" "\xA2""\xAE"" - \x84""\xAE""\xAC""\xAE""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""" "\xAE"" - \x86""\xEB""\xE1""\xE2""\xA5""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""" "\xAE"" - \x87""\xA2""\xEC""\xAE""\xA7""\xA4""\xAE""\xA7""\xAD""\xA0""\xA9""" "\xE1""\xA2""\xAE"" - \x87""\xA5""\xAC""\xA5""\xA7""\xAD""\xA0""\xA9""\xE1""" "\xA2""\xAE"" - \x8C""\xA0""\xE2""\xA5""\xAC""\xA0""\xE2""\xA8""\xAA""\xA0""" " - \x8C""\xA8""\xE0""\xAE""\xAA""\xAE""\xAB""\xAE""\xA7""\xAD""\xA0""\xA9""" "\xE1""\xA2""\xAE"" - \x8F""\xE0""\xA8""\xE0""\xAE""\xA4""\xAE""\xA7""\xAD""" "\xA0""\xA9""\xE1""\xA2""\xAE"" - \x91""\xE2""\xA0""\xE2""\xA8""\xE1""\xE2""" "\xA8""\xAA""\xA0"" - \x92""\xE0""\xA0""\xA2""\xAE""\xA7""\xAD""\xA0""\xA9""" "\xE1""\xA2""\xAE"" - \x95""\xA8""\xAC""\xA8""\xEF"" \x8C""\xE3""\xA4""\xE0""" "\xEC""\xAE""\xAD""\xAE""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""\xAE"" \xA4""" "\xA0"" \x80""\xE0""\xE2""\xA5""\xAB""\xEC""\xAD""\xEB"" \xA2""\xA5""\xA4""" "\xEB"": \x80""\xE0""\xE2""\xA5""\xAB""\xA5""\xA7""\xAD""\xA0""\xA9""\xE1""" "\xA2""\xAE"" - \x81""\xA0""\xE8""\xAB""\xEB""\xAA""\xAE""\xA7""\xAD""\xA0""" "\xA9""\xE1""\xA2""\xAE"" - \x82""\xA5""\xE0""\xA0"" - \x82""\xEC""\xAE""" "\xE2""\xAE""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""\xAE"" - \x83""\xAE""\xA2""" "\xAE""\xE0""\xAE""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""\xAE"" - \x84""\xA5""" "\xEF""\xAD""\xAD""\xA8"" - \x84""\xAE""\xAC""\xAE""\xA2""\xE8""\xEB""\xAD""" "\xA0"" - \x84""\xE3""\xE8""\xA5""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""\xAE""" " - \x87""\xA5""\xAC""\xA5""\xAF""\xA8""\xE1""\xA0""\xAD""\xAD""\xA5"" - " "\x8A""\xAE""\xAD""\xAE""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""\xAE"" - \x8B""" "\xA0""\xA4"" - \x8B""\xEE""\xA4""\xA5""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""" "\xAE"" - \x8B""\xEE""\xA4""\xAD""\xA8""\xAA""\xA8"" - \x8C""\xE3""\xA4""" "\xE0""\xEC""\xAE""\xAD""\xAE""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""\xAE""" " - \x8D""\xA0""\xE0""\xAE""\xA4""\xAE""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""" "\xAE"" - \x8F""\xE0""\xA0""\xA2""\xA8""\xAB""\xEC""\xAD""\xEF"" - \x8F""" "\xE0""\xAE""\xAC""\xEB""\xE1""\xA5""\xAB"" \x90""\xAE""\xA1""\xAE""\xE2""" "\xAD""\xEB"" \xA2""\xA5""\xA4""\xEB"": \x82""\xA5""\xE1""\xE1""\xA5""\xA7""" "\xAD""\xA0""\xA9""\xE1""\xA2""\xAE"" - \x82""\xE0""\xA0""\xE7""\xA5""\xA1""" "\xE1""\xA2""\xAE"" - \x84""\xA5""\xE0""\xEC""\xAE""\xA2""\xA5""\xAD""\xE8""" "\xEB""\xAD""\xA0"" - \x8C""\xA5""\xA6""\xE3""\xA3""\xA8""\xAC""\xA3""\xA0""" " (\x88""\xAD""\xE2""\xA5""\xE0""\xAD""\xA5""\xE2"") - \x8D""\xA0""\xE7""" "\xAE""\xE2""\xAD""\xA8""\xE7""\xA5""\xE1""\xA2""\xAE"" - \x8F""\xAE""\xA2""" "\xEF""\xA7""\xAA""\xA8"" - \x90""\xA0""\xA4""\xA8""\xA2""\xAE"" - \x92""" "\xA5""\xE5""\xAD""\xAE""\xA7""\xAD""\xA0""\xA9""\xE1""\xA2""\xAE"" - \x92""" "\xAE""\xE0""\xA3""\xAE""\xA2""\xAB""\xEF"" - \x93""\xE1""\xE2""\xE0""\xAE""" "\xA9""\xE8""\xEB""\xE1""\xA2""\xAE"" \x93""\xA7""\xAE""\xE0""\xAE""\xE7""" "\xE7""\xA5"" \xA4""\xA0"" \x86""\xEB""\xA7""\xAD""\xA5""\xA2""\xE0""\xEF""" "\xA4"": \x81""\xA0""\xE1""\xAD""\xA5""\xAF""\xA8""\xE1""\xA0""\xAD""\xAD""" "\xA5"" - \x83""\xE3""\xAB""\xEC""\xA1""\xA0"" - \x87""\xAE""\xA4""\xE7""" "\xA5""\xE1""\xA2""\xAE"" - \x8A""\xE0""\xA0""\xE1""\xAD""\xAE""\xE1""\xAB""" "\xAE""\xA2""\xA2""\xA5"" - \x8B""\xA5""\xAF""\xAE""\xAB""\xA0""\xA4"" - " "\x8D""\xA0""\xA2""\xAE""\xA1""\xEB""\xAA""\xA8"" - \x8F""\xA0""\xA2""\xAD""" "\xA8""\xE6""\xA0"" - \x8F""\xAB""\xEF""\xE1""\xAE""\xE7""\xAA""\xA8"" - " "\x8F""\xAE""\xA7""\xEB""\xE0""\xA8""\xE8""\xE8""\xA5"" - \x8F""\xAE""\xE1""" "\xAA""\xE3""\xAB""\xAA""\xA8"" - \x93""\xA7""\xAE""\xE0""\xAE""\xE7""\xE7""" "\xA5"" \x84""\xA5""\xEF""\xAD""\xE1""\xAA""\xA0"" \xE7""\xA5""\xE0""\xA5""" "\xA4""\xA0"" \xA3""\xAE""\xA4""\xAE""\xA2"" - \x8F""\xA5""\xE1""\xE2""\xA5""" "\xA3""\xA0"" \xA4""\xA5""\xEF""\xAD""\xE1""\xAA""\xA8""\xE5"" \xA4""\xA0""" "\xAD""\xAE""\xAA"" - \x8F""\xA5""\xE1""\xE2""\xA5""\xA3""\xA0"" \xAA""\xE0""" "\xA0""\xA9""\xAE""\xA2"" \x90""\xAE""\xA1""\xAE""\xE2""\xA0"" \xE1""\xA5""" "\xA4""\xEC""\xAC""\xA8""\xE6""\xEB"" \x8D""\xA0"" \xA5""\xE2""\xAE""\xA9""" " \xE1""\xA5""\xA4""\xEC""\xAC""\xA8""\xE6""\xA5"" \xE0""\xAE""\xA1""\xA8""" "\xAC"" \x81""\xA8""\xA1""\xAB""\xA8""\xEE"" \x8D""\xAE""\xA2""\xAE""\xE1""" "\xA8"" 9 \xE1""\xA5""\xE0""\xEC""\xAF""\xAD""\xEF"" \x88""\xA7""\xA4""\xA5""" "\xEF""\xAD""\xA0"" \xAD""\xAE""\xA2""\xA0"" \xAA""\xE0""\xA0""\xE1""\xAE""" "\xE2""\xA8""\xE8""\xE8""\xA0"" \xA3""\xAE""\xAB""\xAE""\xA2""\xAD""\xAE""" "\xA9""" ; const char* kTeststr44 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/av_wikipedia_org_clean__ISO-2022-KR.txt "\x1B""$)Ced for the creation of a Wikipedia in the Avar (\x0E"",!,S,Q,b\x0F""" ") language. There are currently 150 articles (mostly stubs). \x0E"",#,c," "V\x0F"" \x0E"",c,d,b,Q,_,Z,h,m\x0F"" / All pages \x0E"",%,Q,T,l,Z,c,d,Q," "_\x0F"" \x0E"",^,Q,T\x0F""I\x0E"",Q,b,e,]\x0F"" \x0E"",^,Q,h\x0F""I \x0E""" ",^,Q,T\x0F""I\x0E"",Q,b,e,],Q,]\x0F"" \x0E"",\",e,[,_,Q,g,l,c,\\\x0F"" \x0E""" ",3,e,],Q,g,l\x0F"" \x0E"",8\x0F""I\x0E"",`,R,`,\\,n\x0F"" \x0E"",\",Q,d," "Q,c,e,_,Q\x0F"" \x0E"",!,Y,V,b,R,Q,[,U,X,Q,_\x0F"" \x0E"",\",Q,\\,e\x0F""" " \x0E"",2,`,c,c,Z,q,],l,e,]\x0F"" \x0E"",6,V,U,V,b,Q,h,Z,q\x0F"" \x0E""," "T\x0F""I\x0E"",e,b,e,c\x0F"" \x0E"",^,Q,h\x0F""I \x0E"",/,e,X,V,U,Q,T,Z\x0F""" " \x0E"",\\\x0F""I\x0E"",`,],Q\x0F"" \x0E"",^,Q,T\x0F""I\x0E"",Q,b,e,]\x0F""" " \x0E"",^,Q,h\x0F""I\x0E"",Q,],U,Q\x0F"" \x0E"",#,Z,\\,Z,a,V,U,Z,q\x0F""" " \x0E"",h,V,R,V,d\x0F""I\x0E"",V,Y,Q,R,Z,q,],U,Q\x0F"" \x0E"",T,l,`,b,]," "l\x0F"" \x0E"",T\x0F""I\x0E"",Q,g,n,Q,],],l,Z,Y,V\x0F""!\x0E"",;,Z,R,Q,R" "\x0F"" \x0E"",T,n,e,^,V,b,Q,],U,Q\x0F"" \x0E"",d\x0F""I\x0E"",Q,U\x0F"" " "\x0E"",R,e,T,`\x0F"" \"\x0E"",g,Z,c,Z,Y,Q,R,V\x0F""\" \x0E"",c,c,m,],\\," "Q\x0F"": \x0E"",^,Q,\\,l,Q,],Q,q,],U,Q\x0F"" \x0E"",d\x0F""I\x0E"",Q,U,V" "\x0F"" \x0E"",X,`\x0F"" \x0E"",X,e,R,Q,],Q\x0F"" \x0E"",S,Q\x0F"" \x0E""" ",h\x0F""I\x0E"",e,_,e,],Q\x0F"", \x0E"",$,n,V,],U,Q,],l,e,_\x0F"" \x0E""" ",d\x0F""I\x0E"",e,R,Q,],Q\x0F"". \x0E"",#,`,b,V,g,Q\x0F"" \x0E"",_,e,X,V" ",b,T,`\x0F"" \x0E"",h\x0F""I\x0E"",Q,b\x0F"" \x0E"",R,Z,h,Z,_,V\x0F"" \x0E""" ",\\\x0F""I\x0E"",`,i,`,_,T,V\x0F""(\x0E"",c,c,m,],\\,Q\x0F"" \x0E"",R,e," "T,`\x0F"" \x0E"",d\x0F""I\x0E"",Q,U\x0F"" \x0E"",\\,S,Q,b,Q,_,Z,U,Q\x0F""" ")! \x0E"",$,n,V,R\x0F"" \x0E"",g\x0F""I\x0E"",Q,X,Q,],l,e,],Q\x0F"" \x0E""" ",_,e,X,V,b,T,e,_\x0F"" \x0E"",R,e,g,n,V,_\x0F"" \x0E"",T,n,Q,R,Z,Y,V\x0F""" "! \x0E"",/,e,X,V,U,Q,T,`\x0F"" \x0E"",g,l,S,Q,S,e,]\x0F"" \x0E"",^,Q,T\x0F""" "I\x0E"",Q,b,e,]\x0F"" \x0E"",^,Q,h\x0F""I \x0E"",],l,Q,q,],U,Q\x0F"" \x0E""" ",j,Q,\\,],l,Z\x0F"" \x0E"",R,Q,d,Q,_,Z\x0F"", \x0E"",g\x0F""I\x0E"",Q,]," "R,Z,g,n,V\x0F"" \"\x0E"",8\x0F""I\x0E"",e,^,Q,U,Q\x0F""\" \x0E"",c,Q,[,d" ",Q,],l,e,]\x0F"" \x0E"",^,Q,d,V,b,Z,Q,],Q,Y,U,Q\x0F"" \x0E"",d\x0F""I\x0E""" ",Q,U\x0F"" \x0E"",g\x0F""I\x0E"",Q,],d\x0F""I\x0E"",Z\x0F"" \x0E"",T,n,Q" ",R,Z,Y,V\x0F"". If you come across pages that shouldn't be here, replace" " their content with {{db|reasonfordeletion}} so that when someone who sp" "eaks the language \"adopts\" the Avar Wikipedia t" ; const char* kTeststr46 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/ksh_wikipedia_org_clean__GB18030.txt "nanie-du-Nord (Allemagne), dans certaines r\xA8""\xA6""gions de la Belgi" "que et dans le sud-ouest des Pays-Bas. Hinweis f\xA8""\xB9""r alle, die " "keine ripuarische Sprache sprechen: Dies ist die ripuarische Ausgabe der" " Wikipedia. Ripuarisch wird in \xA8""\xB9""ber 100 Dialekten im weiteren" " Umkreis von Aachen, Bonn, K\x81""0\x8B""2ln, D\xA8""\xB9""sseldorf, in " "Belgien, den Niederlanden und im deutschen Rheinland von etwa einer Mill" "ion Menschen gesprochen. Informatie voor iedereen die geen Ripuarisch sp" "reekt: Dit is de Ripuarische versie van Wikipedia. Er zijn meer dan 100 " "Ripuarische dialecten die worden gesproken door bijna twee miljoen mense" "n in de omgeving van Aken, Bonn, Keulen en D\xA8""\xB9""sseldorf, in Bel" "gi\x81""0\x8A""5, Nederland en het Duitse Rijnland. Informazione per chi" " non parla un dialetto ripuario: Questa \xA8""\xA8"" la versione in ripu" "ario di Wikipedia. Pi\xA8""\xB4"" di 100 dialetti ripuari sono parlati d" "a oltre 1 milione di persone nelle seguenti regioni: Aquisgrana, Bonn, C" "olonia, D\xA8""\xB9""sseldorf, nel Belgio orientale, nei Paesi Bassi sud" "-orientali e nella Renania. \xA5""\xEA""\xA5""\xD7""\xA5""\xA2""\xA9""`\xA5""" "\xEA""\xD5""Z\xA4""\xF2""\xD4""\x92""\xA4""\xB5""\xA4""\xCA""\xA4""\xA4""" "\xB7""\xBD""\xA4""\xD8""\xA4""\xCE""\xA4""\xB4""\xB0""\xB8""\xC4""\xDA""" ": \xA4""\xB3""\xA4""\xEC""\xA4""\xCF""\xA5""\xEA""\xA5""\xD7""\xA5""\xA2""" "\xA9""`\xA5""\xEA""\xD5""Z\xB0""\xE6""\xA4""\xCE""\xA5""\xA6""\xA5""\xA3""" "\xA5""\xAD""\xA5""\xDA""\xA5""\xC7""\xA5""\xA3""\xA5""\xA2""\xA4""\xC7""" "\xA4""\xB9""\xA1""\xA3"" \xA5""\xA2""\xA9""`\xA5""\xD8""\xA5""\xF3""\xA1""" "\xA2""\xA5""\xDC""\xA5""\xF3""\xA1""\xA2""\xA5""\xB1""\xA5""\xEB""\xA5""" "\xF3""\xA1""\xA2""\xA5""\xC7""\xA5""\xE5""\xA5""\xC3""\xA5""\xBB""\xA5""" "\xEB""\xA5""\xC9""\xA5""\xEB""\xA5""\xD5""\xB8""\xF7""\xCA""\xD0""\xA4""" "\xC8""\xA1""\xA2""\xA4""\xBD""\xA4""\xCE""\xD6""\xDC""\xDE""x\xA1""\xA2""" "\xBC""\xB0""\xA4""\xD3""\xA1""\xA2""\xA5""\xD9""\xA5""\xEB""\xA5""\xAE""" "\xA9""`\xA1""\xA2""\xA5""\xAA""\xA5""\xE9""\xA5""\xF3""\xA5""\xC0""\xA1""" "\xA2""\xA5""\xC9""\xA5""\xA4""\xA5""\xC4""\xA4""\xCE""\xA5""\xE9""\xA5""" "\xA4""\xA5""\xF3""\xA5""\xE9""\xA5""\xF3""\xA5""\xC8""\xA4""\xCB""\xA4""" "\xAA""\xA4""\xA4""\xA4""\xC6""\xA1""\xA2""\xA4""\xAA""\xA4""\xE8""\xA4""" "\xBD""200\xCD""\xF2""\xC8""\xCB""\xA4""\xCE""\xC8""\xCB""\xA4""\xCB""\xA4""" "\xE8""\xA4""\xC3""\xA4""\xC6""\xA1""\xA2""100\xB7""N\xD2""\xD4""\xC9""\xCF""" "\xA4""\xCE""\xA5""\xEA""\xA5""\xD7""\xA5""\xA2""\xA9""`\xA5""\xEA""\xB7""" "\xBD""\xD1""\xD4""\xA4""\xAC""\xD4""\x92""\xA4""\xB5""\xA4""\xEC""\xA4""" "\xC6""\xA4""\xA4""\xA4""\xDE""\xA4""\xB9""\xA1""\xA3"" \xA7""\xB3""\xA7""" "\xD3""\xA7""\xD6""\xA7""\xD5""\xA7""\xD6""\xA7""\xDF""\xA7""\xDA""\xA7""" "\xD6"" \xA7""\xD5""\xA7""\xDD""\xA7""\xF1"" \xA7""\xDC""\xA7""\xE4""\xA7""" "\xE0"" \xA7""\xDF""\xA7""\xD6"" \xA7""\xD4""\xA7""\xE0""\xA7""\xD3""\xA7""" "\xE0""\xA7""\xE2""\xA7""\xF0""\xA7""\xE4"" \xA7""\xE2""\xA7""\xDA""\xA7""" "\xE1""\xA7""\xE5""\xA7""\xD1""\xA7""\xE2""\xA7""\xE3""\xA7""\xDC""\xA7""" "\xDA""\xA7""\xDB"" \xA7""\xF1""\xA7""\xD9""\xA7""\xED""\xA7""\xDC"" \xA7""" "\xDF""\xA7""\xD6""\xA7""\xE4"": \xA7""\xBF""\xA7""\xE4""\xA7""\xE0"" \xA7""" "\xE2""\xA7""\xDA""\xA7""\xE1""\xA7""\xE5""\xA7""\xD1""\xA7""\xE2""\xA7""" "\xE3""\xA7""\xDC""\xA7""\xD1""\xA7""\xF1"" \xA7""\xA3""\xA7""\xDA""\xA7""" "\xDC""\xA7""\xDA""\xA7""\xE1""\xA7""\xD6""\xA7""\xD5""\xA7""\xDA""\xA7""" "\xF1"". \xA7""\xAE""\xA7""\xDA""\xA7""\xDD""\xA7""\xDD""\xA7""\xDA""\xA7""" "\xE0""\xA7""\xDF"" \xA7""\xE9""\xA7""\xD6""\xA7""\xDD""\xA7""\xE0""\xA7""" "\xD3""\xA7""\xD6""\xA7""\xDC""\xA7""\xDA"" \xA7""\xD4""\xA7""\xE0""\xA7""" "\xD3""\xA7""\xE0""\xA7""\xE2""\xA7""\xF0""\xA7""\xE4"" \xA7""\xD2""\xA7""" "\xE0""\xA7""\xDD""\xA7""\xEA""\xA7""\xD6"" \xA7""\xE3""\xA7""\xE4""\xA7""" "\xE0"" \xA7""\xE2""\xA7""\xDA""\xA7""\xE1""\xA7""\xE5""\xA7""\xD1""\xA7""" "\xE2""\xA7""\xE3""\xA7""\xDC""\xA7""\xDA""\xA7""\xE7"" \xA7""\xF1""\xA7""" "\xD9""\xA7""\xED""\xA7""\xDC""\xA7""\xE0""\xA7""\xD3"", \xA7""\xDA""\xA7""" "\xDD""\xA7""\xDA"" \xA7""\xD5""\xA7""\xDA""\xA7""\xD1""\xA7""\xDD""\xA7""" "\xD6""\xA7""\xDC""\xA7""\xE4""\xA7""\xE0""\xA7""\xD3"", \xA7""\xD3"" \xA7""" "\xD9""\xA7""\xD1""\xA7""\xE1""\xA7""\xD1""\xA7""\xD5""\xA7""\xDF""\xA7""" "\xED""\xA7""\xDE"" \xA7""\xD4""\xA7""\xD6""\xA7""\xE2""\xA7""\xDE""\xA7""" "\xD1""\xA7""\xDF""\xA7""\xE3""\xA7""\xDC""\xA7""\xDA""\xA7""\xDE"" \xA7""" "\xE3""\xA7""\xD6""\xA7""\xD3""\xA7""\xD6""\xA7""\xE2""\xA7""\xDF""\xA7""" "\xED""\xA7""\xDE"" \xA7""\xB2""\xA7""\xD6""\xA7""\xDB""\xA7""\xDF""-\xA7""" "\xA3""\xA7""\xD6""\xA7""\xE3""\xA7""\xE4""\xA7""\xE6""\xA7""\xD1""\xA7""" "\xDD""\xA7""\xDA""\xA7""\xF1"", \xA7""\xE3""\xA7""\xE2""\xA7""\xD6""\xA7""" "\xD5""\xA7""\xE0""\xA7""\xDB"" \xA7""\xA1""\xA7""\xD1""\xA7""\xE7""\xA7""" "\xD6""\xA7""\xDF""\xA7""\xD1"", \xA7""\xA2""\xA7""\xE0""\xA7""\xDF""\xA7""" "\xDF""\xA7""\xD1"", \xA7""\xAC""\xA7""\xD7""\xA7""\xDD""\xA7""\xEE""\xA7""" ; const char* kTeststr48 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/co_wikipedia_org_clean__ISO_2022_CN.txt "formatica - Ingenieria - Management - Farmacia - Robotica - Telecommunic" "azione Vita quotidiana \x1B""$)A\x0E""((\x0F"" distrazzione Automobile -" " Bricolage - Cucina - Divertimentu - Giardinu - Ghjocu - Nutrizione - Sa" "lute - Sessualit\x0E""($\x0F"" - Sport - Televisione - Turisimu - Traspo" "rtu Ricerca \x0E""((\x0F"" navigazione Articuli di qualit\x0E""($\x0F"" " "- Indice alfabeticu - Indice tematicu - Pagine nuvelle - Radica di e cat" "egurie Aiutate Wikipedia in lingua corsa! Par aiut\x0E""($\x0F"" Wikiped" "ia pudete: Scrive un articulu, o ancu s\x0E""((\x0F"" voi truvete un sba" "gliu, currighjitelu puru ! Scrivete in suttanacciu o in supranacciu, cum" "e voi vulete: diversit\x0E""($\x0F"" face ricchezza. Fate a sperienza: P" "ruv\x0E""($\x0F"" \x0E""($\x0F"" scrive un articulu. Videte i cunsigli p" "er scrive un articulu. U pi\x0E""(4\x0F"" simplice per cuminci\x0E""($\x0F""" " h\x0E""((\x0F"" di cumplitt\x0E""($\x0F"" un articulu. Videte l'articul" "i da cumplitt\x0E""($\x0F"". Si p\x0E""(0\x0F"" din\x0E""(4\x0F"" traduc" "e un articulu, per esempiu da a wikipedia in sicilianu, talianu o france" "se. Videte Articuli da traduce. Identific\x0E""($\x0F"". S\x0E""((\x0F""" " voi cunniscite u nomu di parechji pianti, fiori, arburi, o animali... c" "hi mancanu, parmittar\x0E""($\x0F"" dopu di cre\x0E""($\x0F"" l'intrata " "currispundenti. Ch\x0E""(,\x0F"" sar\x0E""($\x0F"" issu funzu, issu fior" "i, issa pianta? Incaric\x0E""($\x0F"" imagini o fot\x0E""(0\x0F"". U meg" "liu h\x0E""((\x0F"" d'incaric\x0E""($\x0F"" li annantu \x0E""($\x0F"" Wi" "kiCommons, parch\x0E""(,\x0F"" pudarani serva dopu \x0E""($\x0F"" tutti " "i prugetti Wikipedia, \x0E""($\x0F"" u Wikizziunariu,... T'avemu bisognu" " d'una fot\x0E""(0\x0F"" di tutti i paesi di Corsica (\x0E""((\x0F"" din" "\x0E""(0\x0F"" di i pianti \x0E""((\x0F"" di l'animali). Da leghja A ran" "edda A Ranedda (o ranella) (Emys orbicularis) h\x0E""((\x0F"" una cuppul" "ata d'acqua d'Auropa. Si trova in i stagna, in i paduli, \x0E""((\x0F"" " "in i lava d'Auropa, d'Asia \x0E""((\x0F"" di u Norduvestu di l'Africa. C" "lassificazioni Esistini parechji 13 sottuspezii di ranedda, ch\x0E""(,\x0F""" " s\x0E""(0\x0F"" divisi in 5 gruppi: Emys orbicularis occidentalis Emys " "orbicularis occidentalis (Fritz, 1994) Emys orbicularis hispanica (Fritz" ", Keller & Budde, 1996) Emys orbicularis fritzjuergenobsti (Fritz, 1993)" " Emys orbicularis galloitalica Emys orbicularis galloitalica (Fritz, 199" "5) Emys orbicularis lanzai (Fritz, 1995) Emys orbicularis capolongoi (Fr" "itz, 1995) Emys orbicularis hellenica Emys orbicularis hellenica (Valenc" "iennes, 1832) Emys orbicularis kurae (Fritz, 1994) Emys orbicularis orie" "ntalis (Fritz" ; const char* kTeststr53 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/oc_wikipedia_org_clean__MACINTOSH.txt "Sci\x8E""ncias exactas & naturalas Astronomia - Bioquimia - Biologia - B" "otanica - Quimia - Criptologia - Matematicas - Medecina - Farmacia - Fis" "ica - Zoologia Tecnologias Astronautica - Electricitat e Electronica - E" "nergia - Industria - Informatica - Nanotecnologia - Robotica - Telecomun" "icacions Mancam de fotografias per illustrar los articles. Pod\x8F""tz n" "os ajudar, e nos senhalar d'imatges utils de melhorar. Proj\x8F""cte col" "laboratiu de la setmana Lo subj\x8F""cte per aquesta setmana encara es p" "as estat definit. Pod\x8F""tz crear lo penjador. Modificar O sabiatz ? P" "ensatz, se o av\x8F""tz pas encara fach, de pla\x8D""ar los mod\x8F""ls " "de Babel dins v\x98""stra pagina d'utilisator! Atal, v\x98""stres interl" "ocutors eventuals saupr\x88""n quina lenga utilizar se vos v\x98""lon pa" "rlar! Tanben, ser\x88"" possible a un nov\x8F""l vengut de trobar de mon" "de que parle sa lenga dins las categorias de locutors de las diferentas " "lengas... Per aqu\x98"", cal metre {{Babel-1}} se sab\x8F""tz pas qu'una" " lenga, {{Babel-2}} se ne sab\x8F""tz doas...etc... seguit del(s) c\x98""" "di(s) de la(s) lenga(s) e del niv\x8F""l qu'av\x8F""tz per l'(las)utiliz" "ar (de 1 a 4 : del niv\x8F""l basic al niv\x8F""l exp\x8F""rt). Per exem" "ple se v\x98""stra lenga mairala es l'occitan e que parlatz perfi\x8F""c" "hament lo franc\x8E""s e pro corr\x8F""ctament lo catalan, metretz {{Bab" "el-3|oc|fr 4|ca 3}}. Lo rendut dins v\x98""stra pagina de presentacion s" "er\x88"" aiceste: oc Aqueste utilisator parla occitan coma primi\x8F""ra" " lenga. fr-4 Cet utilisateur parle fran\x8D""ais \x88"" un niveau compar" "able \x88"" la langue maternelle . ca-3 Aquest usuari pot contribuir amb" " un nivell avan\x8D""at de catal\x88"". Per mai d'entre-senhas, veire: W" "ikip\x8F""dia:Babel Archius | Modificar Actualitats e eveniments Efemeri" "d del 12 d'octobre de 2006 12 d'octobre - Lo turc Orhan Pamuk es anoncia" "t coma lo laurejat del Pr\x8F""mi Nobel de literatura del 2006 9 d'octob" "re - La Cor\x8F""a del N\x98""rd an\x97""ncia qu'a efectuat un t\x8F""st" " nuclear amb succ\x8F""s. 1 d'octobre, Brasil : Al primi\x8F""r torn de " "l'eleccion presidenciala, Luiz In\x87""cio Lula da Silva, del Partit del" "s Trabalhadors (PT) obten 48,6% dels sufragis, contra 41,6% de Geraldo A" "lckmin, del Partit Social Democrata Brasilian (PSDB). A las eleccions re" "gionalas, pel PT 4 governadors d'estat son elegits e pel PSDB 4 autres (" "9 elegits d'autres partits). Lo segond torn presidencial, e tanben lo se" "gond torn d'eleccion de governador en 10 estats, tendr\x88"" lu\x98""c l" "o 29 d'octobre. 29 de setembre, Brasil : gr\x8F""va collision d'un avion" " Boeing 737-800 amb un jet executive mod\x8F""l Leg" ; const char* kTeststr54 = // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/am_wikipedia_org_clean__UTF7.txt " +EsgS8A +EhgTSBJwEpsSzQ +EmYScw +EhgSOxMIEi0 +Eu0SfRILEgkTYg +EugScBIzE" "nUTThLOEnUSlQ +EhgTABIYEi0S6w +EhgTIxMlE00 +EqgSpRKVEw0SChLdEpsSzQ +EsoS" "qhNUEvUS6w +EmASGBJwEi0TEBId +EhsSRRIoEmU +Eu0SQBINEs4SdQ +Eu0SBhKTEg0TY" "g +EqUTBRMN +EmUS2Q +EnUSLRMVEh0 +EhgTIxMlE04SfQ +EmISlhIpEpU +EggSoBIbE" "i0SmxLN +EsoSqhNSEvIS6w +EhsS8BMN +EhgSDRKrEh0 +EhgSlRMIEvU +Eu0TIBItEws" "SCRNi +EtsSLA +EhASGRI1E2M +EyUSRRIdEnU 2 +EkASlQ 1999 +EtMSGBJw +Eh0ShR" "IoEnU +EpASzRNi +EugS2xIs +EkASlQ (+EqUSlRLw +EqASzRIuEzMSzRLrEpU +EqASR" "hMjEyASLQ) 12 October, 2006 +EpASyRNi [+EggSGxI1EnASqxKoEg0] To download" " an Amharic unicode font for correct display: Please see the font sectio" "n for more information. [+EggSGxI1EnASqxKoEg0] +EmASrhIdE1ISzRJwEi0Szg +" "EgsS7Q +EmASoBIbEi0Smw +EmASQBILEgk +EggSGxJAEpASYxJgEi0: +EggScBMoEhsSK" "g +EhgSKBMD +EugSKBLzEnESlRNhEwgTPQ +EqUSYxKtEs4 +Eu0SGBIIEqgScQ! +EjUSC" "A +Eh0SlQ +EggSGxLIEkU +Eu0TSBINEwk +EpASYBIt? +EgASIxJlEs4SlQ +EmAS2hIF" " +EusSRRItEmETYg +EkASDRL2En0SlQ +EusSzRJDEgk? +EqUS2hIF +EgsS7Q +Eu0TKB" "IdEik! +Eh0SLRMl +E0USERNOEn0 +EugTCRMNEg0 +EtMSLRIb \"+EwkTDRIN (Google" ") +EmA-1998 +EqU.+EqQ.+EqA. +EugTDRIIEjASZQ +EvUSLRMFEnU +EgYSlg +EpASzQ" " +EugTABIYEigSzRNi +EugTCRMNEg0 +E00SCBML +EswSZRIzEu0SdRKV +EugSMBIrEs0" " +EqUSkw +EugSGhLrEjUScBLzEvUSKBLN +Eu0SBBLN +EvUSLRMFEnU +EpASzRNi +Eug" "TCRMNEg0 +EtMSCxIb +EugS0xIIEh0SlQ +EhgSKBMD +EggSGxIwEpMS8xJ1 +E2M +Egg" "SGxJFEigSZRKT +EyASQxIa +EhsS9RIoEw0 +EpASzRNi +EtwSkw +EqUSKBNNEnU: +En" "MSKhKt +EmAS2xIsEs0 +EqUSCBJ1 (October 12, 2006 +EqU.+EqQ.+EqA.): Wikipe" "dia:+EnMSKhKrEso +EhsSNRJzEsgSOxLOEn0-/+EyUSRRIdEnU 2 +EhgS3RMIEmA +EtUS" "zRJAEnU +EnUSHRIFEi0ScBNhEgISMxJlEpM +EqoSkBNhEyUSYBJlE2Y +EnUSHRIFEi0Sc" "A +EgISMxJl - +EugS3RItEt0SLQ +EgISMxJl (+EqUSNRJzEnISNRJyEq0SNQ) - +Eug" "SrhIdE1ISzRJwEi0TYRMlEpMSdQ - +EugSNhNNEnUSzBIt +EqASIBIrEi0 - +EugScBNI" "EyUSLhNhEhUTDRMLEnU +EyUSkxJ1 (+E0oS2hKtEjU) - +EugSFRKVEzs +EyUSYBJl - " "+EugSLRI7 +EnATDRJjEi0 - +EhgSABKVEvISNRKQEnU - +EhsTExMTEt0 - +Eh0TIxKU" "E2ESABJlEnU - +EpUTDRL1 - +EhgTCBKTEps +EiUSkBNhE00TJRIoEnUSkw +EjMS7RKV" "EjUTZg +EiUSkBNhE00TJRIoEnU - +EiUSkBNhEhUS7RLIEnU (+EmMS7hIOEwI) - +EnU" "SHRIFEi0ScBNhEyQSkw - +EhUSrRIdEpM - +EugTJRKVEnATYRKVEyUSLQ +EyUSkxJ1 (" "+EqwSGhI1EnUSKg) - +EiUSkBNhE0gSCBKt (+EqASNRJ1Ei4SlhIa) - +EugSGBIsEnU " "+EyUSkxJ1 (+EwIS7hIOEwI) - +EhgSDRKtEtATYRIdEvUSLQ (+EwISzhMNEisTSg) - +" "EnQSrRKWEs4SDhMC - +EugSMxLtEpUSNRKT +EugSGBKqEpMSzhJ9 +EnMSKhKt +EugShR" "JlEigScBIgEmU +EyUSkxJ1EpM +E00SDRI1E00SkxNm +EugSMBLN +Eg0TBQ +EyUSkxJ1" " - +EugSYxIVEg0 +EyUSkxJ1 (+EjYSMhLuEg4TAg) - +EnMSKhKt - +EugSSxKVEks +" "EyUSkxJ1 - +EjUSyxIwEs0 - +EqASLRKsEuwSDhMC (+EiUSkBNhEkUSLRI1) - +EnUSH" "RIFEi0SdQ - +E00SDRI1E00Skw - +EgMS7RIbEpYSdQ - +EugSJRKQE2ESDRJhEpM +En" "USHRIFEi0SdQ - +EhUS3RJjEso +EwkS8xLuEn0 - +EugTVhIIEnISqw +EyUSkxJ1 - +" "EhgSlRMNEiUSdQ - +EugSFRMN +EyUSZRJFEpM - +EugSZBJwEiASZRKT +EugSPRIbEn0" " +EyUSkxJ2En0 - +EugSGBM7EhUTTRJ1 +EmQSdRKT +EugSGBIoEwM +EyUSkxJ1 +EmMS" "FRINEpM +EiUSkA +EyUSYBJlE2Y +EqASlRL1Eh0Scw - +EqASYBIzEjASDQ - +Ey0TSB" "Ir - +EhsTKxLIEns - +E0oSDRId - +EygSyxJzEs4SfQ - +EugTCBKQEnU +EqASIBIr" "Ei0 - +EqUTAA +EyUSYBJl - +EwoS3A +EhsSMxIIE0oS6w - +EugSYBLTEgsSdQ +EkA" "SlhJ9 - +EvUSKA +EwgTPQ +EhgSKBJl - +EiUSkA +Ez0SERNN - +EhkS2hJD - +Etg" "TSBKV - +EjUS1RIN - +EqATSBNhEnMSKhKt" ; // NOTE: Unicode handled differently because of embedded NUL const char kTeststr57[] = // This is UTF-16 little endian (note leading space) // Produced by stringify.cc on 2006-10-26 11:18 from file testfiles/new_wikipedia_org_clean__Unicode.txt " \x00""&\t,\tA\t \x00""\x14"" \x00""5\t?\t\x15""\t?\t*\t?\t!\t?\t/\t>\t" " \x00""(\t>\t*\t \x00""8\tM\t5\t>\t*\tB\t \x00""&\tA\t\x17""\tA\t \x00""" "(\tM\t9\tM\t/\tG\t8\t \x00""(\tM\t/\tG\t(\t>\t \x00""&\t?\t8\t\x02""\t|\x00""" " \x00""\x17""\tM\t5\t>\t2\t?\t \x00""&\t,\tA\t \x00""\x14"" \x00""5\t?\t" "\x15""\t?\t*\t?\t!\t?\t/\t>\t/\t>\t\x17""\tA\t \x00""8\tM\t5\t/\t.\t8\tG" "\t5\t\x15""\t$\tG\t8\t\x02""\t \x00""8\t+\tA\t'\tA\t\x15""\tA\t.\tM\t9\t" "?\t \x00""(\x00""2\t>\t\x07""\t,\tM\t0\t0\t?\t/\t(\t)\x00""$\tG\t8\t\x02""" "\t \x00""%\tG\t\x02""\t \x00""\x1B""\t?\t$\t \x00""\x1B""\t?\t\x17""\tA\t" " \x00""(\tM\t9\tM\t/\tG\t8\t/\t>\t\x17""\tA\t \x00""2\t?\t8\t:\x00"" \x00""" ".\t>\t2\t>\t \x00""&\t?\t|\x00"" \x00""%\t \x00""&\t,\tA\t \x00""\x14"" " " \x00""5\t?\t\x15""\t?\t*\t?\t!\t?\t/\t>\t/\tA\t \x00""%\t\x17""\tA\t \x00""" ",\t>\t0\tG\t/\tG\t \x00""\x16""\t\x02""\t2\t>\t,\t\x02""\t2\t>\t \x00""/" "\t>\t/\tG\t\x17""\tA\t \x00""%\t>\t/\t|\x00"" \x00""%\t(\t \x00""5\t?\t\x15""" "\t?\t*\t?\t!\t?\t/\t>\t/\t>\t\x17""\tA\t \x00""*\tM\t0\t>\t5\t?\t'\t?\t\x15""" "\t \x00""5\t \x00""(\t?\t/\t.\t/\t>\t\x17""\tA\t \x00"",\t>\t0\tG\t2\tG\t" " \x00""(\t\x02""\t \x00""\x16""\t\x02""\t2\t>\t,\t\x02""\t2\t>\t \x00""\x1C""" "\tA\t\x08""\t|\x00"" \x00""\x17""\tA\t%\t?\t \x00""&\t,\tA\t \x00""\x14""" " \x00""5\t?\t\x15""\t?\t*\t?\t!\t?\t/\t>\t/\t>\t\x17""\tA\t \x00""/\tG\t" "\x15""\tM\t5\t \x00""\x16""\tM\t/\t:\x00"" \x00""(\t>\t*\t \x00""8\tM\t5" "\t>\t*\tB\t \x00""&\tA\t\x17""\tA\t \x00"",\tA\t2\tG\t\x1F""\t?\t(\t \x00""" ",\tK\t0\tM\t!\t,\x00"" \x00""*\t0\t?\t/\tK\t\x1C""\t(\t>\t$\t,\x00"" \x00""" "6\tM\t0\tK\t$\t \x00""5\t \x00""\x1C""\tM\t/\t>\t\x16""\t\x02""\t|\x00""" " \x00""%\t>\t/\t \x00"",\tA\t\x16""\t\x02""\t \x00""\x14"" \x00""5\t?\t" "\x15""\t?\t*\t?\t!\t?\t/\t>\t \x00""5\t \x00""5\t?\t\x15""\t?\t.\t@\t!\t" "?\t/\t>\t \x00""+\t>\t\t\t(\tM\t!\tG\t8\t(\t(\t>\t*\t \x00""8\tM\t5\t>\t" "*\tB\t \x00""&\tA\t\x17""\tA\t \x00""\x18""\tK\t7\t#\t>\t,\x00"" \x00""\x05""" "\t*\t!\tG\t\x1F""\t,\x00"" \x00""2\tG\t\x16""\t \x00""5\t \x00""*\tM\t0\t" "G\t8\t \x00""5\t?\t\x1C""\tM\t\x1E""\t*\tM\t$\t?\t|\x00"" \x00""5\t?\t\x15""" "\t?\t*\t?\t!\t?\t/\t>\t/\t>\t\x17""\tA\t \x00""+\tA\t\x15""\t@\t \x00""\x1C""" "\tM\t/\t>\t\x1D""\tM\t5\t \x00""5\t?\t\x15""\t?\t*\t?\t!\t?\t/\t>\t/\t>\t" "$\t \x00""5\t?\t\x15""\t?\t.\t?\t!\t?\t/\t>\t \x00""+\t>\t\t\t(\tM\t!\tG" "\t8\t(\t \x00""(\t\x02""\t \x00""9\tK\t8\tM\t\x1F""\t \x00""/\t>\t(\t>\t" " \x00""$\t\x17""\tA\t \x00""&\tA\t|\x00"" \x00""%\tM\t5\t \x00""+\t>\t\t" "\t(\tM\t!\tG\t8\t(\t \x00""\x1B""\t\x17""\tA\t \x00""(\t(\t-\x00""*\tM\t" "0\tK\t+\t?\t\x1F""\t \x00""\x17""\tA\t%\t?\t \x00""\x16""\t:\x00""|\x00""" " \x00""%\tM\t5\t \x00""\x17""\tA\t%\t?\t \x00""(\t\x02""\t \x00"".\tG\t." "\tG\t\x17""\tA\t \x00""*\t0\t?\t/\tK\t\x1C""\t(\t>\t \x00""/\t>\t$\t \x00""" "(\t\x02""\t \x00""9\tK\t8\tM\t\x1F""\t \x00""/\t>\t(\t>\t \x00""$\t\x17""" "\tA\t \x00""&\tA\t \x00"":\x00"" \x00""5\t?\t\x15""\tM\t8\tM\t(\t0\t@\t" ; const char kTeststr58[] = // This is UTF-16 big endian (note leading 00) "\x00 \x00<\x00h\x00t\x00m\x00l\x00>\x00""f\x00u\x00""b\x00""a\x00r" ; const char kTeststr59[] = // This is UTF-32 little endian (note leading space) " \x00\x00\x00<\x00\x00\x00h\x00\x00\x00t\x00\x00\x00m\x00\x00\x00l\x00\x00\x00" ">\x00\x00\x00""f\x00\x00\x00u\x00\x00\x00""b\x00\x00\x00""a\x00\x00\x00r\x00\x00\x00" ; const char kTeststr60[] = // This is UTF-32 big endian (note leading 00) "\x00\x00\x00 \x00\x00\x00<\x00\x00\x00h\x00\x00\x00t\x00\x00\x00m\x00\x00\x00l" "\x00\x00\x00>\x00\x00\x00""f\x00\x00\x00u\x00\x00\x00""b\x00\x00\x00""a\x00\x00\x00r" ; const char kTeststr61[] = // This is binary pseudo-JPEG "\xff\xd8\xff\xe0\x00\x10JFIF foo bar baz\xff\xe1\x00\xa5" "\x01\xd7\xff\x01\x57\x33\x44\x55\x66\x77\xed\xcb\xa9\x87" "\xff\xd7\xff\xe0\x00\x10JFIF foo bar baz\xff\xe1\x00\xa5" "\x87\x01\xd7\xff\x01\x57\x33\x44\x55\x66\x77\xed\xcb\xa9" ; const char kTeststr62[] = // This is pseudo-HZ " ~{\x54\x42\x31\x7D\x37\x22\x55\x39\x35\x3D\x3D\x71~} abc" ; const char kTeststr63[] = // This is pseudo-UTF8UTF8 "Ice cream a l\xc3\x83\xc2\xa0 mode." ; // This one is really JAGRAN, and "www.amarujala.com" matches JAGRAN const char* kTestUrl52 = "http://www.amarujala.com/today/default.asp"; const char kTeststr52[] = // Produced by stringify.cc on 2007-04-10 12:07 from file amarujala_com.html "\r\r\r\r\r\r\r\r\rAmar Ujala - India's Leading Hindi Daily Newspaper\r" "\r\r\r\r\r\r\r\r\r
" "\r\r\r" "\r
\r\r\r\r\r\r\r
\r\r\xDF""\xF0""S\xC5""U\xA7""\xA2""" "\xC7""U\xE8""\xC1""-87/3(14\xA5""\xE6""\xF0""\xDF""\xDA""U)UU
\r\n\xDC""" "\xE6""\xDA""U\xE6""-10,\xE2""\xDA""U\xDF""\xD9""-8
\r\n\xC1""\xE8""\xCC""" " \xB7""\xA4""\xE6"" \xDC""\xFF""\xD8""-357\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r" "\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\n\n\r" "\n\r\n\r\n\r\n\r\n\n\r\n\n
\r
\"Downloading\"
\xD7""\xA2""\xBB""\xDC""\xDF""\xE6""\xDA""10 \xA5""" "\xC2""\xFD""\xF1""\xDC"" 2007<" "/font>
\r\"Downloa"\r
\r<" "/td>\r
\r
\r\r\r\r\r\r\r
\r\r\r\r\r\r" "\r\r\r\r\xDF""\xEB""\xE7""\xE0""\xBF""\xB7""\xA4"" \r\xCF""\xD9""\xE9"" \r\r\r" "\r\r\r\r
\r
\r  \xCC""\xE6""" "\xC1""\xE6"" \xE2""\xD7""\xE6""\xBF""\xE6""\xDA""\r
\r\r\r\r\r\r" "\r\r\r\r\r\r\r\r\r\r\r\r
\xE7""" "\xC1""\x99""\xE6""\xE6""\xE2""\xE6""
\r\r\r\r\r\r\r\r\r\r\r\r\xDF""\xE6""S\xCC""\xE9"" \xD7""\xF0""\xB4"" \xC2""" "\xA2""\xBF"" \xCC""\x88""\xDF""\xF4""\xB4"" \xB7""\xA4""\xE6"" \xD7""\xE3""" "\x88""\xDF""\r\r
  \xD5""" "\xE3""\xE9""\xCC"" \xBF""\xD7""\x88""\xB7""\xA4""\xE6""\xDA""\xE8"" \xE3""" "\xF4""\xCC""\xF0"" \xE3""\xF1""\xB4""\xE7""\xC2""\xDA""\xE6""\xE7""\xD7""" "\xC7""
 " " <" "font face='AU' size='3' color='#04135E'>\xB7""\xE9""\xA4""\xDC""\xBB""\xE9""L\xA4"" \xB7""\xA4""\xE6""" " \xE2""{\xD7""\xE6""\xD9"" \xB7""\xA4""\xDA""\xF0""\xB4"", \xDC""\xE6""\xD6""" " \xE3""\xF4""\xBB""..
  
\r
\r<" "/td>\r\r\r\r\xC8""\xF1""\xE0""\xE6""\xD9"" \xBB""\xF1""\xDC""\xDA""\xE8""<" "/td>\r\r\r\r" "\r\r\r" "\r
\r\r\r\r\r\r\r\r
\r \r\r\r
\r
\r
\r\r\r\r\r" "\r\r\r\r\r
\xBB""\xF5""\xDA""\xCC""\xDC""\xD5""
\r\r\r\r\r\r\r\r\r
  
\xBB""\xCE""\xDA"" \xB7""\xF0"" \xC2""\xE9""" "\xDA""\xF4""\xCF""\xE6""
\r
  <" "/td>\r
\xBB""\xFD""" "\xE6""\xD7""\xE8""\x87""\xE6""\xE6""\xF0""\xB4"" \xB7""\xE8"" S\xD7""\xEB""" "\xE7""\xCC"" \xD7""\xF0""\xB4"" \xD7""\xA2""\xBB""\xDC"" \xC2""\xE6""\xA2""" "\xC7""\xF0""
\r
  
\xB7""\xE6""\xDA""\xCC""" "\xEA""\xE2"" \xCC""\xF4"" \xD7""\xE3""\xC1"" \xB0""\xB7"" \xD5""\xE3""\xE6""" "\xD9""\xE6"" \xCD""\xE6""
\r
\r
\r\r\r\r\r\r\r\r\r
\r
\r\r\r\r\r\r\r\r\r\r" "\r
\r\r\r\r\r\r\r
\r
" "
\r\r\r\r\r
\r
\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r" "\r\r\r\r
\r\r " " \r " " \r \r
\r<" "/td>

\xC0""}\xE6""\xE8""\xE2""\xBB""\xC9""\xB8"" \xD7""\xF0""" "\xB4"" \xDC""\xEA"" \xB7""\xE6"" \xB7""\xE3""\xDA"" \xE0""\xE6""\xE9""M<" "/a>\r

\xB7""\xF0""\xDA""\xDC"" \xD1"" \xC2""" "\xF0""\x8C""\xE2""\xE8"" \xB7""\xE6""\xF0"" \xA9""\x88""\xC2""\xE6""\xCE""" "\xD9"" \xB7""\xE8"" \xA5""\xD9""\xE9""\xD7""\xE7""\xCC""\r\r

\xC2""\xFD""\x87""\xE6""\xDF"" \xD7""\xE9""\xB9""\xC1""" "\xE8""\xFC"" \xB7""\xE6""\xF0"" \xA5""S\xC2""\xCC""\xE6""\xDC"" \xE2""\xF0""" " \xC0""\xE9""^\xE8""\r

\xE7""\xD5""\xE3""" "\xE6""\xDA"" \xD1"" \xD2""\x8C""\xD8""\xE6""\xE2""\xF0""\xD3"" \xBB""\xE6""" "\xA2""\xDF"" \xD7""\xF0""\xB4"" \xE3""\xF1""\xB4""\xC7"" \xC2""\xA2""\xC2""" " \xBB""\xC7""\xB8""\xE6""\r
\r\r " " \r " " \r \r " "
\r
\xA7""\xA2""\xC1""\xD7""\xE6""\xD7"" \xDF"" \xC2""" "\xE8""\xE2""\xE8""\xD5""\xE8"" \xE2""\xF0"" \xC1""\xE6""\xA2""\xBF"" \xE2""" "\xE7""\xD7""\xE7""\xCC"" \xE2""\xA2""\xCC""\xE9""C \xD9""\xE3""\xE8""\xB4""" "
\xA5""\xE6""\xF2""S\xC5""\xF0""\xFE""\xE7""" "\xDC""\xD8""\xE6"" \xE2""\xF0"" \xE2""\xE8""\xB9"" \xDC""\xF0"" \xA7""\xA2""" "\x82""\xDC""\xF1""\xB4""\xC7"" \xD1"" x\xDC""\xF0""\xB4""\xBF""\xDA""
\xE7""\xB7""\xE7""\xDF""\xD8""\xE6""\xF0""" "\xB4"" \xD9""\xF0"" \xA5""\xE6""\xD8""\xDA""\xDC""\xF1""\xB4""\xC7"" \xB7""" "\xE6""\xF0"" \xE3""\xDA""\xE6""\xD8""\xE6""
\xE2""\xE9""\xC2""\xDA""-4\xD1"" \xB7""\xE6""\xF1""\xD9"" \xE3""\xE6""" "\xF0""\xBB""\xE8"" \xBF""\xF5""\xCD""\xE8"" \xC5""\xE8""\xD7""?
<" "/font>
\r
 <" "/td>\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r
\r\r\r\r\r\r\r\r\r\r\r" "\r\r\r\r\r\r\r\r\r\r\r\r\r
\r\r " " \r " " \r \r
\r

\xD6""\xE6""\xDA""\xCC""-\xC2""\xE6""\xB7"" \xB7""\xF0"" \xA5""" "\xE6""\xE7""\xCD""\xFC""\xB7"" \xE7""\xDA""\xE0""\xCC""\xF0"" \xD7""\xF0""" "\xB4"" \xD7""\xC1""\xD5""\xEA""\xCC""\xE8""\r
<" "br> \xD2""\xE2""\xE9""\xDA""\xFF""\xE6""\xE6"" \xC2""\xE7""\xDA""\xE1""" "\xCE"" \xB7""\xF0"" \xC2""\xFD""S\xCC""\xE6""\xDF"" \xB7""\xE6"" \xC2""\xE6""" "\xDC""\xD9"" \xB7""\xDA""\xF0"" \xA7""\xFC""\xDA""\xE6""\xD9""\xD3""" "\r

\xD9""\xF0""\xC2""\xE6""\xDC""\xE8"" \xE2""" "\xF0""\xD9""\xE6"" \xD9""\xF0"" \xE3""\xE7""\xCD""\xD8""\xE6""\xDA"" \xC1""" "\xD7""\xE6"" \xB7""\xDA""\xE6""\xB0""\r
" "\xB0""\xC5""\xD7""\xE8"" \xE7""\xDF""\xDF""\xE6""\xCE"" \xB7""\xE6"" \xE3""" "\xDC"" \xDF""\xE6""\xCC""\xE6""\xFC"" \xE2""\xF0"" \xE2""\xA2""\xD6""\xDF""" " \xD1"" \xA5""\xD7""\xF0""\xE7""\xDA""\xB7""\xE6""\r
\r\r \r \r " " \r
\r
\r\xA5""\xE6""\xA7""\xFC""" "\xE2""\xE8""\xA5""\xE6""\xA7""\xFC""\xE2""\xE8""\xA5""\xE6""\xA7""\xFC""" " \xD5""\xF1""\xB4""\xB7"" \xB7""\xE6"" \xB7""\xE6""\xF0""-\xD5""\xFD""\xE6""" "\xA2""\xC7""\xF0""\xC7"" \xB7""\xE6""\xC7""\xFC""
\r\xD5""\xF1""\xB4""\xB7""\xE6""\xF0""\xB4"" \xB7""\xE6""\xF0"" \xDC""" "\xF0""\xD9""\xE6"" \xE3""\xE6""\xF0""\xBB""\xE6"" L\xC2""\xB0"" \xB7""\xF0""" " \xB9""\xA2""\xC7"" \xDF""\xE6""\xDC""\xF0"" \xBF""\xF0""\xB7""
\r\xC2""\xA2""\xBC""\xFD""\xE3"" \xE2""\xE6""\xF1"" " "\xD7""\xF0""\xB4"" \xE7""\xD7""\xDC""\xF0""\xB4""\xBB""\xF0"" \xB7""\xF1""" "\xD7""\xDA""\xE6"" \xDF""\xE6""\xDC""\xF0"" \xD7""\xE6""\xF0""\xD5""\xE6""" "\xA7""\xDC""
\r\xA5""\xE6""\xA7""\xFC""\xC5""" "\xE8"" \xE7""\xD9""\xDF""\xF0""\xE0""\xE6""\xB7""\xF4""\xB4"" \xB7""\xF4""" " \xD9""\xE9""\xB7""\xE2""\xE6""\xD9"" \xB7""\xE8"" \xA5""\xE6""\xE0""\xE6""" "\xA2""\xB7""\xE6""
\r
\r\r\r\r\r\r
\r" "\r
\r" "\r\r" "\r\r\r\r\r\r\r\r\r\r
\r\xD9""\xA7""\xFC"" \xE7""\xCE""\xCB""\xDC""\xE8""\r\r:\r\r\xC2""" "\xE9""\xE7""\xDC""\xE2"" \xE2""\xE9""\xCF""\xE6""\xDA"" \xB7""\xF0""\xA5""" "\xE6""\xCE""\xF0""\xE0""\xE6"" \xD9"" \xD7""\xE6""\xD9""\xD9""\xF0"" \xC2""" "\xDA"" \xA5""\xC7""\xB8""\xF0"" \xC2""\xFD""\xCE""\xF0""\xE0""\xE6""\r
\r\xD9""\xF4""\xB0""\xC7""\xE6""" "\r\r:\r\r\xDA""" "\xF1""\xDC""\xE8"" \xB7""\xF0"" \xE7""\xDC""\xB0"" \xD9""\xE3""\xE8""\xB4""" " \xE7""\xD7""\xDC"" \xDA""\xE3""\xF0"" \xE3""\xF1""\xB4"" \xDC""\xE6""\xF0""" "\xBB""\r
\r\xBB""\xE6""\xF0""\xDA""\xB9""" "\xC2""\xE9""\xDA""\r\r:\r\r<" "font face='au' size='4'>\xE3""\xDA"" \xE2""\xE6""\xA2""\xE2"" \xB7""\xF0""" " \xE2""\xE6""\xCD"" \xDC""\xF0""\xCC""\xF0"" \xE3""\xF1""\xB4"" \xC1""\xE3""" "\xDA""\r
\r\x9F""\xE6""\xE8""\xD9""\xBB""" "\xDA""\r\r:\r\r\xB7""\xE0""\xD7""\xE8""\xDA"" \xB7""\xF0"" \xB7""\xE9""\xC0""" " \xA5""\xD9""\xC0""\xE9""\xB0"" S\xCD""\xDC"" \xE3""\xF4""\xB4""\xBB""\xF0""" " \xC2""\xD8""\xFC""\xC5""\xD9"" \xB7""\xF0""\xB4""\xBC""\xFD""\r
\r\xE2""\xE6""\xE7""\xE3""\xD5""\xE6""\xD5""\xE6""" "\xCE""\r\r:\r\r\xB0""\xB7"" \xE3""\xE8"" \xE7""\xCE""\xD9"" \xE7""\xD9""\xB7""" "\xE6""\xE3"", \xCC""\xDC""\xE6""\xB7"" \xA5""\xE6""\xF1""\xDA"" \xE7""\xC8""" "\xDA"" \xE7""\xD9""\xB7""\xE6""\xE3""\r
" "\r
\r\r\r\r\r
\r" " \r \r \r \r " " \r
\r \r <" "/tr>\r \r
\r  \xD7""\xF0""\xDA""U\xE6"" \xE7""\xDF""\xDF""\xE6""" "\xE3""U \xB7""\xA4""\xD5"" \xCC""\xB7""\xA4"" \xE3""U\xE6""\xF0""\xBB""\xE6""" "? -\xD9""\xDA""\xF0""U\xE0""\xE6""" "
\r &nb" "sp;\xD7""\xE9""\xDB""\xE6""\xF0"" \xD9""\xE6""\xF1""\xB7""\xA4""\xDA""U\xE8""" " \xB7""\xA4""\xD5"" \xCC""\xB7""\xA4"" \xE7""\xD7""\xDC""\xF0""\xBB""\xE8""" "? -\xE0""\xE6""\xE6""\xCE""\xE6""" "\xD5""
\r  \xD7""\xE9""\xDB""\xE6""\xF0"" \xC1""\xE6""\xF2""\xD5"" \xB7""\xA4""" "\xD5"" \xCC""\xB7""\xA4"" \xE7""\xD7""\xDC""\xF0""\xBB""\xE8""? <" "/a>-\xE7""\xD9""\xCC""\xF0""\xE0""\xE6""
\r
  " ";\xD7""\xE9""\xDB""\xE6""\xF0"" \xCE""\xEA""\xE2""\xDA""U\xE8"" \xD9""\xE6""" "\xF1""\xB7""\xA4""\xDA""U\xE8"" \xB7""\xA4""\xD5"" \xE7""\xD7""\xDC""\xF0""" "\xBB""\xE8""? -\xD9""\xDF""\xE8""" "\xD9""
\r  \xE7""\xDF""\xCE""\xF0""\xE0""\xE6"" \xD8""\xE6""\x98""\xE6""\xE6""" " \xB7""\xA4""\xE6"" \xD8""\xE6""\xF0""\xBB"" \xB7""\xA4""\xD5"" \xCC""\xB7""" "\xA4""?
-\xE2""\xA2""\xC1""\xD8""" "
\r &nb" "sp;\xDF""\xF1""\xDF""\xE6""\xE7""\xE3""U\xB7""\xA4"" \xC1""\xE8""\xDF""\xD9""" " \xB7""\xF1""\xA4""\xE2""\xE6"" \xE3""U\xE6""\xF0""\xBB""\xE6""? " "-\xC2""\xE9""\xD9""\xE8""\xCC""" "
\r  \xD7""" "\xF0""\xDA""U\xE6"" \xE7""\xDF""\xDF""\xE6""\xE3""U \xB7""\xA4""\xD5"" \xCC""" "\xB7""\xA4"" \xE3""U\xE6""\xF0""\xBB""\xE6""? -\xDA""U\xE6""\xE3""\xE9""U\xDC""
\r " "
\r
\r \r" " \r \r
\r\r \r " " \r \r \r \r \r" "
'\r
\r\xBF""\xD7""" "\x88""\xB7""\xE6""\xDA""...
\r\r\xB0""\xB7"" \xBF""\xD7""\x88""\xB7""\xE6""\xDA""\xE8"" " "\xD5""\xE6""\xD5""\xE6"" \xD9""\xF0"" \xE3""\xDF""\xE6"" \xD7""\xF0""\xB4""" " \xE3""\xE6""\xCD"" \xDC""\xE3""\xDA""\xE6""\xD8""\xE6"" \xA5""\xE6""\xF1""" "\xDA"" \xCC""\xE6""\xD5""\xE8""\xC1"" \xE7""\xD9""\xB7""\xE6""\xDC""\xB7""" "\xDA"" \xD6""v\xCC"" \xB7""\xF0"" \xE3""\xE6""\xCD""\xE6""\xA2""\xF0"" \xD7""" "\xF0""\xB4"" \xDA""\xB9""\xCC""\xF0"" \xE3""\xE9""\xB0"" \xB7""\xE3""\xE6""" "- \xD2""\xD5""\xF0""\xC5""\xE6"", \xA7""\xE2""\xF0"" \xB7""\xE6""\xDC""\xF0""" " \xCF""\xE6""\xBB""\xF0"" \xD7""\xF0""\xB4"" \xC2""\xE3""\xD9"" \xDC""\xF0""" "\xD9""\xE6"", \xCC""\xF0""\xDA""\xE6"" \xB7""\xCB""\xD8""\xE6""\x87""\xE6""" " \xE3""\xE6""\xF0""\xBB""\xE6""\xD0""\xD3""\xD6""v\xCC"" \xD5""\xE6""\xF0""" "\xDC""\xE6""- \xD2""\xD5""\xE6""\xD5""\xE6"", \xA7""\xE2""\xE2""\xF0"" \xCC""" "\xE6""\xF0"" \xA5""\x91""\xC0""\xE6"" \xE3""\xE6""\xF0""\xCC""\xE6"" \xE7""" "\xB7"" \xA5""\xE6""\xC2"" 500 L\xC2""\xB0"" \xB7""\xE6"" \xB0""\xB7"" \xD9""" "\xE6""\xF0""\xC5"" \xE7""\xD9""\xB7""\xE6"" ...\r
\r
\r\r
\r\r\r\r
\r " " \r \r \r \r \r \r
\r \r " " \r " " \r " "
<" "img src=\"../image/gharmash.jpg\" border='0'>
\r\xC2""\xFD""\xE0""\xD9""-\xD7""\xF1""\xB4""\xD9""\xF0"" \xC8""\xEA""\xC7""" " \xC5""\xF0""v\xD9""\xF4""\xDC""\xE6""\xF2""\xC1""\xE8"" \xD7""\xF0""\xB4""" " \xB0""\xD7""\xB0""\xE2""\xE2""\xE8"" \xE7""\xB7""\xD8""\xE6"" \xE3""\xF1""" "\xD0"" \xA5""\xD5"" \xD7""\xF1""\xB4"" \xC8""\xEA""\xC7"" \xC5""\xF0""v\xD9""" "\xF4""\xDC""\xE6""\xF2""\xC1""\xE8"" \xD7""\xF0""\xA2""\xB4"" \xB0""\xD7""" "\xC5""\xF0""\xB7""  ..\r\r" "
\r\xC2""\xFD""\xE0""\xD9""-\xD7""\xF1""\xB4"" M\xDA""\xDC"" \xC7""\xF0""\xDF""\xDC""\xC2""" "\xD7""\xF0""\xB4""\xC5"" \xB7""\xE6""\xF0""\xE2""\xF0""\xFC"" \xB7""\xF0""" " \xD5""\xE6""\xDA""\xF0"" \xD7""\xF0""\xB4"" \xC1""\xE6""\xD9""\xD9""\xE6""" " \xBF""\xE6""\xE3""\xCC""\xE6"" \xE3""\xEA""\xA2""\xD0"" \xA7""\xE2"" \xB7""" "\xE6""\xF0""\xE2""\xFC"" \xD7""\xF0""\xB4"" \xA5""\xE6""\xDF""\xF0""\xCE""" "\xD9""  ..\r\r
\r" "\xC2""\xFD""\xE0""\xD9""-v\xD8""" "\xE6"" \xDA""v\xCC""\xCE""\xE6""\xD9"" \xB7""\xDA""\xD9""\xF0"" \xE2""\xF0""" " \xE2""\xA2""\xB7""\xFD""\xE6""\xD7""\xB7"" \xD5""\xE8""\xD7""\xE6""\xE7""" "\xDA""\xD8""\xE6""\xA2"" \xE3""\xF4""\xD9""\xF0"" \xB7""\xE6"" \xB9""\xCC""" "\xDA""\xE6"" \xD5""\xC9""\xB8"" \xC1""\xE6""\xCC""\xE6"" \xE3""\xF1""\xD0""" " \xA7""\xE2"" \xD5""\xE6""\xDA""\xF0""  ..\r\r
\r
\r
\r \r \r \r \r
\r\r
\r\r " "
\r
\r\xC2""\xFD""\xE0""" "\xD9"" \xD7""\xF0""\xB4"" \xE3""\xE8"" \xE7""\xC0""\xC2""\xE6"" \xE3""\xF1""" " \xE3""\xDC""
\r\r\xA7""\xA2""\xC1""\xE8""\xE7""\xD9""\xD8""\xE7""" "\xDA""\xA2""\xBB"" \xB0""\xB7"" \xB0""\xF0""\xE2""\xE6"" \xC8""\xE8""\xCB""" "\xC7"" \xE3""\xF1"", \xE7""\xC1""\xE2""\xD7""\xF0""\xB4"" \xE2""\xC8""\xDC""" "\xCC""\xE6"" \xB7""\xF4"" \xDC""\xF0""\xB7""\xDA"" \xE0""\xE6""\xE6""\xD8""" "\xCE"" \xE3""\xE8"" \xE7""\xB7""\xE2""\xE8"" \xB7""\xF4"" \xE2""\xA2""\xCE""" "\xF0""\xE3"" \xE3""\xF4""\xBB""\xE6""\xD0"" \xD8""\xE3""\xE8"" \xB7""\xE6""" "\xDA""\x87""\xE6"" \xE3""\xF1"" \xE7""\xB7"" \xE3""\xDA"" \xE2""\xE6""\xDC""" " \xCE""\xF0""\xE0""\xE6"" \xB7""\xF0"" \xE7""\xDF""\xE0""\xDF""S\xCC""\xDA""" "\xE8""\xD8"" \xA5""\xE6""\xA7""\xFC""\xA5""\xE6""\xA7""\xFC""\xC5""\xE8""" " \xE2""\xA2""S\xCD""\xE6""\xD9""\xF4""\xB4"" \xD7""\xF0""\xB4"" \xCE""\xE6""" "\xE7""\xB9""\xDC""\xF0"" \xB7""\xE6"" \xD7""\xE6""\xBB""\xFC"" \xC2""\xFD""" "\xE0""\xE6""S\xCC"" \xB7""\xDA""\xD9""\xF0"".." ".\r
\r \r
\r
\r\r\r\r\r\r
\r\r\r\r\r\r\r\r\r\r\r\r\r<" "tr>\r\r\r
\xD9""\xB0"" \xA9""\x88""\xC2""\xE6""\xCE""" "
\r\r\r\r\r\r\r\r\r\r\r\r" "\r\r\r\r\r
  \xD7""\xF1""v\xE2"" \xC8""\xF1""\xA4""" "v\xC5""U\xDA""U \xB0""\xC1"" \xE7""\xDA""U\x8B""\xD8""\xEA""\r" "
  \xC5""U\xE6""\xA7""" "\xD7""\xF0""v\xE2"" \xB7""\xA4""\xE8"" \xE7""\xCE""\xE0""\xE6""\xE6"" \x99""" "\xE6""\xE6""\xD9"" \xCE""\xF0""\xD9""\xF0"" \xDF""\xE6""\xDC""\xE8"" ..<" "/font>\r
  \xB0""" "v\xE0""\xE6""\xD9"" \xB7""\xF0""\xA4"" \xE3""U\xCB""\xB7""\xF0""\xA4"" \xE2""" "\xF1""\xB4""\xC7""U\xDC""\r
  \xE2""\xE6""\xF0""\xD9""\xE8"" \xB7""\xA4""\xE6"" \xC2""" "\xF1""\xD9""\xDC"" \xC2""\xE8""\xE2""\xE8""\r
\r
\r\r
\xDF""" "\xE6""\xF2""\xDC""\xC2""\xF0""\xC2""\xDA""
\r\r\r\r\r" "\r\r
\r
\r
\r
\r\r\r\r\r\r\r\r\r\r\r\r
\xC1""\xE6""\xD8""\xB7""\xE6""
\r<" "table width='98%' border='0' cellspacing='2' cellpadding='0' align='cent" "er' bgcolor='#F3F3F4'>\r
\r\xB7""\xE6""\xC1""\xEA""-\xD7""" "\xB9""\xE6""\xD9""\xF0"" \xDF""\xE6""\xDC""\xE6"" \xD9""\xD7""\xB7""\xE8""" "\xD9""\r
\xD7""\xF1""\xCE""\xE6"" \xD7""\xF0""\xB4"" \xBB""\xDA""\xD7"" " "\x83""\xE6""\xE8"" \xB7""\xE6"" \xD7""\xE6""\xF0""\xD8""\xD9"" \xC7""\xE6""" "\xDC""\xF0""\xB4""\xD0"" \xA9""\xE2""\xD7""\xF0""\xB4"" \xE2""\xEA""\xC1""" "\xE8"", \xC2""\xE9""\xCE""\xE8""\xD9""\xE6"", \xD9""\xD7""\xB7"", \xA5""" "\xC1""\xDF""\xE6""\xD8""\xD9"" \xE2""\xD6""\xE8"" \xA5""\x91""\xC0""\xE8""" " \xCC""\xDA""\xE3"" \xE7""\xD7""\xDC""\xE6""\xB0""\xA2"" \xA5""\xE6""\xF1""" "\xDA"" \xC2""\xEA""\xDA""\xE8"" \xD5""\xF0""\xDC""\xD9""\xF0"" \r" "
\r
\r\r\r\r\r" "\r\r\r\r\r\r\r\r
\xA5""\xE6""\xB9""\xDA""
\r\r" "\r\r\r
\r\xE7""\xC8""\xDA""" " \xD9""\xE6""\xDA""\xE8"" \xB7""\xE6"" \xCE""\xCE""\xFC"" \xA9""\xB7""\xF0""" "\xDA""\xD9""\xF0"" \xD7""\xF0""\xB4"" \xC1""\xE9""\xC5""\xE8""\xA2""
\r
\xB7""\xC5""\xF7""\xC5""\xDA""\xC2""\xA2""\xE7""\xCD""\xD8""\xF4""\xB4""" " \xC2""\xDA"" \xE7""\xC5""\x8C""\xC2""\x87""\xE6""\xE8"" \xB7""\xE8"" \xDF""" "\xC1""\xE3"" \xE2""\xF0"" \xD5""\xE6""\xA2""\x82""\xDC""\xE6""\xCE""\xF0""" "\xE0""\xE6"" \xE2""\xF0"" \xE7""\xD9""\xDF""\xE6""\xFC""\xE2""\xD9"" \xDB""" "\xE6""\xF0""\xDC"" \xDA""\xE3""\xE8"" \xDC""\xF0""\xE7""\xB9""\xB7""\xE6""" "
\r
\r
\r
\r\r\r\r\r\r\r\r\r\r" "\r
\xA5""" "\xD7""\xDA"" \xA9""\xC1""\xE6""\xDC""\xE6"" \xC1""\xD9""\xD7""\xCC""
\r\r\r\r\r\r\r\r" "\r\r
\r
\r\n\r\n\t" "\r\n\t\t\r\n\t\r\n\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\r\n" "\t\r\n\t\t\r\n\t\r\n
v\xD8""\xE6"" \xE2""\xE7""\xBF""\xD9"" \xCC""\xF0""\xB4""\xCE""" "\xE9""\xDC""\xB7""\xA4""\xDA"" m\xE6""\xDA""\xE6"" \xB7""\xF0""\xA4""\xB7""" "\xA4""\xA4""\xC2""\xDA"" \xD5""\xD9""\xE6"" \xE7""\xCC""\xDA""\xA2""\xBB""" "\xE6"" \xB7""\xA4""\xE6""\xC5""\xD9""\xE6"" \xB7""\xA4""\xDA""\xE6""\xF0""" "\xC7""\xB8""\xE6""\xF0""\xB4"" \xD6""\xE6""\xDA""\xCC""\xE8""\xD8""\xE6""" "\xF0""\xB4"" \xB7""\xA4""\xE6"" \xA5""\xC2""\xD7""\xE6""\xD9"" \xB7""\xA4""" "\xE3""\xE6"" \xC1""\xE6""\xD9""\xE6"" \xBF""\xE6""\xE7""\xE3""\xB0""?
\r\n\t\t

\r\n\t\t\t\r\n\t\t\t\t\xE3""\xE6""" "\xA1""\r\n\t\t\t\r\n\t\t

\r\n\t\t\t\r\n\t\t\t\t\xD9""\xE3""\xE8""" "\xB4""\r\n\t\t\t\r\n\t\t

\r\n\t\t\t\r\n\t\t\t\t\xC2""\xCC""\xE6""" " \xD9""\xE3""\xE8""\r\n\t\t\t\r\n\t\t
\r\n
\r
\r

\xE7""\xC2""\xC0""\xDC""\xE6"" \xE2""\xDF""\xF0""" "\xFC""\xFF""\xE6""\x87""\xE6""

\r
\r\r\r\r\r\r\r\r\r\r\rwindow.open('../shopping/Current/index.htm" "','shopping_Nov','width=425,height=189,top=280,left=320,resize=yes')\r\r\r\r" ; // This one is really UTF-8, even though "www.jagran.com" matches JAGRAN const char* kTestUrl52b = "http://www.jagran.com/default.aspx"; const char kTeststr52b[] = // Produced by stringify.cc on 2007-04-10 12:49 from file jagran_com.html "\r\n\r\n\r\n\r\n\r\n\r\n\tJagran" ".com - World's Largest Hindi Portal\r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n \r\n\r\n\r\n<" "td width=\"24%\">\r\n
\r\n \r\n \r\n \r\n
\r" "\n \r\n \r\n" "
<" "img align=absmiddle border=\"0\" src=\"images/logoimg.gif\" width=\"143\"" " height=\"75\" alt=\"\">\r\n
  \xE0""\xA4""\x86""" "\xE0""\xA4""\xAA""\xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\x85""" "\xE0""\xA4""\xAA""\xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""\x86""" "\xE0""\xA4""\xAA""\xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\xAA""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xB8""
\r\n
\r\n
\r\n\r\n \r\n\r\n \"\"\r" "\n \r\n \r\n\"\" \r\n \r\n \"\"\r\n \r\n\t\r\n\t\r\n \"\"      \r\n \xE0""\xA4""\xAA""\xE0""" "\xA5""\x82""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\xB5""\xE0""" "\xA5""\x8B""\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""" "\xA4""\xB0""\xC2""\xA0""\xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""" "\xB5""\xE0""\xA4""\xBF""\xE0""\xA4""\x95""\xE0""\xA4""\xBE""\xE0""\xA4""" "\xB8"" \xE0""\xA4""\xAA""\xE0""\xA4""\xB0"" \xE0""\xA4""\xA7""\xE0""\xA5""" "\x8D""\xE0""\xA4""\xAF""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8"" \xE0""\xA4""" "\xA6""\xE0""\xA4""\xBF""\xE0""\xA4""\xAF""\xE0""\xA4""\xBE"" \xE0""\xA4""" "\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x8F"": \xE0""\xA4""\xB6""\xE0""\xA5""" "\x87""\xE0""\xA4""\x96""\xE0""\xA4""\xBE""\xE0""\xA4""\xB5""\xE0""\xA4""" "\xA4""               \r\n " " \r\n \xE0""\xA4""\xAA""\xE0""\xA4""\xBE""\xE0""\xA4""\x95""" " \xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""\xAA""\xE0""\xA4""\xBE""" "\xE0""\xA4""\x87""\xE0""\xA4""\xAA""\xE0""\xA4""\xB2""\xE0""\xA4""\xBE""" "\xE0""\xA4""\x87""\xE0""\xA4""\xA8"" \xE0""\xA4""\x97""\xE0""\xA5""\x88""" "\xE0""\xA4""\xB8"" \xE0""\xA4""\xAC""\xE0""\xA4""\x82""\xE0""\xA4""\x9F""" "\xE0""\xA4""\xB5""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""\xA5""\x87""" " \xE0""\xA4""\x95""\xE0""\xA5""\x8B"" \xE0""\xA4""\xAE""\xE0""\xA4""\x82""" "\xE0""\xA4""\x9C""\xE0""\xA5""\x82""\xE0""\xA4""\xB0""\xE0""\xA5""\x80""" " \xE0""\xA4""\xA6""\xE0""\xA5""\x80""      " ";    &nbs" "p;    \r\n \r\n \xE0""\xA4""\x9A""\xE0""" "\xA5""\x81""\xE0""\xA4""\xA8""\xE0""\xA4""\xBE""\xE0""\xA4""\xB5"" \xE0""" "\xA4""\x86""\xE0""\xA4""\xAF""\xE0""\xA5""\x8B""\xE0""\xA4""\x97"" \xE0""" "\xA4""\xB8""\xE0""\xA5""\x87"" \xE0""\xA4""\x9F""\xE0""\xA4""\x95""\xE0""" "\xA4""\xB0""\xE0""\xA4""\xBE""\xE0""\xA4""\xB5"" \xE0""\xA4""\x95""\xE0""" "\xA5""\x87"" \xE0""\xA4""\xB0""\xE0""\xA4""\xBE""\xE0""\xA4""\xB8""\xE0""" "\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA5""\x87"" \xE0""\xA4""\xAA""\xE0""" "\xA4""\xB0"" \xE0""\xA4""\xA8""\xE0""\xA4""\xB9""\xE0""\xA5""\x80""\xE0""" "\xA4""\x82"": \xE0""\xA4""\xAD""\xE0""\xA4""\xBE""\xE0""\xA4""\x9C""\xE0""" "\xA4""\xAA""\xE0""\xA4""\xBE""       " "     " ";   \r\n \r\n \xE0""\xA4""\x86""\xE0""\xA4""" "\xB0""\xE0""\xA4""\x95""\xE0""\xA5""\x8D""\xE0""\xA4""\xB7""\xE0""\xA4""" "\xA3"" \xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""\xA4""\xAE""\xE0""\xA4""" "\xB2""\xE0""\xA5""\x87"" \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""" "\x82"" \xE0""\xA4""\xB8""\xE0""\xA4""\xAD""\xE0""\xA5""\x80"" \xE0""\xA4""" "\xB5""\xE0""\xA4""\xBF""\xE0""\xA4""\x95""\xE0""\xA4""\xB2""\xE0""\xA5""" "\x8D""\xE0""\xA4""\xAA""\xE0""\xA5""\x8B""\xE0""\xA4""\x82"" \xE0""\xA4""" "\xAA""\xE0""\xA4""\xB0"" \xE0""\xA4""\xB9""\xE0""\xA5""\x8B""\xE0""\xA4""" "\x97""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB5""\xE0""\xA4""\xBF""\xE0""\xA4""" "\x9A""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0"": \xE0""\xA4""\x85""\xE0""\xA4""" "\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\x9C""\xE0""\xA5""\x81""\xE0""\xA4""" "\xA8""               \r\n " " \r\n \xE0""\xA4""\xA8""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xAF""\xE0""\xA4""\xAE""\xE0""\xA5""\x82""" "\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA4""\xBF""" " \xE0""\xA4""\xB8""\xE0""\xA5""\x87""\xE0""\xA4""\xA0""\xE0""\xA4""\xA8""" "\xE0""\xA4""\xBE""\xC2""\xA0""\xE0""\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""" "\xA4""\x97""\xE0""\xA5""\x81""\xE0""\xA4""\x9C""\xE0""\xA4""\xB0""\xE0""" "\xA4""\xBE""\xE0""\xA4""\xA4"" \xE0""\xA4""\xB9""\xE0""\xA4""\xBE""\xE0""" "\xA4""\x88""\xE0""\xA4""\x95""\xE0""\xA5""\x8B""\xE0""\xA4""\xB0""\xE0""" "\xA5""\x8D""\xE0""\xA4""\x9F"" \xE0""\xA4""\xB8""\xE0""\xA5""\x87"" \xE0""" "\xA4""\x87""\xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""" "\xA5""\x80""\xE0""\xA4""\xAB""\xE0""\xA4""\xBE""    " "     " ";      \r\n \r\n \xE0""\xA4""" "\x95""\xE0""\xA5""\x87""\xE0""\xA4""\x82""\xE0""\xA4""\xA6""\xE0""\xA5""" "\x8D""\xE0""\xA4""\xB0"" \xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""" "\xA8""\xE0""\xA4""\x95""\xE0""\xA5""\x8D""\xE0""\xA4""\xB8""\xE0""\xA4""" "\xB2""\xE0""\xA5""\x80"" \xE0""\xA4""\xB9""\xE0""\xA4""\xBF""\xE0""\xA4""" "\x82""\xE0""\xA4""\xB8""\xE0""\xA4""\xBE"" \xE0""\xA4""\xAA""\xE0""\xA4""" "\xB0"" 24\xC2""\xA0""\xE0""\xA4""\x85""\xE0""\xA4""\xAA""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xB0""\xE0""\xA5""\x88""\xE0""\xA4""\xB2"" \xE0""\xA4""\x95""" "\xE0""\xA5""\x8B"" \xE0""\xA4""\xAC""\xE0""\xA5""\x88""\xE0""\xA4""\xA0""" "\xE0""\xA4""\x95"" \xE0""\xA4""\xAC""\xE0""\xA5""\x81""\xE0""\xA4""\xB2""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x88""      " "     " ";    \r\n \r\n \xE0""\xA4""\x95""\xE0""" "\xA4""\xB6""\xE0""\xA5""\x8D""\xE0""\xA4""\xAE""\xE0""\xA5""\x80""\xE0""" "\xA4""\xB0"" \xE0""\xA4""\xB8""\xE0""\xA5""\x87"" \xE0""\xA4""\xB8""\xE0""" "\xA5""\x87""\xE0""\xA4""\xA8""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""\xE0""" "\xA4""\x9F""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""" "\xA4""\xAA""\xE0""\xA4""\xB0"" \xE0""\xA4""\xB5""\xE0""\xA4""\xBF""\xE0""" "\xA4""\x9A""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0"" \xE0""\xA4""\x95""\xE0""" "\xA5""\x87"" \xE0""\xA4""\xB2""\xE0""\xA4""\xBF""\xE0""\xA4""\x8F"" \xE0""" "\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xA7""\xE0""" "\xA4""\xBE""\xE0""\xA4""\xA8""\xE0""\xA4""\xAE""\xE0""\xA4""\x82""\xE0""" "\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x80"" \xE0""" "\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""\xAC""\xE0""\xA5""\x88""\xE0""" "\xA4""\xA0""\xE0""\xA4""\x95"" \xE0""\xA4""\x95""\xE0""\xA5""\x80"" " ";              \r\n \r\n" " \xE0""\xA4""\xAE""\xE0""\xA4""\xB2""\xE0""\xA5""\x87""\xE0""\xA4""" "\xB0""\xE0""\xA4""\xBF""\xE0""\xA4""\xAF""\xE0""\xA4""\xBE"" \xE0""\xA4""" "\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xAD""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xB5""\xE0""\xA4""\xBF""\xE0""\xA4""\xA4"" 45\xC2""\xA0""" "\xE0""\xA4""\x9C""\xE0""\xA4""\xBF""\xE0""\xA4""\xB2""\xE0""\xA5""\x8B""" "\xE0""\xA4""\x82"" \xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\x95""" "\xE0""\xA4""\xB2""\xE0""\xA5""\x87""\xE0""\xA4""\x95""\xE0""\xA5""\x8D""" "\xE0""\xA4""\x9F""\xE0""\xA4""\xB0""\xE0""\xA5""\x8B""\xE0""\xA4""\x82""" " \xE0""\xA4""\x95""\xE0""\xA5""\x80"" \xE0""\xA4""\xAC""\xE0""\xA5""\x88""" "\xE0""\xA4""\xA0""\xE0""\xA4""\x95"" \xE0""\xA4""\xA6""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xB2""\xE0""\xA5""\x8D""\xE0""\xA4""\xB2""\xE0""\xA5""\x80""" " \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\x86""" "\xE0""\xA4""\x9C""              " "; \r\n \r\n \xE0""\xA4""\xA6""\xE0""\xA4""\xBF""\xE0""" "\xA4""\xB2""\xE0""\xA5""\x8D""\xE0""\xA4""\xB2""\xE0""\xA5""\x80"" \xE0""" "\xA4""\xA8""\xE0""\xA4""\x97""\xE0""\xA4""\xB0"" \xE0""\xA4""\xA8""\xE0""" "\xA4""\xBF""\xE0""\xA4""\x97""\xE0""\xA4""\xAE"" \xE0""\xA4""\x95""\xE0""" "\xA4""\xBE"" \xE0""\xA4""\xB8""\xE0""\xA5""\x80""\xE0""\xA4""\xB2""\xE0""" "\xA4""\xBF""\xE0""\xA4""\x82""\xE0""\xA4""\x97"" \xE0""\xA4""\x85""\xE0""" "\xA4""\xAD""\xE0""\xA4""\xBF""\xE0""\xA4""\xAF""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xA8"" \xE0""\xA4""\xAB""\xE0""\xA4""\xBF""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\x9A""\xE0""\xA4""\xBE""\xE0""\xA4""\xB2""\xE0""\xA5""\x82"" " "              \r\n \r\n " " \xE0""\xA4""\xB0""\xE0""\xA4""\xA3""\xE0""\xA4""\x9C""\xE0""\xA5""" "\x80"" \xE0""\xA4""\x95""\xE0""\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xA4""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8""\xE0""\xA5""\x8B""\xE0""\xA4""" "\x82"" \xE0""\xA4""\x94""\xE0""\xA4""\xB0"" \xE0""\xA4""\x95""\xE0""\xA5""" "\x8B""\xE0""\xA4""\x9A""\xE0""\xA5""\x8B""\xE0""\xA4""\x82"" \xE0""\xA4""" "\x95""\xE0""\xA5""\x80"" \xE0""\xA4""\xAC""\xE0""\xA5""\x88""\xE0""\xA4""" "\xA0""\xE0""\xA4""\x95"" \xE0""\xA4""\xAE""\xE0""\xA5""\x81""\xE0""\xA4""" "\x82""\xE0""\xA4""\xAC""\xE0""\xA4""\x88"" \xE0""\xA4""\xAE""\xE0""\xA5""" "\x87""\xE0""\xA4""\x82"" 20\xC2""\xA0""\xE0""\xA4""\x85""\xE0""\xA4""\xAA""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x88""\xE0""\xA4""\xB2""" " \xE0""\xA4""\x95""\xE0""\xA5""\x8B""      " ";    &nbs" "p;    \r\n \r\n \xE0""\xA4""\xA6""\xE0""" "\xA5""\x87""\xE0""\xA4""\xB6""\xE0""\xA4""\xAD""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\xAA""\xE0""" "\xA5""\x87""\xE0""\xA4""\x9F""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""" "\xA5""\x8B""\xE0""\xA4""\xB2"" \xE0""\xA4""\xA1""\xE0""\xA5""\x80""\xE0""" "\xA4""\xB2""\xE0""\xA4""\xB0""\xE0""\xA5""\x8B""\xE0""\xA4""\x82"" \xE0""" "\xA4""\x95""\xE0""\xA5""\x80"" \xE0""\xA4""\xA4""\xE0""\xA5""\x87""\xE0""" "\xA4""\xB0""\xE0""\xA4""\xB9"" \xE0""\xA4""\x85""\xE0""\xA4""\xAA""\xE0""" "\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x88""\xE0""\xA4""\xB2"" \xE0""" "\xA4""\x95""\xE0""\xA5""\x8B"" \xE0""\xA4""\xB8""\xE0""\xA4""\xBE""\xE0""" "\xA4""\x82""\xE0""\xA4""\x95""\xE0""\xA5""\x87""\xE0""\xA4""\xA4""\xE0""" "\xA4""\xBF""\xE0""\xA4""\x95"" \xE0""\xA4""\xB9""\xE0""\xA5""\x9C""\xE0""" "\xA4""\xA4""\xE0""\xA4""\xBE""\xE0""\xA4""\xB2""    " "     " ";      \r\n \r\n \xE0""\xA4""" "\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xB5""\xE0""\xA5""" "\x80""\xE0""\xA4""\xA3"" \xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""" "\x8F""\xE0""\xA4""\x95"" \xE0""\xA4""\x95""\xE0""\xA4""\xB0""\xE0""\xA5""" "\x8B""\xE0""\xA5""\x9C"" \xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""\xA4""" "\x82""\xE0""\xA4""\x97""\xE0""\xA5""\x87"" \xE0""\xA4""\xA5""\xE0""\xA5""" "\x87"": \xE0""\xA4""\xB0""\xE0""\xA5""\x87""\xE0""\xA4""\x96""\xE0""\xA4""" "\xBE"" \xE0""\xA4""\xAE""\xE0""\xA4""\xB9""\xE0""\xA4""\xBE""\xE0""\xA4""" "\x9C""\xE0""\xA4""\xA8""             " ";  \r\n \r\n \xE0""\xA4""\xB6""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xB0""\xE0""\xA5""\x80""\xE0""\xA4""\xB2""\xE0""\xA4""\x82""" "\xE0""\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xAE""\xE0""\xA5""\x87""" "\xE0""\xA4""\x82"" \xE0""\xA4""\xB8""\xE0""\xA5""\x9C""\xE0""\xA4""\x95""" " \xE0""\xA4""\xA6""\xE0""\xA5""\x81""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""" "\xE0""\xA4""\x98""\xE0""\xA4""\x9F""\xE0""\xA4""\xA8""\xE0""\xA4""\xBE""" " \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82"" 23\xC2""\xA0""\xE0""" "\xA4""\x95""\xE0""\xA5""\x80"" \xE0""\xA4""\xAE""\xE0""\xA5""\x8C""\xE0""" "\xA4""\xA4""               " ";\r\n \r\n \xE0""\xA4""\x85""\xE0""\xA4""\xB0""\xE0""\xA5""" "\x81""\xE0""\xA4""\xA3""\xE0""\xA4""\xBE""\xE0""\xA4""\x9A""\xE0""\xA4""" "\xB2"" \xE0""\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""" "\xA6""\xE0""\xA5""\x87""\xE0""\xA4""\xB6"" \xE0""\xA4""\xAD""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xB0""\xE0""\xA4""\xA4"" \xE0""\xA4""\x95""\xE0""\xA4""" "\xBE"" \xE0""\xA4""\x85""\xE0""\xA4""\xB5""\xE0""\xA4""\xBF""\xE0""\xA4""" "\xAD""\xE0""\xA4""\xBE""\xE0""\xA4""\x9C""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xAF"" \xE0""\xA4""\x85""\xE0""\xA4""\x82""\xE0""\xA4""\x97"": \xE0""\xA4""" "\x96""\xE0""\xA4""\xBE""\xE0""\xA4""\x82""\xE0""\xA4""\xA6""\xE0""\xA5""" "\x82""               \r\n " " \r\n\r\n \r\n\r\n\r\n\r\n \r\n" " \r\n \r\n
\r\n \"\"\r\n
\r\n" "\r\n\r\n" "\r\n\r\n\r\n\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r" "\n \r\n
\r\n\r\n\r\n\r\n" "\r\n \r\n \r\n" " \r\n " " \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n " " \r\n\r\n \r\n \r\n \r\n \r\n \r\n " "\r\n \r\n \r\n " " \r\n " " \r\n " "\r\n\r\n\r\n\t\t
\r\n\r\n" "\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n\r\n\r\n \r\n \r\n\r\n\r\n \r\n \r\n\r\n\r\n" " \r\n \r\n\r\n\r\n \r\n \r\n\r\n\r\n " " \r\n \r\n\r\n\r\n \r\n \r\n\r\n\r\n " " \r\n \r\n\r\n\r\n \r\n \r\n\r\n<" "th>\r\n \r\n \r\n\r\n\r\n \r\n \r\n\r\n \r\n " " \r\n\r\n<" "/tr>\r\n \r\n \r\n\r\n" "\r\n \r\n \r\n\r\n\r\n " " \r\n \r\n\r\n\r\n" " \r\n \r\n\r\n\r\n " " \r\n \r\n\r\n\r\n " " \r\n \r\n\r\n\r\n \r\n \r\n\r\n\r\n \r\n \r\n\r\n\r\n \r\n \r\n" "\r\n\r\n \r\n \r\n\r\n\r\n " " \r\n \r\n\r\n\r\n " " \r\n \r\n\r\n\r\n \r\n " " \r\n\r\n\r\n " " \r\n \r\n\r\n\r\n \r\n \r\n\r\n \r\n \r\n\t\t\"\"\r\n
  \xE0""\xA4""\x9A""\xE0""\xA5""\x88""\xE0""" "\xA4""\xA8""\xE0""\xA4""\xB2""\xE0""\xA5""\x8D""\xE0""\xA4""\xB8""
 \"\"
 \r\n\xE0""\xA4""\xAE""\xE0""\xA5""" "\x81""\xE0""\xA4""\x96""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF"" \xE0""\xA4""" "\xAA""\xE0""\xA5""\x83""\xE0""\xA4""\xB7""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xA0""
 \r\n\xE0""\xA4""\xB8""\xE0""\xA4""\xAE""\xE0""" "\xA4""\xBE""\xE0""\xA4""\x9A""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""
&nbs" "p;\r\n\xE0""\xA4""\xAA""\xE0""\xA4""\x82""\xE0""" "\xA4""\x9A""\xE0""\xA4""\xBE""\xE0""\xA4""\x82""\xE0""\xA4""\x97"" 2007<" "/a>
 \r\n\xE0""\xA4""\xA7""\xE0""\xA4""\xB0""\xE0""" "\xA5""\x8D""\xE0""\xA4""\xAE"" \xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\x97""
 \r" "\n\xE0""\xA4""\x9C""\xE0""\xA5""\x82""\xE0""\xA4""\xA8""\xE0""" "\xA4""\xBF""\xE0""\xA4""\xAF""\xE0""\xA4""\xB0"" \xE0""\xA4""\x9C""\xE0""" "\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3""
&nbs" "p;\r\n7272
 \r\n<" "a id=\"BottomNavRepeat_ctl06_HyperLink1\" title=\"News with difference\"" " href=\"/hatke\">\xE0""\xA4""\x9C""\xE0""\xA4""\xB0""\xE0""\xA4""\xBE"" " "\xE0""\xA4""\xB9""\xE0""\xA4""\x9F"" \xE0""\xA4""\x95""\xE0""\xA5""\x87""" "
 \r\n\xE0""\xA4""\x9C""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3""" " \xE0""\xA4""\x97""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x80""" "\xE0""\xA4""\x9F""\xE0""\xA4""\xBF""\xE0""\xA4""\x82""\xE0""\xA4""\x97""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xB8""
 \r\n\xE0""\xA4""\xB8""\xE0""\xA4""\xBE""\xE0""\xA4""\xB9""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF""
 \r\n\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x97""" "\xE0""\xA4""\xB0""\xE0""\xA4""\xA3"" \xE0""\xA4""\xB0""\xE0""\xA5""\x87""" "\xE0""\xA4""\xA1""\xE0""\xA4""\xBF""\xE0""\xA4""\xAF""\xE0""\xA5""\x8B""" "
 \r\n\xE0""\xA4""\x88""-\xE0""\xA4""" "\xAA""\xE0""\xA5""\x87""\xE0""\xA4""\xAA""\xE0""\xA4""\xB0""<" "/th>
 \r\n\r\n\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""" "\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3"" \xE0""\xA4""\xB8""\xE0""\xA4""" "\x96""\xE0""\xA5""\x80""
 \r\n\xE0""\xA4""\x86""\xE0""\xA4""\xAA""\xE0""\xA4""\x95""\xE0""\xA5""\x80""" " \xE0""\xA4""\xAC""\xE0""\xA4""\xBE""\xE0""\xA4""\xA4""
 \r\n\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x97""" "\xE0""\xA4""\xB0""\xE0""\xA4""\xA3"" \xE0""\xA4""\xAF""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xBE""" "
 \r\n\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""" "\xE0""\xA4""\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3"" \xE0""\xA4""\x95""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xBF""\xE0""\xA4""\x95""" "\xE0""\xA5""\x87""\xE0""\xA4""\x9F""
 \r\n\xE0""" "\xA4""\xB8""\xE0""\xA4""\xBF""\xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""" "\xA4""\xAE""\xE0""\xA5""\x9B""\xE0""\xA4""\xBE""
 \r" "\n\xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""" "\xB0""\xE0""\xA4""\xBE"" \xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""" "\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3""
 \r\n\xE0""\xA4""\xB5""\xE0""\xA4""\xB0""" "\xE0""\xA5""\x8D""\xE0""\xA4""\x97""\xE0""\xA5""\x80""\xE0""\xA4""\x95""" "\xE0""\xA5""\x83""\xE0""\xA4""\xA4""
 \r\n\xE0""" "\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""\xE0""" "\xA4""\xA3"" \xE0""\xA4""\x9C""\xE0""\xA5""\x8B""\xE0""\xA4""\xB6""<" "/font>
&nb" "sp;\r\n\xE0""\xA4""\xB0""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xB6""\xE0""\xA4""\xBF""\xE0""\xA4""\xAB""\xE0""\xA4""\xB2""" "
 \r\n\xE0""\xA4""\x97""\xE0""\xA5""\x81""\xE0""" "\xA4""\xA6""\xE0""\xA4""\x97""\xE0""\xA5""\x81""\xE0""\xA4""\xA6""\xE0""" "\xA5""\x80""
 \r\n\xE0""\xA4""\x96""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xA8""\xE0""\xA4""\xBE"" \xE0""\xA4""\x96""" "\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8""\xE0""\xA4""\xBE""" "
 \r\n\xE0""\xA4""\x9C""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3""" " \xE0""\xA4""\xB6""\xE0""\xA5""\x89""\xE0""\xA4""\xAA""\xE0""\xA4""\xBF""" "\xE0""\xA4""\x82""\xE0""\xA4""\x97""
 \r\n\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""" "\xE0""\xA4""\xA3"" \xE0""\xA4""\xB5""\xE0""\xA4""\xBF""\xE0""\xA4""\xB6""" "\xE0""\xA5""\x87""\xE0""\xA4""\xB7""
 \r\n\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""" "\xB0""\xE0""\xA4""\xA3"" \xE0""\xA4""\x87""\xE0""\xA4""\xAE""\xE0""\xA5""" "\x87""\xE0""\xA4""\x9C""
 \r\n\xE0""\xA4""" "\xAE""\xE0""\xA4""\x82""\xE0""\xA4""\xA1""\xE0""\xA4""\xBF""\xE0""\xA4""" "\xAF""\xE0""\xA4""\xBE""\xE0""\xA4""\x82""
 \r\n\xE0""\xA4""\xB0""\xE0""\xA4""\xBF""\xE0""\xA4""" "\x9C""\xE0""\xA4""\xB2""\xE0""\xA5""\x8D""\xE0""\xA4""\x9F""<" "/th>
 \r\n\r\n\xE0""\xA4""\x9C""\xE0""\xA4""" "\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3"" \xE0""\xA4""" "\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x9F""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xB0""\xE0""\xA5""\x80""\xE0""\xA4""\xAE""\xE0""\xA5""\x89""\xE0""\xA4""" "\xA8""\xE0""\xA5""\x80""
\xE0""\xA4""\xB8""\xE0""\xA4""\xBF""\xE0""\xA4""\x9F""\xE0""\xA5""" "\x80"" \xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""" "\xB0""\xE0""\xA4""\xA3""
 (\xE0""\xA4""\x95""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xA8""\xE0""\xA4""\xAA""\xE0""\xA5""\x81""\xE0""\xA4""\xB0""" ")
 (\xE0""\xA4""\xA8""\xE0""\xA4""\x88"" \xE0""\xA4""\xA6""\xE0""" "\xA4""\xBF""\xE0""\xA4""\xB2""\xE0""\xA5""\x8D""\xE0""\xA4""\xB2""\xE0""" "\xA5""\x80"")
 (\xE0""\xA4""\xB2""\xE0""\xA4""\x96""" "\xE0""\xA4""\xA8""\xE0""\xA4""\x8A"")

\r\n " " \r\n \r\n \r\n " " \r\n \r\n \r" "\n \r\n \r\n \r\n \r\n   \xE0""" "\xA4""\x95""\xE0""\xA5""\x8B""\xE0""\xA4""\xB2""\xE0""\xA4""\x95""\xE0""" "\xA4""\xBE""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE""\r\n " " \r\n \r\n \r\n \r\n <" "tr>\r\n \r\n " " \r\n \r\n \r\n \r\n " " \r\n \r\n \r\n <" "td align=\"center\" vAlign=\"bottom\">21.3\r\n \r\n \r\n \r\n \r\n \r\n \r\n " " \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n " "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n   \xE0""" "\xA4""\xAC""\xE0""\xA5""\x80""\xE0""\xA4""\x8F""\xE0""\xA4""\xB8""\xE0""" "\xA4""\x88""\r\n \r\n +4.75 " " \r\n \r\n \r\n \r\n \r\n " "\r\n \r\n \r\n \r\n " "\r\n \r\n \r\n \r\n \r\n" " \r\n \r\n \r\n 43.11\r\n \r\n \r\n \r\n " "\r\n \r\n \r\n \r\n \r\n " " \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n
  " "  \"\"\"\"
  \"\"\r\n \"\"
34.226.3
  \xE0""\xA4""\x9A""\xE0""\xA5""\x87""\xE0""\xA4""\xA8""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xA8""\xE0""\xA4""\x88""3" "4.221.2
  " "\xE0""\xA4""\xA8""\xE0""\xA4""\x88"" \xE0""\xA4""" "\xA6""\xE0""\xA4""\xBF""\xE0""\xA4""\xB2""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xB2""\xE0""\xA5""\x80""35.2
  \xE0""" "\xA4""\xAE""\xE0""\xA5""\x81""\xE0""\xA4""\x82""\xE0""\xA4""\xAC""\xE0""" "\xA4""\x88""33.223.2
\"\"
    \"\"\"\"
  " ";\"\"\r\n \"\"
  \xE0""\xA4""" "\x8F""\xE0""\xA4""\xA8""\xE0""\xA4""\x8F""\xE0""\xA4""\xB8""\xE0""\xA4""" "\x88""<" "font face=arial size=1>3848.15 +4.65
13182.49
\"\"
    \"\"\"\"
 \"\"\"\"
 &nb" "sp;\xE0""\xA4""\xA1""\xE0""\xA4""\xBE""\xE0""\xA4""" "\xB2""\xE0""\xA4""\xB0""42.72
  \xE0""\xA4""" "\xAA""\xE0""\xA5""\x8C""\xE0""\xA4""\x82""\xE0""\xA4""\xA1""83.9484.93
 &nbs" "p;\xE0""\xA4""\xAF""\xE0""\xA5""\x87""\xE0""\xA4""" "\xA8""35.8136.60
  \xE0""\xA4""\xAF""\xE0""\xA5""" "\x82""\xE0""\xA4""\xB0""\xE0""\xA5""\x8B""57.24\r\n 57.98
    
    
\r\n
\r\n\r\n \r\n \r\n " "
  O \xE0""\xA4""\xAD""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""\xA4""\xA4""-\xE0""\xA4""\xAA""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x95"" \xE0""\xA4""\xB0""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xB6""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA5""\x8B""" "\xE0""\xA4""\x82"" \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82""" " \xE0""\xA4""\x86""\xE0""\xA4""\xA4""\xE0""\xA4""\x82""\xE0""\xA4""\x95""" "\xE0""\xA4""\xB5""\xE0""\xA4""\xBE""\xE0""\xA4""\xA6"" \xE0""\xA4""\x9A""" "\xE0""\xA4""\xBF""\xE0""\xA4""\x82""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE""" " \xE0""\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB5""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xB7""\xE0""\xA4""\xAF""
  O \r\n \xE0""\xA4""" "\xA8""\xE0""\xA5""\x87""\xE0""\xA4""\xAA""\xE0""\xA4""\xBE""\xE0""\xA4""" "\xB2"" \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""" "\xAE""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""\xA4""\xB5""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xA1""\xE0""\xA4""\xBC""\xE0""\xA5""\x80"" \xE0""\xA4""" "\x95""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""\xA5""\x8B""\xE0""\xA4""" "\xAC""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""\xA5""\x80"" \xE0""\xA4""" "\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\x85""\xE0""\xA4""\xAA""\xE0""\xA4""" "\xB9""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3""
  O \xE0""" "\xA4""\xAE""\xE0""\xA5""\x81""\xE0""\xA4""\xA0""\xE0""\xA4""\xAD""\xE0""" "\xA5""\x87""\xE0""\xA5""\x9C"" \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""" "\xA4""\x82"" \xE0""\xA4""\x86""\xE0""\xA4""\xA0"" \xE0""\xA4""\x95""\xE0""" "\xA4""\x9F""\xE0""\xA5""\x8D""\xE0""\xA4""\x9F""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\x89""\xE0""\xA4""\xB2""\xE0""\xA5""\x8D""\xE0""\xA4""\xAB""\xE0""" "\xA4""\xBE"" \xE0""\xA4""\x89""\xE0""\xA4""\x97""\xE0""\xA5""\x8D""\xE0""" "\xA4""\xB0""\xE0""\xA4""\xB5""\xE0""\xA4""\xBE""\xE0""\xA4""\xA6""\xE0""" "\xA5""\x80"" \xE0""\xA4""\xA2""\xE0""\xA5""\x87""\xE0""\xA4""\xB0""<" "/font>
&n" "bsp; O \xE0""\xA4""\x9A""\xE0""\xA5""\x81""\xE0""\xA4""\xA8""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xB5"" \xE0""\xA4""\x86""\xE0""\xA4""\xAF""" "\xE0""\xA5""\x8B""\xE0""\xA4""\x97"" \xE0""\xA4""\xB8""\xE0""\xA5""\x87""" " \xE0""\xA4""\x9F""\xE0""\xA4""\x95""\xE0""\xA4""\xB0""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xB5"" \xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\xB0""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""" "\xE0""\xA5""\x87"" \xE0""\xA4""\xAA""\xE0""\xA4""\xB0"" \xE0""\xA4""\xA8""" "\xE0""\xA4""\xB9""\xE0""\xA5""\x80""\xE0""\xA4""\x82"": \xE0""\xA4""\xAD""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x9C""\xE0""\xA4""\xAA""\xE0""\xA4""\xBE""" "
" "  O \xE0""\xA4""\xAA""\xE0""\xA4""\xBE""\xE0""\xA4""" "\x95"" \xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""\xAA""\xE0""\xA4""" "\xBE""\xE0""\xA4""\x87""\xE0""\xA4""\xAA""\xE0""\xA4""\xB2""\xE0""\xA4""" "\xBE""\xE0""\xA4""\x87""\xE0""\xA4""\xA8"" \xE0""\xA4""\x97""\xE0""\xA5""" "\x88""\xE0""\xA4""\xB8"" \xE0""\xA4""\xAC""\xE0""\xA4""\x82""\xE0""\xA4""" "\x9F""\xE0""\xA4""\xB5""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""\xA5""" "\x87"" \xE0""\xA4""\x95""\xE0""\xA5""\x8B"" \xE0""\xA4""\xAE""\xE0""\xA4""" "\x82""\xE0""\xA4""\x9C""\xE0""\xA5""\x82""\xE0""\xA4""\xB0""\xE0""\xA5""" "\x80"" \xE0""\xA4""\xA6""\xE0""\xA5""\x80""
  O \xE0""\xA4""\xB8""" "\xE0""\xA5""\x80""\xE0""\xA4""\xB2""\xE0""\xA4""\xBF""\xE0""\xA4""\x82""" "\xE0""\xA4""\x97"" \xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""\xA4""\xAE""" "\xE0""\xA4""\xB2""\xE0""\xA5""\x87"" \xE0""\xA4""\xAE""\xE0""\xA5""\x87""" "\xE0""\xA4""\x82"" \xE0""\xA4""\xA6""\xE0""\xA4""\xBF""\xE0""\xA4""\xB2""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xB2""\xE0""\xA5""\x80"" \xE0""\xA4""\xAA""" "\xE0""\xA5""\x81""\xE0""\xA4""\xB2""\xE0""\xA4""\xBF""\xE0""\xA4""\xB8""" " \xE0""\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xAE""" "\xE0""\xA5""\x81""\xE0""\xA4""\x96"" \xE0""\xA4""\xA4""\xE0""\xA4""\xB2""" "\xE0""\xA4""\xAC""
  O \xE0""" "\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xB5""\xE0""" "\xA5""\x80""\xE0""\xA4""\xA3"" \xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""" "\xA4""\x8F""\xE0""\xA4""\x95"" \xE0""\xA4""\x95""\xE0""\xA4""\xB0""\xE0""" "\xA5""\x8B""\xE0""\xA5""\x9C"" \xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""" "\xA4""\x82""\xE0""\xA4""\x97""\xE0""\xA5""\x87"" \xE0""\xA4""\xA5""\xE0""" "\xA5""\x87"": \xE0""\xA4""\xB0""\xE0""\xA5""\x87""\xE0""\xA4""\x96""\xE0""" "\xA4""\xBE"" \xE0""\xA4""\xAE""\xE0""\xA4""\xB9""\xE0""\xA4""\xBE""\xE0""" "\xA4""\x9C""\xE0""\xA4""\xA8""
  O \xE0""\xA4""\xAA""\xE0""\xA5""\x80""\xE0""\xA4""\x8F""\xE0""\xA4""" "\xB8""\xE0""\xA4""\x8F""\xE0""\xA4""\xB2""\xE0""\xA4""\xB5""\xE0""\xA5""" "\x80"" \xE0""\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB5""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xA3""\xE0""\xA4""\xBF""\xE0""\xA4""\x9C""\xE0""\xA5""" "\x8D""\xE0""\xA4""\xAF""\xE0""\xA4""\xBF""\xE0""\xA4""\x95"" \xE0""\xA4""" "\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\x95""\xE0""\xA5""" "\x8D""\xE0""\xA4""\xB7""\xE0""\xA5""\x87""\xE0""\xA4""\xAA""\xE0""\xA4""" "\xA3"" 23 \xE0""\xA4""\x95""\xE0""\xA5""\x8B""
 \r" "\n
\r\n\r\n \r\n \r\n \t\t\r\n " " \r\n \r\n
    \xE0""\xA4""\x9C""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3""" " \xE0""\xA4""\x87""\xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x9C""" "
\r\n \r\n \r\n
\r\n " "\xE0""\xA4""\xAA""\xE0""\xA5""\x82""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xB5""\xE0""\xA5""\x8B""\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xA4""\xE0""\xA4""\xB0"" \xE0""\xA4""\x95""\xE0""\xA5""\x87""" " \xE0""\xA4""\xB5""\xE0""\xA4""\xBF""\xE0""\xA4""\x95""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xB8"" \xE0""\xA4""\xAA""\xE0""\xA4""\xB0"" \xE0""\xA4""\x9C""" "\xE0""\xA5""\x8B""\xE0""\xA4""\xB0"" \r\n
\r\n \r\n" "
\t\t\r\n \r\n\r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n " " \r\n\r\n\r\n\r\n
\"\"
\r\n\r\n \r\n \r\n \xE0""\xA4""\xB5""\xE0""" "\xA5""\x87""\xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\x9F""\xE0""" "\xA4""\x87""\xE0""\xA4""\x82""\xE0""\xA4""\xA1""\xE0""\xA5""\x80""\xE0""" "\xA4""\x9C""-\xE0""\xA4""\xA6""\xE0""\xA4""\x95""\xE0""\xA5""\x8D""\xE0""" "\xA4""\xB7""\xE0""\xA4""\xBF""\xE0""\xA4""\xA3"" \xE0""\xA4""\x85""\xE0""" "\xA4""\xAB""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x80""\xE0""" "\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB5""\xE0""\xA4""\xA8""\xE0""" "\xA4""\xA1""\xE0""\xA5""\x87""\xC2""\xA0""\xE0""\xA4""\x95""\xE0""\xA5""" "\x87"" \xE0""\xA4""\xB2""\xE0""\xA4""\xBE""\xE0""\xA4""\x87""\xE0""\xA4""" "\xB5""\xC2""\xA0""\xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\x95""" "\xE0""\xA5""\x8B""\xE0""\xA4""\xB0"" \xE0""\xA4""\x95""\xE0""\xA5""\x87""" " \xE0""\xA4""\xB2""\xE0""\xA4""\xBF""\xE0""\xA4""\x8F"" \xE0""\xA4""\xAF""" "\xE0""\xA4""\xB9""\xE0""\xA4""\xBE""\xE0""\xA4""\x82"" \xE0""\xA4""\x95""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xB2""\xE0""\xA4""\xBF""\xE0""\xA4""\x95""" "\xC2""\xA0""\xE0""\xA4""\x95""\xE0""\xA4""\xB0""\xE0""\xA5""\x87""\xE0""" "\xA4""\x82"" \r\n \r\n
\xE0""" "\xA4""\x95""\xE0""\xA4""\xBF""\xE0""\xA4""\xA4""\xE0""\xA4""\xA8""\xE0""" "\xA4""\xBE"" \xE0""\xA4""\xA8""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF""\xE0""" "\xA4""\xBE""\xE0""\xA4""\xAF""\xE0""\xA5""\x8B""\xE0""\xA4""\x9A""\xE0""" "\xA4""\xBF""\xE0""\xA4""\xA4"" \xE0""\xA4""\xB9""\xE0""\xA5""\x88"" \xE0""" "\xA4""\xA8""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xAF""\xE0""\xA4""\xBE""\xE0""\xA4""\xB2""\xE0""\xA4""\xAF"" \xE0""" "\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xAB""\xE0""\xA5""\x88""\xE0""" "\xA4""\xB8""\xE0""\xA4""\xB2""\xE0""\xA4""\xBE""?
\r\n\r\n\r\n\r\n\r\n \r\n\t\t \r\n\r" "\n\r\n \r\n\r\n " " \r\n \r\n \r\n " "\r\n \t\t\t\r\n<" "!-- josh & hatke -->\r\n\r\n \r\n \r\n\t" "\t\t\r\n\r\n \r\n\r\n\r\n\r\n \r\n<" "tr>\r\n\r\n
\r\n \r\n" " \r\n \r\n
 " "\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""" "\xE0""\xA4""\xA3"" \xE0""\xA4""\x95""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""" "\xE0""\xA4""\xBF""\xE0""\xA4""\x95""\xE0""\xA5""\x87""\xE0""\xA4""\x9F""" "
\r\n \r\n \r\n \r\n \r\n\t\r\n\t\t\r\n\t\r\n
\r\n\r\n \xE0""\xA4""\x95""\xE0""" "\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xA8"" \xE0""\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""\xA4""\xB9""\xE0""" "\xA5""\x8B""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""\xE0""" "\xA5""\x88"" \xE0""\xA4""\x9F""\xE0""\xA5""\x80""\xE0""\xA4""\xAE"" \xE0""" "\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xAC""\xE0""\xA5""\x89""\xE0""" "\xA4""\xB8"":\xC2""\xA0""\xE0""\xA4""\xB6""\xE0""\xA4""\xBE""\xE0""\xA4""" "\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xB0""\xE0""\xA5""\x80""
\xE0""\xA4""\xA8""\xE0""\xA4""\x88""" " \xE0""\xA4""\xA6""\xE0""\xA4""\xBF""\xE0""\xA4""\xB2""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xB2""\xE0""\xA5""\x80"", 10 \xE0""\xA4""\x85""\xE0""\xA4""\xAA""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x88""\xE0""\xA4""\xB2""" "\xE0""\xA5""\xA4"" \xE0""\xA4""\xAA""\xE0""\xA4""\xBF""\xE0""\xA4""\x9B""" "\xE0""\xA4""\xB2""\xE0""\xA5""\x87"" \xE0""\xA4""\xA6""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xA8""\xE0""\xA5""\x8B""\xE0""\xA4""\x82"" \xE0""\xA4""\xAC""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x82""\xE0""\xA4""\x97""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xB2""\xE0""\xA4""\xBE""\xE0""\xA4""\xA6""\xE0""\xA5""\x87""" "\xE0""\xA4""\xB6"" \xE0""\xA4""\xA6""\xE0""\xA5""\x8C""\xE0""\xA4""\xB0""" "\xE0""\xA5""\x87"" \xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\xB2""" "\xE0""\xA4""\xBF""\xE0""\xA4""\x8F"" \xE0""\xA4""\xAD""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xB0""\xE0""\xA4""\xA4""\xE0""\xA5""\x80""\xE0""\xA4""\xAF""" " \xE0""\xA4""\x95""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xBF""" "\xE0""\xA4""\x95""\xE0""\xA5""\x87""\xE0""\xA4""\x9F"" \xE0""\xA4""\x9F""" "\xE0""\xA5""\x80""\xE0""\xA4""\xAE"" \xE0""\xA4""\x95""\xE0""\xA5""\x87""" " \xE0""\xA4""\xAE""\xE0""\xA5""\x88""\xE0""\xA4""\xA8""\xE0""\xA5""\x87""" "\xE0""\xA4""\x9C""\xE0""\xA4""\xB0"" \xE0""\xA4""\xA8""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xAF""\xE0""\xA5""\x81""\xE0""\xA4""\x95""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xA4"" \xE0""\xA4""\x95""\xE0""\xA4""\xBF""\xE0""\xA4""\x8F""" " \xE0""\xA4""\x97""\xE0""\xA4""\x8F"" \xE0""\xA4""\xAA""\xE0""\xA5""\x82""" "\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\xB5"" \xE0""\xA4""\xB9""" "\xE0""\xA4""\xB0""\xE0""\xA4""\xAB""\xE0""\xA4""\xA8""\xE0""\xA4""\xAE""" "\xE0""\xA5""\x8C""\xE0""\xA4""\xB2""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB0""" "\xE0""\xA4""\xB5""\xE0""\xA4""\xBF"" \xE0""\xA4""\xB6""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xB0""\xE0""\xA5""\x80"" \xE0""\xA4""\xA8""\xE0""\xA5""\x87""" " \xE0""\xA4""\x95""\xE0""\xA4""\xB9""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""" "\xE0""\xA5""\x88"" \xE0""\xA4""\x95""\xE0""\xA4""\xBF"" \xE0""\xA4""\x95""" "\xE0""\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xA8"" \xE0""\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""\xA4""\x9F""" "\xE0""\xA5""\x80""\xE0""\xA4""\xAE"" \xE0""\xA4""\x95""\xE0""\xA4""\xBE""" " \xE0""\xA4""\xAC""\xE0""\xA5""\x89""\xE0""\xA4""\xB8""\xC2""\xA0""\xE0""" "\xA4""\xB9""\xE0""\xA5""\x8B""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE"" \xE0""" "\xA4""\xB9""\xE0""\xA5""\x88""\xE0""\xA5""\xA4""
\xC2""\xA0""\xC2""\xA0""" "\xC2""\xA0""\xC2""\xA0""\xE0""\xA4""\xB6""\xE0""\xA4""\xBE""\xE0""\xA4""" "\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xB0""\xE0""\xA5""\x80"" \xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""" "\x9C""\xE0""\xA5""\x8B""\xE0""\xA4""\xB0"" \xE0""\xA4""\xA6""\xE0""\xA5""" "\x87""\xE0""\xA4""\x95""\xE0""\xA4""\xB0"" \xE0""\xA4""\x95""\xE0""\xA4""" "\xB9""\xE0""\xA4""\xBE"", '\xE0""\xA4""\x9F""\xE0""\xA5""\x80""\xE0""\xA4""" "\xAE"" \xE0""\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xAC""\xE0""\xA5""" "\x89""\xE0""\xA4""\xB8""\xC2""\xA0""\xE0""\xA4""\x95""\xE0""\xA4""\xAA""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8""" " \xE0""\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""\xA4""\xB9""\xE0""\xA5""\x8B""" "\xE0""\xA4""\xA4""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""\xE0""\xA5""\x88""" "\xE0""\xA5""\xA4""' \xE0""\xA4""\xB6""\xE0""\xA4""\xBE""\xE0""\xA4""\xB8""" "\xE0""\xA5""\x8D"" \"\"
\r\n " " \r\n\t\t\t
\r\n\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t
\"\"
\r\n\r\n \r\n \r\n
   \xE0""\xA4""" "\x97""\xE0""\xA5""\x81""\xE0""\xA4""\xA6""\xE0""\xA4""\x97""\xE0""\xA5""" "\x81""\xE0""\xA4""\xA6""\xE0""\xA5""\x80""
\r\n " "\r\n \r\n
\r\n \r\n \xE0""\xA4""\xA6""\xE0""\xA4""\xBE""\xE0""\xA4""\xA6""\xE0""" "\xA4""\xBE"" (\xE0""\xA4""\xB8""\xE0""\xA5""\x8B""\xE0""\xA4""\xB9""" "\xE0""\xA4""\xA8"" \xE0""\xA4""\xB8""\xE0""\xA5""\x87"")- \xE0""\xA4""\xAC""" "\xE0""\xA5""\x87""\xE0""\xA4""\x9F""\xE0""\xA4""\xBE"", \xE0""\xA4""\x85""" "\xE0""\xA4""\x82""\xE0""\xA4""\xA6""\xE0""\xA4""\xB0"" \xE0""\xA4""\xB8""" "\xE0""\xA5""\x87"" \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\xB0""" "\xE0""\xA5""\x87"" \xE0""\xA4""\xA6""\xE0""\xA4""\xBE""\xE0""\xA4""\x82""" "\xE0""\xA4""\xA4"" \xE0""\xA4""\xA4""\xE0""\xA5""\x8B"" \xE0""\xA4""\xB2""" "\xE0""\xA5""\x87"" \xE0""\xA4""\x86""\xE0""\xA5""\xA4""
\r\n\xE0""" "\xA4""\xB8""\xE0""\xA5""\x8B""\xE0""\xA4""\xB9""\xE0""\xA4""\xA8"" (" "\xE0""\xA4""\xA6""\xE0""\xA4""\xBE""\xE0""\xA4""\xA6""\xE0""\xA4""\xBE""" " \xE0""\xA4""\xB8""\xE0""\xA5""\x87"")-\xE0""\xA4""\xAA""\xE0""\xA4""\xB0""" " \xE0""\xA4""\xA6""\xE0""\xA4""\xBE""\xE0""\xA4""\xA6""\xE0""\xA4""\xBE""" "\xE0""\xA4""\x9C""\xE0""\xA5""\x80""\xC2""\xA0""\xE0""\xA4""\x85""\xE0""" "\xA4""\xAD""\xE0""\xA5""\x80"" \xE0""\xA4""\xB0""\xE0""\xA5""\x8B""\xE0""" "\xA4""\x9F""\xE0""\xA5""\x80"" \xE0""\xA4""\xA4""\xE0""\xA5""\x8B"" \xE0""" "\xA4""\xAC""\xE0""\xA4""\xA8""\xE0""\xA5""\x80"" \xE0""\xA4""\xA8""\xE0""" "\xA4""\xB9""\xE0""\xA5""\x80""\xE0""\xA4""\x82""\xE0""\xA5""\xA4""
\r" "\n\xE0""\xA4""\xA6""\xE0""\xA4""\xBE""\xE0""\xA4""\xA6""\xE0""\xA4""\xBE""" "- \xE0""\xA4""\x93"" \xE0""\xA4""\xB0""\xE0""\xA5""\x8B""\xE0""\xA4""" "\x9F""\xE0""\xA5""\x80"" \xE0""\xA4""\xA8""\xE0""\xA4""\xB9""\xE0""\xA5""" "\x80""\xE0""\xA4""\x82"" \xE0""\xA4""\x96""\xE0""\xA4""\xBE""\xE0""\xA4""" "\xA8""\xE0""\xA5""\x80"" \xE0""\xA4""\xB8""\xE0""\xA4""\xBE""\xE0""\xA4""" "\xAE""\xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""\xB5""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xB2""\xE0""\xA5""\x80"" \xE0""\xA4""\xAC""\xE0""\xA5""" "\x81""\xE0""\xA4""\xA2""\xE0""\xA4""\xBF""\xE0""\xA4""\xBC""\xE0""\xA4""" "\xAF""\xE0""\xA4""\xBE"" \xE0""\xA4""\x95""\xE0""\xA5""\x8B"" \xE0""\xA4""" "\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""\xA4""" "\x87""\xE0""\xA4""\xB2""\xC2""\xA0""\xE0""\xA4""\xA6""\xE0""\xA5""\x87""" "\xE0""\xA4""\xA8""\xE0""\xA5""\x80"" \xE0""\xA4""\xB9""\xE0""\xA5""\x88""" "\xE0""\xA5""\xA4""  \"\"
\r\n " " \r\n
\r\n
\"\"
\r\n \r" "\n \r\n \r\n
 \xE0""\xA4""" "\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""\xE0""\xA4""" "\xA3"" \xE0""\xA4""\xB8""\xE0""\xA4""\x96""\xE0""\xA5""\x80""" " 
\r\n \r\n \r\n \r\n \r\n\t\r" "\n\t\t\r\n\t\r\n
\r\n\r\n \xE0""\xA4""\x95""" "\xE0""\xA4""\xB5""\xE0""\xA4""\xB0"" \xE0""\xA4""\xB8""\xE0""\xA5""\x8D""" "\xE0""\xA4""\x9F""\xE0""\xA5""\x8B""\xE0""\xA4""\xB0""\xE0""\xA5""\x80""" ": \xE0""\xA4""\xA8""\xE0""\xA4""\x88"" \xE0""\xA4""\xAA""\xE0""\xA4""" "\xB9""\xE0""\xA4""\x9A""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8"" \xE0""\xA4""" "\xA4""\xE0""\xA4""\xB2""\xE0""\xA4""\xBE""\xE0""\xA4""\xB6""\xE0""\xA4""" "\xA4""\xE0""\xA5""\x80"" \xE0""\xA4""\xAF""\xE0""\xA5""\x81""\xE0""\xA4""" "\xB5""\xE0""\xA4""\xBE"" \xE0""\xA4""\xAA""\xE0""\xA5""\x80""\xE0""\xA4""" "\xA2""\xE0""\xA4""\xBC""\xE0""\xA5""\x80""
\xE0""\xA4""\x89""\xE0""" "\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xB8""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xB9"", \xE0""\xA4""\x8A""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""" "\xA4""\x9C""\xE0""\xA4""\xBE"" \xE0""\xA4""\x94""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\xB9""\xE0""\xA4""\xB0"" \xE0""\xA4""\xAA""\xE0""\xA4""\xB2"" \xE0""" "\xA4""\xA8""\xE0""\xA4""\x88"" \xE0""\xA4""\x9A""\xE0""\xA5""\x81""\xE0""" "\xA4""\xA8""\xE0""\xA5""\x8C""\xE0""\xA4""\xA4""\xE0""\xA4""\xBF""\xE0""" "\xA4""\xAF""\xE0""\xA5""\x8B""\xE0""\xA4""\x82"" \xE0""\xA4""\x95""\xE0""" "\xA5""\x8B"" \xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xB5""\xE0""" "\xA5""\x80""\xE0""\xA4""\x95""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""" "\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""" "\xA4""\xB9""\xE0""\xA5""\x8C""\xE0""\xA4""\xB8""\xE0""\xA4""\xB2""\xE0""" "\xA5""\x87"" \xE0""\xA4""\xB8""\xE0""\xA5""\x87"" \xE0""\xA4""\xAD""\xE0""" "\xA4""\xB0""\xE0""\xA4""\xAA""\xE0""\xA5""\x82""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\xB9""\xE0""\xA5""\x88"" \xE0""\xA4""\x86""\xE0""\xA4""\x9C"" \xE0""" "\xA4""\x95""\xE0""\xA5""\x80"" \xE0""\xA4""\xAF""\xE0""\xA5""\x81""\xE0""" "\xA4""\xB5""\xE0""\xA4""\xBE"" \xE0""\xA4""\xAA""\xE0""\xA5""\x80""\xE0""" "\xA4""\xA2""\xE0""\xA4""\xBC""\xE0""\xA5""\x80""\xE0""\xA5""\xA4"" \xE0""" "\xA4""\x85""\xE0""\xA4""\xAA""\xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""" "\xA4""\xB2""\xE0""\xA4""\x95""\xE0""\xA5""\x8D""\xE0""\xA4""\xB7""\xE0""" "\xA5""\x8D""\xE0""\xA4""\xAF"" \xE0""\xA4""\x95""\xE0""\xA5""\x80"" \xE0""" "\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA4""\xBF"" \xE0""" "\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\x97"" \xE0""\xA4""\xAE""\xE0""" "\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\x86""\xE0""\xA4""\xA8""\xE0""" "\xA5""\x87"" \xE0""\xA4""\xB5""\xE0""\xA4""\xBE""\xE0""\xA4""\xB2""\xE0""" "\xA5""\x80"" \xE0""\xA4""\xAC""\xE0""\xA4""\xBE""\xE0""\xA4""\xA7""\xE0""" "\xA4""\xBE""\xE0""\xA4""\x93""\xE0""\xA4""\x82"" \xE0""\xA4""\xB8""\xE0""" "\xA5""\x87"" \xE0""\xA4""\x9C""\xE0""\xA5""\x82""\xE0""\xA4""\x9D""\xE0""" "\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""\x94""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\xB9""\xE0""\xA4""\xB0"" \xE0""\xA4""\xA4""\xE0""\xA4""\xB0""\xE0""" "\xA4""\xB9"" \xE0""\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\x9C""\xE0""" "\xA5""\x8B""\xE0""\xA4""\x96""\xE0""\xA4""\xBF""\xE0""\xA4""\xAE"" \xE0""" "\xA4""\x89""\xE0""\xA4""\xA0""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8""\xE0""" "\xA5""\x87"" \xE0""\xA4""\x95""\xE0""\xA5""\x80"" \xE0""\xA4""\xB9""\xE0""" "\xA4""\xBF""\xE0""\xA4""\xAE""\xE0""\xA5""\x8D""\xE0""\xA4""\xAE""\xE0""" "\xA4""\xA4"" \xE0""\xA4""\xB9""\xE0""\xA5""\x88"" \xE0""\xA4""\x89""\xE0""" "\xA4""\xB8""\xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82""\xE0""" "\xA5""\xA4"" \xE0""\xA4""\x86""\xE0""\xA4""\x9C"" \xE0""\xA4""\x95""\xE0""" "\xA4""\xBE"" \xE0""\xA4""\xAF""\xE0""\xA5""\x81""\xE0""\xA4""\xB5""\xE0""" "\xA4""\xBE"" \xE0""\xA4""\x9C""\xE0""\xA5""\x80""\xE0""\xA4""\xB5""\xE0""" "\xA4""\xA8"" \xE0""\xA4""\xB8""\xE0""\xA5""\x87"" \xE0""\xA4""\x9C""\xE0""" "\xA5""\x81""\xE0""\xA4""\xA1""\xE0""\xA4""\xBC""\xE0""\xA5""\x87"" \xE0""" "\xA4""\xB9""\xE0""\xA4""\xB0"" \xE0""\xA4""\xAA""\xE0""\xA4""\xB9""\xE0""" "\xA4""\xB2""\xE0""\xA5""\x82"" \xE0""\xA4""\xAA""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\xA4""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""" "\xA4""\x95""\xE0""\xA4""\xBF""\xE0""\xA4""\x95"" \xE0""\xA4""\xA2""\xE0""" "\xA4""\x82""\xE0""\xA4""\x97"" \xE0""\xA4""\xB8""\xE0""\xA5""\x87"" \xE0""" "\xA4""\xB8""\xE0""\xA5""\x8B""\xE0""\xA4""\x9A""\xE0""\xA4""\xA4""\xE0""" "\xA4""\xBE"" \xE0""\xA4""\xB9""\xE0""\xA5""\x88"", \xE0""\xA4""\xAC""\xE0""" "\xA4""\xB9""\xE0""\xA4""\xB8"" \xE0""\xA4""\x95""\xE0""\xA4""\xB0""\xE0""" "\xA4""\xA4""\xE0""\xA4""\xBE"" \xE0""\xA4""\x94""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\xB8""\xE0""\xA4""\x9F""\xE0""\xA5""\x80""\xE0""\xA4""\x95"" \xE0""" "\xA4""\xB5""\xE0""\xA4""\xBF""\xE0""\xA4""\xB6""\xE0""\xA5""\x8D""\xE0""" "\xA4""\xB2""\xE0""\xA5""\x87""\xE0""\xA4""\xB7""\xE0""\xA4""\xA3"" \xE0""" "\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\xAC""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xA6"" \xE0""\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""\xA4""\xB8""\xE0""" "\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""\xA4""\xA8""\xE0""\xA4""\xBF""\xE0""" "\xA4""\xB7""\xE0""\xA5""\x8D"" \"\"
" "\r\n \r\n
 
\r\n\t" "\t\r\n \r\n
 &nb" "sp;  \xE0""\xA4""\xB8""\xE0""\xA4""\xBF""\xE0""\xA4""\xA8""\xE0""" "\xA5""\x87"" \xE0""\xA4""\xAE""\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""<" "/font>  
 \r\n \r\n \r\n \r\n \r\n\t\r" "\n\t\t\r\n\t\r\n
\r\n\r\n " " \r\n " " '\xE0""\xA4""\xAE""\xE0""\xA5""\x88""" "\xE0""\xA4""\xA8""\xE0""\xA4""\x87""\xE0""\xA4""\x9F""\xE0""\xA4""\xB0""" "' \xE0""\xA4""\xB9""\xE0""\xA5""\x88""\xE0""\xA4""\x82"" \xE0""\xA4""\xAA""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x80""\xE0""\xA4""\xA4""" "\xE0""\xA4""\xBF"" \xE0""\xA4""\x9C""\xE0""\xA4""\xBF""\xE0""\xA4""\x82""" "\xE0""\xA4""\x9F""\xE0""\xA4""\xBE""!\r\n
\xE0""\xA4""\xAA""\xE0""\xA4""\xBF""\xE0""\xA4""\x9B""" "\xE0""\xA4""\xB2""\xE0""\xA5""\x87"" 27 \xE0""\xA4""\xAB""\xE0""\xA4""\xB0""" "\xE0""\xA4""\xB5""\xE0""\xA4""\xB0""\xE0""\xA5""\x80"" \xE0""\xA4""\xB8""" "\xE0""\xA5""\x87"" \xE0""\xA4""\xAA""\xE0""\xA4""\xA4""\xE0""\xA4""\xBF""" " \xE0""\xA4""\xB6""\xE0""\xA5""\x87""\xE0""\xA4""\x96""\xE0""\xA4""\xB0""" " \xE0""\xA4""\x95""\xE0""\xA4""\xAA""\xE0""\xA5""\x82""\xE0""\xA4""\xB0""" " \xE0""\xA4""\xB8""\xE0""\xA5""\x87"" \xE0""\xA4""\x85""\xE0""\xA4""\xB2""" "\xE0""\xA4""\x97"" \xE0""\xA4""\xB9""\xE0""\xA5""\x8B"" \xE0""\xA4""\x9A""" "\xE0""\xA5""\x81""\xE0""\xA4""\x95""\xE0""\xA5""\x80""\xE0""\xA4""\x82""" " \xE0""\xA4""\xB8""\xE0""\xA5""\x81""\xE0""\xA4""\x9A""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xBE""" " \xE0""\xA4""\x95""\xE0""\xA5""\x83""\xE0""\xA4""\xB7""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xA3""\xE0""\xA4""\xAE""\xE0""\xA5""\x82""\xE0""\xA4""\xB0""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA4""\xBF"" \xE0""\xA4""\xA8""" "\xE0""\xA5""\x87"" \xE0""\xA4""\x86""\xE0""\xA4""\x96""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xB0"" \xE0""\xA4""\xAC""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE""" " \xE0""\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""\xA4""\xA6""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xAF""\xE0""\xA4""\xBE"" \xE0""\xA4""\x95""\xE0""\xA4""\xBF""" " \xE0""\xA4""\x89""\xE0""\xA4""\xA8""\xE0""\xA4""\x95""\xE0""\xA5""\x87""" " \xE0""\xA4""\xA6""\xE0""\xA4""\xBE""\xE0""\xA4""\x82""\xE0""\xA4""\xAA""" "\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF"" \xE0""\xA4""\x95""" "\xE0""\xA5""\x8B"" \xE0""\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""" "\xE0""\xA5""\x80""\xE0""\xA4""\xA4""\xE0""\xA4""\xBF"" \xE0""\xA4""\x9C""" "\xE0""\xA4""\xBF""\xE0""\xA4""\x82""\xE0""\xA4""\x9F""\xE0""\xA4""\xBE""" " \xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""\xA4""\xE0""\xA5""\x8B""" "\xE0""\xA4""\xA1""\xE0""\xA4""\xBC""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""" "\xE0""\xA5""\x88"", \xE0""\xA4""\x87""\xE0""\xA4""\xB8""\xE0""\xA4""\xB2""" "\xE0""\xA4""\xBF""\xE0""\xA4""\x8F"" \xE0""\xA4""\x85""\xE0""\xA4""\xAC""" " \xE0""\xA4""\x90""\xE0""\xA4""\xB8""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB2""" "\xE0""\xA4""\x97""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""" "\xE0""\xA5""\x88"" \xE0""\xA4""\x95""\xE0""\xA4""\xBF"" \xE0""\xA4""\x9A""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xB0"" \xE0""\xA4""\xB8""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xB2"" \xE0""\xA4""\xAA""\xE0""\xA4""\xB9""\xE0""\xA4""\xB2""" "\xE0""\xA5""\x87"" \xE0""\xA4""\xAD""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""" "\xE0""\xA4""\xA4"" \xE0""\xA4""\xB2""\xE0""\xA5""\x8C""\xE0""\xA4""\x9F""" " \xE0""\xA4""\x86""\xE0""\xA4""\x88"" \xE0""\xA4""\xB8""\xE0""\xA5""\x81""" "\xE0""\xA4""\x9A""\xE0""\xA4""\xBF""\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xB0""\xE0""\xA4""\xBE"" \xE0""\xA4""\x95""\xE0""\xA5""\x83""" "\xE0""\xA4""\xB7""\xE0""\xA5""\x8D""\xE0""\xA4""\xA3""\xE0""\xA4""\xAE""" "\xE0""\xA5""\x82""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""" "\xE0""\xA4""\xBF"" \xE0""\xA4""\x94""\xE0""\xA4""\xB0"" \xE0""\xA4""\xB6""" "\xE0""\xA5""\x87""\xE0""\xA4""\x96""\xE0""\xA4""\xB0"" \xE0""\xA4""\x95""" "\xE0""\xA4""\xAA""\xE0""\xA5""\x82""\xE0""\xA4""\xB0"" \xE0""\xA4""\x95""" "\xE0""\xA5""\x87"" \xE0""\xA4""\xB8""\xE0""\xA4""\x82""\xE0""\xA4""\xAC""" "\xE0""\xA4""\x82""\xE0""\xA4""\xA7""\xE0""\xA5""\x8B""\xE0""\xA4""\x82""" " \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\x96""" "\xE0""\xA4""\x9F""\xE0""\xA4""\xBE""\xE0""\xA4""\xB8"" \xE0""\xA4""\xAA""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x80""\xE0""\xA4""\xA4""" "\xE0""\xA4""\xBF"" \xE0""\xA4""\x95""\xE0""\xA5""\x80"" \xE0""\xA4""\xB5""" "\xE0""\xA4""\x9C""\xE0""\xA4""\xB9"" \xE0""\xA4""\xB8""\xE0""\xA5""\x87""" " \xE0""\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""\xA4""\x86""\xE0""\xA4""\x88""" " \xE0""\xA4""\xA5""\xE0""\xA5""\x80""\xE0""\xA5""\xA4""
\xE0""\xA4""" "\xB8""\xE0""\xA5""\x81""\xE0""\xA4""\x9A""\xE0""\xA4""\xBF""\xE0""\xA4""" "\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xBE"" \xE0""\xA4""" "\xA8""\xE0""\xA5""\x87"" \xE0""\xA4""\xB6""\xE0""\xA5""\x87""\xE0""\xA4""" "\x96""\xE0""\xA4""\xB0"" \xE0""\xA4""\x95""\xE0""\xA5""\x80"" \xE0""\xA4""" "\xB5""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF""\xE0""\xA4""\xB8""\xE0""\xA5""" "\x8D""\xE0""\xA4""\xA4""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE"" \xE0""\xA4""" "\xA4""\xE0""\xA5""\x8B"" \"\"
\r\n " " \r\n
\r\n
\r\n\r\n " " \r\n \r\n " " \r\n
 \xE0""\xA4""\x96""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8""" "\xE0""\xA4""\xBE"" \xE0""\xA4""\x96""\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xA8""\xE0""\xA4""\xBE"" 
\r\n \r" "\n \r\n \r\n \r\n\t\r\n\t\t\r\n\t\r\n
\r\n\r\n \r\n \xE0""\xA4""" "\xB8""\xE0""\xA4""\xAE""\xE0""\xA4""\xB0"" \xE0""\xA4""\xAE""\xE0""\xA4""" "\xBF""\xE0""\xA4""\xB2""\xE0""\xA5""\x8D""\xE0""\xA4""\x95"" \xE0""\xA4""" "\xB6""\xE0""\xA5""\x87""\xE0""\xA4""\x95""
\xE0""\xA4""\x95""\xE0""\xA5""\x87""\xE0""\xA4""\xB2""" "\xE0""\xA5""\x87"" \xE0""\xA4""\xB5"" \xE0""\xA4""\x9A""\xE0""\xA5""\x80""" "\xE0""\xA4""\x95""\xE0""\xA5""\x82"" \xE0""\xA4""\x95""\xE0""\xA5""\x8B""" " \xE0""\xA4""\x9B""\xE0""\xA5""\x80""\xE0""\xA4""\xB2""\xE0""\xA4""\x95""" "\xE0""\xA4""\xB0"" \xE0""\xA4""\x9F""\xE0""\xA5""\x81""\xE0""\xA4""\x95""" "\xE0""\xA4""\xA1""\xE0""\xA4""\xBC""\xE0""\xA5""\x8B""\xE0""\xA4""\x82""" " \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\x95""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x9F"" \xE0""\xA4""\xB2""\xE0""\xA5""\x87""" "\xE0""\xA4""\x82""\xE0""\xA5""\xA4""
\r\n\xE0""\xA4""\xB8""\xE0""\xA4""" "\x82""\xE0""\xA4""\xA4""\xE0""\xA4""\xB0""\xE0""\xA5""\x87"" \xE0""\xA4""" "\x95""\xE0""\xA5""\x8B"" \xE0""\xA4""\x9B""\xE0""\xA5""\x80""\xE0""\xA4""" "\xB2""\xE0""\xA4""\x95""\xE0""\xA4""\xB0"" \xE0""\xA4""\x89""\xE0""\xA4""" "\xB8""\xE0""\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\x9C""\xE0""\xA5""" "\x82""\xE0""\xA4""\xB8"" \xE0""\xA4""\xA8""\xE0""\xA4""\xBF""\xE0""\xA4""" "\x95""\xE0""\xA4""\xBE""\xE0""\xA4""\xB2""\xE0""\xA4""\x95""\xE0""\xA4""" "\xB0"" \xE0""\xA4""\x95""\xE0""\xA4""\xAA"" \xE0""\xA4""\xAE""\xE0""\xA5""" "\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\xB0""\xE0""\xA4""\x96"" \xE0""\xA4""" "\xB2""\xE0""\xA5""\x87""\xE0""\xA4""\x82""\xE0""\xA5""\xA4""
\r\n\xE0""" "\xA4""\x85""\xE0""\xA4""\xAC"" \xE0""\xA4""\xAE""\xE0""\xA4""\xBF""\xE0""" "\xA4""\x95""\xE0""\xA5""\x8D""\xE0""\xA4""\xB8""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\x95""\xE0""" "\xA5""\x87""\xE0""\xA4""\xB2""\xE0""\xA4""\xBE"", \xE0""\xA4""\x9A""\xE0""" "\xA5""\x80""\xE0""\xA4""\x95""\xE0""\xA5""\x82"", \xE0""\xA4""\xB8""\xE0""" "\xA4""\x82""\xE0""\xA4""\xA4""\xE0""\xA4""\xB0""\xE0""\xA5""\x87"" \xE0""" "\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB0""\xE0""\xA4""\xB8"", \xE0""" "\xA4""\xA6""\xE0""\xA5""\x82""\xE0""\xA4""\xA7"" \xE0""\xA4""\x94""\xE0""" "\xA4""\xB0"" \xE0""\xA4""\x9A""\xE0""\xA5""\x80""\xE0""\xA4""\xA8""\xE0""" "\xA5""\x80"" \xE0""\xA4""\xA1""\xE0""\xA4""\xBE""\xE0""\xA4""\xB2""\xE0""" "\xA4""\x95""\xE0""\xA4""\xB0"" \xE0""\xA4""\xB6""\xE0""\xA5""\x87""\xE0""" "\xA4""\x95"" \xE0""\xA4""\xAC""\xE0""\xA4""\xA8""\xE0""\xA4""\xBE"" \xE0""" "\xA4""\xB2""\xE0""\xA5""\x87""\xE0""\xA4""\x82""\xE0""\xA5""\xA4""
" "\r\n\xE0""\xA4""\xA5""\xE0""\xA5""\x8B""\xE0""\xA4""\xA1""\xE0""\xA4""\xBC""" "\xE0""\xA5""\x80"" \xE0""\xA4""\xB8""\xE0""\xA5""\x80"" \xE0""\xA4""\xAC""" "\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\xAB"" \xE0""\xA4""\xA1""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xB2""\xE0""\xA4""\x95""\xE0""\xA4""\xB0""" " \xE0""\xA4""\xA0""\xE0""\xA4""\x82""\xE0""\xA4""\xA1""\xE0""\xA4""\xBE""" " \xE0""\xA4""\x95""\xE0""\xA4""\xB0""\xE0""\xA5""\x87""\xE0""\xA4""\x82""" " \xE0""\xA4""\x94""\xE0""\xA4""\xB0"" \xE0""\xA4""\xA0""\xE0""\xA4""\x82""" "\xE0""\xA4""\xA1""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB8""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xAE""\xE0""\xA4""\xB0"" \xE0""\xA4""\xAE""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xB2""\xE0""\xA5""\x8D""\xE0""\xA4""\x95"" \xE0""\xA4""\xB6""" "\xE0""\xA5""\x87""\xE0""\xA4""\x95"" \xE0""\xA4""\x97""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xB2""\xE0""\xA4""\xBE""\xE0""\xA4""\xB8"" \xE0""\xA4""\xAE""" "\xE0""\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\xA1""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xB2""\xE0""\xA4""\x95""\xE0""\xA4""\xB0"" \xE0""\xA4""\xA4""" "\xE0""\xA5""\x81""\xE0""\xA4""\xB0""\xE0""\xA4""\x82""\xE0""\xA4""\xA4""" " \xE0""\xA4""\xB8""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\xB5""" " \xE0""\xA4""\x95""\xE0""\xA4""\xB0""\xE0""\xA5""\x87""\xE0""\xA4""\x82""" "\xE0""\xA5""\xA4""  \"\"
\r\n " " \r\n
 
\r\n \r\n " " \r\n \r\n \r" "\n \r\n\t\t\t
\xE0""\xA4""\x9C""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3""" " \xE0""\xA4""\x9C""\xE0""\xA5""\x8B""\xE0""\xA4""\xB6""
\r\n \r\n \r\n \r\n\t\r\n\t\t\r\n\t\r\n
\r\n\r\n \r\n " " \xE0""\xA4""\x96""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xA6""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF"" \xE0""\xA4""" "\xB8""\xE0""\xA4""\x82""\xE0""\xA4""\xB0""\xE0""\xA4""\x95""\xE0""\xA5""" "\x8D""\xE0""\xA4""\xB7""\xE0""\xA4""\xA3"" \xE0""\xA4""\x95""\xE0""\xA5""" "\x80"" '\xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\x95""\xE0""\xA4""" "\xBF""\xE0""\xA4""\xB2""' \xE0""\xA4""\x85""\xE0""\xA4""\xAA""\xE0""\xA4""" "\xA8""\xE0""\xA4""\xBE""\xE0""\xA4""\x8F""\xE0""\xA4""\x82"" \xE0""\xA4""" "\x95""\xE0""\xA4""\xB0""\xE0""\xA4""\xBF""\xE0""\xA4""\xAF""\xE0""\xA4""" "\xB0"" \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""" "\x86""\xE0""\xA4""\x97""\xE0""\xA5""\x87"" \xE0""\xA4""\xAC""\xE0""\xA4""" "\xA2""\xE0""\xA4""\xBC""\xE0""\xA4""\xA4""\xE0""\xA5""\x87"" \xE0""\xA4""" "\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\x8F""\xE0""\xA4""\x82"" " "
\xE0""\xA4""\x85""\xE0""\xA4""\xAA""" "\xE0""\xA4""\xA8""\xE0""\xA5""\x80"" \xE0""\xA4""\xAA""\xE0""\xA4""\xB8""" "\xE0""\xA4""\x82""\xE0""\xA4""\xA6""\xE0""\xA5""\x80""\xE0""\xA4""\xA6""" "\xE0""\xA4""\xBE"" \xE0""\xA4""\xAB""\xE0""\xA4""\xB2""\xE0""\xA5""\x8B""" "\xE0""\xA4""\x82"" \xE0""\xA4""\xB5"" \xE0""\xA4""\xB8""\xE0""\xA4""\xAC""" "\xE0""\xA5""\x8D""\xE0""\xA4""\x9C""\xE0""\xA4""\xBF""\xE0""\xA4""\xAF""" "\xE0""\xA5""\x8B""\xE0""\xA4""\x82"" \xE0""\xA4""\x95""\xE0""\xA5""\x87""" " \xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xB5""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xA6"" \xE0""\xA4""\x95""\xE0""\xA5""\x80"" \xE0""\xA4""\xAF""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xA6"" \xE0""\xA4""\x86""\xE0""\xA4""\xA4""" "\xE0""\xA5""\x87"" \xE0""\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""\xA4""\xB5""" "\xE0""\xA4""\xBF""\xE0""\xA4""\xA8""\xE0""\xA4""\xBE""\xE0""\xA4""\xAF""" "\xE0""\xA4""\x95"" \xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\xAE""" "\xE0""\xA5""\x81""\xE0""\xA4""\x82""\xE0""\xA4""\xB9"" \xE0""\xA4""\xAE""" "\xE0""\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\xAA""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xA8""\xE0""\xA5""\x80"" \xE0""\xA4""\xAD""\xE0""\xA4""\xB0""" " \xE0""\xA4""\x86""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""" "\xE0""\xA5""\x88""\xE0""\xA5""\xA4"" \xE0""\xA4""\xB5""\xE0""\xA4""\xB9""" " \xE0""\xA4""\xB8""\xE0""\xA5""\x8B""\xE0""\xA4""\x9A""\xE0""\xA4""\xA4""" "\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""\xE0""\xA5""\x88"" \xE0""\xA4""\x95""" "\xE0""\xA4""\xBF"" \xE0""\xA4""\x95""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF""" "\xE0""\xA4""\xBE"" \xE0""\xA4""\x87""\xE0""\xA4""\xA8"" \xE0""\xA4""\xB8""" "\xE0""\xA4""\xAD""\xE0""\xA5""\x80"" \xE0""\xA4""\x95""\xE0""\xA4""\xBE""" " \xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xB5""\xE0""\xA4""\xBE""" "\xE0""\xA4""\xA6"" \xE0""\xA4""\x89""\xE0""\xA4""\xB8""\xE0""\xA5""\x87""" " \xE0""\xA4""\xB8""\xE0""\xA4""\xBE""\xE0""\xA4""\xB2"" \xE0""\xA4""\x95""" "\xE0""\xA5""\x87"" \xE0""\xA4""\xAC""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""" "\xE0""\xA4""\xB9""\xE0""\xA5""\x8B""\xC2""\xA0""\xE0""\xA4""\xAE""\xE0""" "\xA4""\xB9""\xE0""\xA5""\x80""\xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""" "\xA4""\xA8""\xE0""\xA4""\xB9""\xE0""\xA5""\x80""\xE0""\xA4""\x82"" \xE0""" "\xA4""\xAE""\xE0""\xA4""\xBF""\xE0""\xA4""\xB2"" \xE0""\xA4""\xB8""\xE0""" "\xA4""\x95""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE""! \xE0""\xA4""\xB9""\xE0""" "\xA4""\xBE""\xE0""\xA4""\xB2""\xE0""\xA4""\xBE""\xE0""\xA4""\x82""\xE0""" "\xA4""\x95""\xE0""\xA4""\xBF"", \xE0""\xA4""\x96""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xA8""\xE0""\xA5""\x87""-\xE0""\xA4""\x96""\xE0""\xA4""\xBF""\xE0""" "\xA4""\xB2""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8""\xE0""\xA5""\x87"" \xE0""" "\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\xB6""\xE0""\xA5""\x8C""\xE0""" "\xA4""\x95""\xE0""\xA5""\x80""\xE0""\xA4""\xA8"" \xE0""\xA4""\xB2""\xE0""" "\xA5""\x8B""\xE0""\xA4""\x97"" \xE0""\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""" "\xA4""\xB0""\xE0""\xA4""\xBE""\xE0""\xA4""\x9A""\xE0""\xA5""\x80""\xE0""" "\xA4""\xA8"" \xE0""\xA4""\x95""\xE0""\xA4""\xBE""\xE0""\xA4""\xB2"" \xE0""" "\xA4""\xB8""\xE0""\xA5""\x87"" \xE0""\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""" "\xA4""\x85""\xE0""\xA4""\x9A""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0"" \xE0""" "\xA4""\x94""\xE0""\xA4""\xB0"" \xE0""\xA4""\xAE""\xE0""\xA5""\x81""\xE0""" "\xA4""\xB0""\xE0""\xA4""\xAC""\xE0""\xA5""\x8D""\xE0""\xA4""\xAC""\xE0""" "\xA5""\x87"" \xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\xB0""\xE0""" "\xA5""\x82""\xE0""\xA4""\xAA"" \xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""" "\xA4""\x82"" \xE0""\xA4""\xAB""\xE0""\xA4""\xB2""\xE0""\xA5""\x8B""\xE0""" "\xA4""\x82""-\xE0""\xA4""\xB8""\xE0""\xA4""\xAC""\xE0""\xA5""\x8D""\xE0""" "\xA4""\x9C""\xE0""\xA4""\xBF""\xE0""\xA4""\xAF""\xE0""\xA5""\x8B""\xE0""" "\xA4""\x82"" \xE0""\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB8""\xE0""" "\xA5""\x8D""\xE0""\xA4""\xB5""\xE0""\xA4""\xBE""\xE0""\xA4""\xA6"" \xE0""" "\xA4""\x9A""\xE0""\xA4""\x9F""\xE0""\xA4""\x95""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xB0""\xE0""\xA5""\x87"" \xE0""\xA4""\xB2""\xE0""\xA5""\x87""\xE0""" "\xA4""\x95""\xE0""\xA4""\xB0"" \xE0""\xA4""\xB2""\xE0""\xA5""\x87""\xE0""" "\xA4""\xA4""\xE0""\xA5""\x87"" \xE0""\xA4""\xB0""\xE0""\xA4""\xB9""\xE0""" "\xA5""\x87"" \xE0""\xA4""\xB9""\xE0""\xA5""\x88""\xE0""\xA4""\x82""\xE0""" "\xA5""\xA4"" \xE0""\xA4""\x86""\xE0""\xA4""\x9C"" \xE0""\xA4""\x95""&nbs" "p;\"\"
\r\n
 
\r\n\t\t\t
\"\"
\r\n
\"\"
\r\n\r\n \r\n  \r\n \r\n
 \xE0""" "\xA4""\x9C""\xE0""\xA4""\xB0""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""\xE0""" "\xA4""\x9F"" \xE0""\xA4""\x95""\xE0""\xA5""\x87""
\r\n \r\n \r\n " " \r\n <" "/tr>\r\n \r\n \r\n \r\n \r\n \r\n <" "/tr>\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n " "
  O \r\n " "..\xE0""\xA4""\x85""\xE0""\xA4""\xAC"" " "\xE0""\xA4""\x97""\xE0""\xA4""\xA7""\xE0""\xA5""\x8B""\xE0""\xA4""\x82""" " \xE0""\xA4""\x95""\xE0""\xA5""\x8B"" \xE0""\xA4""\xAD""\xE0""\xA5""\x80""" " \xE0""\xA4""\xAE""\xE0""\xA4""\xBF""\xE0""\xA4""\xB2""\xE0""\xA5""\x87""" "\xE0""\xA4""\x97""\xE0""\xA4""\xBE"" \xE0""\xA4""\x85""\xE0""\xA4""\xB5""" "\xE0""\xA4""\x95""\xE0""\xA4""\xBE""\xE0""\xA4""\xB6""
  O ..\xE0""\xA4""\x94""\xE0""\xA4""" "\xB0"" \xE0""\xA4""\xAA""\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xA8""\xE0""\xA5""\x80"" \xE0""\xA4""\x95""\xE0""\xA5""\x8B"" \xE0""\xA4""" "\x95""\xE0""\xA4""\xBF""\xE0""\xA4""\xAF""\xE0""\xA4""\xBE"" \xE0""\xA4""" "\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x87""\xE0""\xA4""" "\xAE""\xE0""\xA5""\x80"" \xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""" "\xB9""\xE0""\xA4""\xB5""\xE0""\xA4""\xBE""\xE0""\xA4""\xB2""\xE0""\xA5""" "\x87""
&" "nbsp; O \xE0""" "\xA4""\x89""\xE0""\xA4""\xAE""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0"" 120\xC2""" "\xA0""\xE0""\xA4""\xB5""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xB7"", 48\xC2""\xA0""\xE0""\xA4""\xB5""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xB7""\xE0""\xA5""\x8B"" \xE0""\xA4""\xB8""\xE0""\xA5""\x87""" " \xE0""\xA4""\xA8""\xE0""\xA4""\xB9""\xE0""\xA4""\xBE""\xE0""\xA4""\xAF""" "\xE0""\xA4""\xBE"" \xE0""\xA4""\xB9""\xE0""\xA5""\x80"" \xE0""\xA4""\xA8""" "\xE0""\xA4""\xB9""\xE0""\xA5""\x80""\xE0""\xA4""\x82""
  O \xE0""\xA4""\xAE""\xE0""\xA5""" "\x8B""\xE0""\xA4""\x9F""\xE0""\xA5""\x80"" \xE0""\xA4""\xB0""\xE0""\xA4""" "\x95""\xE0""\xA4""\xAE"" \xE0""\xA4""\xA6""\xE0""\xA5""\x87""\xE0""\xA4""" "\x95""\xE0""\xA4""\xB0"" \xE0""\xA4""\x85""\xE0""\xA4""\xA8""\xE0""\xA5""" "\x8B""\xE0""\xA4""\x96""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB5""\xE0""\xA5""" "\x8D""\xE0""\xA4""\xAF""\xE0""\xA4""\xBE""\xE0""\xA4""\xAA""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xB0""
  O \xE0""\xA4""\xA4""\xE0""\xA4""\xA8""\xE0""\xA5""\x8D""\xE0""" "\xA4""\xB9""\xE0""\xA4""\xBE""\xE0""\xA4""\x88"" \xE0""\xA4""\xAE""\xE0""" "\xA5""\x87""\xE0""\xA4""\x82"" \xE0""\xA4""\x87""\xE0""\xA4""\x82""\xE0""" "\xA4""\x9F""\xE0""\xA4""\xB0""\xE0""\xA4""\xA8""\xE0""\xA5""\x87""\xE0""" "\xA4""\x9F"" \xE0""\xA4""\xAC""\xE0""\xA4""\xA8""\xE0""\xA4""\xBE"" \xE0""" "\xA4""\xB5""\xE0""\xA4""\xB0""\xE0""\xA4""\xA6""\xE0""\xA4""\xBE""\xE0""" "\xA4""\xA8""
  O \xE0""" "\xA4""\xB8""\xE0""\xA5""\x8B""\xE0""\xA4""\x8A""\xE0""\xA4""\x82""\xE0""" "\xA4""\x97""\xE0""\xA4""\xBE"", \xE0""\xA4""\xAE""\xE0""\xA4""\x97""\xE0""" "\xA4""\xB0"" \xE0""\xA4""\x85""\xE0""\xA4""\xAA""\xE0""\xA4""\xA8""\xE0""" "\xA5""\x87"" \xE0""\xA4""\xA8""\xE0""\xA4""\xB9""\xE0""\xA5""\x80""\xE0""" "\xA4""\x82"" \xE0""\xA4""\x94""\xE0""\xA4""\xB0""\xE0""\xA5""\x8B""\xE0""" "\xA4""\x82"" \xE0""\xA4""\x95""\xE0""\xA5""\x87"" \xE0""\xA4""\x98""\xE0""" "\xA4""\xB0""\xE0""\xA5""\x8B""\xE0""\xA4""\x82"" \xE0""\xA4""\xAE""\xE0""" "\xA5""\x87""\xE0""\xA4""\x82""
\r\n
\r\n " " \r\n \r\n \r\n\t\t \r\n" " \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r" "\n \r\n " " \r\n \r\n " " \r\n <" "th align=left >\xE0""\xA4""" "\xAF""\xE0""\xA5""\x87"" \xE0""\xA4""\xA6""\xE0""\xA5""\x87""\xE0""\xA4""" "\xB6"" \xE0""\xA4""\xB9""\xE0""\xA5""\x88"" \xE0""\xA4""\xB5""\xE0""\xA5""" "\x80""\xE0""\xA4""\xB0"" \xE0""\xA4""\x9C""\xE0""\xA4""\xB5""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xA8""\xE0""\xA5""\x8B""\xE0""\xA4""\x82"" \xE0""\xA4""" "\x95""\xE0""\xA4""\xBE"".\r\n \r\n \r\n \r\n " " \r\n\t\t\t
\xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""" "\xA4""\x97""\xE0""\xA4""\xB0""\xE0""\xA4""\xA3"" \xE0""\xA4""\xB0""\xE0""" "\xA5""\x87""\xE0""\xA4""\xA1""\xE0""\xA4""\xBF""\xE0""\xA4""\xAF""\xE0""" "\xA5""\x8B""
  O \r\n \xE0""\xA4""\xB9""\xE0""\xA5""\x8B""\xE0""\xA4""\xB2""\xE0""\xA5""" "\x80"" \xE0""\xA4""\x86""\xE0""\xA4""\x88"" \xE0""\xA4""\xB0""\xE0""\xA5""" "\x87""...
  O \xE0""\xA4""\xAD""\xE0""\xA4""" "\x95""\xE0""\xA5""\x8D""\xE0""\xA4""\xA4""\xE0""\xA4""\xBF"" \xE0""\xA4""" "\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\xAA""\xE0""\xA4""\xB0""\xE0""\xA5""" "\x8D""\xE0""\xA4""\xB5"" \xE0""\xA4""\xAE""\xE0""\xA4""\xB9""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xB6""\xE0""\xA4""\xBF""\xE0""\xA4""\xB5""\xE0""\xA4""" "\xB0""\xE0""\xA4""\xBE""\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""" "\xB0""\xE0""\xA4""\xBF""
  O \xE0""\xA4""\x9A""" "\xE0""\xA4""\xB2""\xE0""\xA5""\x8B"" \xE0""\xA4""\xA5""\xE0""\xA5""\x8B""" "\xE0""\xA4""\xA1""\xE0""\xA4""\xBC""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB0""" "\xE0""\xA5""\x82""\xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8""" "\xE0""\xA5""\x80"" \xE0""\xA4""\xB9""\xE0""\xA5""\x8B"" \xE0""\xA4""\x9C""" "\xE0""\xA4""\xBE""\xE0""\xA4""\x8F""..
  O \xE0""" "\xA4""\xB5""\xE0""\xA4""\xB8""\xE0""\xA4""\x82""\xE0""\xA4""\xA4"" \xE0""" "\xA4""\x86""\xE0""\xA4""\xAF""\xE0""\xA5""\x8B""\xE0""\xA4""\x82"" \xE0""" "\xA4""\xB0""\xE0""\xA5""\x87""..
  O 
  O \xE0""\xA4""\x9D""" "\xE0""\xA4""\xB2""\xE0""\xA4""\x95"" 2006
\r\n
\"\"
\r\n
\"\"
\r\n \r\n \"\"\r\n" " \"\"\r\n \"\"\r\n \"\"\r\n \"\"
\xC2""\xA9"" Jagran Infotech Ltd. 2006-08
\r\n\r\n\r\n\r\n
\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\"\"
\"\"
\"\"
\r\n\r\n\r\n" "\r\n\t\r" "\n\t\t\r\n\t\r\n\t\r\n\t\t\r\n\t\r\n\t\r\n\t\t\r\n\t" "\r\n
\r\n\t\t\t\r\n\r\n\r\n\r\n\r\n\r\n" "
Search now
\r\n\t\t\t
\r\n\r\n\"\"\r\n\r\n \r" "\n\r\n \r\n \r\n \r\n\r\n
\r\n\"\"\r\n
\r\n\"\"\r\n\r\n\"\"\r\n\"\"\r\n\"\"\r\n\"\"\r\n\"\"\t\t\r\n\"\"\r\n\r\n\r\n\t\t\r\n\t\t\r\n\t\t\r\n \r\n \r\n \r\n \r\n \r\n \r\n" " \r\n \r\n \r\n " " \r\n \r\n \r\n " " \r\n \r\n
\xE0""\xA4""\xB8""\xE0""\xA4""\x82""\xE0""\xA4""\xAA""\xE0""" "\xA4""\xBE""\xE0""\xA4""\xA6""\xE0""\xA4""\x95"" \xE0""\xA4""\x95""\xE0""" "\xA5""\x87"" \xE0""\xA4""\xA8""\xE0""\xA4""\xBE""\xE0""\xA4""\xAE"" \xE0""" "\xA4""\xAA""\xE0""\xA4""\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""
\"\""
\xE0""\xA4""\xAE""\xE0""\xA5""\x87""\xE0""\xA4""\xB0""\xE0""\xA5""" "\x80"" \xE0""\xA4""\x9C""\xE0""\xA4""\xBE""\xE0""\xA4""\xAA""\xE0""\xA4""" "\xBE""\xE0""\xA4""\xA8"" \xE0""\xA4""\xAF""\xE0""\xA4""\xBE""\xE0""\xA4""" "\xA4""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA4""\xBE""<" "/a>
\"\"
\xE0""\xA4""" "\xA8""\xE0""\xA5""\x8D""\xE0""\xA4""\xAF""\xE0""\xA5""\x82""\xE0""\xA4""" "\x9C"" \xE0""\xA4""\xB2""\xE0""\xA5""\x87""\xE0""\xA4""\x9F""\xE0""\xA4""" "\xB0""
<" "img alt=\"\" border=\"0\" src=\"images/spacer.gif\" width=\"1\" height=\"" "2\">
\xE0""\xA4""\xAA""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""" "\xE0""\xA4""\xB5""\xE0""\xA4""\xBE""\xE0""\xA4""\xB8""\xE0""\xA5""\x80""" " \xE0""\xA4""\xAD""\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""\xA4""\xA4""" "\xE0""\xA5""\x80""\xE0""\xA4""\xAF""
\"\"
\xE0""\xA4""\xA7""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xB0""\xE0""\xA5""\x8D""\xE0""\xA4""\xAE""" "\xE0""\xA4""\xBF""\xE0""\xA4""\x95"" \xE0""\xA4""\x97""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xB0""\xE0""\xA4""\x82""\xE0""\xA4""\xA5"" \xE0""\xA4""\x94""" "\xE0""\xA4""\xB0"" \xE0""\xA4""\xB9""\xE0""\xA4""\xBF""\xE0""\xA4""\xA8""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xA6""\xE0""\xA5""\x82"" \xE0""\xA4""\xB8""" "\xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""\xA4""\x9C""
\"\"
\xE0""\xA4""\xA8""\xE0""\xA4""\xB0""\xE0""\xA5""\x87""" "\xE0""\xA4""\x82""\xE0""\xA4""\xA6""\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""" " \xE0""\xA4""\xAE""\xE0""\xA5""\x8B""\xE0""\xA4""\xB9""\xE0""\xA4""\xA8""" " - \xE0""\xA4""\xB8""\xE0""\xA5""\x8D""\xE0""\xA4""\xAE""\xE0""\xA5""\x83""" "\xE0""\xA4""\xA4""\xE0""\xA4""\xBF"" \xE0""\xA4""\xB6""\xE0""\xA5""\x87""" "\xE0""\xA4""\xB7""
\"\"
\r\n\t\t\r\n\t\t" "\r\n\r\n
\r\n \r\n\r\n<" "td align=\"left\" bgColor=\"#ff6601\" vAlign=\"top\">\r\n \xE0""\xA4""\x9C""\xE0""\xA4""\xA8""\xE0""\xA4""" "\xAE""\xE0""\xA4""\xA4""\r\n\t \r\n\r\n\r\n\t\r\n\t\t\t\r\n\t\t\t\r" "\n\t\t\t" "\r\n\t\t\t\r\n " " \r\n
\xE0""\xA4""\x95""\xE0""\xA5""\x8D""" "\xE0""\xA4""\xAF""\xE0""\xA4""\xBE"" \xE0""\xA4""\xA4""\xE0""\xA4""\xBF""" "\xE0""\xA4""\xB0""\xE0""\xA4""\x82""\xE0""\xA4""\x97""\xE0""\xA5""\x87""" " \xE0""\xA4""\xB8""\xE0""\xA4""\xB0""\xE0""\xA5""\x80""\xE0""\xA4""\x96""" "\xE0""\xA5""\x87"" \xE0""\xA4""\x95""\xE0""\xA5""\x87""\xE0""\xA4""\x95""" " \xE0""\xA4""\x95""\xE0""\xA5""\x8B"" \xE0""\xA4""\x95""\xE0""\xA4""\xBE""" "\xE0""\xA4""\x9F""\xE0""\xA4""\xA8""\xE0""\xA4""\xBE"" \xE0""\xA4""\xB0""" "\xE0""\xA4""\xBE""\xE0""\xA4""\xB7""\xE0""\xA5""\x8D""\xE0""\xA4""\x9F""" "\xE0""\xA5""\x8D""\xE0""\xA4""\xB0""\xE0""\xA5""\x80""\xE0""\xA4""\xAF""" " \xE0""\xA4""\xA7""\xE0""\xA5""\x8D""\xE0""\xA4""\xB5""\xE0""\xA4""\x9C""" " \xE0""\xA4""\x95""\xE0""\xA4""\xBE"" \xE0""\xA4""\x85""\xE0""\xA4""\xAA""" "\xE0""\xA4""\xAE""\xE0""\xA4""\xBE""\xE0""\xA4""\xA8"" \xE0""\xA4""\xB9""" "\xE0""\xA5""\x88""?
&nb" "sp;  \xE0""\xA4""\xB9""\xE0""" "\xA4""\xBE""\xE0""\xA4""\x82""
   \xE0""\xA4""\xA8""" "\xE0""\xA4""\xB9""\xE0""\xA5""\x80""\xE0""\xA4""\x82""
   \xE0""\xA4""\xAA""\xE0""\xA4""\xA4""\xE0""\xA4""\xBE"" \xE0""\xA4""" "\xA8""\xE0""\xA4""\xB9""\xE0""\xA5""\x80""\xE0""\xA4""\x82""
\r\n\t\t\t
\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n" ; // This one is a mixture of UTF-8, CP1252, and UTF8UTF8 const char* kTeststr99 = // 1252 " auf der Computermesse Systems in M\xFC""nchen vertreten (Halle A3.542)." " Artikel des Tages Das Weinbaugebiet Bordeaux, auf franz\xF6""sisch Bord" "elais, ist das gr\xF6""\xDF""te zusammenh\xE4""ngende Anbaugebiet der We" "lt f\xFC""r Qualit\xE4""tswein. Es gibt etwa 4000 Ch\xE2""teaux genannte" // UTF8 "tnegirjji gosa gii beare s\xC3""\xA1""htt\xC3""\xA1"" \xC4""\x8D""\xC3""" "\xA1""llit artihkkaliid. Maid don s\xC3""\xA1""ht\xC3""\xA1""t dievasmah" "ttit ja divvut juo \xC4""\x8D""\xC3""\xA1""llojuvvon artihkkaliid dahje " "\xC4""\x8D""\xC3""\xA1""lligoahttit aibbas o\xC4""\x91""\xC4""\x91""a ar" // UTF8UTF8 "Ice cream a l\xc3\x83\xc2\xa0 mode." // 1252 " Weing\xFC""ter, die die weltber\xFC""hmten Weine erzeugen. Ein differen" "ziertes System von subregionalen und kommunalen Appellationen und Klassi" "fikationen schafft unter ihnen eine qualitative Hierarchie. Die einzelne" "n Lagen spielen demgegen\xFC""ber eine untergeordnete Rolle. Ihre Stelle" // UTF8UTF8 "Ice cream \xC3\x83\xC2\xA9 mode." "Ice cream \xC3\xA2\xE2\x82\xAC\xCB\x9C mode." // UTF8 "tnegirjji gosa gii beare s\xC3""\xA1""htt\xC3""\xA1"" \xC4""\x8D""\xC3""" "\xA1""llit artihkkaliid. Maid don s\xC3""\xA1""ht\xC3""\xA1""t dievasmah" "ttit ja divvut juo \xC4""\x8D""\xC3""\xA1""llojuvvon artihkkaliid dahje " "\xC4""\x8D""\xC3""\xA1""lligoahttit aibbas o\xC4""\x91""\xC4""\x91""a ar" // 1252 " nimmt das Ch\xE2""teau ein, zu dem sie geh\xF6""ren. Im Jahr 2002 wurde" "n auf gut 120.000 Hektar Anbaufl\xE4""che insgesamt 5,74 Millionen Hekto" "liter Qualit\xE4""tswein erzeugt. mehr Fr\xFC""here Artikel des Tages \xB7""" " Weitere exzellente Artikel Was geschah am 13. Oktober? 1781 \x96"" Jose" ; const char kTestStrNoUTF8UTF8[] = ""If management is an art, then surely Jack Welch has proved " "himself a master painter." - BusinessWeek<p>Boardroom " "legend Jack Welch is widely regarded as one of the most effective CEOs " "in business history. Welch’s groundbreaking programs—including Six " "Sigma and Work-Out—along with his numerous strategies on business " "leadership have helped transform GE into the global benchmark for " "maximized productivity and labor efficiency. <p>Now, The GE Way " "Fieldbook explains how you can implement the same programs that helped " "turn GE into a $100 billion juggernaut. Drawing from his unprecedented " "access to GE’s top-level corridors of power—including a " "never-before-published full-length interview with Jack Welch—veteran " "business author Robert Slater packs innovative strategies, easy-to-use " "diagnostic exercises, detailed questionnaires, and more into the " "most hands-on, applications-oriented book ever written on General " "Electric. Only in The GE Way Fieldbook will you find:<br> " "*"The Boca Raton Speeches"—Never-before-seen excerpts " "taken from Jack Welch’s internal speeches to GE employees <br> " "*More than 100 exercises, overheads, and exhibits from the files " "of Jack Welch and GE <br> *The most complete treatment of " "GE’s Six Sigma program ever published<br> *Step-by-step " "action plans that are blueprints for implementing Six Sigma and " "Work-Out—and creating the boundaryless organization<p>The " "fieldbook has become one of today’s most popular, effective teaching " "tools—but never before has one focused on the inner workings and " "strategies of a specific company. Let The GE Way Fieldbook give you " "an inside look at the stunningly successful Jack Welch era at GE, " "provide the techniques and tools you need to focus every worker in " "your organization on progress and growth, and outline a strategic " "roadmap for implementing GE’s business practices—and removing " "the boundaries to success—within your own organization."; const char kUTF16LEChomsky[] = // generated by stringify.cc """\xff""""\xfe""<""\x00""h""\x00""t""\x00""m""\x00""l""\x00"" ""\x00""" "x""\x00""m""\x00""l""\x00""n""\x00""s""\x00"":""\x00""v""\x00""=" """\x00""""\x22""""\x00""u""\x00""r""\x00""n""\x00"":""\x00""s""\x00""c" """\x00""h""\x00""e""\x00""m""\x00""a""\x00""s""\x00""-""\x00""m" """\x00""i""\x00""c""\x00""r""\x00""o""\x00""s""\x00""o""\x00""f" """\x00""t""\x00""-""\x00""c""\x00""o""\x00""m""\x00"":""\x00""v" """\x00""m""\x00""l""\x00""""\x22""""\x00""""\x0a""""\x00""x""\x00""m" """\x00""l""\x00""n""\x00""s""\x00"":""\x00""o""\x00""=""\x00""""\x22""" """\x00""u""\x00""r""\x00""n""\x00"":""\x00""s""\x00""c""\x00""h" """\x00""e""\x00""m""\x00""a""\x00""s""\x00""-""\x00""m""\x00""i" """\x00""c""\x00""r""\x00""o""\x00""s""\x00""o""\x00""f""\x00""t" """\x00""-""\x00""c""\x00""o""\x00""m""\x00"":""\x00""o""\x00""f" """\x00""f""\x00""i""\x00""c""\x00""e""\x00"":""\x00""o""\x00""f" """\x00""f""\x00""i""\x00""c""\x00""e""\x00""""\x22""""\x00""""\x0a""" """\x00""x""\x00""m""\x00""l""\x00""n""\x00""s""\x00"":""\x00""w" """\x00""=""\x00""""\x22""""\x00""u""\x00""r""\x00""n""\x00"":""\x00""s" """\x00""c""\x00""h""\x00""e""\x00""m""\x00""a""\x00""s""\x00""-" """\x00""m""\x00""i""\x00""c""\x00""r""\x00""o""\x00""s""\x00""o" """\x00""f""\x00""t""\x00""-""\x00""c""\x00""o""\x00""m""\x00"":" """\x00""o""\x00""f""\x00""f""\x00""i""\x00""c""\x00""e""\x00"":" """\x00""w""\x00""o""\x00""r""\x00""d""\x00""""\x22""""\x00""""\x0a""" """\x00""x""\x00""m""\x00""l""\x00""n""\x00""s""\x00"":""\x00""m" """\x00""=""\x00""""\x22""""\x00""h""\x00""t""\x00""t""\x00""p""\x00"":" """\x00""/""\x00""/""\x00""s""\x00""c""\x00""h""\x00""e""\x00""m" """\x00""a""\x00""s""\x00"".""\x00""m""\x00""i""\x00""c""\x00""r" """\x00""o""\x00""s""\x00""o""\x00""f""\x00""t""\x00"".""\x00""c" """\x00""o""\x00""m""\x00""/""\x00""o""\x00""f""\x00""f""\x00""i" """\x00""c""\x00""e""\x00""/""\x00""2""\x00""0""\x00""0""\x00""4" """\x00""/""\x00""1""\x00""2""\x00""/""\x00""o""\x00""m""\x00""m" """\x00""l""\x00""""\x22""""\x00""""\x0a""""\x00""x""\x00""m""\x00""l" """\x00""n""\x00""s""\x00"":""\x00""m""\x00""v""\x00""=""\x00""""\x22""" """\x00""h""\x00""t""\x00""t""\x00""p""\x00"":""\x00""/""\x00""/" """\x00""m""\x00""a""\x00""c""\x00""V""\x00""m""\x00""l""\x00""S" """\x00""c""\x00""h""\x00""e""\x00""m""\x00""a""\x00""U""\x00""r" """\x00""i""\x00""""\x22""""\x00"" ""\x00""x""\x00""m""\x00""l""\x00""n" """\x00""s""\x00""=""\x00""""\x22""""\x00""h""\x00""t""\x00""t""\x00""p" """\x00"":""\x00""/""\x00""/""\x00""w""\x00""w""\x00""w""\x00""." """\x00""w""\x00""3""\x00"".""\x00""o""\x00""r""\x00""g""\x00""/" """\x00""T""\x00""R""\x00""/""\x00""R""\x00""E""\x00""C""\x00""-" """\x00""h""\x00""t""\x00""m""\x00""l""\x00""4""\x00""0""\x00""""\x22""" """\x00"">""\x00""""\x0a""""\x00""""\x0a""""\x00""<""\x00""h""\x00""e" """\x00""a""\x00""d""\x00"">""\x00""""\x0a""""\x00""<""\x00""m""\x00""e" """\x00""t""\x00""a""\x00"" ""\x00""n""\x00""a""\x00""m""\x00""e" """\x00""=""\x00""T""\x00""i""\x00""t""\x00""l""\x00""e""\x00"" " """\x00""c""\x00""o""\x00""n""\x00""t""\x00""e""\x00""n""\x00""t" """\x00""=""\x00""""\x22""""\x00""P""\x00""a""\x00""r""\x00""t""\x00""n" """\x00""e""\x00""r""\x00""s""\x00"" ""\x00""i""\x00""n""\x00"" " """\x00""H""\x00""a""\x00""t""\x00""e""\x00"":""\x00"" ""\x00""C" """\x00""h""\x00""o""\x00""m""\x00""s""\x00""k""\x00""y""\x00"" " """\x00""a""\x00""n""\x00""d""\x00"" ""\x00""t""\x00""h""\x00""e" """\x00"" ""\x00""H""\x00""o""\x00""l""\x00""o""\x00""c""\x00""a" """\x00""u""\x00""s""\x00""t""\x00"" ""\x00""D""\x00""e""\x00""n" """\x00""i""\x00""e""\x00""r""\x00""s""\x00""""\x22""""\x00"">""\x00""" """\x0a""""\x00""<""\x00""m""\x00""e""\x00""t""\x00""a""\x00"" ""\x00""" "n""\x00""a""\x00""m""\x00""e""\x00""=""\x00""K""\x00""e""\x00""y" """\x00""w""\x00""o""\x00""r""\x00""d""\x00""s""\x00"" ""\x00""c" """\x00""-""\x00""-""\x00""[""\x00""i""\x00""f""\x00"" ""\x00""!" """\x00""m""\x00""s""\x00""o""\x00""]""\x00"">""\x00""""\x0a""""\x00""<" """\x00""s""\x00""t""\x00""y""\x00""l""\x00""e""\x00"">""\x00""""\x0a""" """\x00""v""\x00""""\x5c""""\x00"":""\x00""*""\x00"" ""\x00""{""\x00""b" """\x00""e""\x00""h""\x00""a""\x00""v""\x00""i""\x00""o""\x00""r" """\x00"":""\x00""u""\x00""r""\x00""l""\x00""(""\x00""#""\x00""d" """\x00""e""\x00""f""\x00""a""\x00""u""\x00""l""\x00""t""\x00""#" """\x00""V""\x00""M""\x00""L""\x00"")""\x00"";""\x00""}""\x00""""\x0a""" """\x00""o""\x00""""\x5c""""\x00"":""\x00""*""\x00"" ""\x00""{""\x00""b" """\x00""e""\x00""h""\x00""a""\x00""v""\x00""i""\x00""o""\x00""r" """\x00"":""\x00""u""\x00""r""\x00""l""\x00""(""\x00""#""\x00""d" """\x00""e""\x00""f""\x00""a""\x00""u""\x00""l""\x00""t""\x00""#"; const char kUTF16LEFltrs[] = """\xff""""\xfe""<""\x00""h""\x00""t""\x00""m""\x00""l""\x00"" ""\x00""" "x""\x00""m""\x00""l""\x00""n""\x00""s""\x00"":""\x00""v""\x00""=" """\x00""""\x22""""\x00""u""\x00""r""\x00""n""\x00"":""\x00""s""\x00""c" """\x00""h""\x00""e""\x00""m""\x00""a""\x00""s""\x00""-""\x00""m" """\x00""i""\x00""c""\x00""r""\x00""o""\x00""s""\x00""o""\x00""f" """\x00""t""\x00""-""\x00""c""\x00""o""\x00""m""\x00"":""\x00""v" """\x00""m""\x00""l""\x00""""\x22""""\x00""""\x0d""""\x00""""\x0a""" """\x00""x""\x00""m""\x00""l""\x00""n""\x00""s""\x00"":""\x00""o" """\x00""=""\x00""""\x22""""\x00""u""\x00""r""\x00""n""\x00"":""\x00""s" """\x00""c""\x00""h""\x00""e""\x00""m""\x00""a""\x00""s""\x00""-" """\x00""m""\x00""i""\x00""c""\x00""r""\x00""o""\x00""s""\x00""o" """\x00""f""\x00""t""\x00""-""\x00""c""\x00""o""\x00""m""\x00"":" """\x00""o""\x00""f""\x00""f""\x00""i""\x00""c""\x00""e""\x00"":" """\x00""o""\x00""f""\x00""f""\x00""i""\x00""c""\x00""e""\x00""""\x22""" """\x00""""\x0d""""\x00""""\x0a""""\x00""x""\x00""m""\x00""l""\x00""n" """\x00""s""\x00"":""\x00""w""\x00""=""\x00""""\x22""""\x00""u""\x00""r" """\x00""n""\x00"":""\x00""s""\x00""c""\x00""h""\x00""e""\x00""m" """\x00""a""\x00""s""\x00""-""\x00""m""\x00""i""\x00""c""\x00""r" """\x00""o""\x00""s""\x00""o""\x00""f""\x00""t""\x00""-""\x00""c" """\x00""o""\x00""m""\x00"":""\x00""o""\x00""f""\x00""f""\x00""i" """\x00""c""\x00""e""\x00"":""\x00""w""\x00""o""\x00""r""\x00""d" """\x00""""\x22""""\x00""""\x0d""""\x00""""\x0a""""\x00""x""\x00""m" """\x00""l""\x00""n""\x00""s""\x00"":""\x00""m""\x00""=""\x00""""\x22""" """\x00""h""\x00""t""\x00""t""\x00""p""\x00"":""\x00""/""\x00""/" """\x00""s""\x00""c""\x00""h""\x00""e""\x00""m""\x00""a""\x00""s" """\x00"".""\x00""m""\x00""i""\x00""c""\x00""r""\x00""o""\x00""s" """\x00""o""\x00""f""\x00""t""\x00"".""\x00""c""\x00""o""\x00""m" """\x00""/""\x00""o""\x00""f""\x00""f""\x00""i""\x00""c""\x00""e" """\x00""/""\x00""2""\x00""0""\x00""0""\x00""4""\x00""/""\x00""1" """\x00""2""\x00""/""\x00""o""\x00""m""\x00""m""\x00""l""\x00""""\x22""" """\x00""""\x0d""""\x00""""\x0a""""\x00""x""\x00""m""\x00""l""\x00""n" """\x00""s""\x00""=""\x00""""\x22""""\x00""h""\x00""t""\x00""t""\x00""p" """\x00"":""\x00""/""\x00""/""\x00""w""\x00""w""\x00""w""\x00""." """\x00""w""\x00""3""\x00"".""\x00""o""\x00""r""\x00""g""\x00""/" """\x00""T""\x00""R""\x00""/""\x00""R""\x00""E""\x00""C""\x00""-" """\x00""h""\x00""t""\x00""m""\x00""l""\x00""4""\x00""0""\x00""""\x22""" """\x00"" ""\x00""x""\x00""m""\x00""l""\x00"":""\x00""l""\x00""a" """\x00""n""\x00""g""\x00""=""\x00""""\x22""""\x00""e""\x00""n""\x00""" """\x22""""\x00"">""\x00""""\x0d""""\x00""""\x0a""""\x00""""\x0d""" """\x00""""\x0a""""\x00""<""\x00""h""\x00""e""\x00""a""\x00""d""\x00"">" """\x00""""\x0d""""\x00""""\x0a""""\x00""<""\x00""m""\x00""e""\x00""t" """\x00""a""\x00"" ""\x00""h""\x00""t""\x00""t""\x00""p""\x00""-" """\x00""e""\x00""q""\x00""u""\x00""i""\x00""v""\x00""=""\x00""C" """\x00""o""\x00""n""\x00""t""\x00""e""\x00""n""\x00""t""\x00""-" """\x00""T""\x00""y""\x00""p""\x00""e""\x00"" ""\x00""c""\x00""o" """\x00""n""\x00""t""\x00""e""\x00""n""\x00""t""\x00""=""\x00""""\x22""" """\x00""t""\x00""e""\x00""x""\x00""t""\x00""/""\x00""h""\x00""t" """\x00""m""\x00""l""\x00"";""\x00"" ""\x00""c""\x00""h""\x00""a" """\x00""r""\x00""s""\x00""e""\x00""t""\x00""=""\x00""u""\x00""n" """\x00""i""\x00""c""\x00""o""\x00""d""\x00""e""\x00""""\x22""""\x00"">" """\x00""""\x0d""""\x00""""\x0a""""\x00""<""\x00""m""\x00""e""\x00""t" """\x00""a""\x00"" ""\x00""n""\x00""a""\x00""m""\x00""e""\x00""=" """\x00""P""\x00""r""\x00""o""\x00""g""\x00""I""\x00""d""\x00"" " """\x00""c""\x00""o""\x00""n""\x00""t""\x00""e""\x00""n""\x00""t" """\x00""=""\x00""W""\x00""o""\x00""r""\x00""d""\x00"".""\x00""D"; namespace { class CompactEncDetTest : public testing::Test { protected: // Objects declared here can be used by all tests in the test case for Foo. // Convert str to UTF-8, returning as function result // Name is just for debug output Encoding TestCompactEncDetWithURL(const char* str, int len, const char* url, const char* name, bool* is_reliable) { int bytes_consumed; if (FLAGS_enc_detect_detail) { fprintf(stderr, "(Unit test %s) start-detail\n", PsStr(name).c_str()); } Encoding enc = CompactEncDet::DetectEncoding( str, len, url, // url hint NULL, // http hint NULL, // meta hint UNKNOWN_ENCODING, // enc hint UNKNOWN_LANGUAGE, // lang hint CompactEncDet::WEB_CORPUS, false, // Include 7-bit encodings &bytes_consumed, is_reliable); if (FLAGS_enc_detect_detail) { fprintf(stderr, "() end-detail\n\n"); } return enc; } // Name is just for debug output // Same as above with is_reliable supplied and then ignored Encoding TestCompactEncDetWithURL(const char* str, int len, const char* url, const char* name) { bool is_reliable; return TestCompactEncDetWithURL(str, len, NULL, name, &is_reliable); } // Name is just for debug output Encoding TestCompactEncDetWithReliable(const char* str, int len, const char* name, bool* is_reliable) { return TestCompactEncDetWithURL(str, len, NULL, name, is_reliable); } // Name is just for debug output Encoding TestCompactEncDet(const char* str, int len, const char* name) { return TestCompactEncDetWithURL(str, len, NULL, name); } // Name is just for debug output Encoding TestCompactEncDet(const char* str, const char* name) { return TestCompactEncDetWithURL(str, strlen(str), NULL, name); } // Every string that is detected as UTF8UTF8 when --ced_allow_utf8utf=true // should be detected as some other encoding when --ced_allow_utf8utf8=false. void TestUTF8UTF8(const char* str, Encoding other, const char* name) { Encoding encoding; #if defined(HTML5_MODE) encoding = ASCII_7BIT; #else encoding = UTF8UTF8; #endif { VarSetter utf8utf8(&FLAGS_ced_allow_utf8utf8, true); EXPECT_EQ(encoding, TestCompactEncDet(str, name)); } { VarSetter noutf8utf8(&FLAGS_ced_allow_utf8utf8, false); EXPECT_EQ(other, TestCompactEncDet(str, name)); } } }; // end class CompactEncDetTest TEST_F(CompactEncDetTest, ZeroLength) { // The spec (.h file) says that DetectEncoding returns ASCII // (ISO_8859_1) when the text_length is 0. It doesn't require that // the text actually *have* a length of 0. In particular, we want to // allow the case where the text is actually NULL. This shows up // in a unit test, caribou/medley/internal/parser_impl_test, which // uses StringPiece() and calls the .data() method, which returns // NULL, and the .size() method, which returns 0. Without the test // for for length == 0, we segfaulted. // // For completeness, test all three cases: // Empty string EXPECT_EQ(ISO_8859_1, TestCompactEncDet("", 0, "ISO_8859_1")); // Non-empty string EXPECT_EQ(ISO_8859_1, TestCompactEncDet("abcdef", 0, "ISO_8859_1")); // Null string EXPECT_EQ(ISO_8859_1, TestCompactEncDet(NULL, 0, "ISO_8859_1")); } // NOTE: strlen will not work for UTF-16 and UTF-32 strings with embedded NUL TEST_F(CompactEncDetTest, EasyTests) { // One-byte EXPECT_EQ(ISO_8859_1, TestCompactEncDet(kTeststr00, strlen(kTeststr00), "ISO_8859_1")); // By design, Latin4 is the most sensitive test of the bunch, // most likely to fail with minor changes in the detector probabilities EXPECT_EQ(ISO_8859_4, TestCompactEncDet(kTeststr03, strlen(kTeststr03), "ISO_8859_4")); EXPECT_EQ(ISO_8859_5, TestCompactEncDet(kTeststr04, strlen(kTeststr04), "ISO_8859_5")); EXPECT_EQ(ISO_8859_6, TestCompactEncDet(kTeststr05, strlen(kTeststr05), "ISO_8859_6")); // This text is in fact CP1253, previously mis-detected as Greek. // 0xA2 = U+0386 Alpha with Tonos EXPECT_EQ(MSFT_CP1253, TestCompactEncDet(kTeststr06, strlen(kTeststr06), "ISO_8859_7 => 1253")); EXPECT_EQ(MSFT_CP1255, // Logical (modern browsers) order TestCompactEncDet(kTeststr07, strlen(kTeststr07), "ISO_8859_8_I")); EXPECT_EQ(ISO_8859_8, // Visual (original 1994 browsers) order TestCompactEncDet(kTeststr07v, strlen(kTeststr07v), "ISO_8859_8")); EXPECT_EQ(ISO_8859_9, TestCompactEncDet(kTeststr08, strlen(kTeststr08), "ISO_8859_9")); // Two-byte Japanese EXPECT_EQ(JAPANESE_SHIFT_JIS, TestCompactEncDet(kTeststr11, strlen(kTeststr11), "JAPANESE_SHIFT_JIS")); // Two-byte Chinese EXPECT_EQ(CHINESE_GB, TestCompactEncDet(kTeststr14, strlen(kTeststr14), "CHINESE_GB")); EXPECT_EQ(GB18030, TestCompactEncDet(kTeststr46, strlen(kTeststr46), "GB18030")); // Two-byte Chinese-T EXPECT_EQ(CHINESE_BIG5, TestCompactEncDet(kTeststr13, strlen(kTeststr13), "CHINESE_BIG5")); // Two-byte Korean //KOREAN_EUC_KR, // 16: Teragram KSC // UTF-8 EXPECT_EQ(UTF8, TestCompactEncDet(kTeststr22, strlen(kTeststr22), "UTF8")); // More one-byte EXPECT_EQ(ISO_8859_11, TestCompactEncDet(kTeststr33, strlen(kTeststr33), "ISO_8859_11")); EXPECT_EQ(RUSSIAN_KOI8_R, TestCompactEncDet(kTeststr25, strlen(kTeststr25), "RUSSIAN_KOI8_R")); EXPECT_EQ(RUSSIAN_KOI8_RU, TestCompactEncDet(kTeststr28, strlen(kTeststr28), "RUSSIAN_KOI8_RU")); EXPECT_EQ(RUSSIAN_CP1251, TestCompactEncDet(kTeststr26, strlen(kTeststr26), "RUSSIAN_CP1251")); EXPECT_EQ(MSFT_CP1252, TestCompactEncDet(kTeststr27, strlen(kTeststr27), "MSFT_CP1252")); EXPECT_EQ(MSFT_CP1250, TestCompactEncDet(kTeststr29, strlen(kTeststr29), "MSFT_CP1250")); EXPECT_EQ(MSFT_CP1257, TestCompactEncDet(kTeststr32, strlen(kTeststr32), "MSFT_CP1257")); EXPECT_EQ(MSFT_CP1256, TestCompactEncDet(kTeststr35, strlen(kTeststr35), "MSFT_CP1256")); EXPECT_EQ(RUSSIAN_CP866, TestCompactEncDet(kTeststr42, strlen(kTeststr42), "RUSSIAN_CP866")); EXPECT_EQ(MACINTOSH_ROMAN, TestCompactEncDet(kTeststr53, strlen(kTeststr53), "MACINTOSH_ROMAN")); // Ascii7 and seven-bit CJK and Unicode encodings EXPECT_EQ(JAPANESE_JIS, TestCompactEncDet(kTeststr12, strlen(kTeststr12), "JAPANESE_JIS")); #if defined(HTML5_MODE) EXPECT_EQ(ASCII_7BIT, TestCompactEncDet(kTeststr44, strlen(kTeststr44), "ASCII_7BIT")); EXPECT_EQ(ASCII_7BIT, TestCompactEncDet(kTeststr48, strlen(kTeststr48), "ASCII_7BIT")); EXPECT_EQ(ASCII_7BIT, TestCompactEncDet(kTeststr54, strlen(kTeststr54), "ASCII_7BIT")); EXPECT_EQ(ASCII_7BIT, TestCompactEncDet(kTeststr62, strlen(kTeststr62), "ASCII_7BIT")); #else EXPECT_EQ(ISO_2022_KR, TestCompactEncDet(kTeststr44, strlen(kTeststr44), "ISO_2022_KR")); EXPECT_EQ(ISO_2022_CN, TestCompactEncDet(kTeststr48, strlen(kTeststr48), "ISO_2022_CN")); EXPECT_EQ(UTF7, TestCompactEncDet(kTeststr54, strlen(kTeststr54), "UTF7")); EXPECT_EQ(HZ_GB_2312, TestCompactEncDet(kTeststr62, strlen(kTeststr62), "HZ_GB_2312")); #endif TestUTF8UTF8(kTeststr63, UTF8, "UTF8UTF8"); // Unicode and other embedded NUL bytes Encoding encoding_UTF16LE; Encoding encoding_UTF16BE; #if defined(HTML5_MODE) encoding_UTF16LE = ASCII_7BIT; encoding_UTF16BE = ASCII_7BIT; #else encoding_UTF16LE = UTF16LE; encoding_UTF16BE = UTF16BE; #endif EXPECT_EQ(encoding_UTF16LE, TestCompactEncDet(kTeststr57, sizeof(kTeststr57), "UTF16LE")); EXPECT_EQ(encoding_UTF16LE, TestCompactEncDet(kUTF16LEChomsky, sizeof(kUTF16LEChomsky), "UTF16LE")); EXPECT_EQ(encoding_UTF16LE, TestCompactEncDet(kUTF16LEFltrs, sizeof(kUTF16LEFltrs), "UTF16LE")); EXPECT_EQ(encoding_UTF16BE, TestCompactEncDet(kTeststr58, sizeof(kTeststr58), "UTF16BE")); EXPECT_EQ(UTF32LE, TestCompactEncDet(kTeststr59, sizeof(kTeststr59), "UTF32LE")); EXPECT_EQ(UTF32BE, TestCompactEncDet(kTeststr60, sizeof(kTeststr60), "UTF32BE")); #if defined(HTML5_MODE) EXPECT_EQ(ASCII_7BIT, TestCompactEncDet(kTeststr61, sizeof(kTeststr61), "BINARYENC")); #else EXPECT_EQ(BINARYENC, TestCompactEncDet(kTeststr61, sizeof(kTeststr61), "ASCII_7BIT")); #endif // Indic. Detection requires a full URL hint // dsites 2007.10.10 NO LONGER DETECTED. Will return some LatinX result EXPECT_EQ(ISO_8859_10, TestCompactEncDetWithURL(kTeststr52, strlen(kTeststr52), kTestUrl52, "Indic JAGRAN")); EXPECT_EQ(UTF8, TestCompactEncDetWithURL(kTeststr52b, strlen(kTeststr52b), kTestUrl52b, "Indic UTF8")); // dsites 2011.11.07 remove mixed encoding UTF8CP1252 -- it was a bad idea // Mixed UTF-8 and CP1252 and UTF8UTF8 //// TestUTF8UTF8(kTeststr99, MSFT_CP1252, "UTF8CP1252"); } TEST_F(CompactEncDetTest, LangHintTests) { // Make sure the Tier1 language hints are plausible EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfLangHint("English")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfLangHint("Spanish")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfLangHint("German")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfLangHint("French")); EXPECT_EQ(JAPANESE_SHIFT_JIS, CompactEncDet::TopEncodingOfLangHint("Japanese")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfLangHint("Portuguese_B")); EXPECT_EQ(CHINESE_GB, CompactEncDet::TopEncodingOfLangHint("Chinese")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfLangHint("Italian")); EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfLangHint("Dutch")); EXPECT_EQ(ISO_8859_9, CompactEncDet::TopEncodingOfLangHint("Turkish")); EXPECT_EQ(ISO_8859_2, CompactEncDet::TopEncodingOfLangHint("Polish")); EXPECT_EQ(ISO_8859_11, CompactEncDet::TopEncodingOfLangHint("Thai")); EXPECT_EQ(CHINESE_BIG5, CompactEncDet::TopEncodingOfLangHint("ChineseT")); EXPECT_EQ(MSFT_CP1256, CompactEncDet::TopEncodingOfLangHint("Arabic")); EXPECT_EQ(RUSSIAN_CP1251, CompactEncDet::TopEncodingOfLangHint("Russian")); EXPECT_EQ(KOREAN_EUC_KR, CompactEncDet::TopEncodingOfLangHint("Korean")); } TEST_F(CompactEncDetTest, TLDHintTests) { // Make sure the Tier1 domain hints are plausible EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfTLDHint("de")); EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfTLDHint("au")); EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfTLDHint("ca")); EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfTLDHint("in")); EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfTLDHint("uk")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfTLDHint("es")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfTLDHint("mx")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfTLDHint("fr")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfTLDHint("it")); EXPECT_EQ(JAPANESE_SHIFT_JIS, CompactEncDet::TopEncodingOfTLDHint("jp")); EXPECT_EQ(KOREAN_EUC_KR, CompactEncDet::TopEncodingOfTLDHint("kr")); EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfTLDHint("nl")); EXPECT_EQ(ISO_8859_2, CompactEncDet::TopEncodingOfTLDHint("pl")); EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfTLDHint("br")); EXPECT_EQ(RUSSIAN_CP1251, CompactEncDet::TopEncodingOfTLDHint("ru")); EXPECT_EQ(ISO_8859_11, CompactEncDet::TopEncodingOfTLDHint("th")); EXPECT_EQ(ISO_8859_9, CompactEncDet::TopEncodingOfTLDHint("tr")); EXPECT_EQ(CHINESE_GB, CompactEncDet::TopEncodingOfTLDHint("cn")); EXPECT_EQ(CHINESE_BIG5, CompactEncDet::TopEncodingOfTLDHint("tw")); } TEST_F(CompactEncDetTest, CharsetHintTests) { // Make sure official encoding names give that encoding, or sub/superset EXPECT_EQ(ISO_8859_1, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-1")); // ASCII_7BIT ok EXPECT_EQ(ISO_8859_2, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-2")); EXPECT_EQ(ISO_8859_3, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-3")); // ASCII_7BIT bug EXPECT_EQ(ISO_8859_4, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-4")); // MSFT_CP1257 bug EXPECT_EQ(ISO_8859_5, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-5")); EXPECT_EQ(ISO_8859_6, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-6")); // ASCII_7BIT bug EXPECT_EQ(ISO_8859_7, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-7")); EXPECT_EQ(ISO_8859_8, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-8")); EXPECT_EQ(ISO_8859_9, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-9")); EXPECT_EQ(ISO_8859_10, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-10")); // ASCII_7BIT bug EXPECT_EQ(JAPANESE_EUC_JP, CompactEncDet::TopEncodingOfCharsetHint("EUC-JP")); EXPECT_EQ(JAPANESE_SHIFT_JIS, CompactEncDet::TopEncodingOfCharsetHint("Shift-JIS")); EXPECT_EQ(JAPANESE_JIS, CompactEncDet::TopEncodingOfCharsetHint("JIS")); // JAPANESE_SHIFT_JIS ok EXPECT_EQ(CHINESE_BIG5, CompactEncDet::TopEncodingOfCharsetHint("Big5")); EXPECT_EQ(CHINESE_GB, CompactEncDet::TopEncodingOfCharsetHint("GB")); EXPECT_EQ(CHINESE_EUC_CN, CompactEncDet::TopEncodingOfCharsetHint("EUC-CN")); // CHINESE_GB ok EXPECT_EQ(KOREAN_EUC_KR, CompactEncDet::TopEncodingOfCharsetHint("EUC-KR")); // Never return UNICODE; return UTF-16BE or lE instead // EXPECT_EQ(UNICODE, CompactEncDet::TopEncodingOfCharsetHint("Unicode")); // ASCII_7BIT EXPECT_EQ(CHINESE_EUC_DEC, CompactEncDet::TopEncodingOfCharsetHint("EUC-DEC")); // UNKNOWN_ENCODING ok EXPECT_EQ(CHINESE_CNS, CompactEncDet::TopEncodingOfCharsetHint("CNS")); // UNKNOWN_ENCODING ok EXPECT_EQ(CHINESE_BIG5_CP950, CompactEncDet::TopEncodingOfCharsetHint("windows-950"));// CHINESE_BIG5 ok EXPECT_EQ(JAPANESE_CP932, CompactEncDet::TopEncodingOfCharsetHint("windows-932")); // JAPANESE_EUC_JP ok EXPECT_EQ(UTF8, CompactEncDet::TopEncodingOfCharsetHint("UTF8")); // Never return "unknown" // EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfCharsetHint("unknown"));// JAPANESE_SHIFT_JIS bug EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfCharsetHint("ASCII")); // UNKNOWN_ENCODING bug EXPECT_EQ(ASCII_7BIT, CompactEncDet::TopEncodingOfCharsetHint("US-ASCII")); // UNKNOWN_ENCODING bug EXPECT_EQ(RUSSIAN_KOI8_R, CompactEncDet::TopEncodingOfCharsetHint("KOI8R")); EXPECT_EQ(RUSSIAN_CP1251, CompactEncDet::TopEncodingOfCharsetHint("windows-1251")); EXPECT_EQ(MSFT_CP1252, CompactEncDet::TopEncodingOfCharsetHint("windows-1252")); // ASCII_7BIT ok EXPECT_EQ(RUSSIAN_KOI8_RU, CompactEncDet::TopEncodingOfCharsetHint("KOI8U")); EXPECT_EQ(MSFT_CP1250, CompactEncDet::TopEncodingOfCharsetHint("windows-1250")); EXPECT_EQ(ISO_8859_15, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-15")); EXPECT_EQ(MSFT_CP1254, CompactEncDet::TopEncodingOfCharsetHint("windows-1254")); // ISO_8859_9 ok EXPECT_EQ(MSFT_CP1257, CompactEncDet::TopEncodingOfCharsetHint("windows-1257")); EXPECT_EQ(ISO_8859_11, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-11")); EXPECT_EQ(MSFT_CP874, CompactEncDet::TopEncodingOfCharsetHint("win-874")); // UNKNOWN_ENCODING bug EXPECT_EQ(MSFT_CP1256, CompactEncDet::TopEncodingOfCharsetHint("windows-1256")); EXPECT_EQ(MSFT_CP1255, CompactEncDet::TopEncodingOfCharsetHint("windows-1255")); // UNKNOWN_ENCODING // Always map ISO-8859-8-I to MSFT_CP1255 EXPECT_EQ(MSFT_CP1255, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-8-I")); // MSFT_CP1255 // Always map Visual Hebrew to ISO_8859_8 EXPECT_EQ(ISO_8859_8, CompactEncDet::TopEncodingOfCharsetHint("Visual")); // ISO_8859_8 ok EXPECT_EQ(CZECH_CP852, CompactEncDet::TopEncodingOfCharsetHint("windows-852")); EXPECT_EQ(CZECH_CSN_369103, CompactEncDet::TopEncodingOfCharsetHint("CSN-369103")); EXPECT_EQ(MSFT_CP1253, CompactEncDet::TopEncodingOfCharsetHint("windows-1253")); // UTF8 EXPECT_EQ(RUSSIAN_CP866, CompactEncDet::TopEncodingOfCharsetHint("windows-866")); EXPECT_EQ(ISO_8859_13, CompactEncDet::TopEncodingOfCharsetHint("ISO-8859-13")); // MSFT_CP1257 ok EXPECT_EQ(ISO_2022_KR, CompactEncDet::TopEncodingOfCharsetHint("ISO-2022-KR")); // KOREAN_EUC_KR ok EXPECT_EQ(GBK, CompactEncDet::TopEncodingOfCharsetHint("GBK")); // CHINESE_GB ok EXPECT_EQ(GB18030, CompactEncDet::TopEncodingOfCharsetHint("GB18030")); // CHINESE_GB ok EXPECT_EQ(BIG5_HKSCS, CompactEncDet::TopEncodingOfCharsetHint("BIG5-HKSCS")); // CHINESE_BIG5 ok EXPECT_EQ(ISO_2022_CN, CompactEncDet::TopEncodingOfCharsetHint("ISO-2022-CN")); // CHINESE_GB ok EXPECT_EQ(TSCII, CompactEncDet::TopEncodingOfCharsetHint("TSCII")); // UNKNOWN_ENCODING EXPECT_EQ(TAMIL_MONO, CompactEncDet::TopEncodingOfCharsetHint("TAM")); // UNKNOWN_ENCODING EXPECT_EQ(TAMIL_BI, CompactEncDet::TopEncodingOfCharsetHint("TAB")); // UNKNOWN_ENCODING EXPECT_EQ(JAGRAN, CompactEncDet::TopEncodingOfCharsetHint("JAGRAN")); // UNKNOWN_ENCODING EXPECT_EQ(MACINTOSH_ROMAN, CompactEncDet::TopEncodingOfCharsetHint("MacRoman"));// ASCII_7BIT EXPECT_EQ(UTF7, CompactEncDet::TopEncodingOfCharsetHint("UTF-7")); // ASCII_7BIT EXPECT_EQ(BHASKAR, CompactEncDet::TopEncodingOfCharsetHint("BHASKAR")); // UNKNOWN_ENCODING EXPECT_EQ(HTCHANAKYA, CompactEncDet::TopEncodingOfCharsetHint("HTCHANAKYA")); // UNKNOWN_ENCODING EXPECT_EQ(UTF16BE, CompactEncDet::TopEncodingOfCharsetHint("UTF-16BE")); // ASCII_7BIT EXPECT_EQ(UTF16LE, CompactEncDet::TopEncodingOfCharsetHint("UTF-16LE")); // UNKNOWN_ENCODING EXPECT_EQ(UTF32BE, CompactEncDet::TopEncodingOfCharsetHint("UTF-32BE")); // UNKNOWN_ENCODING EXPECT_EQ(UTF32LE, CompactEncDet::TopEncodingOfCharsetHint("UTF-32LE")); // UNKNOWN_ENCODING EXPECT_EQ(BINARYENC, CompactEncDet::TopEncodingOfCharsetHint("binary")); // UNKNOWN_ENCODING EXPECT_EQ(HZ_GB_2312, CompactEncDet::TopEncodingOfCharsetHint("HZ-GB-2312")); // GBK EXPECT_EQ(UTF8UTF8, CompactEncDet::TopEncodingOfCharsetHint("utf8utf8")); // UNKNOWN_ENCODING } TEST_F(CompactEncDetTest, UTF8UTF8Tests) { // Present subset of all 128 possible UTF8-UTF8 double-conversions and // make sure they are properly detected. TestUTF8UTF8("\xC3\xA2\xE2\x80\x9A\xC2\xAC", UTF8, "UTF8UTF8 80"); TestUTF8UTF8("\xC3\x82\xC2\x81", UTF8, "UTF8UTF8 81"); TestUTF8UTF8("\xC3\x86\xE2\x80\x99", UTF8, "UTF8UTF8 83"); TestUTF8UTF8("\xC3\xA2\xE2\x82\xAC\xE2\x84\xA2", UTF8, "UTF8UTF8 92"); TestUTF8UTF8("\xC3\x8B\xC5\x93", UTF8, "UTF8UTF8 98"); TestUTF8UTF8("\xC3\x83\xC6\x92", UTF8, "UTF8UTF8 C3"); TestUTF8UTF8("\xC3\x83\xCB\x86", UTF8, "UTF8UTF8 C8"); TestUTF8UTF8("\xC3\x83\xC2\xBF", UTF8, "UTF8UTF8 FF"); // These are bare-byte extra conversions to UTF-8 TestUTF8UTF8("\xc3\x85\xc2\x8f:\xc3\x8c\xc2\x95:" "\xc3\x85\xc2\x8f:\xc3\x8a\xc2\xbe:" "\xc3\x85\xc2\x8f:\xc3\x85\xc2\xad:" "\xc3\x8a\xc2\xbb:\xc3\x85\xc2\x8f:" "\xc3\xa7\xc2\x92\xc2\xb0", UTF8, "UTF8UTF8 bytes1"); TestUTF8UTF8("\x20\x20\xc3\xa7\xc2\x92\xc2\xb0" "\xc3\xa5\xc2\xa2\xc2\x83\xc3\xa3" "\xc2\x83\xc2\xbb\xc3\xa5\xc2\x85" "\xc2\xac\xc3\xa5\xc2\xae\xc2\xb3" "\xc3\xa3\xc2\x80\xc2\x80\xc3\xa4" "\xc2\xba\xc2\x8b\xc3\xa5\xc2\x85" "\xc2\xb8", UTF8, "UTF8UTF8 bytes2"); } TEST_F(CompactEncDetTest, NoUTF8UTF8) { VarSetter utf8utf8(&FLAGS_ced_allow_utf8utf8, true); if (FLAGS_enc_detect_detail) { const char* name = "NoUTF8UTF8"; fprintf(stderr, "(Unit test %s) start-detail\n", PsStr(name).c_str()); } int bytes_consumed = 0; bool confidence = false; Encoding encoding = CompactEncDet::DetectEncoding( kTestStrNoUTF8UTF8, strlen(kTestStrNoUTF8UTF8), NULL, // No url hint. NULL, // No charset_hint, NULL, // No meta_charset hint. UNKNOWN_ENCODING, // No encoding hint (setting this to UTF8 // decreased the detection accuracy although // the content of 'text' is always UTF8 // encoded). UNKNOWN_LANGUAGE, // Just like encoding, this too lowers // the accuracy. CompactEncDet::QUERY_CORPUS, true, &bytes_consumed, &confidence); if (FLAGS_enc_detect_detail) { fprintf(stderr, "() end-detail\n\n"); } EXPECT_EQ(UTF8, encoding); } const char kTestShiftJISNoHint[] = "\x82\xa0\x82\xaf\x82\xdc\x82\xb5\x82\xc4\x82\xa8\x82\xdf\x82\xc5" "\x82\xc6\x82\xa4\x82\xb2\x82\xb4\x82\xa2\x82\xdc\x82\xb7\x82\xb1" "\x82\xc6\x82\xb5\x82\xe0\x82\xe6\x82\xeb\x82\xb5\x82\xad\x82\xa8" "\x82\xcb\x82\xaa\x82\xa2\x82\xa2\x82\xbd\x82\xb5\x82\xa0\x82\xaf" "\x82\xdc\x82\xb5\x82\xc4\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa4" "\x82\xb2\x82\xb4\x82\xa2\x82\xdc\x82\xb7\x82\xb1\x82\xc6\x82\xb5" "\x82\xe0\x82\xe6\x82\xeb\x82\xb5\x82\xad\x82\xa8\x82\xcb\x82\xaa" "\x82\xa2\x82\xa2\x82\xbd\x82\xb5\x82\xa0\x82\xaf\x82\xdc\x82\xb5" "\x82\xc4\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa4\x82\xb2\x82\xb4" "\x82\xa2\x82\xdc\x82\xb7\x82\xb1\x82\xc6\x82\xb5\x82\xe0\x82\xe6" "\x82\xeb\x82\xb5\x82\xad\x82\xa8\x82\xcb\x82\xaa\x82\xa2\x82\xa2" "\x82\xbd\x82\xb5\x82\xa0\x82\xaf\x82\xdc\x82\xb5\x82\xc4\x82\xa8" "\x82\xdf\x82\xc5\x82\xc6\x82\xa4\x82\xb2\x82\xb4\x82\xa2\x82\xdc" "\x82\xb7\x82\xb1\x82\xc6\x82\xb5\x82\xe0\x82\xe6\x82\xeb\x82\xb5" "\x82\xad\x82\xa8\x82\xcb\x82\xaa\x82\xa2\x82\xa2\x82\xbd\x82\xb5" "\x82\xa0\x82\xaf\x82\xdc\x82\xb5\x82\xc4\x82\xa8\x82\xdf\x82\xc5" "\x82\xc6\x82\xa4\x82\xb2\x82\xb4\x82\xa2\x82\xdc\x82\xb7\x82\xb1" "\x82\xc6\x82\xb5\x82\xe0\x82\xe6\x82\xeb\x82\xb5\x82\xad\x82\xa8" "\x82\xcb\x82\xaa\x82\xa2\x82\xa2\x82\xbd\x82\xb5\x82\xa0\x82\xaf" "\x82\xdc\x82\xb5\x82\xc4\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa4" "\x82\xb2\x82\xb4\x82\xa2\x82\xdc\x82\xb7\x82\xb1\x82\xc6\x82\xb5" "\x82\xe0\x82\xe6\x82\xeb\x82\xb5\x82\xad\x82\xa8\x82\xcb\x82\xaa" "\x82\xa2\x82\xa2\x82\xbd\x82\xb5\x82\xa0\x82\xaf\x82\xdc\x82\xb5" "\x82\xc4\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa4\x82\xb2\x82\xb4" "\x82\xa2\x82\xdc\x82\xb7\x82\xb1\x82\xc6\x82\xb5\x82\xe0\x82\xe6" "\x82\xeb\x82\xb5\x82\xad\x82\xa8\x82\xcb\x82\xaa\x82\xa2\x82\xa2" "\x82\xbd\x82\xb5\x82\xa0\x82\xaf\x82\xdc\x82\xb5\x82\xc4\x82\xa8" "\x82\xdf\x82\xc5\x82\xc6\x82\xa4\x82\xb2\x82\xb4\x82\xa2\x82\xdc" "\x82\xb7\x82\xb1\x82\xc6\x82\xb5\x82\xe0\x82\xe6\x82\xeb\x82\xb5" "\x82\xad\x82\xa8\x82\xcb\x82\xaa\x82\xa2\x82\xa2\x82\xbd\x82\xb5" "\x82\xa0\x82\xaf\x82\xdc\x82\xb5\x82\xc4\x82\xa8\x82\xdf\x82\xc5" "\x82\xc6\x82\xa4\x82\xb2\x82\xb4\x82\xa2\x82\xdc\x82\xb7\x82\xb1" "\x82\xc6\x82\xb5\x82\xe0\x82\xe6\x82\xeb\x82\xb5\x82\xad\x82\xa8" "\x82\xcb\x82\xaa\x82\xa2\x82\xa2\x82\xbd\x82\xb5\x82\xa0\x82\xaf" "\x82\xdc\x82\xb5\x82\xc4\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa4" "\x82\xb2\x82\xb4\x82\xa2\x82\xdc\x82\xb7\x82\xb1\x82\xc6\x82\xb5" "\x82\xe0\x82\xe6\x82\xeb\x82\xb5\x82\xad\x82\xa8\x82\xcb\x82\xaa" "\x82\xa2\x82\xa2\x82\xbd\x82\xb5\x82\xa0\x82\xaf\x82\xdc\x82\xb5" "\x82\xc4\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa0\x82\xaf\x82\xdc" "\x82\xb5\x82\xc4\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa4\x82\xb2" "\x82\xb4\x82\xa2\x82\xdc\x82\xb7\x82\xb1\x82\xc6\x82\xb5\x82\xe0" "\x82\xe6\x82\xeb\x82\xb5\x82\xad\x82\xa8\x82\xcb\x82\xaa\x82\xa2" "\x82\xa2\x82\xbd\x82\xb5\x82\xa0\x82\xaf\x82\xdc\x82\xb5\x82\xc4" "\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa0\x82\xaf\x82\xdc\x82\xb5" "\x82\xc4\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa4\x82\xb2\x82\xb4" "\x82\xa2\x82\xdc\x82\xb7\x82\xb1\x82\xc6\x82\xb5\x82\xe0\x82\xe6" "\x82\xeb\x82\xb5\x82\xad\x82\xa8\x82\xcb\x82\xaa\x82\xa2\x82\xa2" "\x82\xbd\x82\xb5\x82\xa0\x82\xaf\x82\xdc\x82\xb5\x82\xc4\x82\xa8" "\x82\xdf\x82\xc5\x82\xc6\x82\xa0\x82\xaf\x82\xdc\x82\xb5\x82\xc4" "\x82\xa8\x82\xdf\x82\xc5\x82\xc6\x82\xa4\x82\xb2\x82\xb4\x82\xa2" "\x82\xdc\x82\xb7\x82\xb1\x82\xc6\x82\xa8\x82\xdf\x82\xc5\x82\xc6" "\x82\xa4\x82\xb2\x82\xb4\x82\xa2\x82\xdc\x82\xb7\x82\xb1\x82\xc6" "\x0a"; TEST_F(CompactEncDetTest, ShiftJISNoHintTest) { bool is_reliable; EXPECT_EQ(JAPANESE_SHIFT_JIS, TestCompactEncDetWithReliable(kTestShiftJISNoHint, strlen(kTestShiftJISNoHint), "JAPANESE_SHIFT_JIS", &is_reliable)); EXPECT_EQ(is_reliable, true); } #if 0 CP1252 => UTF8 => UTF8UTF8 80 => E282AC => C3A2E2809AC2AC 81 => C281 => C382C281 82 => E2809A => C3A2E282ACC5A1 83 => C692 => C386E28099 84 => E2809E => C3A2E282ACC5BE 85 => E280A6 => C3A2E282ACC2A6 86 => E280A0 => C3A2E282ACC2A0 87 => E280A1 => C3A2E282ACC2A1 88 => CB86 => C38BE280A0 89 => E280B0 => C3A2E282ACC2B0 8A => C5A0 => C385C2A0 8B => E280B9 => C3A2E282ACC2B9 8C => C592 => C385E28099 8D => C28D => C382C28D 8E => C5BD => C385C2BD 8F => C28F => C382C28F 90 => C290 => C382C290 91 => E28098 => C3A2E282ACCB9C 92 => E28099 => C3A2E282ACE284A2 93 => E2809C => C3A2E282ACC593 94 => E2809D => C3A2E282ACC29D 95 => E280A2 => C3A2E282ACC2A2 96 => E28093 => C3A2E282ACE2809C 97 => E28094 => C3A2E282ACE2809D 98 => CB9C => C38BC593 99 => E284A2 => C3A2E2809EC2A2 9A => C5A1 => C385C2A1 9B => E280BA => C3A2E282ACC2BA 9C => C593 => C385E2809C 9D => C29D => C382C29D 9E => C5BE => C385C2BE 9F => C5B8 => C385C2B8 A0 => C2A0 => C382C2A0 A1 => C2A1 => C382C2A1 A2 => C2A2 => C382C2A2 A3 => C2A3 => C382C2A3 A4 => C2A4 => C382C2A4 A5 => C2A5 => C382C2A5 A6 => C2A6 => C382C2A6 A7 => C2A7 => C382C2A7 A8 => C2A8 => C382C2A8 A9 => C2A9 => C382C2A9 AA => C2AA => C382C2AA AB => C2AB => C382C2AB AC => C2AC => C382C2AC AD => C2AD => C382C2AD AE => C2AE => C382C2AE AF => C2AF => C382C2AF B0 => C2B0 => C382C2B0 B1 => C2B1 => C382C2B1 B2 => C2B2 => C382C2B2 B3 => C2B3 => C382C2B3 B4 => C2B4 => C382C2B4 B5 => C2B5 => C382C2B5 B6 => C2B6 => C382C2B6 B7 => C2B7 => C382C2B7 B8 => C2B8 => C382C2B8 B9 => C2B9 => C382C2B9 BA => C2BA => C382C2BA BB => C2BB => C382C2BB BC => C2BC => C382C2BC BD => C2BD => C382C2BD BE => C2BE => C382C2BE BF => C2BF => C382C2BF C0 => C380 => C383E282AC C1 => C381 => C383C281 C2 => C382 => C383E2809A C3 => C383 => C383C692 C4 => C384 => C383E2809E C5 => C385 => C383E280A6 C6 => C386 => C383E280A0 C7 => C387 => C383E280A1 C8 => C388 => C383CB86 C9 => C389 => C383E280B0 CA => C38A => C383C5A0 CB => C38B => C383E280B9 CC => C38C => C383C592 CD => C38D => C383C28D CE => C38E => C383C5BD CF => C38F => C383C28F D0 => C390 => C383C290 D1 => C391 => C383E28098 D2 => C392 => C383E28099 D3 => C393 => C383E2809C D4 => C394 => C383E2809D D5 => C395 => C383E280A2 D6 => C396 => C383E28093 D7 => C397 => C383E28094 D8 => C398 => C383CB9C D9 => C399 => C383E284A2 DA => C39A => C383C5A1 DB => C39B => C383E280BA DC => C39C => C383C593 DD => C39D => C383C29D DE => C39E => C383C5BE DF => C39F => C383C5B8 E0 => C3A0 => C383C2A0 E1 => C3A1 => C383C2A1 E2 => C3A2 => C383C2A2 E3 => C3A3 => C383C2A3 E4 => C3A4 => C383C2A4 E5 => C3A5 => C383C2A5 E6 => C3A6 => C383C2A6 E7 => C3A7 => C383C2A7 E8 => C3A8 => C383C2A8 E9 => C3A9 => C383C2A9 EA => C3AA => C383C2AA EB => C3AB => C383C2AB EC => C3AC => C383C2AC ED => C3AD => C383C2AD EE => C3AE => C383C2AE EF => C3AF => C383C2AF F0 => C3B0 => C383C2B0 F1 => C3B1 => C383C2B1 F2 => C3B2 => C383C2B2 F3 => C3B3 => C383C2B3 F4 => C3B4 => C383C2B4 F5 => C3B5 => C383C2B5 F6 => C3B6 => C383C2B6 F7 => C3B7 => C383C2B7 F8 => C3B8 => C383C2B8 F9 => C3B9 => C383C2B9 FA => C3BA => C383C2BA FB => C3BB => C383C2BB FC => C3BC => C383C2BC FD => C3BD => C383C2BD FE => C3BE => C383C2BE FF => C3BF => C383C2BF #endif } // namespace ================================================ FILE: third_party/ced/compact_enc_det/detail_head_string.inc ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// // Produced by stringify.cc on 2007-09-28 09:13 from file i18n/encodings/compact_enc_det/tools/detail_head.ps "%!PS-Adobe-2.0\n\n/inch {72 mul} def\n/cshow {dup stringwidth pop -2 div" " 0 rmoveto show} def\n\n/lmargin 0.5 inch def\n/rmargin 8.5 inch def\n/t" "margin 10.5 inch def\n/bmargin 0.5 inch def\n\n\n% set to N>=0 to track " "ranked encoding N\n/track-me -1 def\n/track-me2 -1 def\n\n/columns 2 def" "\n\n/lpi 18 def % lines per inch\n/lpc lpi 10 mul def " " % lines per column\n/lpp lpc columns mul def % lines per page\n" "/probw 3.0 inch def % probability width\n/probr 50 def " " % probability range\n/widowlines lpi 2 idiv def % 1/2 inch widow a" "t bottom\n/widowlines lpi def % 1 inch widow at bottom\n\n/lpg l" "pi 2 idiv def % 1/2 inch spacing between groups\n\n/delc 4 inch " "def\n/dell -1 inch lpi div def\n\n/next-line 0 def % 24 lines per i" "nch, 240 per column\n\n/Cfont /Courier findfont 6 scalefont def\n/Hfont " "/Helvetica findfont 6 scalefont def\nHfont setfont\n\n\n% simple string " "hash -- sum the characters\n/strhash {\n /hstr exch def\n /h 0 def\n " "0 1 hstr length 1 sub {/i exch def /h h hstr i get add def} for\n h\n}" " def\n\n% convert pro at 30 per 2x to 0-2.5 inches spanning -50 to 0\n/p" "rob2x {\n 30 idiv probr div probw mul neg probw add\n}def\n\n\n/cliptoc" "olumn {\n % ====== MUST MATCH ME ======\n gsave\n lmargin tmargin mov" "eto\n next-line lpc idiv delc mul 0 rmoveto\n -1 18 rmoveto 0 -10.5 in" "ch rlineto delc 2 add 0 rlineto 0 10.5 inch rlineto closepath\n clip\n" " newpath\n} def\n\n/endcliptocolumn {\n grestore\n % ====== MUST MATC" "H ME ======\n} def\n\n\n\n/column-box {\n lmargin tmargin moveto\n nex" "t-line 1 sub lpc idiv delc mul next-line 1 sub lpc mod 1 add dell mul r" "moveto\n % box\n gsave -1.5 0 rmoveto 0 detail-count dell mul neg rmov" "eto probw 3 add 0 rlineto 0.25 setlinewidth stroke grestore\n gsave -1" ".5 0 rmoveto 0 detail-count dell mul neg rlineto 0.25 setlinewidth strok" "e grestore\n gsave probw .8 mul 0 rmoveto 0 detail-count dell mul neg r" "lineto 0.25 setlinewidth 0.8 setgray stroke grestore\n gsave probw .6 m" "ul 0 rmoveto 0 detail-count dell mul neg rlineto 0.25 setlinewidth 0.8 s" "etgray stroke grestore\n gsave probw .4 mul 0 rmoveto 0 detail-count de" "ll mul neg rlineto 0.25 setlinewidth 0.8 setgray stroke grestore\n gsav" "e probw .2 mul 0 rmoveto 0 detail-count dell mul neg rlineto 0.25 setlin" "ewidth 0.8 setgray stroke grestore\n gsave probw 1.5 add 0 rmoveto 0 de" "tail-count dell mul neg rlineto 0.25 setlinewidth stroke grestore\n} def" "\n\n\n/IncrementLine {\n /incr exch def\n /next-line next-line incr ad" "d def\n next-line lpc ge next-line incr sub lpc lt and {\n % We " "just went to the top of column 2; redo clip\n endcliptocolumn % M" "UST match\n column-box\n /next-line lpc def\n cliptocolumn " " % MUST match\n } if\n next-line lpp ge {\n % We just went to the" " top of column 3; start new page column 1\n endcliptocolumn % MUS" "T match\n column-box\n showpage\n Hfont setfont\n /next-line" " 0 def\n show-pageno\n cliptocolumn % MUST match\n } if\n}" " def\n\n/IncrementLineOutside {\n /incr exch def\n /next-line next-lin" "e incr add def\n next-line lpc ge next-line incr sub lpc lt and {\n" " % We just went to the top of column 2\n /next-line lpc def\n } i" "f\n next-line lpp ge {\n % We just went to the top of column 3; star" "t new page column 1\n showpage\n Hfont setfont\n /next-line 0 d" "ef\n show-pageno\n } if\n} def\n\n/NextColumn {\n lpc 1 sub Increme" "ntLine\n} def\n\n/NextPage {\n lpp 1 sub IncrementLine\n} def\n\n% Up" "on entry, we are OUTSIDE the clip\n/start-detail {\n /d-title exch def\n" "\n % align >= 1 inch at bottom of column, and/or start new column\n lp" "c next-line lpc mod sub widowlines lt {\n % Start at top of a column\n" " next-line lpc ge {\n % Start new page\n showpage\n Hf" "ont setfont\n /next-line 0 def\n show-pageno\n } {\n %" " Start new column\n /next-line lpc def\n } ifelse\n } if\n\n l" "margin tmargin moveto\n next-line lpc idiv delc mul next-line lpc mod " "dell mul rmoveto\n gsave d-title show grestore\n 0 dell rmoveto\n 1 1" " 4 {/j exch def gsave probw j mul 5 div -2 rmoveto 50 j 10 mul sub 20 st" "ring cvs cshow grestore} for\n 2 IncrementLineOutside\n /detail-count " "1 def\n cliptocolumn % MUST match\n /d-array [] def\n} def\n" "\n/size-detail {\n /d-names exch def\n /d-size exch def\n % zero sums" "\n /sums d-size array def\n 0 1 d-size 1 sub {/i exch def sums i 0 pu" "t} for\n /old-d-max 0 def\n /colors d-size array def\n 0 1 d-size 1 s" "ub {/i exch def colors i i 3 mul 17 mod 17 div put} for\n %0 1 d-size " "1 sub {/i exch def colors i d-names i get strhash 3 mul 17 mod 17 div p" "ut} for\n %0 1 d-size 1 sub {/i exch def ( ) show colors i get 20 stri" "ng cvs show} for\n} def\n\n/count-detail {\n /detail-total-count exch d" "ef\n % if total-count >= one column, start at top of a column\n detail" "-total-count lpp ge {\n % Start new page\n NextPage\n } {\n de" "tail-total-count lpc ge {\n % Start new column\n NextColumn\n " " } if\n } ifelse\n} def\n\n% highlight next entry with underbar\n/do-" "flag {\ngsave\n setrgbcolor\n lmargin tmargin moveto\n next-line lpc " "idiv delc mul next-line lpc mod dell mul rmoveto\n 0 -2 rmoveto\n pro" "bw 0 rlineto\n 0 dell neg rlineto\n probw neg 0 rlineto\n closepath\n" " fill\ngrestore\n} def\n\n/do-detail-e {\n /d-array exch def\n /d-enc" " exch def\n /d-label exch def\n /d-max -999999 def\n\n lmargin tmargi" "n moveto\n next-line lpc idiv delc mul next-line lpc mod dell mul rmov" "eto\n 0.25 setlinewidth\n\n % show label, using encoding color\n gsav" "e\n probw 2 add -2 rmoveto\n detail-count 1 sub 2 mod 0.25 inch mu" "l 0 rmoveto\n % ([) show detail-count 20 string cvs show (] ) show\n " " d-enc 0 lt {\n 0 setgray\n }{\n colors d-enc get 1 .8 se" "thsbcolor\n } ifelse\n d-label show\n grestore\n % For -prune- d" "raw horizontal line\n d-label length 8 gt {d-label 4 get (p) 0 get eq d" "-label 5 get (r) 0 get eq and {\n /prune-val d-label cvi def\n /ne" "wx prune-val 30 mul prob2x def\n gsave newx 6 rmoveto 0 -12 rlineto 1" ".5 setlinewidth 0.8 setgray stroke grestore\n gsave probw 0 add 0 rli" "neto 0.25 setlinewidth 0.8 setgray stroke grestore\n } if } if\n\n % t" "rack max per new row\n 0 1 d-array length 1 sub {\n /i exch def\n " " /sum sums i get d-array i get add def\n d-max sum lt {/d-max sum def" "} if\n } for\n\n % draw line increments\n 0 1 d-array length 1 sub {\n" " /i exch def\n detail-count 1 gt {\n /oldx old-d-max sums i g" "et sub prob2x def\n } {\n /oldx 600 prob2x def\n } ifelse\n " " /oldy dell neg def\n /newx d-max sums i get d-array i get add sub" " prob2x def\n /newy 0 def\n gsave\n oldx oldy rmoveto\n newx" " oldx sub newy oldy sub rlineto\n % if encoding is being tracked, ma" "ke bold line\n i track-me eq\n {2 setlinewidth}\n {i track-" "me2 eq {1.25 setlinewidth} {0.25 setlinewidth} ifelse}\n ifelse\n " " colors i get 1 .8 sethsbcolor stroke\n grestore\n } for\n /detail" "-count detail-count 1 add def\n\n % increment running total in sums, tr" "ack max per row\n 0 1 d-array length 1 sub {\n /i exch def\n sums" " i sums i get d-array i get add put\n } for\n /old-d-max d-max def\n" "\n 1 IncrementLine\n} def\n\n\n/do-detail {\n /d-array exch def\n /d-" "label exch def\n d-label -1 d-array do-detail-e\n} def\n\n% Upon exit, " "we are outside the clip\n/end-detail {\n pop\n endcliptocolumn " " % MUST match\n column-box\n\n % text labels\n 0 1 d-array length 1 s" "ub {\n /i exch def\n gsave\n /newx old-d-max sums i get sub pro" "b2x def\n newx 0 ge {\n newx 0 rmoveto\n currentpoint trans" "late\n colors i get 1 .8 sethsbcolor\n gsave 0 dell neg rline" "to 0.25 setlinewidth stroke grestore\n -60 rotate\n 0 -2 movet" "o d-names i get show\n } if\n grestore\n } for\n d-array length " "0 gt {\n lpg IncrementLineOutside\n } {\n lpg 4 idiv IncrementLin" "eOutside\n } ifelse\n} def\n\n/do-src {\n/src exch def\n lmargin tmarg" "in moveto\n next-line lpc idiv delc mul next-line lpc mod dell mul rmo" "veto\n Cfont setfont\n src show\n Hfont setfont\n 1 IncrementLine\n}" " def\n\n% Underline trigram in source text\n/do-highlight1 {\n /hl-colo" "r exch def\n /hl-offset exch def\n /hl-line exch 1 sub 2 mul def\n gs" "ave\n lmargin tmargin moveto\n next-line hl-line sub lpc idiv delc mul" "\n next-line hl-line sub lpc mod dell mul rmoveto\n % Assume text is 6" " chars in and 3.6 pts per char, but 2 chars per offset\n hl-offset 2 mu" "l 6 add 3.6 mul 4 rmoveto\n\n 0 setgray 0.5 setlinewidth\n hl-color 1" " eq {0 0 1 setrgbcolor} if % Latin1 blue\n hl-color 2 eq {1 0 1 setrgb" "color} if % Latin2 magenta\n hl-color 3 eq {1 0.67 0 setrgbcolor} if " "% Latin7 orange\n 18 -2 rlineto stroke\n grestore\n} def\n\n% Box trig" "ram in source text\n/do-highlight2 {\n /hl-color exch def\n /hl-offset" " exch def\n /hl-line exch 1 sub 2 mul def\n gsave\n lmargin tmargin m" "oveto\n next-line hl-line sub lpc idiv delc mul\n next-line hl-line su" "b lpc mod dell mul rmoveto\n % Assume text is 6 chars in and 3.6 pts pe" "r char, but 2 chars per offset\n hl-offset 2 mul 6 add 3.6 mul 4 rmove" "to\n\n 0 setgray 0.25 setlinewidth\n hl-color 1 eq {0 0 1 setrgbcolor}" " if % Latin1 blue\n hl-color 2 eq {1 0 1 setrgbcolor} if % Latin2 mag" "enta\n hl-color 3 eq {1 0.67 0 setrgbcolor} if % Latin7 orange\n -0.5" " -0.5 rmoveto\n 22 0 rlineto\n 0 4 rlineto\n -11 2 rlineto\n -11 -2 " "rlineto\n closepath\n stroke\n grestore\n} def\n\n/show-pageno {\ngsa" "ve\nlmargin bmargin moveto 0 -12 rmoveto\n(Page ) show pageno 20 string " "cvs show\ngrestore\n/pageno pageno 1 add def\n} def\n\n/pageno 1 def\nsh" "ow-pageno\n%=============================\n\n\n" ================================================ FILE: third_party/ced/util/basictypes.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_BASICTYPES_H_ #define UTIL_BASICTYPES_H_ #include // So we can set the bounds of our types #include // For size_t #include // for memcpy #include "util/port.h" // Types that only need exist on certain systems #ifndef COMPILER_MSVC // stdint.h is part of C99 but MSVC doesn't have it. #include // For intptr_t. #endif typedef signed char schar; typedef signed char int8; typedef short int16; // TODO(mbelshe) Remove these type guards. These are // temporary to avoid conflicts with npapi.h. #ifndef _INT32 #define _INT32 typedef int int32; #endif // The NSPR system headers define 64-bit as |long| when possible. In order to // not have typedef mismatches, we do the same on LP64. #if __LP64__ typedef long int64; #else typedef long long int64; #endif // NOTE: unsigned types are DANGEROUS in loops and other arithmetical // places. Use the signed types unless your variable represents a bit // pattern (eg a hash value) or you really need the extra bit. Do NOT // use 'unsigned' to express "this value should always be positive"; // use assertions for this. typedef unsigned char uint8; typedef unsigned short uint16; // TODO(mbelshe) Remove these type guards. These are // temporary to avoid conflicts with npapi.h. #ifndef _UINT32 #define _UINT32 typedef unsigned int uint32; #endif // See the comment above about NSPR and 64-bit. #if __LP64__ typedef unsigned long uint64; #else typedef unsigned long long uint64; #endif // A type to represent a Unicode code-point value. As of Unicode 4.0, // such values require up to 21 bits. // (For type-checking on pointers, make this explicitly signed, // and it should always be the signed version of whatever int32 is.) typedef signed int char32; const uint8 kuint8max = (( uint8) 0xFF); const uint16 kuint16max = ((uint16) 0xFFFF); const uint32 kuint32max = ((uint32) 0xFFFFFFFF); const uint64 kuint64max = ((uint64) GG_LONGLONG(0xFFFFFFFFFFFFFFFF)); const int8 kint8min = (( int8) 0x80); const int8 kint8max = (( int8) 0x7F); const int16 kint16min = (( int16) 0x8000); const int16 kint16max = (( int16) 0x7FFF); const int32 kint32min = (( int32) 0x80000000); const int32 kint32max = (( int32) 0x7FFFFFFF); const int64 kint64min = (( int64) GG_LONGLONG(0x8000000000000000)); const int64 kint64max = (( int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF)); // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) // An older, deprecated, politically incorrect name for the above. #define DISALLOW_EVIL_CONSTRUCTORS(TypeName) DISALLOW_COPY_AND_ASSIGN(TypeName) // A macro to disallow all the implicit constructors, namely the // default constructor, copy constructor and operator= functions. // // This should be used in the private: declarations for a class // that wants to prevent anyone from instantiating it. This is // especially useful for classes containing only static methods. #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ TypeName(); \ DISALLOW_COPY_AND_ASSIGN(TypeName) // The arraysize(arr) macro returns the # of elements in an array arr. // The expression is a compile-time constant, and therefore can be // used in defining new arrays, for example. If you use arraysize on // a pointer by mistake, you will get a compile-time error. // This template function declaration is used in defining arraysize. // Note that the function doesn't need an implementation, as we only // use its type. template char (&ArraySizeHelper(T (&array)[N]))[N]; // That gcc wants both of these prototypes seems mysterious. VC, for // its part, can't decide which to use (another mystery). Matching of // template overloads: the final frontier. #ifndef _MSC_VER template char (&ArraySizeHelper(const T (&array)[N]))[N]; #endif #define arraysize(array) (sizeof(ArraySizeHelper(array))) // Use implicit_cast as a safe version of static_cast or const_cast // for upcasting in the type hierarchy (i.e. casting a pointer to Foo // to a pointer to SuperclassOfFoo or casting a pointer to Foo to // a const pointer to Foo). // When you use implicit_cast, the compiler checks that the cast is safe. // Such explicit implicit_casts are necessary in surprisingly many // situations where C++ demands an exact type match instead of an // argument type convertable to a target type. // // The From type can be inferred, so the preferred syntax for using // implicit_cast is the same as for static_cast etc.: // // implicit_cast(expr) // // implicit_cast would have been part of the C++ standard library, // but the proposal was submitted too late. It will probably make // its way into the language in the future. template inline To implicit_cast(From const &f) { return f; } // The COMPILE_ASSERT macro can be used to verify that a compile time // expression is true. For example, you could use it to verify the // size of a static array: // // COMPILE_ASSERT(arraysize(content_type_names) == CONTENT_NUM_TYPES, // content_type_names_incorrect_size); // // or to make sure a struct is smaller than a certain size: // // COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); // // The second argument to the macro is the name of the variable. If // the expression is false, most compilers will issue a warning/error // containing the name of the variable. template struct CompileAssert { }; #undef COMPILE_ASSERT #define COMPILE_ASSERT(expr, msg) \ typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] // Implementation details of COMPILE_ASSERT: // // - COMPILE_ASSERT works by defining an array type that has -1 // elements (and thus is invalid) when the expression is false. // // - The simpler definition // // #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1] // // does not work, as gcc supports variable-length arrays whose sizes // are determined at run-time (this is gcc's extension and not part // of the C++ standard). As a result, gcc fails to reject the // following code with the simple definition: // // int foo; // COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is // // not a compile-time constant. // // - By using the type CompileAssert<(bool(expr))>, we ensures that // expr is a compile-time constant. (Template arguments must be // determined at compile-time.) // // - The outter parentheses in CompileAssert<(bool(expr))> are necessary // to work around a bug in gcc 3.4.4 and 4.0.1. If we had written // // CompileAssert // // instead, these compilers will refuse to compile // // COMPILE_ASSERT(5 > 0, some_message); // // (They seem to think the ">" in "5 > 0" marks the end of the // template argument list.) // // - The array size is (bool(expr) ? 1 : -1), instead of simply // // ((expr) ? 1 : -1). // // This is to avoid running into a bug in MS VC 7.1, which // causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1. // MetatagId refers to metatag-id that we assign to // each metatag pair.. typedef uint32 MetatagId; // Argument type used in interfaces that can optionally take ownership // of a passed in argument. If TAKE_OWNERSHIP is passed, the called // object takes ownership of the argument. Otherwise it does not. enum Ownership { DO_NOT_TAKE_OWNERSHIP, TAKE_OWNERSHIP }; // bit_cast is a template function that implements the // equivalent of "*reinterpret_cast(&source)". We need this in // very low-level functions like the protobuf library and fast math // support. // // float f = 3.14159265358979; // int i = bit_cast(f); // // i = 0x40490fdb // // The classical address-casting method is: // // // WRONG // float f = 3.14159265358979; // WRONG // int i = * reinterpret_cast(&f); // WRONG // // The address-casting method actually produces undefined behavior // according to ISO C++ specification section 3.10 -15 -. Roughly, this // section says: if an object in memory has one type, and a program // accesses it with a different type, then the result is undefined // behavior for most values of "different type". // // This is true for any cast syntax, either *(int*)&f or // *reinterpret_cast(&f). And it is particularly true for // conversions betweeen integral lvalues and floating-point lvalues. // // The purpose of 3.10 -15- is to allow optimizing compilers to assume // that expressions with different types refer to different memory. gcc // 4.0.1 has an optimizer that takes advantage of this. So a // non-conforming program quietly produces wildly incorrect output. // // The problem is not the use of reinterpret_cast. The problem is type // punning: holding an object in memory of one type and reading its bits // back using a different type. // // The C++ standard is more subtle and complex than this, but that // is the basic idea. // // Anyways ... // // bit_cast<> calls memcpy() which is blessed by the standard, // especially by the example in section 3.9 . Also, of course, // bit_cast<> wraps up the nasty logic in one place. // // Fortunately memcpy() is very fast. In optimized mode, with a // constant size, gcc 2.95.3, gcc 4.0.1, and msvc 7.1 produce inline // code with the minimal amount of data movement. On a 32-bit system, // memcpy(d,s,4) compiles to one load and one store, and memcpy(d,s,8) // compiles to two loads and two stores. // // I tested this code with gcc 2.95.3, gcc 4.0.1, icc 8.1, and msvc 7.1. // // WARNING: if Dest or Source is a non-POD type, the result of the memcpy // is likely to surprise you. template inline Dest bit_cast(const Source& source) { // Compile time assertion: sizeof(Dest) == sizeof(Source) // A compile error here means your Dest and Source have different sizes. // typedef char VerifySizesAreEqual [sizeof(Dest) == sizeof(Source) ? 1 : -1]; Dest dest; memcpy(&dest, &source, sizeof(dest)); return dest; } // The following enum should be used only as a constructor argument to indicate // that the variable has static storage class, and that the constructor should // do nothing to its state. It indicates to the reader that it is legal to // declare a static instance of the class, provided the constructor is given // the base::LINKER_INITIALIZED argument. Normally, it is unsafe to declare a // static variable that has a constructor or a destructor because invocation // order is undefined. However, IF the type can be initialized by filling with // zeroes (which the loader does for static variables), AND the destructor also // does nothing to the storage, AND there are no virtual methods, then a // constructor declared as // explicit MyClass(base::LinkerInitialized x) {} // and invoked as // static MyClass my_variable_name(base::LINKER_INITIALIZED); namespace base { enum LinkerInitialized { LINKER_INITIALIZED }; } // base // UnaligndLoad32 is put here instead of util/port.h to // avoid the circular dependency between port.h and basictypes.h // ARM does not support unaligned memory access. #if defined(ARCH_CPU_X86_FAMILY) // x86 and x86-64 can perform unaligned loads/stores directly; inline uint32 UnalignedLoad32(const void* p) { return *reinterpret_cast(p); } #else #define NEED_ALIGNED_LOADS // If target architecture does not support unaligned loads and stores, // use memcpy version of UNALIGNED_LOAD32. inline uint32 UnalignedLoad32(const void* p) { uint32 t; memcpy(&t, reinterpret_cast(p), sizeof(t)); return t; } #endif #endif // UTIL_BASICTYPES_H_ ================================================ FILE: third_party/ced/util/case_insensitive_hash.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_CASE_INSENSITIVE_HASH_H_ #define UTIL_CASE_INSENSITIVE_HASH_H_ #include #include #ifndef _MSC_VER #include #endif #include #include "util/basictypes.h" #include "util/string_util.h" // Functors for hashing c-strings with case-insensitive semantics. struct CStringCaseHash { size_t operator()(const char *str) const { unsigned long hash_val = 0; while (*str) { hash_val = 5*hash_val + tolower(*str); str++; } return (size_t)hash_val; } }; struct CStringCaseEqual { bool operator()(const char *str1, const char *str2) const { return !base::strcasecmp(str1, str2); } }; // These functors, in addition to being case-insensitive, ignore all // non-alphanumeric characters. This is useful when we want all variants of // a string -- where variants can differ in puncutation and whitespace -- to // map to the same value. struct CStringAlnumCaseHash { size_t operator()(const char *str) const { unsigned long hash_val = 0; while (*str) { if (isalnum(*str)) { hash_val = 5*hash_val + tolower(*str); } str++; } return (size_t)hash_val; } }; struct CStringAlnumCaseEqual { bool operator()(const char *str1, const char *str2) const { while (true) { // Skip until each pointer is pointing to an alphanumeric char or '\0' while (!isalnum(*str1) && (*str1 != '\0')) { str1++; } while (!isalnum(*str2) && (*str2 != '\0')) { str2++; } if (tolower(*str1) != tolower(*str2)) { return false; // mismatch on alphanumeric char or '\0' } if (*str1 == '\0') { // in which case *str2 must be '\0' as well return true; // reached '\0' in both strings without mismatch } str1++; str2++; } } }; #endif // UTIL_CASE_INSENSITIVE_HASH_H_ ================================================ FILE: third_party/ced/util/commandlineflags.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_COMMANDLINEFLAGS_H_ #define UTIL_COMMANDLINEFLAGS_H_ #undef DEFINE_bool #define DEFINE_bool(name, default_value, comment) \ bool FLAGS_##name = default_value #undef DEFINE_int32 #define DEFINE_int32(name, default_value, comment) \ int32 FLAGS_##name = default_value #undef DEFINE_string #define DEFINE_string(name, default_value, comment) \ string FLAGS_##name = default_value #undef DECLARE_bool #define DECLARE_bool(name) extern bool FLAGS_##name #undef DECLARE_int32 #define DECLARE_int32(name) extern int32 FLAGS_##name #undef DECLARE_string #define DECLARE_string(name) extern string FLAGS_##name #endif // UTIL_COMMANDLINEFLAGS_H_ ================================================ FILE: third_party/ced/util/encodings/encodings.cc ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #include "util/encodings/encodings.h" #include // for strcasecmp #include #include // for pair #include "util/basictypes.h" #include "util/string_util.h" #include "util/case_insensitive_hash.h" struct EncodingInfo { // The standard name for this encoding. // const char* encoding_name_; // The "preferred MIME name" of an encoding as specified by the IANA at: // http://www.iana.org/assignments/character-sets // // Note that the preferred MIME name may differ slightly from the // official IANA name: i.e. ISO-8859-1 vs. ISO_8859-1:1987 // const char* mime_encoding_name_; // It is an internal policy that if an encoding has an IANA name, // then encoding_name_ and mime_encoding_name_ must be the same string. // // However, there can be exceptions if there are compelling reasons. // For example, Japanese mobile handsets require the name // "Shift_JIS" in charset=... parameter in Content-Type headers to // process emoji (emoticons) in their private encodings. In that // case, mime_encoding_name_ should be "Shift_JIS", despite // encoding_name_ actually is "X-KDDI-Shift_JIS". // Some multi-byte encodings use byte values that coincide with the // ASCII codes for HTML syntax characters <>"&' and browsers like MSIE // can misinterpret these, as indicated in an external XSS report from // 2007-02-15. Here, we map these dangerous encodings to safer ones. We // also use UTF8 instead of encodings that we don't support in our // output, and we generally try to be conservative in what we send out. // Where the client asks for single- or double-byte encodings that are // not as common, we substitute a more common single- or double-byte // encoding, if there is one, thereby preserving the client's intent // to use less space than UTF-8. This also means that characters // outside the destination set will be converted to HTML NCRs (&#NNN;) // if requested. Encoding preferred_web_output_encoding_; }; static const EncodingInfo kEncodingInfoTable[] = { { "ASCII", "ISO-8859-1", ISO_8859_1}, { "Latin2", "ISO-8859-2", ISO_8859_2}, { "Latin3", "ISO-8859-3", UTF8}, // MSIE 6 does not support ISO-8859-3 (XSS issue) { "Latin4", "ISO-8859-4", ISO_8859_4}, { "ISO-8859-5", "ISO-8859-5", ISO_8859_5}, { "Arabic", "ISO-8859-6", ISO_8859_6}, { "Greek", "ISO-8859-7", ISO_8859_7}, { "Hebrew", "ISO-8859-8", MSFT_CP1255}, // we do not endorse the visual order { "Latin5", "ISO-8859-9", ISO_8859_9}, { "Latin6", "ISO-8859-10", UTF8}, // MSIE does not support ISO-8859-10 (XSS issue) { "EUC-JP", "EUC-JP", JAPANESE_EUC_JP}, { "SJS", "Shift_JIS", JAPANESE_SHIFT_JIS}, { "JIS", "ISO-2022-JP", JAPANESE_SHIFT_JIS}, // due to potential confusion with HTML syntax chars { "BIG5", "Big5", CHINESE_BIG5}, { "GB", "GB2312", CHINESE_GB}, { "EUC-CN", "EUC-CN", // Misnamed. Should be EUC-TW. CHINESE_BIG5}, // MSIE treats "EUC-CN" like GB2312, which is not EUC-TW, // and EUC-TW is rare, so we prefer Big5 for output. { "KSC", "EUC-KR", KOREAN_EUC_KR}, { "Unicode", "UTF-16LE", // Internet Explorer doesn't recognize "ISO-10646-UCS-2" UTF8 // due to potential confusion with HTML syntax chars }, { "EUC", "EUC", // Misnamed. Should be EUC-TW. CHINESE_BIG5 // MSIE does not recognize "EUC" (XSS issue), // and EUC-TW is rare, so we prefer Big5 for output. }, { "CNS", "CNS", // Misnamed. Should be EUC-TW. CHINESE_BIG5}, // MSIE does not recognize "CNS" (XSS issue), // and EUC-TW is rare, so we prefer Big5 for output. { "BIG5-CP950", "BIG5-CP950", // Not an IANA name CHINESE_BIG5 // MSIE does not recognize "BIG5-CP950" (XSS issue) }, { "CP932", "CP932", // Not an IANA name JAPANESE_SHIFT_JIS}, // MSIE does not recognize "CP932" (XSS issue) { "UTF8", "UTF-8", UTF8}, { "Unknown", "x-unknown", // Not an IANA name UTF8}, // UTF-8 is our default output encoding { "ASCII-7-bit", "US-ASCII", ASCII_7BIT}, { "KOI8R", "KOI8-R", RUSSIAN_KOI8_R}, { "CP1251", "windows-1251", RUSSIAN_CP1251}, { "CP1252", "windows-1252", MSFT_CP1252}, { "KOI8U", "KOI8-U", ISO_8859_5}, // because koi8-u is not as common { "CP1250", "windows-1250", MSFT_CP1250}, { "ISO-8859-15", "ISO-8859-15", ISO_8859_15}, { "CP1254", "windows-1254", MSFT_CP1254}, { "CP1257", "windows-1257", MSFT_CP1257}, { "ISO-8859-11", "ISO-8859-11", ISO_8859_11}, { "CP874", "windows-874", MSFT_CP874}, { "CP1256", "windows-1256", MSFT_CP1256}, { "CP1255", "windows-1255", MSFT_CP1255}, { "ISO-8859-8-I", "ISO-8859-8-I", MSFT_CP1255}, // Java does not support iso-8859-8-i { "VISUAL", "ISO-8859-8", MSFT_CP1255}, // we do not endorse the visual order { "CP852", "cp852", MSFT_CP1250}, // because cp852 is not as common { "CSN_369103", "csn_369103", MSFT_CP1250}, // MSIE does not recognize "csn_369103" (XSS issue) { "CP1253", "windows-1253", MSFT_CP1253}, { "CP866", "IBM866", RUSSIAN_CP1251}, // because cp866 is not as common { "ISO-8859-13", "ISO-8859-13", UTF8}, // because iso-8859-13 is not widely supported { "ISO-2022-KR", "ISO-2022-KR", KOREAN_EUC_KR}, // due to potential confusion with HTML syntax chars { "GBK", "GBK", GBK}, { "GB18030", "GB18030", GBK}, // because gb18030 is not widely supported { "BIG5_HKSCS", "BIG5-HKSCS", CHINESE_BIG5}, // because Big5-HKSCS is not widely supported { "ISO_2022_CN", "ISO-2022-CN", CHINESE_GB}, // due to potential confusion with HTML syntax chars { "TSCII", "tscii", UTF8}, // we do not have an output converter for this font encoding { "TAM", "tam", UTF8}, // we do not have an output converter for this font encoding { "TAB", "tab", UTF8}, // we do not have an output converter for this font encoding { "JAGRAN", "jagran", UTF8}, // we do not have an output converter for this font encoding { "MACINTOSH", "MACINTOSH", ISO_8859_1}, // because macintosh is relatively uncommon { "UTF7", "UTF-7", UTF8}, // UTF-7 has been the subject of XSS attacks and is deprecated { "BHASKAR", "bhaskar", UTF8}, // we do not have an output converter for this font encoding { "HTCHANAKYA", "htchanakya", // not an IANA charset name. UTF8}, // we do not have an output converter for this font encoding { "UTF-16BE", "UTF-16BE", UTF8}, // due to potential confusion with HTML syntax chars { "UTF-16LE", "UTF-16LE", UTF8}, // due to potential confusion with HTML syntax chars { "UTF-32BE", "UTF-32BE", UTF8}, // unlikely to cause XSS bugs, but very uncommon on Web { "UTF-32LE", "UTF-32LE", UTF8}, // unlikely to cause XSS bugs, but very uncommon on Web { "X-BINARYENC", "x-binaryenc", // Not an IANA name UTF8}, // because this one is not intended for output (just input) { "HZ-GB-2312", "HZ-GB-2312", CHINESE_GB}, // due to potential confusion with HTML syntax chars { "X-UTF8UTF8", "x-utf8utf8", // Not an IANA name UTF8}, // because this one is not intended for output (just input) { "X-TAM-ELANGO", "x-tam-elango", UTF8}, // we do not have an output converter for this font encoding { "X-TAM-LTTMBARANI", "x-tam-lttmbarani", UTF8}, // we do not have an output converter for this font encoding { "X-TAM-SHREE", "x-tam-shree", UTF8}, // we do not have an output converter for this font encoding { "X-TAM-TBOOMIS", "x-tam-tboomis", UTF8}, // we do not have an output converter for this font encoding { "X-TAM-TMNEWS", "x-tam-tmnews", UTF8}, // we do not have an output converter for this font encoding { "X-TAM-WEBTAMIL", "x-tam-webtamil", UTF8}, // we do not have an output converter for this font encoding { "X-KDDI-Shift_JIS", "Shift_JIS", JAPANESE_SHIFT_JIS}, // KDDI version of Shift_JIS with Google Emoji PUA mappings. // Note that MimeEncodingName() returns "Shift_JIS", since KDDI uses // "Shift_JIS" in HTTP headers and email messages. { "X-DoCoMo-Shift_JIS", "Shift_JIS", JAPANESE_SHIFT_JIS}, // DoCoMo version of Shift_JIS with Google Emoji PUA mappings. // See the comment at KDDI_SHIFT_JIS for other issues. { "X-SoftBank-Shift_JIS", "Shift_JIS", JAPANESE_SHIFT_JIS}, // SoftBank version of Shift_JIS with Google Emoji PUA mappings. // See the comment at KDDI_SHIFT_JIS for other issues. { "X-KDDI-ISO-2022-JP", "ISO-2022-JP", JAPANESE_SHIFT_JIS}, // KDDI version of ISO-2022-JP with Google Emoji PUA mappings. // See the comment at KDDI_SHIFT_JIS for other issues. // The preferred Web encoding is due to potential confusion with // HTML syntax chars. { "X-SoftBank-ISO-2022-JP", "ISO-2022-JP", JAPANESE_SHIFT_JIS}, // SoftBank version of ISO-2022-JP with Google Emoji PUA mappings. // See the comment at KDDI_SHIFT_JIS for other issues. // The preferred Web encoding is due to potential confusion with // HTML syntax chars. // Please refer to NOTE: section in the comments in the definition // of "struct I18NInfoByEncoding", before adding new encodings. }; COMPILE_ASSERT(arraysize(kEncodingInfoTable) == NUM_ENCODINGS, kEncodingInfoTable_has_incorrect_size); Encoding default_encoding() {return LATIN1;} // ************************************************************* // Encoding predicates // IsValidEncoding() // IsEncEncCompatible // IsEncodingWithSupportedLanguage // IsSupersetOfAscii7Bit // Is8BitEncoding // IsCJKEncoding // IsHebrewEncoding // IsRightToLeftEncoding // IsLogicalRightToLeftEncoding // IsVisualRightToLeftEncoding // IsIso2022Encoding // IsIso2022JpOrVariant // IsShiftJisOrVariant // IsJapaneseCellPhoneCarrierSpecificEncoding // ************************************************************* bool IsValidEncoding(Encoding enc) { return ((enc >= 0) && (enc < kNumEncodings)); } bool IsEncEncCompatible(const Encoding from, const Encoding to) { // Tests compatibility between the "from" and "to" encodings; in // the typical case -- when both are valid known encodings -- this // returns true iff converting from first to second is a no-op. if (!IsValidEncoding(from) || !IsValidEncoding(to)) { return false; // we only work with valid encodings... } else if (to == from) { return true; // the trivial common case } if (to == UNKNOWN_ENCODING) { return true; // all valid encodings are compatible with the unknown } if (from == UNKNOWN_ENCODING) { return false; // no unknown encoding is compatible with one that is } if (from == ASCII_7BIT) { return IsSupersetOfAscii7Bit(to); } return (from == ISO_8859_1 && to == MSFT_CP1252) || (from == ISO_8859_8 && to == HEBREW_VISUAL) || (from == HEBREW_VISUAL && to == ISO_8859_8) || (from == ISO_8859_9 && to == MSFT_CP1254) || (from == ISO_8859_11 && to == MSFT_CP874) || (from == JAPANESE_SHIFT_JIS && to == JAPANESE_CP932) || (from == CHINESE_BIG5 && to == CHINESE_BIG5_CP950) || (from == CHINESE_GB && to == GBK) || (from == CHINESE_GB && to == GB18030) || (from == CHINESE_EUC_CN && to == CHINESE_EUC_DEC) || (from == CHINESE_EUC_CN && to == CHINESE_CNS) || (from == CHINESE_EUC_DEC && to == CHINESE_EUC_CN) || (from == CHINESE_EUC_DEC && to == CHINESE_CNS) || (from == CHINESE_CNS && to == CHINESE_EUC_CN) || (from == CHINESE_CNS && to == CHINESE_EUC_DEC); } // To be a superset of 7-bit Ascii means that bytes 0...127 in the given // encoding represent the same characters as they do in ISO_8859_1. // TODO: This list could be expanded. Many other encodings are supersets // of 7-bit Ascii. In fact, Japanese JIS and Unicode are the only two // encodings that I know for a fact should *not* be in this list. bool IsSupersetOfAscii7Bit(Encoding e) { switch (e) { case ISO_8859_1: case ISO_8859_2: case ISO_8859_3: case ISO_8859_4: case ISO_8859_5: case ISO_8859_6: case ISO_8859_7: case ISO_8859_8: case ISO_8859_9: case ISO_8859_10: case JAPANESE_EUC_JP: case JAPANESE_SHIFT_JIS: case CHINESE_BIG5: case CHINESE_GB: case CHINESE_EUC_CN: case KOREAN_EUC_KR: case CHINESE_EUC_DEC: case CHINESE_CNS: case CHINESE_BIG5_CP950: case JAPANESE_CP932: case UTF8: case UNKNOWN_ENCODING: case ASCII_7BIT: case RUSSIAN_KOI8_R: case RUSSIAN_CP1251: case MSFT_CP1252: case RUSSIAN_KOI8_RU: case MSFT_CP1250: case ISO_8859_15: case MSFT_CP1254: case MSFT_CP1257: case ISO_8859_11: case MSFT_CP874: case MSFT_CP1256: case MSFT_CP1255: case ISO_8859_8_I: case HEBREW_VISUAL: case CZECH_CP852: case MSFT_CP1253: case RUSSIAN_CP866: case ISO_8859_13: case GBK: case GB18030: case BIG5_HKSCS: case MACINTOSH_ROMAN: return true; default: return false; } } // To be an 8-bit encoding means that there are fewer than 256 symbols. // Each byte determines a new character; there are no multi-byte sequences. // TODO: This list could maybe be expanded. Other encodings may be 8-bit. bool Is8BitEncoding(Encoding e) { switch (e) { case ASCII_7BIT: case ISO_8859_1: case ISO_8859_2: case ISO_8859_3: case ISO_8859_4: case ISO_8859_5: case ISO_8859_6: case ISO_8859_7: case ISO_8859_8: case ISO_8859_8_I: case ISO_8859_9: case ISO_8859_10: case ISO_8859_11: case ISO_8859_13: case ISO_8859_15: case MSFT_CP1252: case MSFT_CP1253: case MSFT_CP1254: case MSFT_CP1255: case MSFT_CP1256: case MSFT_CP1257: case RUSSIAN_KOI8_R: case RUSSIAN_KOI8_RU: case RUSSIAN_CP866: return true; default: return false; } } bool IsCJKEncoding(Encoding e) { switch (e) { case JAPANESE_EUC_JP: case JAPANESE_SHIFT_JIS: case JAPANESE_JIS: case CHINESE_BIG5: case CHINESE_GB: case CHINESE_EUC_CN: case KOREAN_EUC_KR: case CHINESE_EUC_DEC: case CHINESE_CNS: case CHINESE_BIG5_CP950: case JAPANESE_CP932: case ISO_2022_KR: case GBK: case GB18030: case BIG5_HKSCS: case ISO_2022_CN: case HZ_GB_2312: return true; default: return false; } } bool IsHebrewEncoding(Encoding e) { return (e == ISO_8859_8 || e == ISO_8859_8_I || e == MSFT_CP1255 || e == HEBREW_VISUAL); } bool IsRightToLeftEncoding(Encoding enc) { switch (enc) { case MSFT_CP1255: case MSFT_CP1256: case ARABIC_ENCODING: case HEBREW_ENCODING: case ISO_8859_8_I: case HEBREW_VISUAL: return true; default: return false; } } bool IsLogicalRightToLeftEncoding(Encoding enc) { return IsRightToLeftEncoding(enc) && !IsVisualRightToLeftEncoding(enc); } // Note that despite an RFC to the contrary, ARABIC_ENCODING (ISO-8859-6) // is NOT visual. bool IsVisualRightToLeftEncoding(Encoding enc) { switch (enc) { case HEBREW_ENCODING: case HEBREW_VISUAL: return true; default: return false; } } bool IsIso2022Encoding(Encoding enc) { return (IsIso2022JpOrVariant(enc) || enc == ISO_2022_KR || enc == ISO_2022_CN); } bool IsIso2022JpOrVariant(Encoding enc) { return (enc == JAPANESE_JIS || enc == KDDI_ISO_2022_JP || enc == SOFTBANK_ISO_2022_JP); } bool IsShiftJisOrVariant(Encoding enc) { return (enc == JAPANESE_SHIFT_JIS || enc == JAPANESE_CP932 || enc == KDDI_SHIFT_JIS || enc == DOCOMO_SHIFT_JIS || enc == SOFTBANK_SHIFT_JIS); } bool IsJapaneseCellPhoneCarrierSpecificEncoding(Encoding enc) { return (enc == KDDI_ISO_2022_JP || enc == KDDI_SHIFT_JIS || enc == DOCOMO_SHIFT_JIS || enc == SOFTBANK_SHIFT_JIS || enc == SOFTBANK_ISO_2022_JP); } // ************************************************************* // ENCODING NAMES // EncodingName() [Encoding to name] // MimeEncodingName() [Encoding to name] // EncodingFromName() [name to Encoding] // EncodingNameAliasToEncoding() [name to Encoding] // default_encoding_name() // invalid_encoding_name() // ************************************************************* const char * EncodingName(const Encoding enc) { if ( (enc < 0) || (enc >= kNumEncodings) ) return invalid_encoding_name(); return kEncodingInfoTable[enc].encoding_name_; } // TODO: Unify MimeEncodingName and EncodingName, or determine why // such a unification is not possible. const char * MimeEncodingName(Encoding enc) { if ( (enc < 0) || (enc >= kNumEncodings) ) return ""; // TODO: Should this be invalid_encoding_name()? return kEncodingInfoTable[enc].mime_encoding_name_; } bool EncodingFromName(const char* enc_name, Encoding *encoding) { *encoding = UNKNOWN_ENCODING; if ( enc_name == NULL ) return false; for ( int i = 0; i < kNumEncodings; i++ ) { if (!base::strcasecmp(enc_name, kEncodingInfoTable[i].encoding_name_) ) { *encoding = static_cast(i); return true; } } return false; } // The encoding_map maps standard and non-standard encoding-names // (strings) to Encoding enums. It is used only by // EncodingNameAliasToEncoding. Note that the map uses // case-insensitive hash and comparison functions. typedef std::unordered_map EncodingMap; static const EncodingMap& GetEncodingMap() { static EncodingMap encoding_map; if (!encoding_map.empty()) { // Already initialized return encoding_map; } // Initialize the map with all the "standard" encoding names, // i.e., the ones returned by EncodingName and MimeEncodingName. // // First, add internal encoding names returned by EncodingName(). for (int i = 0; i < NUM_ENCODINGS; ++i) { Encoding e = static_cast(i); // Internal encoding names must be unique. // The internal names are guaranteed to be unique by the CHECK_EQ. const char *encoding_name = EncodingName(e); // CHECK_EQ(0, encoding_map.count(encoding_name)) // << "Duplicate found for " << encoding_name; encoding_map[encoding_name] = e; } // Then, add mime encoding names returned by MimeEncodingName(). // We don't override existing entries, to give precedence to entries // added earlier. for (int i = 0; i < NUM_ENCODINGS; ++i) { Encoding e = static_cast(i); // Note that MimeEncodingName() can return the same mime encoding // name for different encoding enums like JAPANESE_SHIFT_JIS and // KDDI_SHIFT_JIS. In that case, the encoding enum first seen // will be the value for the encoding name in the map. const char *mime_encoding_name = MimeEncodingName(e); if (encoding_map.count(mime_encoding_name) == 0) { encoding_map[mime_encoding_name] = e; } } // Add some non-standard names: alternate spellings, common typos, // etc. (It does no harm to add names already in the map.) Note // that although the map is case-insensitive, by convention the // keys are written here in lower case. For ease of maintenance, // they are listed in alphabetical order. encoding_map["5601"] = KOREAN_EUC_KR; encoding_map["646"] = ASCII_7BIT; encoding_map["852"] = CZECH_CP852; encoding_map["866"] = RUSSIAN_CP866; encoding_map["8859-1"] = ISO_8859_1; encoding_map["ansi-1251"] = RUSSIAN_CP1251; encoding_map["ansi_x3.4-1968"] = ASCII_7BIT; encoding_map["arabic"] = ISO_8859_6; encoding_map["ascii"] = ISO_8859_1; encoding_map["ascii-7-bit"] = ASCII_7BIT; // not iana standard encoding_map["asmo-708"] = ISO_8859_6; encoding_map["bhaskar"] = BHASKAR; encoding_map["big5"] = CHINESE_BIG5; encoding_map["big5-cp950"] = CHINESE_BIG5_CP950; // not iana standard encoding_map["big5-hkscs"] = BIG5_HKSCS; encoding_map["chinese"] = CHINESE_GB; encoding_map["cns"] = CHINESE_CNS; // not iana standard encoding_map["cns11643"] = CHINESE_CNS; encoding_map["cp1250"] = MSFT_CP1250; // not iana standard encoding_map["cp1251"] = RUSSIAN_CP1251; // not iana standard encoding_map["cp1252"] = MSFT_CP1252; // not iana standard encoding_map["cp1253"] = MSFT_CP1253; // not iana standard encoding_map["cp1254"] = MSFT_CP1254; // not iana standard encoding_map["cp1255"] = MSFT_CP1255; encoding_map["cp1256"] = MSFT_CP1256; encoding_map["cp1257"] = MSFT_CP1257; // not iana standard encoding_map["cp819"] = ISO_8859_1; encoding_map["cp852"] = CZECH_CP852; encoding_map["cp866"] = RUSSIAN_CP866; encoding_map["cp-866"] = RUSSIAN_CP866; encoding_map["cp874"] = MSFT_CP874; encoding_map["cp932"] = JAPANESE_CP932; // not iana standard encoding_map["cp950"] = CHINESE_BIG5_CP950; // not iana standard encoding_map["csbig5"] = CHINESE_BIG5; encoding_map["cseucjpkdfmtjapanese"] = JAPANESE_EUC_JP; encoding_map["cseuckr"] = KOREAN_EUC_KR; encoding_map["csgb2312"] = CHINESE_GB; encoding_map["csibm852"] = CZECH_CP852; encoding_map["csibm866"] = RUSSIAN_CP866; encoding_map["csiso2022jp"] = JAPANESE_JIS; encoding_map["csiso2022kr"] = ISO_2022_KR; encoding_map["csiso58gb231280"] = CHINESE_GB; encoding_map["csiso88598i"] = ISO_8859_8_I; encoding_map["csisolatin1"] = ISO_8859_1; encoding_map["csisolatin2"] = ISO_8859_2; encoding_map["csisolatin3"] = ISO_8859_3; encoding_map["csisolatin4"] = ISO_8859_4; encoding_map["csisolatin5"] = ISO_8859_9; encoding_map["csisolatin6"] = ISO_8859_10; encoding_map["csisolatinarabic"] = ISO_8859_6; encoding_map["csisolatincyrillic"] = ISO_8859_5; encoding_map["csisolatingreek"] = ISO_8859_7; encoding_map["csisolatinhebrew"] = ISO_8859_8; encoding_map["csksc56011987"] = KOREAN_EUC_KR; encoding_map["csmacintosh"] = MACINTOSH_ROMAN; encoding_map["csn-369103"] = CZECH_CSN_369103; encoding_map["csshiftjis"] = JAPANESE_SHIFT_JIS; encoding_map["csunicode"] = UTF16BE; encoding_map["csunicode11"] = UTF16BE; encoding_map["csunicode11utf7"] = UTF7; encoding_map["csunicodeascii"] = UTF16BE; encoding_map["csunicodelatin1"] = UTF16BE; encoding_map["cyrillic"] = ISO_8859_5; encoding_map["ecma-114"] = ISO_8859_6; encoding_map["ecma-118"] = ISO_8859_7; encoding_map["elot_928"] = ISO_8859_7; encoding_map["euc"] = CHINESE_EUC_DEC; // not iana standard encoding_map["euc-cn"] = CHINESE_EUC_CN; // not iana standard encoding_map["euc-dec"] = CHINESE_EUC_DEC; // not iana standard encoding_map["euc-jp"] = JAPANESE_EUC_JP; encoding_map["euc-kr"] = KOREAN_EUC_KR; encoding_map["eucgb2312_cn"] = CHINESE_GB; encoding_map["gb"] = CHINESE_GB; // not iana standard encoding_map["gb18030"] = GB18030; encoding_map["gb2132"] = CHINESE_GB; // common typo encoding_map["gb2312"] = CHINESE_GB; encoding_map["gb_2312-80"] = CHINESE_GB; encoding_map["gbk"] = GBK; encoding_map["greek"] = ISO_8859_7; encoding_map["greek8"] = ISO_8859_7; encoding_map["hebrew"] = ISO_8859_8; encoding_map["htchanakya"] = HTCHANAKYA; encoding_map["hz-gb-2312"] = HZ_GB_2312; encoding_map["ibm819"] = ISO_8859_1; encoding_map["ibm852"] = CZECH_CP852; encoding_map["ibm874"] = MSFT_CP874; encoding_map["iso-10646"] = UTF16BE; encoding_map["iso-10646-j-1"] = UTF16BE; encoding_map["iso-10646-ucs-2"] = UNICODE; encoding_map["iso-10646-ucs-4"] = UTF32BE; encoding_map["iso-10646-ucs-basic"] = UTF16BE; encoding_map["iso-10646-unicode-latin1"] = UTF16BE; encoding_map["iso-2022-cn"] = ISO_2022_CN; encoding_map["iso-2022-jp"] = JAPANESE_JIS; encoding_map["iso-2022-kr"] = ISO_2022_KR; encoding_map["iso-8559-1"] = ISO_8859_1; // common typo encoding_map["iso-874"] = MSFT_CP874; encoding_map["iso-8858-1"] = ISO_8859_1; // common typo // iso-8859-0 was a temporary name, eventually renamed iso-8859-15 encoding_map["iso-8859-0"] = ISO_8859_15; encoding_map["iso-8859-1"] = ISO_8859_1; encoding_map["iso-8859-10"] = ISO_8859_10; encoding_map["iso-8859-11"] = ISO_8859_11; encoding_map["iso-8859-13"] = ISO_8859_13; encoding_map["iso-8859-15"] = ISO_8859_15; encoding_map["iso-8859-2"] = ISO_8859_2; encoding_map["iso-8859-3"] = ISO_8859_3; encoding_map["iso-8859-4"] = ISO_8859_4; encoding_map["iso-8859-5"] = ISO_8859_5; encoding_map["iso-8859-6"] = ISO_8859_6; encoding_map["iso-8859-7"] = ISO_8859_7; encoding_map["iso-8859-8"] = ISO_8859_8; encoding_map["iso-8859-8-i"] = ISO_8859_8_I; encoding_map["iso-8859-9"] = ISO_8859_9; encoding_map["iso-9959-1"] = ISO_8859_1; // common typo encoding_map["iso-ir-100"] = ISO_8859_1; encoding_map["iso-ir-101"] = ISO_8859_2; encoding_map["iso-ir-109"] = ISO_8859_3; encoding_map["iso-ir-110"] = ISO_8859_4; encoding_map["iso-ir-126"] = ISO_8859_7; encoding_map["iso-ir-127"] = ISO_8859_6; encoding_map["iso-ir-138"] = ISO_8859_8; encoding_map["iso-ir-144"] = ISO_8859_5; encoding_map["iso-ir-148"] = ISO_8859_9; encoding_map["iso-ir-149"] = KOREAN_EUC_KR; encoding_map["iso-ir-157"] = ISO_8859_10; encoding_map["iso-ir-58"] = CHINESE_GB; encoding_map["iso-latin-1"] = ISO_8859_1; encoding_map["iso_2022-cn"] = ISO_2022_CN; encoding_map["iso_2022-kr"] = ISO_2022_KR; encoding_map["iso_8859-1"] = ISO_8859_1; encoding_map["iso_8859-10:1992"] = ISO_8859_10; encoding_map["iso_8859-11"] = ISO_8859_11; encoding_map["iso_8859-13"] = ISO_8859_13; encoding_map["iso_8859-15"] = ISO_8859_15; encoding_map["iso_8859-1:1987"] = ISO_8859_1; encoding_map["iso_8859-2"] = ISO_8859_2; encoding_map["iso_8859-2:1987"] = ISO_8859_2; encoding_map["iso_8859-3"] = ISO_8859_3; encoding_map["iso_8859-3:1988"] = ISO_8859_3; encoding_map["iso_8859-4"] = ISO_8859_4; encoding_map["iso_8859-4:1988"] = ISO_8859_4; encoding_map["iso_8859-5"] = ISO_8859_5; encoding_map["iso_8859-5:1988"] = ISO_8859_5; encoding_map["iso_8859-6"] = ISO_8859_6; encoding_map["iso_8859-6:1987"] = ISO_8859_6; encoding_map["iso_8859-7"] = ISO_8859_7; encoding_map["iso_8859-7:1987"] = ISO_8859_7; encoding_map["iso_8859-8"] = ISO_8859_8; encoding_map["iso_8859-8:1988:"] = ISO_8859_8; encoding_map["iso_8859-9"] = ISO_8859_9; encoding_map["iso_8859-9:1989"] = ISO_8859_9; encoding_map["jagran"] = JAGRAN; encoding_map["jis"] = JAPANESE_JIS; // not iana standard encoding_map["koi8-cs"] = CZECH_CSN_369103; encoding_map["koi8-r"] = RUSSIAN_KOI8_R; encoding_map["koi8-ru"] = RUSSIAN_KOI8_RU; // not iana standard encoding_map["koi8-u"] = RUSSIAN_KOI8_RU; encoding_map["koi8r"] = RUSSIAN_KOI8_R; // not iana standard encoding_map["koi8u"] = RUSSIAN_KOI8_RU; // not iana standard encoding_map["korean"] = KOREAN_EUC_KR; // i assume this is what is meant encoding_map["ks-c-5601"] = KOREAN_EUC_KR; // not iana standard encoding_map["ks-c-5601-1987"] = KOREAN_EUC_KR; // not iana standard encoding_map["ks_c_5601-1989"] = KOREAN_EUC_KR; encoding_map["ksc"] = KOREAN_EUC_KR; // not iana standard encoding_map["l1"] = ISO_8859_1; encoding_map["l2"] = ISO_8859_2; encoding_map["l3"] = ISO_8859_3; encoding_map["l4"] = ISO_8859_4; encoding_map["l5"] = ISO_8859_9; encoding_map["l6"] = ISO_8859_10; encoding_map["latin-1"] = ISO_8859_1; // not iana standard encoding_map["latin1"] = ISO_8859_1; encoding_map["latin2"] = ISO_8859_2; encoding_map["latin3"] = ISO_8859_3; encoding_map["latin4"] = ISO_8859_4; encoding_map["latin5"] = ISO_8859_9; encoding_map["latin6"] = ISO_8859_10; encoding_map["mac"] = MACINTOSH_ROMAN; encoding_map["macintosh"] = MACINTOSH_ROMAN; encoding_map["macintosh-roman"] = MACINTOSH_ROMAN; encoding_map["ms932"] = JAPANESE_CP932; // not iana standard encoding_map["ms_kanji"] = JAPANESE_CP932; encoding_map["shift-jis"] = JAPANESE_SHIFT_JIS; encoding_map["shift_jis"] = JAPANESE_SHIFT_JIS; encoding_map["sjis"] = JAPANESE_SHIFT_JIS; // not iana standard encoding_map["sjs"] = JAPANESE_SHIFT_JIS; // not iana standard encoding_map["sun_eu_greek"] = ISO_8859_7; encoding_map["tab"] = TAMIL_BI; encoding_map["tam"] = TAMIL_MONO; encoding_map["tis-620"] = ISO_8859_11; encoding_map["tscii"] = TSCII; encoding_map["un"] = UNKNOWN_ENCODING; // not iana standard encoding_map["unicode"] = UNICODE; // not iana standard encoding_map["unicode-1-1-utf-7"] = UTF7; encoding_map["unicode-1-1-utf-8"] = UTF8; encoding_map["unicode-2-0-utf-7"] = UTF7; encoding_map["unknown"] = UNKNOWN_ENCODING; // not iana standard encoding_map["us"] = ISO_8859_1; encoding_map["us-ascii"] = ISO_8859_1; encoding_map["utf-16be"] = UTF16BE; encoding_map["utf-16le"] = UTF16LE; encoding_map["utf-32be"] = UTF32BE; encoding_map["utf-32le"] = UTF32LE; encoding_map["utf-7"] = UTF7; encoding_map["utf-8"] = UTF8; encoding_map["utf7"] = UTF7; encoding_map["utf8"] = UTF8; // not iana standard encoding_map["visual"] = HEBREW_VISUAL; encoding_map["win-1250"] = MSFT_CP1250; // not iana standard encoding_map["win-1251"] = RUSSIAN_CP1251; // not iana standard encoding_map["window-874"] = MSFT_CP874; encoding_map["windows-1250"] = MSFT_CP1250; encoding_map["windows-1251"] = RUSSIAN_CP1251; encoding_map["windows-1252"] = MSFT_CP1252; encoding_map["windows-1253"] = MSFT_CP1253; encoding_map["windows-1254"] = MSFT_CP1254; encoding_map["windows-1255"] = MSFT_CP1255; encoding_map["windows-1256"] = MSFT_CP1256; encoding_map["windows-1257"] = MSFT_CP1257; encoding_map["windows-31j"] = JAPANESE_CP932; encoding_map["windows-874"] = MSFT_CP874; encoding_map["windows-936"] = GBK; encoding_map["x-big5"] = CHINESE_BIG5; encoding_map["x-binaryenc"] = BINARYENC; // not iana standard encoding_map["x-cp1250"] = MSFT_CP1250; encoding_map["x-cp1251"] = RUSSIAN_CP1251; encoding_map["x-cp1252"] = MSFT_CP1252; encoding_map["x-cp1253"] = MSFT_CP1253; encoding_map["x-cp1254"] = MSFT_CP1254; encoding_map["x-cp1255"] = MSFT_CP1255; encoding_map["x-cp1256"] = MSFT_CP1256; encoding_map["x-cp1257"] = MSFT_CP1257; encoding_map["x-euc-jp"] = JAPANESE_EUC_JP; encoding_map["x-euc-tw"] = CHINESE_CNS; encoding_map["x-gbk"] = GBK; encoding_map["x-iso-10646-ucs-2-be"] = UTF16BE; encoding_map["x-iso-10646-ucs-2-le"] = UTF16LE; encoding_map["x-iso-10646-ucs-4-be"] = UTF32BE; encoding_map["x-iso-10646-ucs-4-le"] = UTF32LE; encoding_map["x-jis"] = JAPANESE_JIS; // not iana standard encoding_map["x-mac-roman"] = MACINTOSH_ROMAN; encoding_map["x-shift_jis"] = JAPANESE_SHIFT_JIS; // not iana standard encoding_map["x-sjis"] = JAPANESE_SHIFT_JIS; encoding_map["x-unicode-2-0-utf-7"] = UTF7; encoding_map["x-utf8utf8"] = UTF8UTF8; // not iana standard encoding_map["x-x-big5"] = CHINESE_BIG5; encoding_map["zh_cn.euc"] = CHINESE_GB; encoding_map["zh_tw-big5"] = CHINESE_BIG5; encoding_map["zh_tw-euc"] = CHINESE_CNS; // Remove they entry for the empty string, if any. encoding_map.erase(""); return encoding_map; } // ---------------------------------------------------------------------- // EncodingNameAliasToEncoding() // // This function takes an encoding name/alias and returns the Encoding // enum. The input is case insensitive. It is the union of the common // IANA standard names, the charset names used in Netscape Navigator, // and some common names we have been using. // See: http://www.iana.org/assignments/character-sets // http://physics.hallym.ac.kr/resource/relnotes/windows-2.0.html // // UNKNOWN_ENCODING is returned if none matches. // // TODO: Check if it is possible to remove the non-standard, // non-netscape-use names. It is because this routine is used for // encoding detections from html meta info. Non-standard names may // introduce noise on encoding detection. // // TODO: Unify EncodingNameAliasToEncoding and EncodingFromName, // or determine why such a unification is not possible. // ---------------------------------------------------------------------- Encoding EncodingNameAliasToEncoding(const char *encoding_name) { if (!encoding_name) { return UNKNOWN_ENCODING; } const EncodingMap& encoding_map = GetEncodingMap(); EncodingMap::const_iterator emi = encoding_map.find(encoding_name); if (emi != encoding_map.end()) { return emi->second; } else { return UNKNOWN_ENCODING; } } const char* default_encoding_name() { return kEncodingInfoTable[LATIN1].encoding_name_; } static const char* const kInvalidEncodingName = "invalid_encoding"; const char *invalid_encoding_name() { return kInvalidEncodingName; } // ************************************************************* // Miscellany // ************************************************************* Encoding PreferredWebOutputEncoding(Encoding enc) { return IsValidEncoding(enc) ? kEncodingInfoTable[enc].preferred_web_output_encoding_ : UTF8; } ================================================ FILE: third_party/ced/util/encodings/encodings.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_ENCODINGS_ENCODINGS_H_ #define UTIL_ENCODINGS_ENCODINGS_H_ // This interface defines the Encoding enum and various functions that // depend only on Encoding values. // A hash-function for Encoding, hash, is defined in // i18n/encodings/public/encodings-hash.h // On some Windows projects, UNICODE may be defined, which would prevent the // Encoding enum below from compiling. Note that this is a quick fix that does // not break any existing projects. The UNICODE enum may someday be changed // to something more specific and non-colliding, but this involves careful // testing of changes in many other projects. #undef UNICODE // NOTE: The Encoding enum must always start at 0. This assumption has // been made and used. #ifndef SWIG #include "util/encodings/encodings.pb.h" #else // TODO: Include a SWIG workaround header file. #endif const int kNumEncodings = NUM_ENCODINGS; // some of the popular encoding aliases // TODO: Make these static const Encoding values instead of macros. #define LATIN1 ISO_8859_1 #define LATIN2 ISO_8859_2 #define LATIN3 ISO_8859_3 #define LATIN4 ISO_8859_4 #define CYRILLIC ISO_8859_5 #define ARABIC_ENCODING ISO_8859_6 // avoiding the same name as language #define GREEK_ENCODING ISO_8859_7 // avoiding the same name as language #define HEBREW_ENCODING ISO_8859_8 // avoiding the same name as language #define LATIN5 ISO_8859_9 #define LATIN6 ISO_8859_10 #define KOREAN_HANGUL KOREAN_EUC_KR // The default Encoding (LATIN1). Encoding default_encoding(); // ************************************************************* // Encoding predicates // IsValidEncoding() // IsEncEncCompatible // IsSupersetOfAscii7Bit // Is8BitEncoding // IsCJKEncoding // IsHebrewEncoding // IsRightToLeftEncoding // IsLogicalRightToLeftEncoding // IsVisualRightToLeftEncoding // IsIso2022Encoding // IsIso2022JpOrVariant // IsShiftJisOrVariant // IsJapaneseCellPhoneCarrierSpecificEncoding // ************************************************************* // IsValidEncoding // =================================== // // Function to check if the input language enum is within range. // bool IsValidEncoding(Encoding enc); // // IsEncEncCompatible // ------------------ // // This function is to determine whether or not converting from the // first encoding to the second requires any changes to the underlying // text (e.g. ASCII_7BIT is a subset of UTF8). // // TODO: the current implementation is likely incomplete. It would be // good to consider the full matrix of all pairs of encodings and to fish out // all compatible pairs. // bool IsEncEncCompatible(const Encoding from, const Encoding to); // To be a superset of 7-bit Ascii means that bytes 0...127 in the given // encoding represent the same characters as they do in ISO_8859_1. // WARNING: This function does not currently return true for all encodings that // are supersets of Ascii 7-bit. bool IsSupersetOfAscii7Bit(Encoding e); // To be an 8-bit encoding means that there are fewer than 256 symbols. // Each byte determines a new character; there are no multi-byte sequences. // WARNING: This function does not currently return true for all encodings that // are 8-bit encodings. bool Is8BitEncoding(Encoding e); // IsCJKEncoding // ------------- // // This function returns true if the encoding is either Chinese // (simplified or traditional), Japanese, or Korean. Note: UTF8 is not // considered a CJK encoding. bool IsCJKEncoding(Encoding e); // IsHebrewEncoding // ------------- // // This function returns true if the encoding is a Hebrew specific // encoding (not UTF8, etc). bool IsHebrewEncoding(Encoding e); // IsRightToLeftEncoding // --------------------- // // Returns true if the encoding is a right-to-left encoding. // // Note that the name of this function is somewhat misleading. There is nothing // "right to left" about these encodings. They merely contain code points for // characters in RTL languages such as Hebrew and Arabic. But this is also // true for UTF-8. // // TODO: Get rid of this function. The only special-case we // should need to worry about are visual encodings. Anything we // need to do for all 'RTL' encodings we need to do for UTF-8 as well. bool IsRightToLeftEncoding(Encoding enc); // IsLogicalRightToLeftEncoding // ---------------------------- // // Returns true if the encoding is a logical right-to-left encoding. // Logical right-to-left encodings are those that the browser renders // right-to-left and applies the BiDi algorithm to. Therefore the characters // appear in reading order in the file, and indexing, snippet generation etc. // should all just work with no special processing. // // TODO: Get rid of this function. The only special-case we // should need to worry about are visual encodings. bool IsLogicalRightToLeftEncoding(Encoding enc); // IsVisualRightToLeftEncoding // --------------------------- // // Returns true if the encoding is a visual right-to-left encoding. // Visual right-to-left encodings are those that the browser renders // left-to-right and does not apply the BiDi algorithm to. Therefore each // line appears in reverse order in the file, lines are manually wrapped // by abusing
or

tags, etc. Visual RTL encoding is a relic of // the prehistoric days when browsers couldn't render right-to-left, but // unfortunately some visual pages persist to this day. These documents require // special processing so that we don't index or snippet them with each line // reversed. bool IsVisualRightToLeftEncoding(Encoding enc); // IsIso2022Encoding // ----------------- // // Returns true if the encoding is a kind of ISO 2022 such as // ISO-2022-JP. bool IsIso2022Encoding(Encoding enc); // IsIso2022JpOrVariant // -------------------- // // Returns true if the encoding is ISO-2022-JP or a variant such as // KDDI's ISO-2022-JP. bool IsIso2022JpOrVariant(Encoding enc); // IsShiftJisOrVariant // -------------------- // // Returns true if the encoding is Shift_JIS or a variant such as // KDDI's Shift_JIS. bool IsShiftJisOrVariant(Encoding enc); // IsJapanesCellPhoneCarrierSpecificEncoding // ----------------------------------------- // // Returns true if it's Japanese cell phone carrier specific encoding // such as KDDI_SHIFT_JIS. bool IsJapaneseCellPhoneCarrierSpecificEncoding(Encoding enc); // ************************************************************* // ENCODING NAMES // // This interface defines a standard name for each valid encoding, and // a standard name for invalid encodings. (Some names use all upper // case, but others use mixed case.) // // EncodingName() [Encoding to name] // MimeEncodingName() [Encoding to name] // EncodingFromName() [name to Encoding] // EncodingNameAliasToEncoding() [name to Encoding] // default_encoding_name() // invalid_encoding_name() // ************************************************************* // EncodingName // ------------ // // Given the encoding, returns its standard name. // Return invalid_encoding_name() if the encoding is invalid. // const char* EncodingName(Encoding enc); // // MimeEncodingName // ---------------- // // Return the "preferred MIME name" of an encoding. // // This name is suitable for using in HTTP headers, HTML tags, // and as the "charset" parameter of a MIME Content-Type. const char* MimeEncodingName(Encoding enc); // The maximum length of an encoding name const int kMaxEncodingNameSize = 50; // The standard name of the default encoding. const char* default_encoding_name(); // The name used for an invalid encoding. const char* invalid_encoding_name(); // EncodingFromName // ---------------- // // If enc_name matches the standard name of an Encoding, using a // case-insensitive comparison, set *encoding to that Encoding and // return true. Otherwise set *encoding to UNKNOWN_ENCODING and // return false. // // REQUIRES: encoding must not be NULL. // bool EncodingFromName(const char* enc_name, Encoding *encoding); // // EncodingNameAliasToEncoding // --------------------------- // // If enc_name matches the standard name or an alias of an Encoding, // using a case-insensitive comparison, return that // Encoding. Otherwise, return UNKNOWN_ENCODING. // // Aliases include most mime-encoding names (e.g., "ISO-8859-7" for // GREEK), alternate names (e.g., "cyrillic" for ISO_8859_5) and // common variations with hyphens and underscores (e.g., "koi8-u" and // "koi8u" for RUSSIAN_KOI8_R). Encoding EncodingNameAliasToEncoding(const char *enc_name); // ************************************************************* // Miscellany // ************************************************************* // PreferredWebOutputEncoding // -------------------------- // // Some multi-byte encodings use byte values that coincide with the // ASCII codes for HTML syntax characters <>"&' and browsers like MSIE // can misinterpret these, as indicated in an external XSS report from // 2007-02-15. Here, we map these dangerous encodings to safer ones. We // also use UTF8 instead of encodings that we don't support in our // output, and we generally try to be conservative in what we send out. // Where the client asks for single- or double-byte encodings that are // not as common, we substitute a more common single- or double-byte // encoding, if there is one, thereby preserving the client's intent // to use less space than UTF-8. This also means that characters // outside the destination set will be converted to HTML NCRs (&#NNN;) // if requested. Encoding PreferredWebOutputEncoding(Encoding enc); #endif // UTIL_ENCODINGS_ENCODINGS_H_ ================================================ FILE: third_party/ced/util/encodings/encodings.pb.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_ENCODINGS_ENCODINGS_PB_H_ #define UTIL_ENCODINGS_ENCODINGS_PB_H_ enum Encoding { ISO_8859_1 = 0, // Teragram ASCII ISO_8859_2 = 1, // Teragram Latin2 ISO_8859_3 = 2, // in BasisTech but not in Teragram ISO_8859_4 = 3, // Teragram Latin4 ISO_8859_5 = 4, // Teragram ISO-8859-5 ISO_8859_6 = 5, // Teragram Arabic ISO_8859_7 = 6, // Teragram Greek ISO_8859_8 = 7, // Teragram Hebrew ISO_8859_9 = 8, // in BasisTech but not in Teragram ISO_8859_10 = 9, // in BasisTech but not in Teragram JAPANESE_EUC_JP = 10, // Teragram EUC_JP JAPANESE_SHIFT_JIS = 11, // Teragram SJS JAPANESE_JIS = 12, // Teragram JIS CHINESE_BIG5 = 13, // Teragram BIG5 CHINESE_GB = 14, // Teragram GB CHINESE_EUC_CN = 15, // Misnamed. Should be EUC_TW. Was Basis Tech // CNS11643EUC, before that Teragram EUC-CN(!) // See //i18n/basistech/basistech_encodings.h KOREAN_EUC_KR = 16, // Teragram KSC UNICODE = 17, // Teragram Unicode CHINESE_EUC_DEC = 18, // Misnamed. Should be EUC_TW. Was Basis Tech // CNS11643EUC, before that Teragram EUC. CHINESE_CNS = 19, // Misnamed. Should be EUC_TW. Was Basis Tech // CNS11643EUC, before that Teragram CNS. CHINESE_BIG5_CP950 = 20, // Teragram BIG5_CP950 JAPANESE_CP932 = 21, // Teragram CP932 UTF8 = 22, UNKNOWN_ENCODING = 23, ASCII_7BIT = 24, // ISO_8859_1 with all characters <= 127. // Should be present only in the crawler // and in the repository, // *never* as a result of Document::encoding(). RUSSIAN_KOI8_R = 25, // Teragram KOI8R RUSSIAN_CP1251 = 26, // Teragram CP1251 //---------------------------------------------------------- // These are _not_ output from teragram. Instead, they are as // detected in the headers of usenet articles. MSFT_CP1252 = 27, // 27: CP1252 aka MSFT euro ascii RUSSIAN_KOI8_RU = 28, // CP21866 aka KOI8-U, used for Ukrainian. // Misnamed, this is _not_ KOI8-RU but KOI8-U. // KOI8-U is used much more often than KOI8-RU. MSFT_CP1250 = 29, // CP1250 aka MSFT eastern european ISO_8859_15 = 30, // aka ISO_8859_0 aka ISO_8859_1 euroized //---------------------------------------------------------- //---------------------------------------------------------- // These are in BasisTech but not in Teragram. They are // needed for new interface languages. Now detected by // research langid MSFT_CP1254 = 31, // used for Turkish MSFT_CP1257 = 32, // used in Baltic countries //---------------------------------------------------------- //---------------------------------------------------------- //---------------------------------------------------------- // New encodings detected by Teragram ISO_8859_11 = 33, // aka TIS-620, used for Thai MSFT_CP874 = 34, // used for Thai MSFT_CP1256 = 35, // used for Arabic //---------------------------------------------------------- // Detected as ISO_8859_8 by Teragram, but can be found in META tags MSFT_CP1255 = 36, // Logical Hebrew Microsoft ISO_8859_8_I = 37, // Iso Hebrew Logical HEBREW_VISUAL = 38, // Iso Hebrew Visual //---------------------------------------------------------- //---------------------------------------------------------- // Detected by research langid CZECH_CP852 = 39, CZECH_CSN_369103 = 40, // aka ISO_IR_139 aka KOI8_CS MSFT_CP1253 = 41, // used for Greek RUSSIAN_CP866 = 42, //---------------------------------------------------------- //---------------------------------------------------------- // Handled by iconv in glibc ISO_8859_13 = 43, ISO_2022_KR = 44, GBK = 45, GB18030 = 46, BIG5_HKSCS = 47, ISO_2022_CN = 48, //----------------------------------------------------------- // Detected by xin liu's detector // Handled by transcoder // (Indic encodings) TSCII = 49, TAMIL_MONO = 50, TAMIL_BI = 51, JAGRAN = 52, MACINTOSH_ROMAN = 53, UTF7 = 54, BHASKAR = 55, // Indic encoding - Devanagari HTCHANAKYA = 56, // 56 Indic encoding - Devanagari //----------------------------------------------------------- // These allow a single place (inputconverter and outputconverter) // to do UTF-16 <==> UTF-8 bulk conversions and UTF-32 <==> UTF-8 // bulk conversions, with interchange-valid checking on input and // fallback if needed on ouput. UTF16BE = 57, // big-endian UTF-16 UTF16LE = 58, // little-endian UTF-16 UTF32BE = 59, // big-endian UTF-32 UTF32LE = 60, // little-endian UTF-32 //----------------------------------------------------------- //----------------------------------------------------------- // An encoding that means "This is not text, but it may have some // simple ASCII text embedded". Intended input conversion (not yet // implemented) is to keep strings of >=4 seven-bit ASCII characters // (follow each kept string with an ASCII space), delete the rest of // the bytes. This will pick up and allow indexing of e.g. captions // in JPEGs. No output conversion needed. BINARYENC = 61, //----------------------------------------------------------- //----------------------------------------------------------- // Some Web pages allow a mixture of HZ-GB and GB-2312 by using // ~{ ... ~} for 2-byte pairs, and the browsers support this. HZ_GB_2312 = 62, //----------------------------------------------------------- //----------------------------------------------------------- // Some external vendors make the common input error of // converting MSFT_CP1252 to UTF8 *twice*. No output conversion needed. UTF8UTF8 = 63, //----------------------------------------------------------- //----------------------------------------------------------- // Handled by transcoder for tamil language specific font // encodings without the support for detection at present. TAM_ELANGO = 64, // Elango - Tamil TAM_LTTMBARANI = 65, // Barani - Tamil TAM_SHREE = 66, // Shree - Tamil TAM_TBOOMIS = 67, // TBoomis - Tamil TAM_TMNEWS = 68, // TMNews - Tamil TAM_WEBTAMIL = 69, // Webtamil - Tamil //----------------------------------------------------------- //----------------------------------------------------------- // Shift_JIS variants used by Japanese cell phone carriers. KDDI_SHIFT_JIS = 70, DOCOMO_SHIFT_JIS = 71, SOFTBANK_SHIFT_JIS = 72, // ISO-2022-JP variants used by KDDI and SoftBank. KDDI_ISO_2022_JP = 73, SOFTBANK_ISO_2022_JP = 74, //----------------------------------------------------------- NUM_ENCODINGS = 75, // Always keep this at the end. It is not a // valid Encoding enum, it is only used to // indicate the total number of Encodings. }; #endif // UTIL_ENCODINGS_ENCODINGS_PB_H_ ================================================ FILE: third_party/ced/util/encodings/encodings_unittest.cc ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #include "util/encodings/encodings.h" #include "gtest/gtest.h" TEST(EncodingsTest, EncodingNameAliasToEncoding) { // Test that cases, non-alpha-numeric chars are ignored. EXPECT_EQ(ISO_8859_1, EncodingNameAliasToEncoding("iso_8859_1")); EXPECT_EQ(ISO_8859_1, EncodingNameAliasToEncoding("iso-8859-1")); // Test that spaces are ignored. EXPECT_EQ(UTF8, EncodingNameAliasToEncoding("UTF8")); EXPECT_EQ(UTF8, EncodingNameAliasToEncoding("UTF 8")); EXPECT_EQ(UTF8, EncodingNameAliasToEncoding("UTF-8")); // Test alphanumeric differences are counted. EXPECT_NE(UTF8, EncodingNameAliasToEncoding("UTF-7")); EXPECT_NE(KOREAN_EUC_KR, EncodingNameAliasToEncoding("euc-jp")); } ================================================ FILE: third_party/ced/util/languages/languages.cc ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #include "util/languages/languages.h" #include "util/basictypes.h" #include "util/string_util.h" Language default_language() {return ENGLISH;} // Language names and codes struct LanguageInfo { const char * language_name_; const char * language_code_639_1_; // the ISO-639-1 code for the language const char * language_code_639_2_; // the ISO-639-2 code for the language const char * language_code_other_; // some nonstandard code for the language }; static const LanguageInfo kLanguageInfoTable[] = { { "ENGLISH", "en", "eng", NULL}, { "DANISH", "da", "dan", NULL}, { "DUTCH", "nl", "dut", NULL}, { "FINNISH", "fi", "fin", NULL}, { "FRENCH", "fr", "fre", NULL}, { "GERMAN", "de", "ger", NULL}, { "HEBREW", "he", "heb", NULL}, { "ITALIAN", "it", "ita", NULL}, { "Japanese", "ja", "jpn", NULL}, { "Korean", "ko", "kor", NULL}, { "NORWEGIAN", "nb", "nor", NULL}, { "POLISH", "pl", "pol", NULL}, { "PORTUGUESE", "pt", "por", NULL}, { "RUSSIAN", "ru", "rus", NULL}, { "SPANISH", "es", "spa", NULL}, { "SWEDISH", "sv", "swe", NULL}, { "Chinese", "zh", "chi", "zh-CN"}, { "CZECH", "cs", "cze", NULL}, { "GREEK", "el", "gre", NULL}, { "ICELANDIC", "is", "ice", NULL}, { "LATVIAN", "lv", "lav", NULL}, { "LITHUANIAN", "lt", "lit", NULL}, { "ROMANIAN", "ro", "rum", NULL}, { "HUNGARIAN", "hu", "hun", NULL}, { "ESTONIAN", "et", "est", NULL}, // TODO: Although Teragram has two output names "TG_UNKNOWN_LANGUAGE" // and "Unknown", they are essentially the same. Need to unify them. // "un" and "ut" are invented by us, not from ISO-639. // { "TG_UNKNOWN_LANGUAGE", NULL, NULL, "ut"}, { "Unknown", NULL, NULL, "un"}, { "BULGARIAN", "bg", "bul", NULL}, { "CROATIAN", "hr", "scr", NULL}, { "SERBIAN", "sr", "scc", NULL}, { "IRISH", "ga", "gle", NULL}, { "GALICIAN", "gl", "glg", NULL}, // Impossible to tell Tagalog from Filipino at the moment. // Use ISO 639-2 code for Filipino here. { "TAGALOG", NULL, "fil", NULL}, { "TURKISH", "tr", "tur", NULL}, { "UKRAINIAN", "uk", "ukr", NULL}, { "HINDI", "hi", "hin", NULL}, { "MACEDONIAN", "mk", "mac", NULL}, { "BENGALI", "bn", "ben", NULL}, { "INDONESIAN", "id", "ind", NULL}, { "LATIN", "la", "lat", NULL}, { "MALAY", "ms", "may", NULL}, { "MALAYALAM", "ml", "mal", NULL}, { "WELSH", "cy", "wel", NULL}, { "NEPALI", "ne", "nep", NULL}, { "TELUGU", "te", "tel", NULL}, { "ALBANIAN", "sq", "alb", NULL}, { "TAMIL", "ta", "tam", NULL}, { "BELARUSIAN", "be", "bel", NULL}, { "JAVANESE", "jw", "jav", NULL}, { "OCCITAN", "oc", "oci", NULL}, { "URDU", "ur", "urd", NULL}, { "BIHARI", "bh", "bih", NULL}, { "GUJARATI", "gu", "guj", NULL}, { "THAI", "th", "tha", NULL}, { "ARABIC", "ar", "ara", NULL}, { "CATALAN", "ca", "cat", NULL}, { "ESPERANTO", "eo", "epo", NULL}, { "BASQUE", "eu", "baq", NULL}, { "INTERLINGUA", "ia", "ina", NULL}, { "KANNADA", "kn", "kan", NULL}, { "PUNJABI", "pa", "pan", NULL}, { "SCOTS_GAELIC", "gd", "gla", NULL}, { "SWAHILI", "sw", "swa", NULL}, { "SLOVENIAN", "sl", "slv", NULL}, { "MARATHI", "mr", "mar", NULL}, { "MALTESE", "mt", "mlt", NULL}, { "VIETNAMESE", "vi", "vie", NULL}, { "FRISIAN", "fy", "fry", NULL}, { "SLOVAK", "sk", "slo", NULL}, { "ChineseT", NULL, NULL, // We intentionally set these 2 fields to NULL to avoid // confusion between CHINESE_T and CHINESE. "zh-TW"}, { "FAROESE", "fo", "fao", NULL}, { "SUNDANESE", "su", "sun", NULL}, { "UZBEK", "uz", "uzb", NULL}, { "AMHARIC", "am", "amh", NULL}, { "AZERBAIJANI", "az", "aze", NULL}, { "GEORGIAN", "ka", "geo", NULL}, { "TIGRINYA", "ti", "tir", NULL}, { "PERSIAN", "fa", "per", NULL}, { "BOSNIAN", "bs", "bos", NULL}, { "SINHALESE", "si", "sin", NULL}, { "NORWEGIAN_N", "nn", "nno", NULL}, { "PORTUGUESE_P", NULL, NULL, "pt-PT"}, { "PORTUGUESE_B", NULL, NULL, "pt-BR"}, { "XHOSA", "xh", "xho", NULL}, { "ZULU", "zu", "zul", NULL}, { "GUARANI", "gn", "grn", NULL}, { "SESOTHO", "st", "sot", NULL}, { "TURKMEN", "tk", "tuk", NULL}, { "KYRGYZ", "ky", "kir", NULL}, { "BRETON", "br", "bre", NULL}, { "TWI", "tw", "twi", NULL}, { "YIDDISH", "yi", "yid", NULL}, { "SERBO_CROATIAN", "sh", NULL, NULL}, { "SOMALI", "so", "som", NULL}, { "UIGHUR", "ug", "uig", NULL}, { "KURDISH", "ku", "kur", NULL}, { "MONGOLIAN", "mn", "mon", NULL}, { "ARMENIAN", "hy", "arm", NULL}, { "LAOTHIAN", "lo", "lao", NULL}, { "SINDHI", "sd", "snd", NULL}, { "RHAETO_ROMANCE", "rm", "roh", NULL}, { "AFRIKAANS", "af", "afr", NULL}, { "LUXEMBOURGISH", "lb", "ltz", NULL}, { "BURMESE", "my", "bur", NULL}, // KHMER is known as Cambodian for Google user interfaces. { "KHMER", "km", "khm", NULL}, { "TIBETAN", "bo", "tib", NULL}, { "DHIVEHI", "dv", "div", NULL}, { "CHEROKEE", NULL, "chr", NULL}, { "SYRIAC", NULL, "syr", NULL}, { "LIMBU", NULL, NULL, "sit-NP"}, { "ORIYA", "or", "ori", NULL}, { "ASSAMESE", "as", "asm", NULL}, { "CORSICAN", "co", "cos", NULL}, { "INTERLINGUE", "ie", "ine", NULL}, { "KAZAKH", "kk", "kaz", NULL}, { "LINGALA", "ln", "lin", NULL}, { "MOLDAVIAN", "mo", "mol", NULL}, { "PASHTO", "ps", "pus", NULL}, { "QUECHUA", "qu", "que", NULL}, { "SHONA", "sn", "sna", NULL}, { "TAJIK", "tg", "tgk", NULL}, { "TATAR", "tt", "tat", NULL}, { "TONGA", "to", "tog", NULL}, { "YORUBA", "yo", "yor", NULL}, { "CREOLES_AND_PIDGINS_ENGLISH_BASED", NULL, "cpe", NULL}, { "CREOLES_AND_PIDGINS_FRENCH_BASED", NULL, "cpf", NULL}, { "CREOLES_AND_PIDGINS_PORTUGUESE_BASED", NULL, "cpp", NULL}, { "CREOLES_AND_PIDGINS_OTHER", NULL, "crp", NULL}, { "MAORI", "mi", "mao", NULL}, { "WOLOF", "wo", "wol", NULL}, { "ABKHAZIAN", "ab", "abk", NULL}, { "AFAR", "aa", "aar", NULL}, { "AYMARA", "ay", "aym", NULL}, { "BASHKIR", "ba", "bak", NULL}, { "BISLAMA", "bi", "bis", NULL}, { "DZONGKHA", "dz", "dzo", NULL}, { "FIJIAN", "fj", "fij", NULL}, { "GREENLANDIC", "kl", "kal", NULL}, { "HAUSA", "ha", "hau", NULL}, { "HAITIAN_CREOLE", "ht", NULL, NULL}, { "INUPIAK", "ik", "ipk", NULL}, { "INUKTITUT", "iu", "iku", NULL}, { "KASHMIRI", "ks", "kas", NULL}, { "KINYARWANDA", "rw", "kin", NULL}, { "MALAGASY", "mg", "mlg", NULL}, { "NAURU", "na", "nau", NULL}, { "OROMO", "om", "orm", NULL}, { "RUNDI", "rn", "run", NULL}, { "SAMOAN", "sm", "smo", NULL}, { "SANGO", "sg", "sag", NULL}, { "SANSKRIT", "sa", "san", NULL}, { "SISWANT", "ss", "ssw", NULL}, { "TSONGA", "ts", "tso", NULL}, { "TSWANA", "tn", "tsn", NULL}, { "VOLAPUK", "vo", "vol", NULL}, { "ZHUANG", "za", "zha", NULL}, { "KHASI", NULL, "kha", NULL}, { "SCOTS", NULL, "sco", NULL}, { "GANDA", "lg", "lug", NULL}, { "MANX", "gv", "glv", NULL}, { "MONTENEGRIN", NULL, NULL, "sr-ME"}, { "XX", NULL, NULL, "XX"}, }; COMPILE_ASSERT(arraysize(kLanguageInfoTable) == NUM_LANGUAGES + 1, kLanguageInfoTable_has_incorrect_length); // LANGUAGE NAMES const char* default_language_name() { return kLanguageInfoTable[ENGLISH].language_name_; } static const char* const kInvalidLanguageName = "invalid_language"; const char *invalid_language_name() { return kInvalidLanguageName; } const char* LanguageName(Language lang) { return IsValidLanguage(lang) ? kLanguageInfoTable[lang].language_name_ : kInvalidLanguageName; } // LANGUAGE CODES // The space before invalid_language_code is intentional. It is used // to prevent it matching any two letter language code. // static const char* const kInvalidLanguageCode = " invalid_language_code"; const char *invalid_language_code() { return kInvalidLanguageCode; } const char * LanguageCode(Language lang) { if (! IsValidLanguage(lang)) return kInvalidLanguageCode; const LanguageInfo& info = kLanguageInfoTable[lang]; if (info.language_code_639_1_) { return info.language_code_639_1_; } else if (info.language_code_639_2_) { return info.language_code_639_2_; } else if (info.language_code_other_) { return info.language_code_other_; } else { return kInvalidLanguageCode; } } const char* default_language_code() { return kLanguageInfoTable[ENGLISH].language_code_639_1_; } const char* LanguageCodeISO639_1(Language lang) { if (! IsValidLanguage(lang)) return kInvalidLanguageCode; if (const char* code = kLanguageInfoTable[lang].language_code_639_1_) return code; return kInvalidLanguageCode; } const char* LanguageCodeISO639_2(Language lang) { if (! IsValidLanguage(lang)) return kInvalidLanguageCode; if (const char* code = kLanguageInfoTable[lang].language_code_639_2_) return code; return kInvalidLanguageCode; } const char* LanguageCodeWithDialects(Language lang) { if (lang == CHINESE) return "zh-CN"; return LanguageCode(lang); } bool LanguageFromCode(const char* lang_code, Language *language) { *language = UNKNOWN_LANGUAGE; if ( lang_code == NULL ) return false; for ( int i = 0 ; i < kNumLanguages ; i++ ) { const LanguageInfo& info = kLanguageInfoTable[i]; if ((info.language_code_639_1_ && !base::strcasecmp(lang_code, info.language_code_639_1_)) || (info.language_code_639_2_ && !base::strcasecmp(lang_code, info.language_code_639_2_)) || (info.language_code_other_ && !base::strcasecmp(lang_code, info.language_code_other_))) { *language = static_cast(i); return true; } } // For convenience, this function can also parse the non-standard // five-letter language codes "zh-cn" and "zh-tw" which are used by // front-ends such as GWS to distinguish Simplified from Traditional // Chinese. if (!base::strcasecmp(lang_code, "zh-cn") || !base::strcasecmp(lang_code, "zh_cn")) { *language = CHINESE; return true; } if (!base::strcasecmp(lang_code, "zh-tw") || !base::strcasecmp(lang_code, "zh_tw")) { *language = CHINESE_T; return true; } if (!base::strcasecmp(lang_code, "sr-me") || !base::strcasecmp(lang_code, "sr_me")) { *language = MONTENEGRIN; return true; } // Process language-code synonyms. if (!base::strcasecmp(lang_code, "he")) { *language = HEBREW; // Use "iw". return true; } if (!base::strcasecmp(lang_code, "in")) { *language = INDONESIAN; // Use "id". return true; } if (!base::strcasecmp(lang_code, "ji")) { *language = YIDDISH; // Use "yi". return true; } // Process language-detection synonyms. // These distinct languages cannot be differentiated by our current // language-detection algorithms. if (!base::strcasecmp(lang_code, "fil")) { *language = TAGALOG; return true; } return false; } ================================================ FILE: third_party/ced/util/languages/languages.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_LANGUAGES_LANGUAGES_H_ #define UTIL_LANGUAGES_LANGUAGES_H_ // This interface defines the Language enum and functions that depend // only on Language values. // A hash-function for Language, hash, is defined in // i18n/languages/public/languages-hash.h #ifndef SWIG // Language enum defined in languages.proto // Also description on how to add languages. #include "util/languages/languages.pb.h" #else // TODO: Include a header containing swig-compatible enum. #endif const int kNumLanguages = NUM_LANGUAGES; // Return the default language (ENGLISH). Language default_language(); // ******************************************* // Language predicates // IsValidLanguage() // IS_LANGUAGE_UNKNOWN() // IsCJKLanguage() // IsChineseLanguage() // IsNorwegianLanguage() // IsPortugueseLanguage() // IsRightToLeftLanguage() // IsMaybeRightToLeftLanguage() // IsSameLanguage() // IsScriptRequiringLongerSnippets() // ******************************************* // IsValidLanguage // =============== // // Function to check if the input is within range of the Language enum. If // IsValidLanguage(lang) returns true, it is safe to call // static_cast(lang). // inline bool IsValidLanguage(int lang) { return ((lang >= 0) && (lang < kNumLanguages)); } // Return true if the language is "unknown". (This function was // previously a macro, hence the spelling in all caps.) // inline bool IS_LANGUAGE_UNKNOWN(Language lang) { return lang == TG_UNKNOWN_LANGUAGE || lang == UNKNOWN_LANGUAGE; } // IsCJKLanguage // ------------- // // This function returns true if the language is either Chinese // (simplified or traditional), Japanese, or Korean. bool IsCJKLanguage(Language lang); // IsChineseLanguage // ----------------- // // This function returns true if the language is either Chinese // (simplified or traditional) bool IsChineseLanguage(Language lang); // IsNorwegianLanguage // -------------------- // // This function returns true if the language is any of the Norwegian // (regular or Nynorsk). bool IsNorwegianLanguage(Language lang); // IsPortugueseLanguage // -------------------- // // This function returns true if the language is any of the Portuguese // languages (regular, Portugal or Brazil) bool IsPortugueseLanguage(Language lang); // IsSameLanguage // -------------- // // WARNING: This function provides only a simple test on the values of // the two Language arguments. It returns false if either language is // invalid. It returns true if the language arguments are equal, or // if they are both Chinese languages, both Norwegian languages, or // both Portuguese languages, as defined by IsChineseLanguage, // IsNorwegianLanguage, and IsPortugueseLanguage. Otherwise it returns // false. bool IsSameLanguage(Language lang1, Language lang2); // IsRightToLeftLanguage // --------------------- // // This function returns true if the language is only written right-to-left // (E.g., Hebrew, Arabic, Persian etc.) // // IMPORTANT NOTE: Technically we're talking about scripts, not languages. // There are languages that can be written in more than one script. // Examples: // - Kurdish and Azeri ('AZERBAIJANI') can be written left-to-right in // Latin or Cyrillic script, and right-to-left in Arabic script. // - Sindhi and Punjabi are written in different scripts, depending on // region and dialect. // - Turkmen used an Arabic script historically, but not any more. // - Pashto and Uyghur can use Arabic script, but use a Roman script // on the Internet. // - Kashmiri and Urdu are written either with Arabic or Devanagari script. // // This function only returns true for languages that are always, unequivocally // written in right-to-left script. // // TODO: If we want to do anything special with multi-script languages // we should create new 'languages' for each language+script, as we do for // traditional vs. simplified Chinese. However most such languages are rare in // use and even rarer on the web, so this is unlikely to be something we'll // be concerned with for a while. bool IsRightToLeftLanguage(Language lang); // IsMaybeRightToLeftLanguage // -------------------------- // // This function returns true if the language may appear on the web in a // right-to-left script (E.g., Hebrew, Arabic, Persian, Urdu, Kurdish, etc.) // // NOTE: See important notes under IsRightToLeftLanguage(...). // // This function returns true for languages that *may* appear on the web in a // right-to-left script, even if they may also appear in a left-to-right // script. // // This function should typically be used in cases where doing some work on // left-to-right text would be OK (usually a no-op), and this function is used // just to cut down on unnecessary work on regular, LTR text. bool IsMaybeRightToLeftLanguage(Language lang); // IsScriptRequiringLongerSnippets // -------------------- // // This function returns true if the script chracteristics require longer // snippet length (Devanagari, Bengali, Gurmukhi, // Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam). // COMMENTED OUT TO REDUCE DEPENDENCIES ON GOOGLE3 CODE // bool IsScriptRequiringLongerSnippets(UnicodeScript script); // ******************************************* // LANGUAGE NAMES // // This interface defines a standard name for each valid Language, // and a standard name for invalid languages. Some language names use all // uppercase letters, but others use mixed case. // LanguageName() [Language to name] // LanguageEnumName() [language to enum name] // LanguageFromName() [name to Language] // default_language_name() // invalid_language_name() // ******************************************* // Given a Language, returns its standard name. // Return invalid_language_name() if the language is invalid. const char* LanguageName(Language lang); // Given a Language, return the name of the enum constant for that // language. In all but a few cases, this is the same as its standard // name. For example, LanguageName(CHINESE) returns "Chinese", but // LanguageEnumName(CHINESE) returns "CHINESE". This is intended for // code that is generating C++ code, where the enum constant is more // useful than its integer value. Return "NUM_LANGUAGES" if // the language is invalid. const char* LanguageEnumName(Language lang); // The maximum length of a standard language name. const int kMaxLanguageNameSize = 50; // The standard name for the default language. const char* default_language_name(); // The standard name for all invalid languages. const char* invalid_language_name(); // If lang_name matches the standard name of a Language, using a // case-insensitive comparison, set *language to that Language and // return true. // Otherwise, set *language to UNKNOWN_LANGUAGE and return false. // // For backwards compatibility, "HATIAN_CREOLE" is allowed as a name // for HAITIAN_CREOLE, and "QUECHAU" is allowed as a name for QUECHUA. // For compatibility with LanguageEnumName, "UNKNOWN_LANGUAGE" is allowed // as a name for UNKNOWN_LANGUAGE (the return value is true in this case, // as it is for "Unknown"), and "CHINESE_T" is allowed as a name for // CHINESE_T (i.e., a synonym for "ChineseT"). // // REQUIRES: language must not be NULL. // bool LanguageFromName(const char* lang_name, Language *language); // ******************************************* // LANGUAGE CODES // // This interface defines a standard code for each valid language, and // a standard code for invalid languages. These are derived from ISO codes, // with some Google additions. // LanguageCode() // default_language_code() // invalid_language_code() // LanguageCodeWithDialects() // LanguageCodeISO639_1() // LanguageCodeISO639_2() // ******************************************* // Given a Language, return its standard code. There are Google-specific codes: // For CHINESE_T, return "zh-TW". // For TG_UNKNOWN_LANGUAGE, return "ut". // For UNKNOWN_LANGUAGE, return "un". // For PORTUGUESE_P, return "pt-PT". // For PORTUGUESE_B, return "pt-BR". // For LIMBU, return "sit-NP". // For CHEROKEE, return "chr". // For SYRIAC, return "syr". // Otherwise return the ISO 639-1 two-letter language code for lang. // If lang is invalid, return invalid_language_code(). // // NOTE: See the note below about the codes for Chinese languages. // const char* LanguageCode(Language lang); // The maximum length of a language code. const int kMaxLanguageCodeSize = 50; // The standard code for the default language. const char* default_language_code(); // The standard code for all invalid languages. const char* invalid_language_code(); // -------------------------------------------- // NOTE: CHINESE LANGUAGE CODES // // There are three functions that return codes for Chinese languages. // LanguageCode(lang) and LanguageCodeWithDialects(lang) are defined here. // LanguageCode(lang, encoding) is defined in i18n/encodings.lang_enc.h. // The following list shows the different results. // // LanguageCode(CHINESE) returns "zh" // LanguageCode(CHINESE_T) returns "zh-TW". // // LanguageCodeWithDialects(CHINESE) returns "zh-CN". // LanguageCodeWithDialects(CHINESE_T) returns "zh-TW". // // LanguageCode(CHINESE_T, ) returns "zh-TW". // LanguageCode(CHINESE, CHINESE_BIG5) returns "zh-TW". // LanguageCode(CHINESE, ) returns "zh-CN". // // -------------------------------------------- // LanguageCodeWithDialects // ------------------------ // // If lang is CHINESE, return "zh-CN". Otherwise return LanguageCode(lang). const char* LanguageCodeWithDialects(Language lang); // LanguageCodeISO639_1 // -------------------- // // Return the ISO 639-1 two-letter language code for lang. // Return invalid_language_code() if lang is invalid or does not have // an ISO 639-1 two-letter language code. const char* LanguageCodeISO639_1(Language lang); // LanguageCodeISO639_2 // -------------------- // // Return the ISO 639-2 three-letter language for lang. // Return invalid_language_code() if lang is invalid or does not have // an ISO 639-2 three-letter language code. const char* LanguageCodeISO639_2(Language lang); // LanguageFromCode // ---------------- // // If lang_code matches the code for a Language, using a case-insensitive // comparison, set *lang to that Language and return true. // Otherwise, set *lang to UNKNOWN_LANGUAGE and return false. // // lang_code can be an ISO 639-1 (two-letter) code, an ISO 639-2 // (three-letter) code, or a Google-specific code (see LanguageCode). // // Certain language-code aliases are also allowed: // For "zh-cn" and "zh_cn", set *lang to CHINESE. // For "zh-tw" and "zh_tw", set *lang to CHINESE_T. // For "he", set *lang to HEBREW. // For "in", set *lang to INDONESIAN. // For "ji", set *lang to YIDDISH. // For "fil", set *lang to TAGALOG. // // REQUIRES: 'lang' must not be NULL. bool LanguageFromCode(const char* lang_code, Language *language); // LanguageFromCodeOrName // ---------------------- // // If lang_code_or_name is a language code or a language name. // set *language to the corresponding Language and return true. // Otherwise set *language to UNKNOWN_LANGUAGE and return false. // bool LanguageFromCodeOrName(const char* lang_code_or_name, Language* language); // LanguageNameFromCode // -------------------- // // If language_code is the code for a Language (see LanguageFromCode), // return the standard name of that language (see LanguageName). // Otherwise return invalid_language_name(). // const char* LanguageNameFromCode(const char* language_code); // Miscellany // LanguageCodeToUnderscoreForm // ---------------------------- // // Given a language code, convert the dash "-" to underscore "_". // // Specifically, if result_length <= strlen(lang_code), set result[0] // to '\0' and return false. Otherwise, copy lang_code to result, // converting every dash to an underscore, converting every character // before the first dash or underscore to lower case, and converting // every character after the first dash or underscore to upper // case. If there is no dash or underscore, convert the entire string // to lower case. // // REQUIRES: 'lang_code' must not be NULL. 'result' must not be NULL. bool LanguageCodeToUnderscoreForm(const char* lang_code, char* result, int result_length); // // AlwaysPutInExpectedRestrict // --------------------------- // // For Web pages in certain top-level domains, Web Search always // applies a "country restrict". If 'tld' matches one of those, using // a case-SENSITIVE comparison, set *expected_language to the Language // most commonly found in that top-level domain and return true. // Otherwise, set *expected_language to UNKNOWN_LANGUAGE and return false. bool AlwaysPutInExpectedRestrict(const char *tld, Language *expected_language); #endif // UTIL_LANGUAGES_LANGUAGES_H_ ================================================ FILE: third_party/ced/util/languages/languages.pb.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_LANGUAGES_LANGUAGES_PB_H_ #define UTIL_LANGUAGES_LANGUAGES_PB_H_ enum Language { ENGLISH = 0, DANISH = 1, DUTCH = 2, FINNISH = 3, FRENCH = 4, GERMAN = 5, HEBREW = 6, ITALIAN = 7, JAPANESE = 8, KOREAN = 9, NORWEGIAN = 10, POLISH = 11, PORTUGUESE = 12, RUSSIAN = 13, SPANISH = 14, SWEDISH = 15, CHINESE = 16, CZECH = 17, GREEK = 18, ICELANDIC = 19, LATVIAN = 20, LITHUANIAN = 21, ROMANIAN = 22, HUNGARIAN = 23, ESTONIAN = 24, TG_UNKNOWN_LANGUAGE = 25, UNKNOWN_LANGUAGE = 26, BULGARIAN = 27, CROATIAN = 28, SERBIAN = 29, IRISH = 30, // UI only. GALICIAN = 31, TAGALOG = 32, // Tagalog (tl) + Filipino (fil), TURKISH = 33, UKRAINIAN = 34, HINDI = 35, MACEDONIAN = 36, BENGALI = 37, INDONESIAN = 38, LATIN = 39, // UI only. MALAY = 40, MALAYALAM = 41, WELSH = 42, // UI only. NEPALI = 43, TELUGU = 44, ALBANIAN = 45, TAMIL = 46, BELARUSIAN = 47, JAVANESE = 48, // UI only. OCCITAN = 49, // UI only. URDU = 50, BIHARI = 51, GUJARATI = 52, THAI = 53, ARABIC = 54, CATALAN = 55, ESPERANTO = 56, BASQUE = 57, INTERLINGUA = 58, // UI only. KANNADA = 59, PUNJABI = 60, SCOTS_GAELIC = 61, // UI only. SWAHILI = 62, SLOVENIAN = 63, MARATHI = 64, MALTESE = 65, VIETNAMESE = 66, FRISIAN = 67, // UI only. SLOVAK = 68, CHINESE_T = 69, // This is added to solve the problem of // distinguishing Traditional and Simplified // Chinese when the encoding is UTF8. FAROESE = 70, // UI only. SUNDANESE = 71, // UI only. UZBEK = 72, AMHARIC = 73, AZERBAIJANI = 74, GEORGIAN = 75, TIGRINYA = 76, // UI only. PERSIAN = 77, BOSNIAN = 78, // UI only. LangId language: CROATIAN (28) SINHALESE = 79, NORWEGIAN_N = 80, // UI only. LangId language: NORWEGIAN (10) PORTUGUESE_P = 81, // UI only. LangId language: PORTUGUESE (12) PORTUGUESE_B = 82, // UI only. LangId language: PORTUGUESE (12) XHOSA = 83, // UI only. ZULU = 84, // UI only. GUARANI = 85, SESOTHO = 86, // UI only. TURKMEN = 87, // UI only. KYRGYZ = 88, BRETON = 89, // UI only. TWI = 90, // UI only. YIDDISH = 91, // UI only. SERBO_CROATIAN= 92, // UI only. LangId language: SERBIAN (29) SOMALI = 93, // UI only. UIGHUR = 94, KURDISH = 95, MONGOLIAN = 96, ARMENIAN = 97, LAOTHIAN = 98, SINDHI = 99, RHAETO_ROMANCE= 100, // UI only. AFRIKAANS = 101, LUXEMBOURGISH = 102, // UI only. BURMESE = 103, KHMER = 104, TIBETAN = 105, DHIVEHI = 106, // sometimes spelled Divehi, lang of Maldives CHEROKEE = 107, SYRIAC = 108, // UI only. LIMBU = 109, // UI only. ORIYA = 110, ASSAMESE = 111, // UI only. CORSICAN = 112, // UI only. INTERLINGUE = 113, // UI only. KAZAKH = 114, LINGALA = 115, // UI only. MOLDAVIAN = 116, // UI only. LangId language: ROMANIAN (22) PASHTO = 117, QUECHUA = 118, // UI only. SHONA = 119, // UI only. TAJIK = 120, TATAR = 121, // UI only. TONGA = 122, // UI only. YORUBA = 123, // UI only. CREOLES_AND_PIDGINS_ENGLISH_BASED = 124, // UI only. CREOLES_AND_PIDGINS_FRENCH_BASED = 125, // UI only. CREOLES_AND_PIDGINS_PORTUGUESE_BASED = 126, // UI only. CREOLES_AND_PIDGINS_OTHER = 127, // UI only. MAORI = 128, // UI only. WOLOF = 129, // UI only. ABKHAZIAN = 130, // UI only. AFAR = 131, // UI only. AYMARA = 132, // UI only. BASHKIR = 133, // UI only. BISLAMA = 134, // UI only. DZONGKHA = 135, // UI only. FIJIAN = 136, // UI only. GREENLANDIC = 137, // UI only. HAUSA = 138, // UI only. HAITIAN_CREOLE= 139, // UI only. INUPIAK = 140, // UI only. INUKTITUT = 141, KASHMIRI = 142, // UI only. KINYARWANDA = 143, // UI only. MALAGASY = 144, // UI only. NAURU = 145, // UI only. OROMO = 146, // UI only. RUNDI = 147, // UI only. SAMOAN = 148, // UI only. SANGO = 149, // UI only. SANSKRIT = 150, SISWANT = 151, // UI only. TSONGA = 152, // UI only. TSWANA = 153, // UI only. VOLAPUK = 154, // UI only. ZHUANG = 155, // UI only. KHASI = 156, // UI only. SCOTS = 157, // UI only. GANDA = 158, // UI only. MANX = 159, // UI only. MONTENEGRIN = 160, // UI only. LangId language: SERBIAN (29) NUM_LANGUAGES = 161, // Always keep this at the end. It is not a // valid Language enum. It is only used to // indicate the total number of Languages. // NOTE: If you add a language, you will break a unittest. See the note // at the top of this enum. }; #endif // UTIL_LANGUAGES_LANGUAGES_PB_H_ ================================================ FILE: third_party/ced/util/logging.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_LOGGING_H_ #define UTIL_LOGGING_H_ #undef CHECK #define CHECK(expr) #undef DCHECK #define DCHECK(expr) #endif // UTIL_LOGGING_H_ ================================================ FILE: third_party/ced/util/port.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_PORT_H_ #define UTIL_PORT_H_ #include #if defined(_MSC_VER) #define GG_LONGLONG(x) x##I64 #define GG_ULONGLONG(x) x##UI64 #else #define GG_LONGLONG(x) x##LL #define GG_ULONGLONG(x) x##ULL #endif // Per C99 7.8.14, define __STDC_CONSTANT_MACROS before including // to get the INTn_C and UINTn_C macros for integer constants. It's difficult // to guarantee any specific ordering of header includes, so it's difficult to // guarantee that the INTn_C macros can be defined by including at // any specific point. Provide GG_INTn_C macros instead. #define GG_INT8_C(x) (x) #define GG_INT16_C(x) (x) #define GG_INT32_C(x) (x) #define GG_INT64_C(x) GG_LONGLONG(x) #define GG_UINT8_C(x) (x ## U) #define GG_UINT16_C(x) (x ## U) #define GG_UINT32_C(x) (x ## U) #define GG_UINT64_C(x) GG_ULONGLONG(x) // Define an OS-neutral wrapper for shared library entry points #if defined(_WIN32) #define API_CALL __stdcall #else #define API_CALL #endif #endif // UTIL_PORT_H_ ================================================ FILE: third_party/ced/util/string_util.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_STRING_UTIL_H_ #define UTIL_STRING_UTIL_H_ #include namespace base { #if defined(_WIN32) // Compare the two strings s1 and s2 without regard to case using // the current locale; returns 0 if they are equal, 1 if s1 > s2, and -1 if // s2 > s1 according to a lexicographic comparison. inline int strcasecmp(const char* s1, const char* s2) { return _stricmp(s1, s2); } inline int strncasecmp(const char* s1, const char* s2, size_t n) { return _strnicmp(s1, s2, n); } #else inline int strcasecmp(const char* s1, const char* s2) { return ::strcasecmp(s1, s2); } inline int strncasecmp(const char* s1, const char* s2, size_t n) { return ::strncasecmp(s1, s2, n); } #endif } #ifndef HAVE_MEMRCHR #if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 2))) #define HAVE_MEMRCHR #endif #endif #ifndef HAVE_MEMRCHR inline void* memrchr(const void* s, int c, size_t n) { const unsigned char* p = (const unsigned char*) s; for (p += n; n > 0; n--) { if (*--p == c) return (void*) p; } return NULL; } #endif #endif // UTIL_STRING_UTIL_H_ ================================================ FILE: third_party/ced/util/varsetter.h ================================================ // Copyright 2016 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //////////////////////////////////////////////////////////////////////////////// #ifndef UTIL_VARSETTER_H_ #define UTIL_VARSETTER_H_ // // Use a VarSetter object to temporarily set an object of some sort to // a particular value. When the VarSetter object is destructed, the // underlying object will revert to its former value. // // Sample code: // #if 0 { bool b = true; { VarSetter bool_setter(&b, false); // Now b == false. } // Now b == true again. } #endif template class VarSetter { public: // Constructor that just sets the object to a fixed value VarSetter(C* object, const C& value) : object_(object), old_value_(*object) { *object = value; } ~VarSetter() { *object_ = old_value_; } private: C*const object_; C old_value_; // Disallow VarSetter(const VarSetter&); VarSetter& operator=(const VarSetter&); // VarSetters always live on the stack static void* operator new (size_t); static void* operator new[](size_t); // Redundant, no default ctor static void operator delete (void*); static void operator delete[](void*); }; #endif // UTIL_VARSETTER_H_ ================================================ FILE: third_party/guicon/CMakeLists.txt ================================================ # ======================== file(GLOB SRC_CODE *.h *.cpp ) add_library(guicon STATIC ${SRC_CODE}) # 添加include目录 target_include_directories(guicon PUBLIC .. ) ================================================ FILE: third_party/guicon/guicon.cpp ================================================ #include "guicon.h" #include #include #include #include #include DWORD GetParentPID() { int pid = GetCurrentProcessId(); HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); std::shared_ptr defer(nullptr, [h](auto) { CloseHandle(h); }); PROCESSENTRY32 pe = {0}; pe.dwSize = sizeof(PROCESSENTRY32); if (!Process32First(h, &pe)) { throw std::runtime_error("failed at Process32First"); } DWORD parentPid = 0; do { if (pe.th32ProcessID != pid) { continue; } assert(parentPid == 0); parentPid = pe.th32ParentProcessID; } while (Process32Next(h, &pe)); return parentPid; } bool ReleaseConsole() { bool result = true; FILE *fp; // Just to be safe, redirect standard IO to NUL before releasing. // Redirect STDIN to NUL if (freopen_s(&fp, "NUL:", "r", stdin) != 0) result = false; else setvbuf(stdin, NULL, _IONBF, 0); // Redirect STDOUT to NUL if (freopen_s(&fp, "NUL:", "w", stdout) != 0) result = false; else setvbuf(stdout, NULL, _IONBF, 0); // Redirect STDERR to NUL if (freopen_s(&fp, "NUL:", "w", stderr) != 0) result = false; else setvbuf(stderr, NULL, _IONBF, 0); // Detach from console if (!FreeConsole()) result = false; return result; } bool RedirectConsoleIO() { bool result = true; FILE *fp; // Redirect STDIN if the console has an input handle if (GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE) if (freopen_s(&fp, "CONIN$", "r", stdin) != 0) result = false; else setvbuf(stdin, NULL, _IONBF, 0); // Redirect STDOUT if the console has an output handle if (GetStdHandle(STD_OUTPUT_HANDLE) != INVALID_HANDLE_VALUE) if (freopen_s(&fp, "CONOUT$", "w", stdout) != 0) result = false; else setvbuf(stdout, NULL, _IONBF, 0); // Redirect STDERR if the console has an error handle if (GetStdHandle(STD_ERROR_HANDLE) != INVALID_HANDLE_VALUE) if (freopen_s(&fp, "CONOUT$", "w", stderr) != 0) result = false; else setvbuf(stderr, NULL, _IONBF, 0); // Make C++ standard streams point to console as well. std::ios::sync_with_stdio(true); // Clear the error state for each of the C++ standard streams. std::wcout.clear(); std::cout.clear(); std::wcerr.clear(); std::cerr.clear(); std::wcin.clear(); std::cin.clear(); return result; } void AdjustConsoleBuffer(short minLength) { // Set the screen buffer to be big enough to scroll some text CONSOLE_SCREEN_BUFFER_INFO conInfo; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &conInfo); if (conInfo.dwSize.Y < minLength) conInfo.dwSize.Y = minLength; SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), conInfo.dwSize); } bool AttachParentConsole(short minLength) { bool result = false; // Release any current console and redirect IO to NUL ReleaseConsole(); // Attempt to attach to parent process's console if (AttachConsole(ATTACH_PARENT_PROCESS)) { AdjustConsoleBuffer(minLength); result = RedirectConsoleIO(); } return result; } ================================================ FILE: third_party/guicon/guicon.h ================================================ #pragma once #include DWORD GetParentPID(); bool ReleaseConsole(); bool RedirectConsoleIO(); bool AttachParentConsole(short minLength); ================================================ FILE: third_party/uchardet/WinCodePage_Identifiers.txt ================================================ Identifier .NET Name Additional information ------------------------------------------------------------------------------- 037 IBM037 IBM EBCDIC US-Canada 437 IBM437 OEM United States 500 IBM500 IBM EBCDIC International 708 ASMO-708 Arabic (ASMO 708) 709 Arabic (ASMO-449+, BCON V4) 710 Arabic - Transparent Arabic 720 DOS-720 Arabic (Transparent ASMO); Arabic (DOS) 737 ibm737 OEM Greek (formerly 437G); Greek (DOS) 775 ibm775 OEM Baltic; Baltic (DOS) 850 ibm850 OEM Multilingual Latin 1; Western European (DOS) 852 ibm852 OEM Latin 2; Central European (DOS) 855 IBM855 OEM Cyrillic (primarily Russian) 857 ibm857 OEM Turkish; Turkish (DOS) 858 IBM00858 OEM Multilingual Latin 1 + Euro symbol 860 IBM860 OEM Portuguese; Portuguese (DOS) 861 ibm861 OEM Icelandic; Icelandic (DOS) 862 DOS-862 OEM Hebrew; Hebrew (DOS) 863 IBM863 OEM French Canadian; French Canadian (DOS) 864 IBM864 OEM Arabic; Arabic (864) 865 IBM865 OEM Nordic; Nordic (DOS) 866 cp866 OEM Russian; Cyrillic (DOS) 869 ibm869 OEM Modern Greek; Greek, Modern (DOS) 870 IBM870 IBM EBCDIC Multilingual/ROECE (Latin 2); IBM EBCDIC Multilingual Latin 2 874 windows-874 ANSI/OEM Thai (ISO 8859-11); Thai (Windows) 875 cp875 IBM EBCDIC Greek Modern 932 shift_jis ANSI/OEM Japanese; Japanese (Shift-JIS) 936 gb2312 ANSI/OEM Simplified Chinese (PRC, Singapore); Chinese Simplified (GB2312) 949 ks_c_5601-1987 ANSI/OEM Korean (Unified Hangul Code) 950 big5 ANSI/OEM Traditional Chinese (Taiwan; Hong Kong SAR, PRC); Chinese Traditional (Big5) 1026 IBM1026 IBM EBCDIC Turkish (Latin 5) 1047 IBM01047 IBM EBCDIC Latin 1/Open System 1140 IBM01140 IBM EBCDIC US-Canada (037 + Euro symbol); IBM EBCDIC (US-Canada-Euro) 1141 IBM01141 IBM EBCDIC Germany (20273 + Euro symbol); IBM EBCDIC (Germany-Euro) 1142 IBM01142 IBM EBCDIC Denmark-Norway (20277 + Euro symbol); IBM EBCDIC (Denmark-Norway-Euro) 1143 IBM01143 IBM EBCDIC Finland-Sweden (20278 + Euro symbol); IBM EBCDIC (Finland-Sweden-Euro) 1144 IBM01144 IBM EBCDIC Italy (20280 + Euro symbol); IBM EBCDIC (Italy-Euro) 1145 IBM01145 IBM EBCDIC Latin America-Spain (20284 + Euro symbol); IBM EBCDIC (Spain-Euro) 1146 IBM01146 IBM EBCDIC United Kingdom (20285 + Euro symbol); IBM EBCDIC (UK-Euro) 1147 IBM01147 IBM EBCDIC France (20297 + Euro symbol); IBM EBCDIC (France-Euro) 1148 IBM01148 IBM EBCDIC International (500 + Euro symbol); IBM EBCDIC (International-Euro) 1149 IBM01149 IBM EBCDIC Icelandic (20871 + Euro symbol); IBM EBCDIC (Icelandic-Euro) 1200 utf-16 Unicode UTF-16, little endian byte order (BMP of ISO 10646); available only to managed applications 1201 unicodeFFFE Unicode UTF-16, big endian byte order; available only to managed applications 1250 windows-1250 ANSI Central European; Central European (Windows) 1251 windows-1251 ANSI Cyrillic; Cyrillic (Windows) 1252 windows-1252 ANSI Latin 1; Western European (Windows) 1253 windows-1253 ANSI Greek; Greek (Windows) 1254 windows-1254 ANSI Turkish; Turkish (Windows) 1255 windows-1255 ANSI Hebrew; Hebrew (Windows) 1256 windows-1256 ANSI Arabic; Arabic (Windows) 1257 windows-1257 ANSI Baltic; Baltic (Windows) 1258 windows-1258 ANSI/OEM Vietnamese; Vietnamese (Windows) 1361 Johab Korean (Johab) 10000 macintosh MAC Roman; Western European (Mac) 10001 x-mac-japanese Japanese (Mac) 10002 x-mac-chinesetrad MAC Traditional Chinese (Big5); Chinese Traditional (Mac) 10003 x-mac-korean Korean (Mac) 10004 x-mac-arabic Arabic (Mac) 10005 x-mac-hebrew Hebrew (Mac) 10006 x-mac-greek Greek (Mac) 10007 x-mac-cyrillic Cyrillic (Mac) 10008 x-mac-chinesesimp MAC Simplified Chinese (GB 2312); Chinese Simplified (Mac) 10010 x-mac-romanian Romanian (Mac) 10017 x-mac-ukrainian Ukrainian (Mac) 10021 x-mac-thai Thai (Mac) 10029 x-mac-ce MAC Latin 2; Central European (Mac) 10079 x-mac-icelandic Icelandic (Mac) 10081 x-mac-turkish Turkish (Mac) 10082 x-mac-croatian Croatian (Mac) 12000 utf-32 Unicode UTF-32, little endian byte order; available only to managed applications 12001 utf-32BE Unicode UTF-32, big endian byte order; available only to managed applications 20000 x-Chinese_CNS CNS Taiwan; Chinese Traditional (CNS) 20001 x-cp20001 TCA Taiwan 20002 x_Chinese-Eten Eten Taiwan; Chinese Traditional (Eten) 20003 x-cp20003 IBM5550 Taiwan 20004 x-cp20004 TeleText Taiwan 20005 x-cp20005 Wang Taiwan 20105 x-IA5 IA5 (IRV International Alphabet No. 5, 7-bit); Western European (IA5) 20106 x-IA5-German IA5 German (7-bit) 20107 x-IA5-Swedish IA5 Swedish (7-bit) 20108 x-IA5-Norwegian IA5 Norwegian (7-bit) 20127 us-ascii US-ASCII (7-bit) 20261 x-cp20261 T.61 20269 x-cp20269 ISO 6937 Non-Spacing Accent 20273 IBM273 IBM EBCDIC Germany 20277 IBM277 IBM EBCDIC Denmark-Norway 20278 IBM278 IBM EBCDIC Finland-Sweden 20280 IBM280 IBM EBCDIC Italy 20284 IBM284 IBM EBCDIC Latin America-Spain 20285 IBM285 IBM EBCDIC United Kingdom 20290 IBM290 IBM EBCDIC Japanese Katakana Extended 20297 IBM297 IBM EBCDIC France 20420 IBM420 IBM EBCDIC Arabic 20423 IBM423 IBM EBCDIC Greek 20424 IBM424 IBM EBCDIC Hebrew 20833 x-EBCDIC-KoreanExtended IBM EBCDIC Korean Extended 20838 IBM-Thai IBM EBCDIC Thai 20866 koi8-r Russian (KOI8-R); Cyrillic (KOI8-R) 20871 IBM871 IBM EBCDIC Icelandic 20880 IBM880 IBM EBCDIC Cyrillic Russian 20905 IBM905 IBM EBCDIC Turkish 20924 IBM00924 IBM EBCDIC Latin 1/Open System (1047 + Euro symbol) 20932 EUC-JP Japanese (JIS 0208-1990 and 0212-1990) 20936 x-cp20936 Simplified Chinese (GB2312); Chinese Simplified (GB2312-80) 20949 x-cp20949 Korean Wansung 21025 cp1025 IBM EBCDIC Cyrillic Serbian-Bulgarian 21027 (deprecated) 21866 koi8-u Ukrainian (KOI8-U); Cyrillic (KOI8-U) 28591 iso-8859-1 ISO 8859-1 Latin 1; Western European (ISO) 28592 iso-8859-2 ISO 8859-2 Central European; Central European (ISO) 28593 iso-8859-3 ISO 8859-3 Latin 3 28594 iso-8859-4 ISO 8859-4 Baltic 28595 iso-8859-5 ISO 8859-5 Cyrillic 28596 iso-8859-6 ISO 8859-6 Arabic 28597 iso-8859-7 ISO 8859-7 Greek 28598 iso-8859-8 ISO 8859-8 Hebrew; Hebrew (ISO-Visual) 28599 iso-8859-9 ISO 8859-9 Turkish 28603 iso-8859-13 ISO 8859-13 Estonian 28605 iso-8859-15 ISO 8859-15 Latin 9 29001 x-Europa Europa 3 38598 iso-8859-8-i ISO 8859-8 Hebrew; Hebrew (ISO-Logical) 50220 iso-2022-jp ISO 2022 Japanese with no halfwidth Katakana; Japanese (JIS) 50221 csISO2022JP ISO 2022 Japanese with halfwidth Katakana; Japanese (JIS-Allow 1 byte Kana) 50222 iso-2022-jp ISO 2022 Japanese JIS X 0201-1989; Japanese (JIS-Allow 1 byte Kana - SO/SI) 50225 iso-2022-kr ISO 2022 Korean 50227 x-cp50227 ISO 2022 Simplified Chinese; Chinese Simplified (ISO 2022) 50229 ISO 2022 Traditional Chinese 50930 EBCDIC Japanese (Katakana) Extended 50931 EBCDIC US-Canada and Japanese 50933 EBCDIC Korean Extended and Korean 50935 EBCDIC Simplified Chinese Extended and Simplified Chinese 50936 EBCDIC Simplified Chinese 50937 EBCDIC US-Canada and Traditional Chinese 50939 EBCDIC Japanese (Latin) Extended and Japanese 51932 euc-jp EUC Japanese 51936 EUC-CN EUC Simplified Chinese; Chinese Simplified (EUC) 51949 euc-kr EUC Korean 51950 EUC Traditional Chinese 52936 hz-gb-2312 HZ-GB2312 Simplified Chinese; Chinese Simplified (HZ) 54936 GB18030 Windows XP and later: GB18030 Simplified Chinese (4 byte); Chinese Simplified (GB18030) 57002 x-iscii-de ISCII Devanagari 57003 x-iscii-be ISCII Bangla 57004 x-iscii-ta ISCII Tamil 57005 x-iscii-te ISCII Telugu 57006 x-iscii-as ISCII Assamese 57007 x-iscii-or ISCII Odia 57008 x-iscii-ka ISCII Kannada 57009 x-iscii-ma ISCII Malayalam 57010 x-iscii-gu ISCII Gujarati 57011 x-iscii-pa ISCII Punjabi 65000 utf-7 Unicode (UTF-7) 65001 utf-8 Unicode (UTF-8) ================================================ FILE: third_party/uchardet/uchardet/AUTHORS ================================================ == Original Authors == The original code is Mozilla Universal charset detector code. The initial developer of the Original Code is Netscape Communications Corporation. The initial developer of the C wrapper is BYVoid. == Maintainers == BYVoid Jehan == Contributors == You can obtain the full list of contributors to uchardet with the following git command in the source repository: $ git shortlog -s ================================================ FILE: third_party/uchardet/uchardet/CMakeLists.txt ================================================ ######## Project settings cmake_minimum_required(VERSION 2.8.5) include(CheckCCompilerFlag) set (PACKAGE_NAME uchardet) project (${PACKAGE_NAME} CXX C) enable_testing() ######## Package information set (PACKAGE_URL https://www.freedesktop.org/wiki/Software/uchardet) set (PACKAGE_BUGREPORT https://bugs.freedesktop.org/enter_bug.cgi?product=uchardet) set (UCHARDET_VERSION_MAJOR 0) set (UCHARDET_VERSION_MINOR 0) set (UCHARDET_VERSION_REVISION 6) if (CMAKE_BUILD_TYPE MATCHES Debug) set (version_suffix .debug) endif (CMAKE_BUILD_TYPE MATCHES Debug) set ( UCHARDET_VERSION ${UCHARDET_VERSION_MAJOR}.${UCHARDET_VERSION_MINOR}.${UCHARDET_VERSION_REVISION}${version_suffix} ) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) ######## Directory include(GNUInstallDirs) ######## Configuration option(BUILD_BINARY "Build the CLI tool." ON) option(BUILD_SHARED_LIBS "Build shared library and link executable to it." ON) option(CHECK_SSE2 "Check and enable SSE2 extensions if supported. Disabling SSE on platforms which support it may decrease performances." ON) set(TARGET_ARCHITECTURE "" CACHE STRING "Target CPU architecture. It is autodetected if not specified.") if (BUILD_SHARED_LIBS) option(BUILD_STATIC "Build static library" ON) endif (BUILD_SHARED_LIBS) if (TARGET_ARCHITECTURE STREQUAL "") string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} TARGET_ARCHITECTURE) endif (TARGET_ARCHITECTURE STREQUAL "") if (TARGET_ARCHITECTURE MATCHES ".*(x86)|(amd).*") CHECK_C_COMPILER_FLAG(-msse2 SUPPORTS_CFLAG_SSE2) CHECK_C_COMPILER_FLAG(-mfpmath=sse SUPPORTS_CFLAG_SSE_MATH) if (CHECK_SSE2 AND SUPPORTS_CFLAG_SSE2 AND SUPPORTS_CFLAG_SSE_MATH) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mfpmath=sse") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mfpmath=sse") else (CHECK_SSE2 AND SUPPORTS_CFLAG_SSE2 AND SUPPORTS_CFLAG_SSE_MATH) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffloat-store") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffloat-store") endif (CHECK_SSE2 AND SUPPORTS_CFLAG_SSE2 AND SUPPORTS_CFLAG_SSE_MATH) endif (TARGET_ARCHITECTURE MATCHES ".*(x86)|(amd).*") configure_file( uchardet.pc.in uchardet.pc @ONLY ) install( FILES ${CMAKE_BINARY_DIR}/uchardet.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) ######## Subdirectories add_subdirectory(src) add_subdirectory(doc) ================================================ FILE: third_party/uchardet/uchardet/COPYING ================================================ MOZILLA PUBLIC LICENSE Version 1.1 --------------- 1. Definitions. 1.0.1. "Commercial Use" means distribution or otherwise making the Covered Code available to a third party. 1.1. "Contributor" means each entity that creates or contributes to the creation of Modifications. 1.2. "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 1.3. "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 1.4. "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. 1.5. "Executable" means Covered Code in any form other than Source Code. 1.6. "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 1.7. "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 1.8. "License" means this document. 1.8.1. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9. "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. B. Any new file that contains any part of the Original Code or previous Modifications. 1.10. "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 1.10.1. "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.11. "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 1.12. "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. Source Code License. 2.1. The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License. (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 2.2. Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code. (d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1. Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. 3.2. Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 3.3. Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 3.4. Intellectual Property Matters (a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. (b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file. (c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License. 3.5. Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.6. Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. 3.7. Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. 4. Inability to Comply Due to Statute or Regulation. If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Application of this License. This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code. 6. Versions of the License. 6.1. New Versions. Netscape Communications Corporation ("Netscape") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 6.2. Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Netscape. No one other than Netscape has the right to modify the terms applicable to Covered Code created under this License. 6.3. Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", "MPL", "NPL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the Mozilla Public License and Netscape Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) 7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 8. TERMINATION. 8.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 8.2. If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant") alleging that: (a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above. (b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 8.3. If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. 8.4. In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination. 9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 10. U.S. GOVERNMENT END USERS. The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. 11. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. 12. RESPONSIBILITY FOR CLAIMS. As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. 13. MULTIPLE-LICENSED CODE. Initial Developer may designate portions of the Covered Code as "Multiple-Licensed". "Multiple-Licensed" means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the NPL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A. EXHIBIT A -Mozilla Public License. ``The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is ______________________________________. The Initial Developer of the Original Code is ________________________. Portions created by ______________________ are Copyright (C) ______ _______________________. All Rights Reserved. Contributor(s): ______________________________________. Alternatively, the contents of this file may be used under the terms of the _____ license (the "[___] License"), in which case the provisions of [______] License are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the [____] License and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the [___] License. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the [___] License." [NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code. You should use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.] ------------------------------------------------------------------------ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. ------------------------------------------------------------------------ GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ================================================ FILE: third_party/uchardet/uchardet/INSTALL ================================================ # Building uchardet (generic) `uchardet` uses a typical cmake installation. * Configure with `cmake`. There are various options. For instance to configure with a prefix as a release-ready build: > cmake -DCMAKE_INSTALL_PREFIX=/home/jehan/.local -DCMAKE_BUILD_TYPE=Release Alternatively, use `ccmake`, curses interface to `cmake`. * Build with `make`. * Install with `make install`. Read `README` for more details on uchardet. # Building uchardet on Windows The above procedure is generic, which means it should work on any platform. In particular, it works well on Linux. The procedure is the same on Windows, but if you want more details (for instance which tools to use in order to run CMake on Windows, compiler information, etc.), the following link may be useful: https://github.com/BYVoid/uchardet/issues/39#issuecomment-353873891 ================================================ FILE: third_party/uchardet/uchardet/Origin_GitHub.url ================================================ [InternetShortcut] URL=https://github.com/freedesktop/uchardet ================================================ FILE: third_party/uchardet/uchardet/README.md ================================================ # uchardet Forked from [freedesktop/uchardet](https://github.com/freedesktop/uchardet) [uchardet](https://www.freedesktop.org/wiki/Software/uchardet/) is an encoding detector library, which takes a sequence of bytes in an unknown character encoding without any additional information, and attempts to determine the encoding of the text. Returned encoding names are [iconv](https://www.gnu.org/software/libiconv/)-compatible. uchardet started as a C language binding of the original C++ implementation of the universal charset detection library by Mozilla. It can now detect more charsets, and more reliably than the original implementation. The original code of universalchardet is available at http://lxr.mozilla.org/seamonkey/source/extensions/universalchardet/ Techniques used by universalchardet are described at http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html ## Supported Languages/Encodings * International (Unicode) * UTF-8 * UTF-16BE / UTF-16LE * UTF-32BE / UTF-32LE / X-ISO-10646-UCS-4-34121 / X-ISO-10646-UCS-4-21431 * Arabic * ISO-8859-6 * WINDOWS-1256 * Bulgarian * ISO-8859-5 * WINDOWS-1251 * Chinese * ISO-2022-CN * BIG5 * EUC-TW * GB18030 * HZ-GB-2312 * Croatian: * ISO-8859-2 * ISO-8859-13 * ISO-8859-16 * Windows-1250 * IBM852 * MacCentralEurope * Czech * Windows-1250 * ISO-8859-2 * IBM852 * MacCentralEurope * Danish * ISO-8859-1 * ISO-8859-15 * WINDOWS-1252 * English * ASCII * Esperanto * ISO-8859-3 * Estonian * ISO-8859-4 * ISO-8859-13 * ISO-8859-13 * Windows-1252 * Windows-1257 * Finnish * ISO-8859-1 * ISO-8859-4 * ISO-8859-9 * ISO-8859-13 * ISO-8859-15 * WINDOWS-1252 * French * ISO-8859-1 * ISO-8859-15 * WINDOWS-1252 * German * ISO-8859-1 * WINDOWS-1252 * Greek * ISO-8859-7 * WINDOWS-1253 * Hebrew * ISO-8859-8 * WINDOWS-1255 * Hungarian: * ISO-8859-2 * WINDOWS-1250 * Irish Gaelic * ISO-8859-1 * ISO-8859-9 * ISO-8859-15 * WINDOWS-1252 * Italian * ISO-8859-1 * ISO-8859-3 * ISO-8859-9 * ISO-8859-15 * WINDOWS-1252 * Japanese * ISO-2022-JP * SHIFT_JIS * EUC-JP * Korean * ISO-2022-KR * EUC-KR / UHC * Lithuanian * ISO-8859-4 * ISO-8859-10 * ISO-8859-13 * Latvian * ISO-8859-4 * ISO-8859-10 * ISO-8859-13 * Maltese * ISO-8859-3 * Polish: * ISO-8859-2 * ISO-8859-13 * ISO-8859-16 * Windows-1250 * IBM852 * MacCentralEurope * Portuguese * ISO-8859-1 * ISO-8859-9 * ISO-8859-15 * WINDOWS-1252 * Romanian: * ISO-8859-2 * ISO-8859-16 * Windows-1250 * IBM852 * Russian * ISO-8859-5 * KOI8-R * WINDOWS-1251 * MAC-CYRILLIC * IBM866 * IBM855 * Slovak * Windows-1250 * ISO-8859-2 * IBM852 * MacCentralEurope * Slovene * ISO-8859-2 * ISO-8859-16 * Windows-1250 * IBM852 * MacCentralEurope * Spanish * ISO-8859-1 * ISO-8859-15 * WINDOWS-1252 * Swedish * ISO-8859-1 * ISO-8859-4 * ISO-8859-9 * ISO-8859-15 * WINDOWS-1252 * Thai * TIS-620 * ISO-8859-11 * Turkish: * ISO-8859-3 * ISO-8859-9 * Vietnamese: * VISCII * Windows-1258 * Others * WINDOWS-1252 ## Installation ### Build from source If you prefer a development version, clone the git repository: git clone https://github.com/PyYoshi/uchardet.git The source can be browsed at: https://github.com/PyYoshi/uchardet mkdir build/ && cd build/ cmake .. make make install ## Usage ### Command Line ``` uchardet Command Line Tool Version 0.0.6 Authors: BYVoid, Jehan Bug Report: https://bugs.freedesktop.org/enter_bug.cgi?product=uchardet Usage: uchardet [Options] [File]... Options: -v, --version Print version and build information. -h, --help Print this help. ``` ### Library See [uchardet.h](https://github.com/PyYoshi/uchardet/blob/cchardet/src/uchardet.h) ## Licenses * [Mozilla Public License Version 1.1](http://www.mozilla.org/MPL/1.1/) * [GNU General Public License, version 2.0](http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) or later. * [GNU Lesser General Public License, version 2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html) or later. See the file `COPYING` for the complete text of these 3 licenses. ================================================ FILE: third_party/uchardet/uchardet/_GitHub.url ================================================ [InternetShortcut] URL=https://github.com/PyYoshi/uchardet ================================================ FILE: third_party/uchardet/uchardet/_GitHub_libchardet.url ================================================ [InternetShortcut] URL=https://github.com/Joungkyun/libchardet ================================================ FILE: third_party/uchardet/uchardet/doc/CMakeLists.txt ================================================ install( FILES uchardet.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) ================================================ FILE: third_party/uchardet/uchardet/doc/README.maintainer ================================================ # How to do a uchardet release # * Update UCHARDET_VERSION_MAJOR, UCHARDET_VERSION_MINOR and UCHARDET_VERSION_REVISION as needed in CMakeLists.txt. * Update README.md. * Commit the version change with the message "Release: version X.Y.Z." * Tag your release commit with: git tag -a vx.y.z The tag message should be have the header "Version x.y.z released." followed by a list of new features or important fixes. This tag message will be considered as the release note, hence have to be carefully crafted. Considering that the previous release was va.b.c, you can read the full list of commits between a.b.c and x.y.z with: git log va.b.c.. This should help you to build a proper release note. * Push the release and the tag: git push git push origin vx.y.z * Create a release tarball: git archive --format=tar.xz --prefix=uchardet-x.y.z/ vx.y.z >uchardet-x.y.z.tar.xz Note: if you have not already set this up, you have to run first: git config tar.tar.xz.command "xz -c" Cf. EXAMPLES section in `git help archive`. * Compute a SHA1 checksum: sha1sum uchardet-x.y.x.tar.xz > uchardet-x.y.z.tar.xz.sha1 * Upload to annarchy download server: scp uchardet-x.y.x.tar.xz uchardet-x.y.z.tar.xz.sha1 annarchy.freedesktop.org:/srv/www.freedesktop.org/www/software/uchardet/releases/ The archive and its checksum file should now be available from: https://www.freedesktop.org/software/uchardet/releases/ * Make the git tag into a Gitlab release (not automatic). It will be found at: https://gitlab.freedesktop.org/uchardet/uchardet/-/tags/vx.y.z Just click the "Edit release notes" button, and copy paste the tag comment as "release notes". * Update the wiki page: https://www.freedesktop.org/wiki/Software/uchardet/ The release note link will be: https://gitlab.freedesktop.org/uchardet/uchardet/-/releases/vx.y.z * Spread the good news! ================================================ FILE: third_party/uchardet/uchardet/doc/uchardet.1 ================================================ .TH UCHARDET "1" "July 2011" "uchardet " "User Commands" .SH NAME uchardet \- Universal Charset Detector .SH DESCRIPTION uchardet CLI is an encoding detector utility, which takes one or several files in unknown character encoding without any additional information, and attempts to determine the encoding of the texts. Returned encoding names are iconv-compatible. .SS "Usage:" .HP uchardet [\fBOptions\fR] [\fBFile\fR]... .HP \fB\-v\fR Print version and build information. .HP \fB\-h\fR Print help text. .HP .IP .PP uchardet Command Line Interface ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModel.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### # Third party modules. import unicodedata import subprocess import wikipedia import importlib import optparse import datetime import operator import requests import sys import re import os # Custom modules. import charsets.db from charsets.codepoints import * # Command line processing. usage = 'Usage: {} \n' \ '\nEx: `{} fr`'.format(__file__, __file__) description = "Internal tool for uchardet to generate language data." cmdline = optparse.OptionParser(usage, description = description) cmdline.add_option('--max-page', help = 'Maximum number of Wikipedia pages to parse (useful for debugging).', action = 'store', type = 'int', dest = 'max_page', default = None) cmdline.add_option('--max-depth', help = 'Maximum depth when following links from start page (default: 2).', action = 'store', type = 'int', dest = 'max_depth', default = 2) (options, langs) = cmdline.parse_args() if len(langs) < 1: print("Please select at least one language code.\n") exit(1) if len(langs) > 1: print("This script is meant to generate data for one language at a time.\n") exit(1) lang = langs[0] # Load the language data. sys_path_backup = sys.path current_dir = os.path.dirname(os.path.realpath(__file__)) sys.path = [current_dir + '/langs'] try: lang = importlib.import_module(lang.lower()) except ImportError: print('Unknown language code "{}": ' 'file "langs/{}.py" does not exist.'.format(lang, lang.lower())) exit(1) sys.path = sys_path_backup charsets = charsets.db.load(lang.charsets) if not hasattr(lang, 'start_pages') or lang.start_pages is None or \ lang.start_pages == []: # Let's start with the main page, assuming it should have links # to relevant pages. In locale wikipedia, this page is usually redirected # to a relevant page. print("Warning: no `start_pages` set for '{}'. Using ['Main_Page'].\n" " If you don't get good data, it is advised to set a " "start_pages` variable yourself.".format(lang.code)) lang.start_pages = ['Main_Page'] if not hasattr(lang, 'wikipedia_code') or lang.wikipedia_code is None: lang.wikipedia_code = lang.code if not hasattr(lang, 'clean_wikipedia_content') or lang.clean_wikipedia_content is None: lang.clean_wikipedia_content = None if hasattr(lang, 'case_mapping'): lang.case_mapping = bool(lang.case_mapping) else: lang.case_mapping = False if not hasattr(lang, 'custom_case_mapping'): lang.custom_case_mapping = None if not hasattr(lang, 'alphabet') or lang.alphabet is None: lang.alphabet = None def local_lowercase(text, lang): lowercased = '' for l in text: if lang.custom_case_mapping is not None and \ l in lang.custom_case_mapping: lowercased += lang.custom_case_mapping[l] elif l.isupper() and \ lang.case_mapping and \ len(unicodedata.normalize('NFC', l.lower())) == 1: lowercased += l.lower() else: lowercased += l return lowercased if lang.alphabet is not None: # Allowing to provide an alphabet in string format rather than list. lang.alphabet = list(lang.alphabet) if lang.use_ascii: lang.alphabet += [chr(l) for l in range(65, 91)] + [chr(l) for l in range(97, 123)] if lang.case_mapping or lang.custom_case_mapping is not None: lang.alphabet = [local_lowercase(l, lang) for l in lang.alphabet] #alphabet = [] #for l in lang.alphabet: #if l.isupper() and \ #lang.custom_case_mapping is not None and \ #l in lang.custom_case_mapping: #alphabet.append(lang.custom_case_mapping[l]) #elif l.isupper() and \ #lang.case_mapping and \ #len(unicodedata.normalize('NFC', l.lower())) == 1: #alphabet.append(l.lower()) #else: #alphabet.append(l) lang.alphabet = list(set(lang.alphabet)) # Starting processing. wikipedia.set_lang(lang.wikipedia_code) visited_pages = [] # The full list of letter characters. # The key is the unicode codepoint, # and the value is the occurrence count. characters = {} # Sequence of letters. # The key is the couple (char1, char2) in unicode codepoint, # the value is the occurrence count. sequences = {} prev_char = None def process_text(content, lang): global charsets global characters global sequences global prev_char if lang.clean_wikipedia_content is not None: content = lang.clean_wikipedia_content(content) # Clean out the Wikipedia syntax for titles. content = re.sub(r'(=+) *([^=]+) *\1', r'\2', content) # Clean multiple spaces. Newlines and such are normalized to spaces, # since they have basically a similar role in the purpose of uchardet. content = re.sub(r'\s+', ' ', content) if lang.case_mapping or lang.custom_case_mapping is not None: content = local_lowercase(content, lang) # In python 3, strings are UTF-8. # Looping through them return expected characters. for char in content: is_letter = False if ord(char) in characters: characters[ord(char)] += 1 is_letter = True else: # We save the character if it is at least in one of the # language encodings and its not a special character. for charset in charsets: # Does the character exist in the charset? try: codepoint = char.encode(charset, 'ignore') except LookupError: # unknown encoding. Use iconv from command line instead. try: call = subprocess.Popen(['iconv', '-f', 'UTF-8', '-t', charset], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) if call.poll() is not None: (_, error) = call.communicate(input='') print('Error: `iconv` ended with error "{}".\n'.format(error)) exit(1) (codepoint, _) = call.communicate(input=char.encode('UTF-8')) except FileNotFoundError: print('Error: "{}" is not a supported charset by python and `iconv` is not installed.\n') exit(1) if codepoint == b'': continue # ord() is said to return the unicode codepoint. # But it turns out it also gives the codepoint for other # charsets if I turn the string to encoded bytes first. # Not sure if that is a bug or expected. codepoint = ord(codepoint) if charsets[charset].charmap[codepoint] == LET: characters[ord(char)] = 1 is_letter = True break if is_letter: if prev_char is not None: if (prev_char, ord(char)) in sequences: sequences[(prev_char, ord(char))] += 1 else: sequences[(prev_char, ord(char))] = 1 prev_char = ord(char) else: prev_char = None def visit_pages(titles, depth, lang, logfd): global visited_pages global options if len(titles) == 0: return next_titles = [] for title in titles: if options.max_page is not None and \ len(visited_pages) > options.max_page: return if title in visited_pages: continue visited_pages += [title] try: page = wikipedia.page(title) except (wikipedia.exceptions.PageError, wikipedia.exceptions.DisambiguationError): # Let's just discard a page when I get an exception. print("Discarding page {}.\n".format(title)) continue logfd.write("\n{} (revision {})".format(title, page.revision_id)) process_text(page.content, lang) try: next_titles += page.links except KeyError: pass if depth >= options.max_depth: return visit_pages (next_titles, depth + 1, lang, logfd) language_c = lang.name.replace('-', '_').title() build_log = current_dir + '/BuildLangModelLogs/Lang{}Model.log'.format(language_c) logfd = open(build_log, 'w') logfd.write('= Logs of language model for {} ({}) =\n'.format(lang.name, lang.code)) logfd.write('\n- Generated by {}'.format(os.path.basename(__file__))) logfd.write('\n- Started: {}'.format(str(datetime.datetime.now()))) logfd.write('\n- Maximum depth: {}'.format(options.max_depth)) if options.max_page is not None: logfd.write('\n- Max number of pages: {}'.format(options.max_page)) logfd.write('\n\n== Parsed pages ==\n') try: visit_pages(lang.start_pages, 0, lang, logfd) except requests.exceptions.ConnectionError: print('Error: connection to Wikipedia failed. Aborting\n') exit(1) logfd.write('\n\n== End of Parsed pages ==') logfd.write('\n\n- Wikipedia parsing ended at: {}\n'.format(str(datetime.datetime.now()))) ########### CHARACTERS ########### # Character ratios. ratios = {} n_char = len(characters) occurrences = sum(characters.values()) logfd.write("\n{} characters appeared {} times.\n".format(n_char, occurrences)) for char in characters: ratios[char] = characters[char] / occurrences #logfd.write("Character '{}' usage: {} ({} %)\n".format(chr(char), # characters[char], # ratios[char] * 100)) sorted_ratios = sorted(ratios.items(), key=operator.itemgetter(1), reverse=True) # Accumulated ratios of the frequent chars. accumulated_ratios = 0 # If there is no alphabet defined, we just use the first 64 letters, which was # the original default. # If there is an alphabet, we make sure all the alphabet characters are in the # frequent list, and we stop then. There may therefore be more or less than # 64 frequent characters depending on the language. if lang.alphabet is None: freq_count = 64 else: freq_count = 0 for order, (char, ratio) in enumerate(sorted_ratios): if len(lang.alphabet) == 0: break if chr(char) in lang.alphabet: lang.alphabet.remove(chr(char)) freq_count += 1 else: if len(lang.alphabet) > 0: print("Error: alphabet characters are absent from data collection" "\n Please check the configuration or the data." "\n Missing characters: {}".format(", ".join(lang.alphabet))) exit(1) logfd.write('\nFirst {} characters:'.format(freq_count)) for order, (char, ratio) in enumerate(sorted_ratios): if order >= freq_count: break logfd.write("\n[{:2}] Char {}: {} %".format(order, chr(char), ratio * 100)) accumulated_ratios += ratio logfd.write("\n\nThe first {} characters have an accumulated ratio of {}.\n".format(freq_count, accumulated_ratios)) with open(current_dir + '/header-template.cpp', 'r') as header_fd: c_code = header_fd.read() c_code += '\n/********* Language model for: {} *********/\n\n'.format(lang.name) c_code += '/**\n * Generated by {}\n'.format(os.path.basename(__file__)) c_code += ' * On: {}\n'.format(str(datetime.datetime.now())) c_code += ' **/\n' c_code += \ """ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ """ for charset in charsets: charset_c = charset.replace('-', '_').title() CTOM_str = 'static const unsigned char {}_CharToOrderMap[]'.format(charset_c) CTOM_str += ' =\n{' for line in range(0, 16): CTOM_str += '\n ' for column in range(0, 16): cp = line * 16 + column cp_type = charsets[charset].charmap[cp] if cp_type == ILL: CTOM_str += 'ILL,' elif cp_type == RET: CTOM_str += 'RET,' elif cp_type == CTR: CTOM_str += 'CTR,' elif cp_type == SYM: CTOM_str += 'SYM,' elif cp_type == NUM: CTOM_str += 'NUM,' else: # LET try: uchar = bytes([cp]).decode(charset) except UnicodeDecodeError: print('Unknown character 0X{:X} in {}.'.format(cp, charset)) print('Please verify your charset specification.\n') exit(1) except LookupError: # Unknown encoding. Use iconv instead. try: call = subprocess.Popen(['iconv', '-t', 'UTF-8', '-f', charset], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if call.poll() is not None: (_, error) = call.communicate(input='') print('Error: `iconv` ended with error "{}".\n'.format(error)) exit(1) (uchar, _) = call.communicate(input=bytes([cp])) uchar = uchar.decode('UTF-8') except FileNotFoundError: print('Error: "{}" is not a supported charset by python and `iconv` is not installed.\n') exit(1) #if lang.case_mapping and uchar.isupper() and \ #len(unicodedata.normalize('NFC', uchar.lower())) == 1: # Unless we encounter special cases of characters with no # composed lowercase, we lowercase it. if lang.case_mapping or lang.custom_case_mapping is not None: uchar = local_lowercase(uchar, lang) for order, (char, ratio) in enumerate(sorted_ratios): if char == ord(uchar): CTOM_str += '{:3},'.format(min(249, order)) break else: # XXX: we must make sure the character order does not go # over the special characters (250 currently). This may # actually happen when building a model for a language # writable with many different encoding. So let's just # ceil the order value at 249 max. # It may be an interesting alternative to add another # constant for any character with an order > freqCharCount. # Maybe IRR (irrelevant character) or simply CHR. CTOM_str += '{:3},'.format(min(249, n_char)) n_char += 1 CTOM_str += ' /* {:X}X */'.format(line) CTOM_str += '\n};\n/*' CTOM_str += 'X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF' CTOM_str += ' */\n\n' c_code += CTOM_str ########### SEQUENCES ########### ratios = {} occurrences = sum(sequences.values()) ratio_512 = 0 ratio_1024 = 0 sorted_seqs = sorted(sequences.items(), key=operator.itemgetter(1), reverse=True) for order, ((c1, c2), count) in enumerate(sorted_seqs): if order < 512: ratio_512 += count elif order < 1024: ratio_1024 += count else: break ratio_512 /= occurrences ratio_1024 /= occurrences logfd.write("\n{} sequences found.\n".format(len(sorted_seqs))) c_code += """ /* Model Table: * Total sequences: {} * First 512 sequences: {} * Next 512 sequences (512-1024): {} * Rest: {} * Negative sequences: TODO""".format(len(sorted_seqs), ratio_512, ratio_1024, 1 - ratio_512 - ratio_1024) logfd.write("\nFirst 512 (typical positive ratio): {}".format(ratio_512)) logfd.write("\nNext 512 (512-1024): {}".format(ratio)) logfd.write("\nRest: {}".format(1 - ratio_512 - ratio_1024)) c_code += "\n */\n" LM_str = 'static const PRUint8 {}LangModel[]'.format(language_c) LM_str += ' =\n{' for line in range(0, freq_count): LM_str += '\n ' for column in range(0, freq_count): # Let's not make too long lines. if freq_count > 40 and column == int(freq_count / 2): LM_str += '\n ' first_order = int(line) second_order = column if first_order < len(sorted_ratios) and second_order < len(sorted_ratios): (first_char, _) = sorted_ratios[first_order] (second_char, _) = sorted_ratios[second_order] if (first_char, second_char) in sequences: for order, (seq, _) in enumerate(sorted_seqs): if seq == (first_char, second_char): if order < 512: LM_str += '3,' elif order < 1024: LM_str += '2,' else: LM_str += '1,' break else: pass # impossible! LM_str += '0,' else: LM_str += '0,' else: # It may indeed happen that we find less than 64 letters used for a # given language. LM_str += '0,' LM_str += '\n};\n' c_code += LM_str for charset in charsets: charset_c = charset.replace('-', '_').title() SM_str = '\n\nconst SequenceModel {}{}Model ='.format(charset_c, language_c) SM_str += '\n{\n ' SM_str += '{}_CharToOrderMap,\n {}LangModel,'.format(charset_c, language_c) SM_str += '\n {},'.format(freq_count) SM_str += '\n (float){},'.format(ratio_512) SM_str += '\n {},'.format('PR_TRUE' if lang.use_ascii else 'PR_FALSE') SM_str += '\n "{}"'.format(charset) SM_str += '\n};' c_code += SM_str c_code += '\n' lang_model_file = current_dir + '/../src/LangModels/Lang{}Model.cpp'.format(language_c) with open(lang_model_file, 'w') as cpp_fd: cpp_fd.write(c_code) logfd.write('\n\n- Processing end: {}\n'.format(str(datetime.datetime.now()))) logfd.close() print("The following language model file has been generated: {}" "\nThe build log is available in: {}" "\nTest them and commit them.".format(lang_model_file, build_log)) ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangAfricaansModel.log ================================================ = Logs of language model for Africaans (af) = - Generated by BuildLangModel.py - Started: 2019-03-05 22:03:10.909663 - Maximum depth: 4 - Max number of pages: 100 == Parsed pages == Tuisblad (revision 1684582) 1461 (revision 1430176) 1790 (revision 1675248) 1791 (revision 1675249) 1902 (revision 1754087) 1975 (revision 1880191) 1980 (revision 1758590) 4 Maart (revision 1661671) 91ste Oscar-toekenningsaand (revision 1946970) Afrikaans (revision 1948308) Arbeidersparty (Verenigde Koninkryk) (revision 1889370) Bohemian Rhapsody (rolprent) (revision 1866749) Brexit (revision 1929336) Britse Ryk (revision 1818751) Britse Statebond (revision 1948285) Calvados (département) (revision 1868774) Chagos-argipel (revision 1615824) Charlie Chaplin (revision 1781860) Côtes-d'Armor (revision 1782169) Deelstate van die Verenigde State van Amerika (revision 1649766) Demokratiese Alliansie (revision 1812222) Département (revision 1854517) Eduard IV van Engeland (revision 1782743) Elizabeth II van die Verenigde Koninkryk (revision 1901993) Engeland (revision 1888071) Frankryk (revision 1879703) Franse Rewolusie (revision 1756798) Hendrik VI van Engeland (revision 1800756) Huis van Lancaster (revision 1785007) Huis van York (revision 1785020) Internasionale Geregshof (revision 1882325) Internasionale reg (revision 1882335) Kanada (revision 1877750) Karl Lagerfeld (revision 1949039) Litaue (revision 1931631) Maori (revision 1890097) Mauritius (revision 1888421) Nieu-Seeland (revision 1671277) Ottawa (revision 1789990) Pole (revision 1936495) Pretoria (revision 1918057) Pretoriabrug (revision 1887276) Pyrénées-Atlantiques (revision 1792575) Rami Malek (revision 1949040) Ridder (revision 1884319) Robert Mugabe (revision 1906590) Rose-oorlog (revision 1913440) Src: (revision 1901833) Stevens Mokgalapa (revision 1930702) Suid-Afrika (revision 1948307) Suider-Afrika (revision 1948287) Suiderkruis (revision 1888298) Suur (revision 1798004) Suurstof (revision 1798017) Tweede Vryheidsoorlog (revision 1948023) Verenigde Koninkryk (revision 1929407) Verenigde State van Amerika (revision 1912053) Vermont (revision 1801379) Vlag van Nieu-Seeland (revision 1843138) Wapen (heraldiek) (revision 1927920) Wikipedia (revision 1857198) Zimbabwe (revision 1811872) Zimbabwe African National Union (revision 1281251) 1361 (revision 1232246) 13de eeu (revision 1778015) 1403 (revision 1298375) 1451 (revision 1436197) 1456 (revision 1290621) 1457 (revision 1245081) 1458 (revision 1287891) 1459 (revision 1499559) 1460 (revision 1340662) 1462 (revision 1226747) 1463 (revision 1222574) 1464 (revision 1825686) 1465 (revision 1606552) 1466 (revision 1435721) 1471 (revision 1614854) 14de eeu (revision 1424027) 1561 (revision 1443451) 15de eeu (revision 1929254) 16de eeu (revision 1778021) 17de eeu (revision 1778022) 18 Desember (revision 1868555) 22 Julie (revision 1574046) 29 Maart (revision 1557782) Ab Urbe Condita (jaartelling) (revision 1610886) Armeense kalender (revision 1614076) Dinsdag (revision 1881264) Drie Konings (revision 1882373) Eeue (revision 1824796) Ethiopiese kalender (revision 1617197) Geskiedenis (revision 1881847) Gewone jaar (revision 1618048) Gregoriaanse kalender (revision 1784182) Hierdie dag in die geskiedenis (revision 1805537) Hindoekalender (revision 1882190) Indiese kalender (revision 1619125) Irannese kalender (revision 1120053) Islamitiese kalender (revision 1866795) Joodse kalender (revision 1950690) == End of Parsed pages == - Wikipedia parsing ended at: 2019-03-05 22:07:18.720938 53 characters appeared 821166 times. First 50 characters: [ 0] Char e: 17.6384555619692 % [ 1] Char i: 8.750605845833851 % [ 2] Char n: 8.378330325415325 % [ 3] Char a: 8.181536985213707 % [ 4] Char s: 6.845875255429474 % [ 5] Char r: 6.67185441189723 % [ 6] Char o: 5.801384860064834 % [ 7] Char t: 5.707372200018023 % [ 8] Char d: 5.647335617889683 % [ 9] Char l: 4.071284003477981 % [10] Char g: 3.3341614241213104 % [11] Char k: 3.1217804926165966 % [12] Char v: 2.253990058039422 % [13] Char u: 2.214168633382288 % [14] Char m: 2.17848766266504 % [15] Char w: 1.7287612979592433 % [16] Char b: 1.5950489913123533 % [17] Char p: 1.5948054351982426 % [18] Char h: 1.476193607626229 % [19] Char y: 0.8480623893341908 % [20] Char f: 0.8352756933433678 % [21] Char c: 0.3411003378123303 % [22] Char j: 0.29957402035642 % [23] Char ë: 0.16768838456536192 % [24] Char ê: 0.0817130762842105 % [25] Char z: 0.07367572451855045 % [26] Char é: 0.05212100841973487 % [27] Char x: 0.026060504209867434 % [28] Char á: 0.02581694809575652 % [29] Char q: 0.018510264672429205 % [30] Char ï: 0.009864022621491879 % [31] Char ó: 0.00596712479571731 % [32] Char š: 0.0038968978257745692 % [33] Char ô: 0.003409785597552748 % [34] Char ü: 0.0026791172552200165 % [35] Char è: 0.00207022696994274 % [36] Char ø: 0.0018266708558318295 % [37] Char ž: 0.0014613366846654636 % [38] Char í: 0.001217780570554553 % [39] Char ç: 0.001217780570554553 % [40] Char ö: 0.0010960025134990976 % [41] Char ò: 0.0007306683423327318 % [42] Char æ: 0.0006088902852772765 % [43] Char ä: 0.0006088902852772765 % [44] Char ã: 0.00048711222822182116 % [45] Char â: 0.0003653341711663659 % [46] Char ß: 0.0003653341711663659 % [47] Char û: 0.00024355611411091058 % [48] Char à: 0.00024355611411091058 % [49] Char î: 0.00024355611411091058 % The first 50 characters have an accumulated ratio of 0.9999963466582882. 825 sequences found. First 512 (typical positive ratio): 0.9986034713711631 Next 512 (512-1024): 1.217780570554553e-06 Rest: -1.1709383462843448e-17 - Processing end: 2019-03-05 22:07:18.831493 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangArabicModel.log ================================================ = Logs of language model for Arabic (ar) = - Generated by BuildLangModel.py - Started: 2015-12-13 18:31:12.817808 - Maximum depth: 2 - Max number of pages: 50 == Parsed pages == الصفحة_الرئيسية (revision 17217037) 11 ديسمبر (revision 17699159) 12 ديسمبر (revision 17710194) 13 ديسمبر (revision 17722318) 1437 هـ (revision 17278274) 14 ديسمبر (revision 17432010) 15 ديسمبر (revision 17206233) 1645 (revision 17168144) 1954 (revision 17409780) 1955 (revision 16826533) 1972 (revision 17004868) 1988 (revision 17671285) 2003 (revision 17656994) 2011 (revision 17589601) 2015 (revision 17678287) 216 ق.م (revision 17586752) 25 يناير (revision 17325864) 2 ربيع الأول (revision 17722146) 6 (عدد) (revision 16972178) آريز (revision 17466671) آلهة اليونان (revision 17722617) أثينا (revision 17642941) أثينا (ميثولوجيا) (revision 17662932) أزمة المهاجرين إلى أوروبا (revision 17718437) أوروبا (revision 17713457) إس سي إي سانتا مونيكا ستوديو (revision 17035439) إسبارطة (revision 16733170) إسماعيل الصفوي (revision 17194218) إله الحرب (لعبة فيديو) (revision 17630201) إمارة دبي (revision 17602037) إيطاليا (revision 17586853) اتفاق باريس (revision 17718086) الأزمة الليبية (revision 17630232) الإمارات العربية المتحدة (revision 17722077) الإنتخابات البلدية السعودية 2015 (revision 17722004) الاتحاد الأوروبي لكرة القدم (revision 17596822) الاحتجاجات اللبنانية 2015 (revision 17315127) الانتفاضة الفلسطينية (2015) (revision 17710414) التمرد العراقي (revision 17708640) الجمعية العامة للأمم المتحدة (revision 17304227) الجمهورية الرومانية (revision 16472557) الجيش اللبناني (revision 17516533) الحرب الأهلية السورية (revision 17675300) الحرب الأهلية اليمنية (2015) (revision 17686236) الحرب في شمال غرب باكستان (revision 17490838) الدولة الصفوية (revision 17031046) الرياض (revision 17580586) السعودية (revision 17711339) السلطة الوطنية الفلسطينية (revision 17438123) العراق (revision 17704602) العلاقات الخارجية في تركيا (revision 17647409) == End of Parsed pages == - Wikipedia parsing ended at: 2015-12-13 18:33:58.846891 95 characters appeared 727795 times. First 64 characters: [ 0] Char ا: 14.933875610577156 % [ 1] Char ل: 11.460782225764122 % [ 2] Char ي: 8.30302489025069 % [ 3] Char م: 6.3702003998378665 % [ 4] Char و: 5.952637762007158 % [ 5] Char ر: 4.9419135883043985 % [ 6] Char ن: 4.900967992360486 % [ 7] Char ت: 4.229625100474721 % [ 8] Char ة: 3.6022506337636284 % [ 9] Char ب: 3.5434428650925054 % [10] Char ع: 3.3116468236247845 % [11] Char د: 3.1756195082406444 % [12] Char س: 2.5401383631379715 % [13] Char ف: 2.3899587109007343 % [14] Char ق: 2.010868445097864 % [15] Char أ: 1.8763525443291036 % [16] Char ه: 1.8663222473361318 % [17] Char ك: 1.8573911609725264 % [18] Char ح: 1.8431014227907585 % [19] Char ج: 1.3270220323030524 % [20] Char ط: 1.0305099650313618 % [21] Char ش: 0.9638703206260004 % [22] Char إ: 0.8946200509758929 % [23] Char ص: 0.8509264284585631 % [24] Char ى: 0.7726076711161797 % [25] Char خ: 0.717097534333157 % [26] Char ز: 0.6687322666410184 % [27] Char ث: 0.6549921337739336 % [28] Char ض: 0.5409490309771295 % [29] Char غ: 0.4574090231452538 % [30] Char ذ: 0.44765352880962356 % [31] Char ئ: 0.39269299734128427 % [32] Char ء: 0.295138053984982 % [33] Char ظ: 0.2397653185306302 % [34] Char آ: 0.12324899181775088 % [35] Char ؤ: 0.08491402111858422 % [36] Char ـ: 0.047678261048784344 % [37] Char a: 0.03311372020967443 % [38] Char e: 0.029403884335561525 % [39] Char i: 0.027205463076827956 % [40] Char o: 0.02432003517474014 % [41] Char t: 0.02349562720271505 % [42] Char r: 0.02294602188803166 % [43] Char n: 0.020472797971956388 % [44] Char s: 0.01799957405588112 % [45] Char l: 0.012915724895059736 % [46] Char h: 0.011816514265692949 % [47] Char d: 0.011129507622338709 % [48] Char پ: 0.010717303636326163 % [49] Char c: 0.009480691678288529 % [50] Char u: 0.007969277062909199 % [51] Char m: 0.007694474405567502 % [52] Char A: 0.006870066433542411 % [53] Char گ: 0.006595263776200715 % [54] Char f: 0.006183059790188171 % [55] Char S: 0.005770855804175626 % [56] Char y: 0.0054960531468339294 % [57] Char T: 0.0049464478321505365 % [58] Char b: 0.0048090465034796885 % [59] Char G: 0.0046716451748088405 % [60] Char I: 0.004396842517467144 % [61] Char C: 0.0042594411887962955 % [62] Char p: 0.0039846385314545995 % [63] Char k: 0.003709835874112903 % The first 64 characters have an accumulated ratio of 0.999523217389512. 1479 sequences found. First 512 (typical positive ratio): 0.9696025116913417 Next 512 (512-1024): 1.3740132867084825e-06 Rest: 0.0012305764497782395 - Processing end: 2015-12-13 18:33:59.193909 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangBelarusianModel.log ================================================ = Logs of language model for Belarusian (be) = - Generated by BuildLangModel.py - Started: 2019-03-05 18:30:17.964464 - Maximum depth: 4 - Max number of pages: 100 == Parsed pages == Галоўная_старонка (revision 3314810) 1386 (revision 3318522) 1812 (revision 3317760) 1837 (revision 3317732) 1925 (revision 3316369) 1956 (revision 3316332) 1959 (revision 3316329) 2019 (revision 3333637) 4 сакавіка (revision 1761191) Helaeomyia petrolei (revision 3312800) TUT.BY (revision 3189969) XX стагоддзе (revision 3006438) Іван Пятровіч Паўлаў (revision 3330827) Інструкцыя па транслітарацыі (revision 3285076) Антрапалогія (revision 3095342) Асфальт (revision 2594585) Аэрапорт Віцебск (revision 3106296) Аўстрыя (revision 3306502) Баравуха (revision 3332684) Беларуская Вікіпедыя (revision 3330925) Беларуская мова (revision 3321859) Беларусь (revision 3320908) Беласток (revision 3082237) Вялікае княства Літоўскае (revision 3259013) Вікіпедыя (revision 3333246) Віцебск (revision 3328544) Віцебская вобласць (revision 3328232) Віцебскі раён (revision 3238295) Віцьба (revision 3194807) Горад (revision 2627422) Гравітацыя (альбом) (revision 3333104) Давыд Львовіч Глінскі (revision 3326607) Еўрапейскі маршрут E95 (revision 2686641) Жарэс Іванавіч Алфёраў (revision 3332006) Заходняя Дзвіна (revision 3169818) Знакі паштовай аплаты Украіны (1999) (revision 3225969) Зігмунд Фрэйд (revision 3200632) КА Піянер-4 (revision 2394843) Лучоса (revision 3251826) Лявон Вольскі (revision 3333010) Літаратура (revision 1786497) Магістраль М3 (revision 3116154) Магістраль М8 (revision 3107563) Манстэра прывабная (revision 3332338) Масква (revision 3227608) Мастацтва (revision 3294147) Медыцына (revision 1782135) Месяц, спадарожнік Зямлі (revision 3186245) Мінск (revision 3229030) Наваполацк (revision 3260791) Нафта (revision 3327706) Неўралогія (revision 3193067) Нобелеўская прэмія па фізіцы (revision 3052696) Ніва (1956) (revision 3315439) Орша (revision 3248596) Пагранічны канфлікт паміж Індыяй і Пакістанам (2019) (revision 3333643) Панядзелак (revision 1526755) Полацк (revision 3329956) Поль Марыа (revision 3281894) Порт (revision 2674776) Псіхааналіз (revision 3260302) Псіхааналітык (revision 3260302) Псіхалогія (revision 2232890) Псіхіятрыя (revision 1919915) Расія (revision 3239593) Рэч Паспалітая (revision 3266116) Санкт-Пецярбург (revision 2857455) Сацыялогія (revision 3130424) Славенская Вікіпедыя (revision 2760315) Справа БелТА (revision 3333271) Суперкубак Беларусі па футболе 2019 (revision 3333334) Сыраежка шэрая (revision 3332345) Універсальны каардынаваны час (revision 2713688) ФК БАТЭ (revision 3333087) ФК Дынама Брэст (revision 3332229) Футбол (revision 3161765) Чыкага (revision 3312149) Энцыклапедыя (revision 3048519) Ягайла (revision 3248985) Яўхім Храптовіч (revision 3008180) 12 сакавіка (revision 3110377) 1345 (revision 3318571) 1360-я (revision 2963824) 1370-я (revision 3318540) 1380-я (revision 3066609) 1383 (revision 3318525) 1384 (revision 3318524) 1385 (revision 3318523) 1387 (revision 3318521) 1388 (revision 3318520) 1389 (revision 3318519) 1390-я (revision 3318516) 1400-я (revision 3005229) 1428 (revision 3318470) 1456 (revision 3318437) 23.10 (revision 2463644) 24 лютага (revision 3100846) 24 чэрвеня (revision 2866534) == End of Parsed pages == - Wikipedia parsing ended at: 2019-03-05 18:36:38.571630 64 characters appeared 650592 times. First 61 characters: [ 0] Char а: 15.592106881117504 % [ 1] Char н: 6.625350450051645 % [ 2] Char і: 5.712796960306921 % [ 3] Char р: 5.026345236338596 % [ 4] Char с: 4.852196153656977 % [ 5] Char ы: 4.281024051940387 % [ 6] Char к: 4.109795386355811 % [ 7] Char л: 4.034633072647681 % [ 8] Char е: 3.7853216762579316 % [ 9] Char т: 3.5224841375239784 % [10] Char я: 3.404437804338203 % [11] Char д: 3.239664797599725 % [12] Char о: 3.2385888544587087 % [13] Char в: 3.172802616693719 % [14] Char м: 2.900435295853623 % [15] Char у: 2.899205646549604 % [16] Char п: 2.7653275785745906 % [17] Char з: 2.334028085190104 % [18] Char ц: 2.276849392553244 % [19] Char г: 2.130521125375043 % [20] Char ў: 2.0449067925827555 % [21] Char б: 1.5492044169003 % [22] Char ч: 1.3281749545029757 % [23] Char э: 1.3109598642467168 % [24] Char й: 1.2388716737986325 % [25] Char х: 1.0653374157690227 % [26] Char ь: 1.0553465151738723 % [27] Char ш: 0.8255558014854164 % [28] Char ж: 0.5312084993359893 % [29] Char ю: 0.4706482711130786 % [30] Char ф: 0.4598888397029167 % [31] Char i: 0.2782081550341842 % [32] Char ё: 0.27574885642614727 % [33] Char и: 0.14233190694014067 % [34] Char e: 0.13833554670208056 % [35] Char a: 0.13664477890905513 % [36] Char s: 0.111436968176676 % [37] Char o: 0.10344424770055581 % [38] Char n: 0.10298312921154887 % [39] Char t: 0.09744970734346564 % [40] Char r: 0.09714229501746102 % [41] Char x: 0.07516231370813044 % [42] Char l: 0.07485490138212582 % [43] Char u: 0.0667084747430033 % [44] Char c: 0.06363435148295707 % [45] Char v: 0.053336038561802177 % [46] Char m: 0.04857114750873051 % [47] Char d: 0.04764891053071664 % [48] Char b: 0.04518961192267965 % [49] Char p: 0.041808076336628794 % [50] Char k: 0.033815355860508586 % [51] Char g: 0.03243200039348778 % [52] Char w: 0.031202351089469286 % [53] Char y: 0.0301264079484531 % [54] Char h: 0.029511583296443857 % [55] Char z: 0.020750332005312084 % [56] Char f: 0.018905858049284345 % [57] Char j: 0.010605725247159511 % [58] Char ъ: 0.002305592445034676 % [59] Char щ: 0.0019981801190300527 % [60] Char q: 0.001844473956027741 % The first 61 characters have an accumulated ratio of 0.9999815552604403. 1419 sequences found. First 512 (typical positive ratio): 0.9748335015136226 Next 512 (512-1024): 0.03404437804338203 Rest: 0.0015613246491147821 - Processing end: 2019-03-05 18:36:38.805955 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangCroatianModel.log ================================================ = Logs of language model for Croatian (hr) = - Generated by BuildLangModel.py - Started: 2016-09-25 23:41:35.999066 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Fizika čvrstog stanja (revision 4776646) Agregatno stanje (revision 4663090) Alnico (revision 3915185) Aluminij (revision 4772363) Amorfna tvar (revision 4659679) Antimon (revision 4420072) Antoine Henri Becquerel (revision 4634966) Apsolutna nula (revision 4706683) Arsen (revision 4540773) Arthur Holly Compton (revision 4736068) Atom (revision 4778162) Atomska jezgra (revision 4540956) Bell Labs (revision 4769518) Bor (element) (revision 4602837) Brian Josephson (revision 4403761) Cink (revision 4537854) Coulombov zakon (revision 4710338) Dijamant (revision 4625335) Dimenzija (revision 4669110) Dinastija Han (revision 4541686) Dislokacija (revision 4668021) EV (revision 4538157) Eksponencijalna funkcija (revision 4160157) Električna struja (revision 4280621) Električna vodljivost (revision 4460160) Električni izolator (revision 4649046) Električni luk (revision 4646980) Električni naboj (revision 4727496) Električni otpor (revision 4593314) Električni vodič (revision 4333008) Električno polje (revision 4705679) Elektrolit (revision 4486319) Elektromagnetsko zračenje (revision 4537368) Elektron (revision 4630705) Elektronika (revision 4090016) Elektronska konfiguracija (revision 4420620) Elektronski mikroskop (revision 4413214) Elektrotehnika (revision 4596912) Energetika (revision 4586277) Energija (revision 4719089) Fermi-Diracova statistika (revision 3934172) Feromagnetizam (revision 4760511) Fizika (revision 4769955) Fizika kondenzirane tvari (revision 4769955) Fizikalna veličina (revision 4621676) Fosfor (revision 4602427) Fotodioda (revision 3939069) Fotoelektrični učinak (revision 4704417) Foton (revision 4537522) Fotonaponski sustavi (revision 4418887) Francuski jezik (revision 4771366) Galij (revision 4537855) Genitiv (revision 4625199) Germanij (revision 4537856) Helij (revision 4747001) Henri (revision 3922500) Indij (revision 4537867) Integrirani krug (revision 4447159) Ion (revision 4549144) Ioniziranje (revision 4566703) Izolator (revision 4649046) John Bardeen (revision 4403736) Kadmij (revision 3921860) Kelvin (revision 4624351) Keramika (revision 4599177) Kinetička energija (revision 4719090) Klasična mehanika (revision 4637127) Kompas (revision 4702880) Kondenzacija (revision 4477825) Kondenzirana tvar (revision 4776646) Konstrukcija (revision 4680450) Kovalentna veza (revision 4641419) Kristal (revision 4720329) Kristalna rešetka (revision 4479184) Kristalografija (revision 4105956) Krutine (revision 4625162) Kubični kristalni sustav (revision 4344344) Kubični metar (revision 4616551) Kvantna mehanika (revision 4541215) Latinski jezik (revision 4760544) Luminiscencija (revision 4708222) Magnet (revision 4603344) Magnetizam (revision 4760040) Magnetska permeabilnost (revision 4675996) Magnetska vodljivost (revision 4736934) Magnetski moment (revision 4410235) Magnetsko polje (revision 4678057) Materijal (revision 4669230) Mehanika (revision 4698699) Metal (revision 4671710) Metan (revision 4422418) Metar (revision 4655527) Mjerna veličina (revision 4621676) Molekula (revision 4539232) Molekule (revision 4539232) Napon (revision 4585417) Niskotemperaturna fizika (revision 4657522) Njemački jezik (revision 4731246) Optika (revision 4768098) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-25 23:50:27.589690 49 characters appeared 500582 times. First 31 characters: [ 0] Char a: 10.808019465342342 % [ 1] Char i: 10.18554402675286 % [ 2] Char e: 9.571259054460608 % [ 3] Char o: 8.468143081453189 % [ 4] Char n: 6.952906816465634 % [ 5] Char t: 5.369549843981606 % [ 6] Char r: 5.331993559496746 % [ 7] Char j: 5.102860270644969 % [ 8] Char s: 4.717109284792501 % [ 9] Char k: 4.013927788054705 % [10] Char l: 3.854713113935379 % [11] Char u: 3.786792173909569 % [12] Char m: 3.730058212240951 % [13] Char v: 3.0989927724129114 % [14] Char p: 2.67308852495695 % [15] Char d: 2.6135578186990345 % [16] Char z: 1.8931963194841206 % [17] Char g: 1.5665765049482403 % [18] Char č: 1.161048539500022 % [19] Char b: 1.1440683044935693 % [20] Char c: 1.007627122029957 % [21] Char h: 0.8006680224219008 % [22] Char f: 0.5159993767254915 % [23] Char š: 0.422907735395999 % [24] Char ž: 0.3611795869607777 % [25] Char ć: 0.34959307366225717 % [26] Char đ: 0.2195444502598975 % [27] Char y: 0.11306838839590717 % [28] Char w: 0.07291512679241363 % [29] Char x: 0.04534721584076135 % [30] Char q: 0.02477116636235422 % The first 31 characters have an accumulated ratio of 0.9997702674087363. 712 sequences found. First 512 (typical positive ratio): 0.9989731099787131 Next 512 (512-1024): 1.9976747066414694e-06 Rest: 3.7513395167998453e-17 - Processing end: 2016-09-25 23:50:27.987029 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangCzechModel.log ================================================ = Logs of language model for Czech (cs) = - Generated by BuildLangModel.py - Started: 2016-09-21 03:20:56.824516 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Sociální fobie (revision 13567590) Adaptace (revision 13991192) Agorafobie (revision 13013445) Alkoholismus (revision 13822064) Alprazolam (revision 14082425) Antidepresivum (revision 14113423) Asertivita (revision 14111958) Atenolol (revision 12051880) Automatické negativní myšlenky (revision 13567590) Benzodiazepin (revision 13947546) Beta-blokátory (revision 13428762) Blud (revision 13888988) Bohatství (revision 13556478) Bupropion (revision 13686045) Citaloparam (revision 13567590) Clonazepan (revision 13567590) Crohnova nemoc (revision 13745254) Deprese (psychologie) (revision 13695735) Diagnostický a statický manuál mentálních poruch (revision 13567590) Diagnostický a statistický manuál mentálních poruch (revision 13714660) Diagnóza (medicína) (revision 13052239) Dichotomické myšlení (revision 13567590) Digital object identifier (revision 14138049) Dopamin (revision 13714274) Dystymie (revision 13567267) Důkaz kruhem (revision 13190761) Elektivní mutismus (revision 9940891) Emoce (revision 14110033) Escitalopram (revision 12954987) Evoluce (revision 13951488) Expozice (psychologie) (revision 14119474) Extraverze a introverze (revision 13872996) Fluoxetin (revision 12955006) Fluvoxamin (revision 12955006) Gen (revision 13907182) Generalizovaná úzkostná porucha (revision 14006709) Halucinaci (revision 12188143) Hněv (revision 14057864) Inteligence (revision 14009781) International Standard Serial Number (revision 12869806) Interpersonální psychoterapie (revision 13567590) Iracionalita (revision 4765977) Ján Praško Pavlov (revision 14086840) Klinické testování (revision 13530979) Kognitivní omyl (revision 13107294) Kognitivní psychologie (revision 11629465) Kognitivní restrukturalizace (revision 13567360) Kognitivně behaviorální terapie (revision 13980494) Komorbidita (revision 11351714) Lymská borelióza (revision 14068446) Malé sebevědomí (revision 13567590) Medical Subject Headings (revision 12239331) Meditace (revision 13180783) Mentální černý filtr (revision 13567590) Mezinárodní klasifikace nemocí (revision 12531067) Michael Liebowitz (revision 13567590) Moclobemid (revision 13567590) Moritova terapie (revision 11960292) Musturbace (revision 13567590) Nervozita (revision 13847097) Noradrenalin (revision 14054165) Obsedantně kompulzivní porucha (revision 13950365) Panická ataka (revision 13253537) Panická porucha (revision 13253537) Paranoia (revision 14027052) Paroxetin (revision 12955006) Pohlavnost (revision 13564689) Porucha (revision 11039108) Pravděpodobnost (revision 13596041) Predestinace (revision 12467403) Profese (revision 13975485) Propanolol (revision 12972658) Psychiatr (revision 12767960) Psychické trauma (revision 11227535) Psychoaktivní droga (revision 13939232) Psychodynamická léčba (revision 13567590) Psychofarmaka (revision 9928215) Psycholog (revision 12358728) Psychoterapie (revision 13874178) Puberta (revision 12540014) RIMA (revision 10234728) Remise (revision 9896748) Richard Heimberg (revision 13567590) Rámování myšlenek (revision 13567590) Schizofrenie (revision 13977456) Sebevražda (revision 14053884) Selektivní abstrakce (revision 13567590) Selektivní inhibitor zpětného vychytávání serotoninu (revision 12955027) Serotonin (revision 13975104) Sertralin (revision 12955006) Skupinová terapie (revision 11964235) Sociální chování (revision 13507313) Sociální dovednost (revision 12226347) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-21 03:28:11.731386 47 characters appeared 594800 times. First 41 characters: [ 0] Char o: 8.323806321452588 % [ 1] Char e: 8.040013449899126 % [ 2] Char n: 6.895595158036315 % [ 3] Char a: 6.263113651647613 % [ 4] Char i: 5.650470746469401 % [ 5] Char t: 5.40383322125084 % [ 6] Char s: 4.588937457969065 % [ 7] Char v: 3.8685272360457295 % [ 8] Char p: 3.6914929388029587 % [ 9] Char r: 3.6302958977807664 % [10] Char l: 3.6017148621385338 % [11] Char í: 3.5733019502353733 % [12] Char k: 3.301950235373235 % [13] Char u: 3.1782111634162744 % [14] Char c: 3.1383658372562206 % [15] Char d: 3.120208473436449 % [16] Char m: 2.758406186953598 % [17] Char h: 2.2747141896435776 % [18] Char á: 2.156186953597848 % [19] Char z: 2.0260591795561536 % [20] Char y: 1.9894082044384667 % [21] Char j: 1.8979488903833224 % [22] Char b: 1.8189307330195021 % [23] Char ě: 1.277236045729657 % [24] Char é: 1.2291526563550772 % [25] Char č: 0.9502353732347008 % [26] Char ž: 0.9214862138533961 % [27] Char ř: 0.8955951580363146 % [28] Char ý: 0.7646267652992602 % [29] Char š: 0.6605581708137189 % [30] Char f: 0.6260928043039677 % [31] Char ů: 0.5016812373907196 % [32] Char g: 0.47041022192333554 % [33] Char ú: 0.19502353732347008 % [34] Char x: 0.13685272360457296 % [35] Char ň: 0.05447209145931405 % [36] Char w: 0.04488903833221251 % [37] Char ó: 0.03429724277067922 % [38] Char ť: 0.02269670477471419 % [39] Char ď: 0.012104909213180902 % [40] Char q: 0.007229320780094149 % The first 41 characters have an accumulated ratio of 0.9999613315400132. 1025 sequences found. First 512 (typical positive ratio): 0.9786035192432675 Next 512 (512-1024): 1.6812373907195695e-06 Rest: 2.0246480655940202e-06 - Processing end: 2016-09-21 03:28:12.235582 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangDanishModel.log ================================================ = Logs of language model for Danish (da) = - Generated by BuildLangModel.py - Started: 2016-02-19 17:53:58.564190 - Maximum depth: 4 - Max number of pages: 100 == Parsed pages == Forside (revision 2692411) 16. februar (revision 6877446) 17. februar (revision 8454583) 1878 (revision 8280505) 19. februar (revision 8206479) 1922 (revision 8455105) 1926 (revision 8425271) 1942 (revision 8443554) 1945 (revision 8448461) 1948 (revision 8454392) 1985 (revision 8409096) 2. verdenskrig (revision 8433181) 23. oktober (revision 6877825) 26. oktober (revision 7849938) 3C 273 (revision 8443798) A-bus (revision 8427319) Aktuelle begivenheder (revision 8440596) B-52 Stratofortress (revision 8422571) Borgerkrigen i Syrien (revision 8447763) Boutros Boutros-Ghali (revision 8453935) Brasilien (revision 8452750) Cusco (region) (revision 7693764) Danmark (revision 8451178) Danmark i Eurovision Song Contest (revision 8453514) Dansk (sprog) (revision 8455750) Dansk Melodi Grand Prix 2016 (revision 8452164) Dobbeltmordet på Peter Bangs Vej (revision 8334648) Encyklopædi (revision 8446641) Eritrea-sagen (revision 8452285) Eurovision Song Contest 2014 (revision 8445804) Eurovision Song Contest 2016 (revision 8453588) Flygtningekrisen i Europa 2015 (revision 8452286) Fonograf (revision 8177165) Formel 1 (revision 8450846) Formel 1 2016 (revision 8456463) Frederik 6. (revision 8438503) Første observation af gravitationsbølger (revision 8451269) Grammofon (revision 8375093) Guadalcanal (revision 7796248) Harper Lee (revision 8456583) Hartkorn (revision 8437552) IC4 (revision 8446402) IC4-sagen (revision 8434463) Islamisk Stat (revision 8439228) Jonathan Leunbach (revision 8452603) Juliane Marie af Braunschweig-Wolfenbüttel (revision 8437957) Kaliumklorid (revision 8452216) Kejserriget Japan (revision 8044942) Kevin Magnussen (revision 8455302) København (revision 8427847) LIGO (revision 8451266) Latinamerika (revision 7692181) Leonid Hurwicz (revision 8445727) Lighthouse X (revision 8452940) Linkoban (revision 8455879) Machu Picchu (revision 8406907) Matador (tv-serie) (revision 8454648) Middelaldercentret (revision 8449194) Nobelprisen (revision 8409809) Nykøbing Falster (revision 8452825) Nyligt afdøde (revision 8456580) Overvågning (revision 8455039) Panorama (foto) (revision 8448393) Peru (revision 8437485) Peter Lauritsen (revision 8456097) Professor (revision 8415451) Renault F1 (revision 8450843) S-bus (revision 8455589) Salomonøerne (revision 8238961) Slaget om Belgien (1940) (revision 8430013) Slaget om Guadalcanal (revision 7762887) Slaget om Henderson Field (revision 8445480) Slaget om Iwo Jima (revision 8145239) Soldiers of Love (Lighthouse X-sang) (revision 8452929) Solen (revision 8276478) Stillehavskrigen (revision 8430649) Stockholm (revision 8358042) Søslaget ved Guadalcanal (revision 7772812) Thomas Edison (revision 8282441) Togulykken ved Bad Aibling (revision 8455364) Topografi (revision 6886168) USA (revision 8448088) United States Army (revision 8401635) United States Marine Corps (revision 8401667) Vestallierede (revision 6961443) Wikimedia (revision 8263252) Wikipedia (revision 8267051) Zikavirus (revision 8454832) 1. februar (revision 8404985) 10. februar (revision 6877431) 11. februar (revision 6877433) 12. februar (revision 6877437) 13. februar (revision 6877438) 14. februar (revision 6877441) 1497 (revision 7369489) 15. februar (revision 7329463) 1560 (revision 7874693) 1568 (revision 7369703) 1620 (revision 7423903) 1688 (revision 7367090) 18. februar (revision 6877450) == End of Parsed pages == - Wikipedia parsing ended at: 2016-02-19 17:56:42.162636 53 characters appeared 1301488 times. First 30 characters: [ 0] Char e: 15.272749345364689 % [ 1] Char r: 8.48482659847805 % [ 2] Char n: 7.695652975670924 % [ 3] Char t: 6.977014002434137 % [ 4] Char a: 6.780469739252302 % [ 5] Char i: 6.164636170291236 % [ 6] Char s: 6.0942551909814 % [ 7] Char d: 5.953493232361728 % [ 8] Char l: 5.076650725938311 % [ 9] Char o: 4.883026197706011 % [10] Char g: 4.012253666572415 % [11] Char k: 3.232607599916403 % [12] Char m: 3.0863135119186653 % [13] Char f: 2.701600014752345 % [14] Char v: 2.13970470722742 % [15] Char b: 1.982423195603801 % [16] Char u: 1.8339777239590376 % [17] Char p: 1.5789619266562582 % [18] Char h: 1.3433085821767086 % [19] Char ø: 0.8730775850411222 % [20] Char y: 0.859938777768216 % [21] Char å: 0.7699648402443973 % [22] Char æ: 0.7208671920140639 % [23] Char j: 0.644108896893402 % [24] Char c: 0.5698093259407694 % [25] Char w: 0.11087309295206717 % [26] Char z: 0.05309307500338075 % [27] Char x: 0.032424424965885205 % [28] Char é: 0.032193919575132464 % [29] Char q: 0.012139950579644223 % The first 30 characters have an accumulated ratio of 0.9997241618823994. 964 sequences found. First 512 (typical positive ratio): 0.9968082796759031 Next 512 (512-1024): 7.68351302509128e-07 Rest: 3.903127820947816e-17 - Processing end: 2016-02-19 17:56:42.304278 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangEsperantoModel.log ================================================ = Logs of language model for Esperanto (eo) = - Generated by BuildLangModel.py - Started: 2015-12-04 01:22:51.466573 - Maximum depth: 3 - Max number of pages: 50 == Parsed pages == Vikipedio:Ĉefpaĝo (revision 5524911) 10-a de novembro (revision 5792999) 12-a de novembro (revision 5793854) 13-a de novembro (revision 5795088) 18-a de novembro (revision 5796972) 2-a de novembro (revision 5772615) 20-a de novembro (revision 5799664) 2015 (revision 5791963) 22-a de novembro (revision 5799355) 24-a de novembro (revision 5800563) 4-a de decembro (revision 5806422) 4-a de novembro (revision 5789811) 5-a de novembro (revision 5789774) 6-a de novembro (revision 5790336) 7-a de novembro (revision 5791066) 8-a de novembro (revision 5791337) 9-a de novembro (revision 5791916) A Night at the Opera (Queen) (revision 5184272) Abdelhamid Abaaoud (revision 5800134) André Glucksmann (revision 5792591) Anglio (revision 5693468) Argentino (revision 5804665) Atencoj de novembro 2015 en Parizo (revision 5800135) Aung San Suu Kyi (revision 5791362) Austin FX4 (revision 5583207) Azilo (revision 5751210) Aŭstrio (revision 5804014) Bahio (revision 5773065) Bamako (revision 5798202) Bataclan (revision 5795605) Bejruto (revision 5774306) Birmo (revision 5790386) Blonda (revision 5441229) Bohemian rhapsody (revision 5654078) Cayetano Redondo (revision 5591025) Ciro la 2-a (revision 5774667) DJ Abdel (revision 5628860) Daniela Mercury (revision 5764721) Decembro de 2015 (revision 5626904) Dilatkoeficiento (revision 5806460) Eksproprietigo (revision 5586845) Elektroniko (revision 5788966) Elle s'appelait Sarah (filmo) (revision 5475154) Esperanto (revision 5804190) Federaciero (revision 5696168) Fondaĵo Vikimedio (revision 5772681) Francio (revision 5759775) François Hollande (revision 5627721) == End of Parsed pages == - Wikipedia parsing ended at: 2015-12-04 01:27:38.176708 56 characters appeared 342524 times. First 35 characters: [ 0] Char a: 12.557952143499435 % [ 1] Char o: 9.84719318938235 % [ 2] Char e: 9.10242785906973 % [ 3] Char i: 8.362333734278474 % [ 4] Char n: 7.6359612757062285 % [ 5] Char r: 6.630192336887342 % [ 6] Char t: 5.70821314710794 % [ 7] Char l: 5.610409781504361 % [ 8] Char s: 5.004320865107262 % [ 9] Char k: 3.8855671427403626 % [10] Char d: 3.7194473963868226 % [11] Char j: 3.28531723324497 % [12] Char u: 2.8465158645817517 % [13] Char m: 2.787833845219605 % [14] Char p: 2.6582078920017285 % [15] Char g: 1.6825098387266293 % [16] Char v: 1.4048650605505015 % [17] Char c: 1.3823848839789328 % [18] Char b: 1.1406499982482978 % [19] Char f: 1.077296773364786 % [20] Char z: 0.7342551178895493 % [21] Char h: 0.6735294461118053 % [22] Char ĝ: 0.53572888323154 % [23] Char ŭ: 0.4268314045147202 % [24] Char ĉ: 0.33545094650301877 % [25] Char y: 0.17079095187490512 % [26] Char ŝ: 0.15327393116978666 % [27] Char w: 0.1442234704721421 % [28] Char ĵ: 0.1039343228503696 % [29] Char á: 0.0814541462788009 % [30] Char ó: 0.05430276418586727 % [31] Char é: 0.053718863495696656 % [32] Char q: 0.04350060141771087 % [33] Char x: 0.040873048311943105 % [34] Char ĥ: 0.03824549520617533 % The first 35 characters have an accumulated ratio of 0.9991971365510156. 989 sequences found. First 512 (typical positive ratio): 0.9942980632768038 Next 512 (512-1024): 0.0015327393116978665 Rest: -5.0306980803327406e-17 - Processing end: 2015-12-04 01:27:38.307198 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangEstonianModel.log ================================================ = Logs of language model for Estonian (et) = - Generated by BuildLangModel.py - Started: 2016-09-26 23:45:22.351942 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Harilik pohl (revision 4248853) A-vitamiin (revision 4330862) Aasta keskmine sademete hulk (revision 4266801) Aasta keskmine õhutemperatuur (revision 3902142) Ahm (revision 4343671) Ain Raal (revision 4464651) Alalehed (revision 2892741) Alamliik (revision 3522810) Alaska (revision 4216575) Aleksander Heintalu (revision 4445156) Aleuudid (revision 4335893) Ameerika jänes (revision 4325220) Ameerika valgejänes (revision 4355263) Anneli Sihvart (revision 4211078) Arbutiin (revision 4451788) Baribal (revision 4268462) Bensoehape (revision 3810308) Binaarne nomenklatuur (revision 3970950) C-vitamiin (revision 4444353) Droog (revision 4352968) E-vitamiin (revision 4336726) Eesti (revision 4474984) Eesti Entsüklopeediakirjastus (revision 4012421) Eesti köök (revision 4314947) Ellips (revision 4272113) Emakakael (botaanika) (revision 3521516) Euraasia (revision 3710768) Fenoloogia (revision 3512905) Folaadid (revision 4266628) Fosfor (revision 4270122) Fotosüntees (revision 4380600) Fruktoos (revision 4285660) Glükoos (revision 4047315) Gneiss (revision 4333338) Graniit (revision 4435351) Gröönimaa (revision 4331557) Halljänes (revision 4051603) Haned (revision 4127680) Happeline keskkond (revision 2966453) Heilongjiang (revision 4342364) Hendrik Relve (revision 4342591) Hiina (revision 4448121) Holland (revision 4307885) Hunt (revision 4427752) Hõimkond (revision 3489569) Hüdrofiilsus (revision 4309797) Ida-Euroopa (revision 4337624) Ida-sinilind (revision 4248853) Ida-vöötorav (revision 3520679) Igihaljus (revision 3536500) Ilves (revision 4404632) Imetaja (revision 4289188) Indiaanlased (revision 4479868) Indrek Rohtmets (revision 4218674) Itaalia (revision 4404119) Jaapan (revision 4465542) Jilin (revision 3894473) Jood (revision 4025060) Juurestik (revision 3341159) Jääkaru (revision 4372399) Jõhvikas (revision 4391549) Kaalium (revision 4486067) Kaheidulehelised (revision 4031352) Kaheli õiekate (revision 3063362) Kahesuguline õis (revision 3383221) Kaitsestaatus (revision 3527096) Kajakas (revision 4456839) Kalorsus (revision 3843290) Kaltsium (revision 4339861) Kanada (revision 4434682) Kanalised (revision 3616579) Kanarbikulaadsed (revision 4318215) Kanarbikulised (revision 3534760) Karboksüülhapped (revision 3659011) Karoteen (revision 4347634) Kasvuperiood (revision 4231717) Katteseemnetaimed (revision 4176294) Kaukasus (revision 4476003) Kesk-Euroopa (revision 3580746) Kimalane (revision 4261145) Kiudained (toit) (revision 3538655) Klass (bioloogia) (revision 3489567) Kliima (revision 4160781) Korea (revision 4329396) Kroom (revision 4030460) Kroonlehed (revision 3543291) Kuusepüü (revision 4028988) Kvertsetiin (revision 4448461) Laanemets (revision 4001157) Laanepüü (revision 4475093) Laiuskraad (revision 3990366) Leesikas (revision 4420533) Lehed (revision 4471821) Leheroots (revision 3595351) Liik (bioloogia) (revision 4320981) Liiv (revision 4399494) Liivakivi (revision 4330598) Linnaeus (revision 4276836) Linnud (revision 4479668) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-26 23:47:54.476445 55 characters appeared 433559 times. First 33 characters: [ 0] Char a: 12.486881831538499 % [ 1] Char i: 10.26503889897338 % [ 2] Char e: 10.177622884082673 % [ 3] Char s: 8.710233209320991 % [ 4] Char t: 6.56634967789851 % [ 5] Char l: 6.051540851418146 % [ 6] Char u: 5.423944607308348 % [ 7] Char n: 5.131020230233947 % [ 8] Char k: 4.663033174262327 % [ 9] Char o: 4.526950195936424 % [10] Char d: 4.167368224393911 % [11] Char r: 3.6740097656835635 % [12] Char m: 3.552688330769284 % [13] Char v: 2.4700213811730354 % [14] Char p: 1.9229216784797456 % [15] Char g: 1.865259399528092 % [16] Char h: 1.8043680329551455 % [17] Char j: 1.6860450365463524 % [18] Char ä: 1.0247740215287884 % [19] Char b: 0.9255949017319443 % [20] Char õ: 0.9246723052687178 % [21] Char ü: 0.6536595941959457 % [22] Char f: 0.37342091849090897 % [23] Char c: 0.34851081398379463 % [24] Char ö: 0.24333481717597835 % [25] Char y: 0.1287022066200909 % [26] Char x: 0.06781084004714467 % [27] Char w: 0.04082489349777078 % [28] Char q: 0.020989069538401926 % [29] Char š: 0.018913227496142396 % [30] Char z: 0.017529332801302706 % [31] Char ō: 0.010379210211297655 % [32] Char ž: 0.009687262863877812 % The first 33 characters have an accumulated ratio of 0.9995410082595447. 853 sequences found. First 512 (typical positive ratio): 0.9972721312183132 Next 512 (512-1024): 9.687262863877811e-05 Rest: -5.204170427930421e-18 - Processing end: 2016-09-26 23:47:54.561846 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangFinnishModel.log ================================================ = Logs of language model for Finnish (fi) = - Generated by BuildLangModel.py - Started: 2016-09-21 18:12:24.181917 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Yhdistynyt kuningaskunta (revision 15843357) 1. toukokuuta (revision 15910178) 1700-luku (revision 15493702) 1707 (revision 15106709) 1800-luku (revision 15708929) 2014 (revision 15891601) 409 (revision 12809782) 5. marraskuuta (revision 15421719) 927 (revision 12785964) Aasia (revision 15948161) Abhasia (revision 15730328) Adolf Hitler (revision 15951829) Afrikka (revision 15934209) Agatha Christie (revision 15760740) Aikavyöhyke (revision 15800313) Ajoneuvon kansallisuustunnus (revision 15897445) Akrotiri ja Dhekelia (revision 14625383) Alamaat (revision 15913741) Alan Turing (revision 15904871) Alankomaat (revision 15936643) Albania (revision 15767604) Alec Guinness (revision 15363805) Alexander Fleming (revision 15023225) Alfred Hitchcock (revision 15892843) Alfred Tennyson (revision 15856114) Allen Jones (revision 12871703) Andorra (revision 15913862) Andrew Lloyd Webber (revision 14978349) Anglit (revision 15902350) Anguilla (revision 15854041) Anne Brontë (revision 14287992) Anthony Eden (revision 14391831) Antigua ja Barbuda (revision 15196967) Arabian Lawrence (revision 15736417) Argentiina (revision 15676474) Armenia (revision 15634470) Arthur Conan Doyle (revision 15402837) Arts and Crafts (revision 15806930) Aurinko (revision 15934252) Australia (revision 15934255) Avara luonto (revision 15815943) Azerbaidžan (revision 15946891) BBC (revision 15866026) BKT (revision 15656549) Bahama (revision 15516869) Bangladesh (revision 15883994) Bank of England (revision 14481173) Barbados (revision 15839821) Barbara Hepworth (revision 15106880) Bath (revision 15869900) Beatrix Potter (revision 15057380) Belfast (revision 15715934) Belgia (revision 15932391) Belize (revision 15665086) Ben Nevis (revision 15610196) Bengalin kieli (revision 15551820) Benjamin Britten (revision 15081615) Bermuda (revision 15632621) Bertrand Russell (revision 14631969) Bhutan (revision 15377394) Big Ben (revision 14897401) Big Brother (revision 14641391) Birmingham (revision 15855259) Black Sabbath (revision 15839917) Bosnia ja Hertsegovina (revision 15934266) Botswana (revision 15524955) Bristol (revision 15891889) Bristolin kanaali (revision 15849713) Bristolin kansainvälinen lentoasema (revision 14452870) Britannia (provinssi) (revision 14557442) Britannian avoin golfturnaus (revision 14293265) Britannian kuninkaallinen perhe (revision 15522149) Britannian talous (revision 15470242) Britannian väestö (revision 15661241) Brittein saaret (revision 15805422) Brittiläinen Antarktiksen alue (revision 15836227) Brittiläinen Intia (revision 15593126) Brittiläinen Intian valtameren alue (revision 14272903) Brittiläinen imperiumi (revision 15906600) Brittiläinen kansainyhteisö (revision 15894379) Brittiläinen keittiö (revision 13393533) Brittiläinen kulttuuri (revision 15951407) Brittiläiset Neitsytsaaret (revision 15910520) Brittiläiset merentakaiset alueet (revision 15836213) Brunei (revision 15580824) Bruttokansantuote (revision 15656549) Bulgaria (revision 15944101) Burma (revision 15627218) Cambridge (revision 14641664) Cambridgen yliopisto (revision 15493340) Canterburyn tarinoita (revision 15232140) Cardiff (revision 15840398) Caymansaaret (revision 15914575) Channel 4 (revision 15882475) Charles Babbage (revision 15203616) Charles Chaplin (revision 15674652) Charles Darwin (revision 15894085) Charles Dickens (revision 15699592) Charles Dickensin joulutarina (revision 15116247) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-21 18:15:05.189221 61 characters appeared 940364 times. First 30 characters: [ 0] Char a: 12.508773198463574 % [ 1] Char i: 10.969475649854738 % [ 2] Char n: 8.815841525196626 % [ 3] Char t: 8.80169806585535 % [ 4] Char e: 7.8206949649284745 % [ 5] Char s: 7.595782058862313 % [ 6] Char l: 5.963541777439374 % [ 7] Char o: 5.439808414613916 % [ 8] Char u: 5.0102938861972595 % [ 9] Char k: 4.589712068943515 % [10] Char r: 3.1231523112326713 % [11] Char ä: 3.041800834570443 % [12] Char m: 3.0392486313810396 % [13] Char v: 2.156292669647073 % [14] Char h: 1.996141919512019 % [15] Char j: 1.9248929138078446 % [16] Char p: 1.6324529650220552 % [17] Char y: 1.6323466232224966 % [18] Char d: 1.1981530556252684 % [19] Char b: 0.6835650875618378 % [20] Char g: 0.5793501239945382 % [21] Char c: 0.5056552569005194 % [22] Char ö: 0.38931732818355447 % [23] Char f: 0.215023118707224 % [24] Char w: 0.2106631049253268 % [25] Char z: 0.06593191572625068 % [26] Char x: 0.024458613898447838 % [27] Char š: 0.010421496356729947 % [28] Char ž: 0.007869293167326695 % [29] Char q: 0.007762951367768225 % The first 30 characters have an accumulated ratio of 0.9996012182516557. 919 sequences found. First 512 (typical positive ratio): 0.9985378147555799 Next 512 (512-1024): 1.0634179955846884e-06 Rest: 3.881443777498106e-17 - Processing end: 2016-09-21 18:15:05.307164 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangFrenchModel.log ================================================ = Logs of language model for French (fr) = - Generated by BuildLangModel.py - Started: 2015-12-03 21:07:37.508739 - Maximum depth: 2 - Max number of pages: 50 == Parsed pages == Wikipédia:Accueil_principal (revision 115957655) Bœuf (animal) (revision 115500130) 1500 av. J.-C. (revision 110583603) 1898 dans les chemins de fer (revision 106801806) 1913 dans les chemins de fer (revision 112852042) 1974 dans les chemins de fer (revision 90170756) 1er décembre (revision 121012781) 2009 dans les chemins de fer (revision 107042206) 2011 dans les chemins de fer (revision 109560866) 24 novembre (revision 120782024) 26 novembre (revision 120833172) 29 novembre (revision 120918160) 2 décembre (revision 121025437) 30 novembre (revision 120947714) 3 décembre (revision 121030621) Amphibien (revision 120332329) Angleterre (revision 120784240) Anne-Josèphe Théroigne de Méricourt (revision 121009789) Années 1930 (revision 120558236) Antonio Troyo Calderón (revision 121028881) António Costa (revision 120993829) Attentat du 24 novembre 2015 à Tunis (revision 121015161) Balard (métro de Paris) (revision 118979088) Bois de Vincennes (revision 120822909) Buse à tête blanche (revision 121009499) Californie (revision 120922479) Charenton-le-Pont (revision 120210025) Charenton - Écoles (métro de Paris) (revision 108644873) Chronique médiévale (revision 100253272) Concorde (métro de Paris) (revision 120856751) Conférence de Paris de 2015 sur le climat (revision 121029398) Crise de la dette publique grecque (revision 120905208) Crise entre la Colombie et le Venezuela de 2015 (revision 120857143) Crise migratoire en Europe (revision 121002308) Crise russo-turque de 2015 (revision 121030214) Créteil (revision 120684618) Créteil - Préfecture (métro de Paris) (revision 113486387) Deuxième guerre civile libyenne (revision 121027704) Devise (monnaie) (revision 121015771) Droits de tirage spéciaux (revision 121009135) Décembre 2015 (revision 121010045) Département français (revision 120993190) Eldar Riazanov (revision 120996396) Enfants verts de Woolpit (revision 121002303) Ernst Larsen (revision 121026772) Fatima Mernissi (revision 120992271) Fejervarya cancrivora (revision 120353807) Fonds monétaire international (revision 120754406) Français (revision 120883858) Freyja (revision 121028677) Fusillade du 2 décembre 2015 en Californie (revision 121030353) == End of Parsed pages == - Wikipedia parsing ended at: 2015-12-03 21:10:27.682316 56 characters appeared 728239 times. First 38 characters: [ 0] Char e: 14.339660468609894 % [ 1] Char s: 7.954806045817375 % [ 2] Char a: 7.864176458552756 % [ 3] Char n: 7.572102015959047 % [ 4] Char i: 7.34154583866011 % [ 5] Char r: 7.020222756540091 % [ 6] Char t: 6.833608197308851 % [ 7] Char l: 5.9446143367768 % [ 8] Char o: 5.386418469760614 % [ 9] Char u: 5.024861343597363 % [10] Char d: 4.169235649285468 % [11] Char c: 3.4240132703686568 % [12] Char p: 2.8882001650557028 % [13] Char m: 2.803063280049544 % [14] Char é: 2.498355622261373 % [15] Char g: 1.277739862874688 % [16] Char v: 1.1729665672945284 % [17] Char f: 1.1614318925517584 % [18] Char b: 0.9925312981040565 % [19] Char h: 0.8580974103282026 % [20] Char q: 0.7740590657737364 % [21] Char x: 0.43570860665248634 % [22] Char y: 0.41044217626356183 % [23] Char è: 0.4100302235941771 % [24] Char à: 0.363479571953713 % [25] Char j: 0.29591933417463223 % [26] Char k: 0.1359443808969308 % [27] Char ç: 0.11685724054877589 % [28] Char ê: 0.11218844362908331 % [29] Char z: 0.10738232915292918 % [30] Char w: 0.08239053387692777 % [31] Char ô: 0.04792382720507965 % [32] Char â: 0.03364280133307884 % [33] Char î: 0.029385957082770905 % [34] Char û: 0.024854477719539875 % [35] Char œ: 0.021146903695078125 % [36] Char ï: 0.017851282340001016 % [37] Char ù: 0.015242248767231636 % The first 38 characters have an accumulated ratio of 0.999621003544166. 914 sequences found. First 512 (typical positive ratio): 0.997057879992383 Next 512 (512-1024): 1.3731755646154627e-06 Rest: 3.8163916471489756e-17 - Processing end: 2015-12-03 21:10:27.987730 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangGermanModel.log ================================================ = Logs of language model for German (de) = - Generated by BuildLangModel.py - Started: 2015-12-03 22:42:29.154759 - Maximum depth: 3 - Max number of pages: 100 == Parsed pages == Wikipedia:Hauptseite (revision 140459035) 1740 (revision 145584733) 1890 (revision 148575121) 1925 (revision 148682812) 1965 (revision 148411693) 3. Dezember (revision 148684818) Bundeswehreinsatz in Syrien (revision 148714599) Clara Klabunde (revision 148697193) Day Tripper (revision 145956669) Dezember 2015 (revision 148713161) Edwar al-Charrat (revision 148656295) Enzyklika (revision 148704406) Enzyklopädie (revision 148364925) Facebook Inc. (revision 148280344) Franz Neubauer (CSU) (revision 148710968) Freie Inhalte (revision 148123311) Gabriele Ferzetti (revision 148715582) Georg von Waldburg zu Zeil und Trauchburg (revision 148710609) Jim Loscutoff (revision 148690370) Katarina Witt (revision 148713884) Klavierkonzert (Gershwin) (revision 143900338) Ludolf Camphausen (revision 145088962) Mark Zuckerberg (revision 148714452) Montenegro (revision 148692773) NATO (revision 148697872) NATO-Osterweiterung (revision 148697354) Nekrolog 2015 (revision 148711617) Peter-Ulrich-Haus (revision 148654149) Philanthropie (revision 145561255) Präsidentschaftswahl in Burkina Faso 2015 (revision 148677453) Québec (Stadt) (revision 148716893) Rivka Zohar (revision 148708850) Roch Marc Kaboré (revision 148673951) Rubber Soul (revision 148665720) Salve Regina (Latry) (revision 148713279) Schießerei in San Bernardino (revision 148711974) Single (Musik) (revision 146450210) The Giving Pledge (revision 148711856) Ubi primum (Benedikt XIV.) (revision 136691297) VTech (revision 148704025) Walter Damrosch (revision 148716127) We Can Work It Out (revision 148706519) 1. August (revision 148089156) 1. Januar (revision 148659041) 1. Juni (revision 148375663) 1. November (revision 147888516) 10. August (revision 148079904) 10. November (revision 148658709) 10. September (revision 148201788) 11. August (revision 148315737) 11. Oktober (revision 148087353) 12. Januar (revision 147377586) 12. September (revision 148359994) 13. Dezember (revision 148614781) 13. September (revision 148320520) 14. August (revision 148513270) 14. Dezember (revision 147968142) 15. April (revision 146544147) 15. August (revision 147827975) 16. April (revision 148712866) 16. Dezember (revision 148392316) 16. Februar (revision 148221712) 16. Jahrhundert (revision 147390194) 16. Juli (revision 147928181) 1652 (revision 142931287) 1654 (revision 145531451) 1656 (revision 144194148) 1657 (revision 147492859) 1662 (revision 147548355) 1665 (revision 147757128) 1666 (revision 147843417) 1667 (revision 148566099) 1668 (revision 145304760) 1670 (revision 147643990) 1672 (revision 145296252) 1673 (revision 147879655) 1674 (revision 146784434) 1679 (revision 146069377) 1685 (revision 148596629) 1688 (revision 140370621) 1692 (revision 146892539) 1693 (revision 147464373) 17. August (revision 148288443) 17. Februar (revision 145814425) 17. Jahrhundert (revision 147869798) 17. Oktober (revision 148327370) 1700er (revision 127393249) 1707 (revision 148288721) 1710er (revision 134739897) 1720er (revision 127302296) 1730 (revision 148694277) 1730er (revision 127393280) 1731 (revision 147730204) 1735 (revision 145436596) 1736 (revision 145680122) 1737 (revision 146645905) 1738 (revision 145094942) 1739 (revision 147843445) 1740er (revision 127393296) 1741 (revision 146530178) 1742 (revision 147010984) == End of Parsed pages == - Wikipedia parsing ended at: 2015-12-03 22:50:46.517106 59 characters appeared 1746165 times. First 31 characters: [ 0] Char e: 14.27997926885489 % [ 1] Char r: 8.696257226550754 % [ 2] Char n: 8.464091308667852 % [ 3] Char i: 8.258784250056554 % [ 4] Char s: 6.690833913175444 % [ 5] Char a: 6.370703799469123 % [ 6] Char t: 5.925728668253001 % [ 7] Char h: 4.540979804314025 % [ 8] Char d: 4.367284878576767 % [ 9] Char l: 4.083634708060234 % [10] Char u: 3.899917819908199 % [11] Char o: 3.6450163644329145 % [12] Char c: 3.392405643223865 % [13] Char m: 2.578565026787274 % [14] Char g: 2.543631329227192 % [15] Char b: 1.9455206123132693 % [16] Char k: 1.7604292836014925 % [17] Char f: 1.6422273954637734 % [18] Char p: 1.519329502080273 % [19] Char w: 1.0273370500496803 % [20] Char z: 1.0037997554641171 % [21] Char v: 0.9010603236234834 % [22] Char ä: 0.4926224039538073 % [23] Char j: 0.4661644231787947 % [24] Char ü: 0.4094687500894818 % [25] Char y: 0.34229296773214446 % [26] Char ö: 0.3044958523392692 % [27] Char ß: 0.14477440562604335 % [28] Char x: 0.09918879372796958 % [29] Char é: 0.07633871942227682 % [30] Char q: 0.06099079983850323 % The first 31 characters have an accumulated ratio of 0.9993385504806246. 1188 sequences found. First 512 (typical positive ratio): 0.9934041448127945 Next 512 (512-1024): 1.1453671331174316e-06 Rest: 0.0001130256702826099 - Processing end: 2015-12-03 22:50:46.681265 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangGreekModel.log ================================================ = Logs of language model for Greek (el) = - Generated by BuildLangModel.py - Started: 2016-05-25 15:16:42.898905 - Maximum depth: 5 - Max number of pages: 200 == Parsed pages == Πύλη:Κύρια (revision 5511929) 14 Σεπτεμβρίου (revision 5808678) 16 Σεπτεμβρίου (revision 5810117) 1771 (revision 4940722) 1829 (revision 5863423) 1921 (revision 5819621) 1948 (revision 5785943) 1965 (revision 5846907) 1970 (revision 5816968) 1973 (revision 5423504) 25 Μαΐου (revision 5865973) Eurovision (revision 5865484) Scorpions (revision 5586116) Wiki (revision 5859059) Wikimedia (revision 5771416) Αγία Πετρούπολη (revision 5782933) Αγγλική γλώσσα (revision 5851128) Αλεξάντρ Πούσκιν (revision 5790131) Βέλος ΙΙ (Αντιτορπιλικό) (revision 5178914) Βραζιλία (revision 5857981) Γαλλική γλώσσα (revision 5851119) Γαλλική εισβολή στην Ρωσία (revision 5858523) Γενικές εκλογές στη Δομινικανή Δημοκρατία 2016 (revision 5848770) Γηραιότερο πρόσωπο στον κόσμο (revision 5852034) Διαγωνισμός Τραγουδιού Eurovision 2016 (revision 5863783) Δικτατορία των Συνταγματαρχών (revision 5864405) Δομινικανή Δημοκρατία (revision 5848627) Εγκυκλοπαίδεια (revision 5566281) Ελεύθερο περιεχόμενο (revision 5824058) Ελλάδα (revision 5863759) Ελληνική γλώσσα (revision 5790854) Ιππικό (revision 5376587) Ιταλία (revision 5781867) Κίεβο (revision 5794613) Κατάληψη του Παρισιού (1814) (revision 5729368) Κλάους Μάιν (revision 5668218) Μάχη της Λειψίας (revision 5729316) Μάχη της Σαλτάνοφκα (revision 5865460) Μάχη του Μποροντίνο (revision 5670322) Μαξ Βερστάπεν (revision 5864745) Μπλουζ (revision 5846428) Νίκος Καχτίτσης (revision 5723615) Νικολάι Νικολάεβιτς Ραέφσκι (revision 5865460) Ντίλμα Ρούσεφ (revision 5843412) Ομοσπονδιακό Σοβιέτ της Ρωσικής Αυτοκρατορίας (revision 5865460) Ουκρανία (revision 5847651) Πάτρα (revision 5800331) Ποδόσφαιρο (revision 5864952) Πριμέρα Ντιβιζιόν (revision 5846965) Ρωσική Αυτοκρατορία (revision 5858419) Ρωσική γλώσσα (revision 5818960) Ρώσοι (revision 5376764) Σουζάνα Μούσατ Τζόουνς (revision 5848866) Στοκχόλμη (revision 5670508) Στρατηγός (revision 5464718) Τζακ Στάινμπεργκερ (revision 5820361) Τζαμάλα (revision 5863755) ΦΚ Μπαρτσελόνα (revision 5862032) Φόρμουλα Ένα (revision 5809160) 10 Σεπτεμβρίου (revision 5841838) 11 Σεπτεμβρίου (revision 5796866) 12 Σεπτεμβρίου (revision 5795991) 1321 (revision 5811404) 13 Σεπτεμβρίου (revision 5830505) 1435 (revision 5600729) 1498 (revision 5831868) 1523 (revision 5863396) 1527 (revision 5579042) 1580 (revision 5742938) 15 Σεπτεμβρίου (revision 5817369) 1712 (revision 5699806) 1741 (revision 5817896) 1752 (revision 5666171) 1760 (revision 5490201) 1769 (revision 5336004) 17 Σεπτεμβρίου (revision 5843911) 1812 (revision 5703237) 1814 (revision 5751122) 1851 (revision 5854460) 1878 (revision 5863501) 1889 (revision 5795061) 1890 (revision 5705460) 1898 (revision 5863504) 18 Σεπτεμβρίου (revision 5661544) 1901 (revision 5865687) 1902 (revision 5779111) 1905 (revision 5862599) 1910 (revision 5794858) 1916 (revision 5800363) 1917 (revision 5865701) 1925 (revision 5854774) 1927 (revision 5839595) 1928 (revision 5814308) 1933 (revision 5854834) 1936 (revision 5854290) 1937 (revision 5794891) 1943 (revision 5807315) 1944 (revision 5865804) 1950 (revision 5807377) 1956 (revision 5795994) 1960 (revision 5795065) 1963 (revision 5863751) 1966 (revision 5707508) 1969 (revision 5668647) 1980 (revision 5832053) 1981 (revision 5817635) 1982 (revision 5788879) 1983 (revision 5812702) 1984 (revision 5749754) 1989 (revision 5846909) 1994 (revision 5863999) 1999 (revision 5795003) 19 Σεπτεμβρίου (revision 5850863) 1 Σεπτεμβρίου (revision 5630491) 2000 (revision 5779037) 2001 (revision 5779042) 2005 (revision 5779066) 2006 (revision 5808681) 2009 (revision 5827105) 2011 (revision 5808660) 2016 (revision 5801621) 20 Σεπτεμβρίου (revision 5808561) 21 Σεπτεμβρίου (revision 5751207) 22 Σεπτεμβρίου (revision 5807133) 23 Σεπτεμβρίου (revision 5800012) 24 Σεπτεμβρίου (revision 5662618) 258 (revision 4952368) 25 Σεπτεμβρίου (revision 5817621) 26 Σεπτεμβρίου (revision 5817637) 27 Σεπτεμβρίου (revision 5817648) 28 Σεπτεμβρίου (revision 5817677) 29 Σεπτεμβρίου (revision 5703562) 2 Σεπτεμβρίου (revision 5701639) 30 Σεπτεμβρίου (revision 5838312) 326 (revision 5818811) 3 Σεπτεμβρίου (revision 5816313) 407 (revision 4952524) 4 Σεπτεμβρίου (revision 5816970) 5 Σεπτεμβρίου (revision 5817185) 628 (revision 5398024) 680 (revision 5365010) 685 (revision 5819296) 6 Σεπτεμβρίου (revision 5765157) 775 (revision 5373211) 786 (revision 5398031) 7 Σεπτεμβρίου (revision 5749649) 81 (revision 5397958) 891 (revision 4952139) 8 Σεπτεμβρίου (revision 5788878) 9 Σεπτεμβρίου (revision 5817240) CIA (revision 5857678) Miyavi (revision 4944860) Άρμεν Κούπτσιος (revision 5766774) Έιμι Γουάινχαουζ (revision 5809279) Έρβιν Θάλμπεργκ (revision 5716376) Ίων Δραγούμης (revision 5818568) Αγία Ελένη (revision 5821916) Αλεξάντερ φον Χούμπολτ (revision 5773636) Αλμπέρτο Κόρντα (revision 5800055) Απρίλιος (revision 5766829) Αυτοκρατορία των Σασσανιδών (revision 5859880) Αύγουστος (revision 5461793) Β΄ Παγκόσμιος Πόλεμος (revision 5848530) Βέρμαχτ (revision 5212228) Βασίλης Λάσκος (revision 5695445) Βενεζουέλα (revision 5847962) Βρετανική Αυτοκρατορία (revision 5606306) Βόρεια Ελλάδα (revision 5670938) Γαλλία (revision 5776756) Γεώργιος Καρατζαφέρης (revision 5803114) Γιάννης Λάτσης (revision 5692530) Γιάννος Κρανιδιώτης (revision 5574536) Γιώργος Παπασιδέρης (μουσικός) (revision 5722203) Γκέοργκ Φρήντριχ Χαίντελ (revision 5807098) Γκρέις Κέλι (revision 5807168) Γρηγοριανό Hμερολόγιο (revision 5793842) Γρηγοριανό ημερολόγιο (revision 5793842) Γρηγόρης Λαμπράκης (revision 5752808) Δάντης Αλιγκέρι (revision 5648882) Δήμος Βιάννου (revision 4816422) Δεκέμβριος (revision 5461807) Δομιτιανός (revision 5735554) Δράμα (πόλη) (revision 5857326) Ενιαία Δημοκρατική Αριστερά (revision 5742309) Ετόρε Σότσας (revision 5785872) Ζιλ Αντριαμαχαζό (revision 5819706) Η.Π.Α. (revision 5845171) Ηράκλειος (revision 5778827) Θεσσαλονίκη (revision 5844955) Θεόδωρος Ρούζβελτ (revision 5815087) Ιανουάριος (revision 5615044) Ιερουσαλήμ (revision 5824734) Ιησούς Χριστός (revision 5859687) Ιούλιος (revision 5712711) Ιούνιος (revision 5461799) Ιράκ (revision 5820378) Ιράν (revision 5861249) Ισιδώρα Ντάνκαν (revision 5044778) Ιωάννης ο Χρυσόστομος (revision 5824898) == End of Parsed pages == - Wikipedia parsing ended at: 2016-05-25 15:21:50.071087 63 characters appeared 1875535 times. First 46 characters: [ 0] Char α: 9.004097497514042 % [ 1] Char ο: 8.311015256980008 % [ 2] Char τ: 7.94493304577094 % [ 3] Char ι: 6.338831320129989 % [ 4] Char ν: 5.836627948825269 % [ 5] Char ε: 5.635565318695733 % [ 6] Char ρ: 4.717907157157825 % [ 7] Char σ: 4.307197679595422 % [ 8] Char κ: 4.061294510632965 % [ 9] Char ς: 3.766551943845356 % [10] Char η: 3.7565281373048225 % [11] Char π: 3.4156653968067783 % [12] Char υ: 3.30956233821283 % [13] Char μ: 3.1442761665338157 % [14] Char λ: 3.0899983204792236 % [15] Char ί: 2.429973314280992 % [16] Char ό: 2.076100952528212 % [17] Char ά: 1.922651403466211 % [18] Char γ: 1.8994047031913561 % [19] Char έ: 1.6641651582081913 % [20] Char δ: 1.508582884350332 % [21] Char ω: 1.2410325587099147 % [22] Char ή: 1.2077087337746297 % [23] Char χ: 1.0482342371643292 % [24] Char ύ: 0.9225101104484854 % [25] Char β: 0.8928652357860558 % [26] Char θ: 0.8681256281541001 % [27] Char φ: 0.806756472153279 % [28] Char ώ: 0.6969211451665791 % [29] Char ζ: 0.35515199663029484 % [30] Char e: 0.35488540603081253 % [31] Char ξ: 0.314736861748781 % [32] Char a: 0.2909036621550651 % [33] Char i: 0.2884510286398281 % [34] Char o: 0.24137112877125727 % [35] Char r: 0.23262695710823847 % [36] Char n: 0.2206303801315358 % [37] Char t: 0.21668483925919804 % [38] Char s: 0.2013825388489151 % [39] Char l: 0.14865091827131993 % [40] Char d: 0.1359078876160669 % [41] Char c: 0.12124540464454144 % [42] Char h: 0.1166600463334462 % [43] Char u: 0.10381037943840024 % [44] Char m: 0.09074744006376848 % [45] Char ψ: 0.08669526295163779 % The first 46 characters have an accumulated ratio of 0.993456267145108. 1579 sequences found. First 512 (typical positive ratio): 0.958419074626211 Next 512 (512-1024): 0.006969211451665791 Rest: 0.0018920066107342773 - Processing end: 2016-05-25 15:21:50.812982 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangHungarianModel.log ================================================ = Logs of language model for Hungarian (hu) = - Generated by BuildLangModel.py - Started: 2015-12-12 18:01:21.560682 - Maximum depth: 2 - Max number of pages: 50 == Parsed pages == Kezdőlap (revision 12748721) 1722 (revision 16471860) 1780 (revision 16407861) 1800 (revision 15028835) 1831 (revision 16469576) 1848–49-es forradalom és szabadságharc (revision 16955214) 1875 (revision 16798555) 1895 (revision 16649417) 1900 (revision 16961019) 1905 (revision 16601113) 1915 (revision 16792868) 1940 (revision 16936087) 1950 (revision 16820817) 1970 (revision 16093156) 1985 (revision 16463340) 1995 (revision 16945805) 1998 (revision 16542908) 2003 (revision 16943939) 2015 (revision 16960983) 73. Golden Globe-gála (revision 16937296) Akacuki (revision 16960353) Akasztottak erdeje (regény) (revision 16918702) Alan Hodgkinson (revision 16953214) Alfred Bernhard Nobel (revision 16654409) Alkotmány (revision 16784843) André-Marie Ampère (revision 16865419) Angela Merkel (revision 16960753) Anne Baxter (revision 15572176) Az irgalmasság rendkívüli szentéve (revision 16951018) Az év embereinek listája (revision 16961722) Bencések (revision 16853524) Boeing 747–400 (revision 16947261) Chantal Szent Johanna Franciska (revision 16371923) December 12. (revision 15637986) December 13. (revision 16546152) Dinamó (revision 15949492) Dionne Warwick (revision 16522754) Elektrodinamika (revision 14888277) Elektromosság (revision 16051899) Enciklopédia (revision 16556513) Eric Maskin (revision 16907781) Európai migrációs válság (revision 16922218) Eötvös Loránd (revision 16960057) Eötvös Loránd Tudományegyetem (revision 16684410) Fellner Jakab (revision 16960223) Feltaláló (revision 13609621) Ferenc pápa (revision 16928970) Frank Sinatra (revision 16927399) François Jean Dominique Arago (revision 16197941) Gabriella (revision 16906500) == End of Parsed pages == - Wikipedia parsing ended at: 2015-12-12 18:02:46.729734 55 characters appeared 375370 times. First 32 characters: [ 0] Char e: 9.710685457015744 % [ 1] Char a: 8.803314063457389 % [ 2] Char t: 7.322375256413672 % [ 3] Char s: 6.666222660308496 % [ 4] Char l: 5.73967019207715 % [ 5] Char r: 5.4341050163838345 % [ 6] Char n: 5.39920611663159 % [ 7] Char i: 4.773689959240216 % [ 8] Char o: 4.347976663025815 % [ 9] Char k: 4.289634227562138 % [10] Char z: 4.244611982843594 % [11] Char á: 3.7855982097663636 % [12] Char m: 3.2144284306151265 % [13] Char g: 3.0727016010869277 % [14] Char é: 3.0295441830727015 % [15] Char b: 2.287609558568879 % [16] Char d: 1.9966965926952074 % [17] Char v: 1.8832085675466872 % [18] Char y: 1.8453792258305137 % [19] Char u: 1.5155713029810587 % [20] Char h: 1.2960545595012922 % [21] Char p: 1.288861656498921 % [22] Char j: 1.2363801049631031 % [23] Char c: 1.0951860830647095 % [24] Char f: 1.0256546873751233 % [25] Char ö: 1.020859418706876 % [26] Char ó: 0.9955510562911262 % [27] Char ő: 0.8399712283879905 % [28] Char í: 0.6340410794682579 % [29] Char ü: 0.4211844313610571 % [30] Char ú: 0.3295415190345526 % [31] Char ű: 0.2056637451048299 % The first 32 characters have an accumulated ratio of 0.9975117883688093. 1084 sequences found. First 512 (typical positive ratio): 0.9748272224933486 Next 512 (512-1024): 5.328076298052588e-06 Rest: 0.0001889139024889644 - Processing end: 2015-12-12 18:02:46.902033 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangIrishModel.log ================================================ = Logs of language model for Irish (ga) = - Generated by BuildLangModel.py - Started: 2016-09-27 00:31:16.489602 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Tracy Caldwell Dyson (revision 812158) 14 Lúnasa (revision 716575) 1969 (revision 810361) California (revision 790976) Ceimic (revision 759983) Ceimic fhisiciúil (revision 656896) NASA (revision 806394) Rúisis (revision 771746) SAM (revision 807668) Spáinnis (revision 812323) Stáisiún Idirnáisiúnta Spáis (revision 806394) Tointeálaí spáis (revision 761309) 10 Lúnasa (revision 649045) 11 Lúnasa (revision 776455) 12 Lúnasa (revision 716531) 13 Lúnasa (revision 716546) 1598 (revision 703178) 15 Lúnasa (revision 776986) 16 Lúnasa (revision 648836) 1740 (revision 791225) 1771 (revision 776762) 17 Lúnasa (revision 777131) 1823 (revision 791774) 1832 (revision 794492) 1898 (revision 805176) 18 Lúnasa (revision 777242) 1911 (revision 801932) 1956 (revision 797081) 1962 (revision 801511) 1966 (revision 807415) 19 Lúnasa (revision 648524) 1 Lúnasa (revision 647726) 2001 (revision 801012) 2004 (revision 795759) 2016 (revision 812091) 20 Lúnasa (revision 777924) 21 Lúnasa (revision 647805) 22 Lúnasa (revision 778960) 23 Lúnasa (revision 778453) 24 Lúnasa (revision 778495) 25 Lúnasa (revision 778551) 26 Lúnasa (revision 649051) 27 Lúnasa (revision 778763) 28 Lúnasa (revision 778813) 29 Lúnasa (revision 778959) 2 Lúnasa (revision 774393) 30 Lúnasa (revision 648308) 31 Lúnasa (revision 649053) 3 Lúnasa (revision 647811) 4 Lúnasa (revision 786284) 5 Lúnasa (revision 776845) 6 Lúnasa (revision 647834) 7 Lúnasa (revision 775859) 8 Lúnasa (revision 648745) 9 Lúnasa (revision 648522) AK Parti (revision 792248) An Phacastáin (revision 759339) An Tuirc (revision 811970) Aoine (revision 717430) Bertolt Brecht (revision 800584) Czesław Miłosz (revision 780306) Céadaoin (revision 717606) Dan Boyle (revision 797926) Domhnach (revision 717663) Déardaoin (revision 647860) Féilire (revision 648837) Halle Berry (revision 759955) Henry Bagenal (revision 716575) Iúil (revision 647071) Luan (revision 717791) Lúnasa (revision 810265) Meán Fómhair (revision 779166) Pápa Pius VII (revision 758126) Satharn (revision 784525) Walter Scott (revision 759029) Áth Buí (revision 716575) 11 Márta (revision 716519) 17 Márta (revision 798614) 1882 (revision 801198) 1886 (revision 776624) 1890 (revision 801200) 1891 (revision 796677) 1903 (revision 812849) 1922 (revision 801227) 1930í (revision 740221) 1940í (revision 740219) 1950í (revision 740217) 1960í (revision 772724) 1967 (revision 796983) 1968 (revision 810926) 1970 (revision 812852) 1970í (revision 740213) 1971 (revision 809746) 1972 (revision 789490) 1980í (revision 740211) 1990í (revision 740208) 19ú haois (revision 739964) 1 Bealtaine (revision 647679) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-27 00:33:40.157338 44 characters appeared 183561 times. First 31 characters: [ 0] Char a: 15.192769705983297 % [ 1] Char i: 10.534372769814938 % [ 2] Char n: 8.106297089250985 % [ 3] Char h: 7.243368689427493 % [ 4] Char r: 6.442544985045844 % [ 5] Char e: 6.198484427520007 % [ 6] Char s: 5.622654049607488 % [ 7] Char t: 4.776068990689743 % [ 8] Char c: 4.543448771797931 % [ 9] Char l: 4.1953356105054995 % [10] Char o: 3.9469168287381304 % [11] Char d: 3.2169142682813887 % [12] Char g: 2.811054635788648 % [13] Char m: 2.6269196615838877 % [14] Char á: 2.2749930540801153 % [15] Char u: 2.1932763495513754 % [16] Char b: 2.0478206154902185 % [17] Char í: 1.6599386579938005 % [18] Char é: 1.2829522611012143 % [19] Char f: 1.1494816437042727 % [20] Char ú: 1.0525111543301682 % [21] Char p: 0.9059658642086281 % [22] Char ó: 0.8890777452726886 % [23] Char v: 0.2522322279787101 % [24] Char y: 0.23479933101257894 % [25] Char k: 0.18195586208399386 % [26] Char w: 0.1688811893593955 % [27] Char j: 0.09697048937410452 % [28] Char z: 0.07735848028720697 % [29] Char x: 0.0343210159020707 % [30] Char q: 0.010895560603831969 % The first 31 characters have an accumulated ratio of 0.9997058198636966. 701 sequences found. First 512 (typical positive ratio): 0.9974076651249096 Next 512 (512-1024): 5.447780301915984e-06 Rest: -2.7755575615628914e-17 - Processing end: 2016-09-27 00:33:40.258886 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangItalianModel.log ================================================ = Logs of language model for Italian (it) = - Generated by BuildLangModel.py - Started: 2016-09-21 18:43:12.831409 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Pieve Ligure (revision 83186252) 010 (prefisso) (revision 76157203) 1000 (revision 83185341) 1143 (revision 70627567) 1162 (revision 70627612) 118 - Emergenza sanitaria (revision 83267411) 1201 (revision 77523243) 1202 (revision 76764411) 1374 (revision 78259457) 1404 (revision 70628069) 1520 (revision 76854924) 1537 (revision 70628296) 1582 (revision 80626188) 1584 (revision 76837051) 1600 (revision 76869356) 1619 (revision 70628455) 1742 (revision 70628675) 1748 (revision 70628682) 1749 (revision 70628684) 1750 (revision 70628690) 1754 (revision 70628697) 1775 (revision 70628734) 1797 (revision 78338823) 1798 (revision 82047236) 1803 (revision 77502534) 1805 (revision 79369853) 1809 (revision 70628789) 1810 (revision 82930218) 1814 (revision 78338825) 1815 (revision 82669615) 1816 (revision 83185384) 1818 (revision 72407239) 1823 (revision 74880156) 1859 (revision 83185401) 1860 (revision 83185403) 1861 (revision 83185412) 1868 (revision 83185430) 1874 (revision 83185441) 1897 (revision 83185267) 1908 (revision 83185631) 1909 (revision 83185630) 1913 (revision 83185626) 1915 (revision 83185625) 1917 (revision 83185270) 1920 (revision 83185621) 1921 (revision 83185619) 1923 (revision 83185616) 1925 (revision 83185614) 1926 (revision 83185612) 1928 (revision 83185610) 1929 (revision 83185609) 1939 (revision 83185598) 1946 (revision 83185590) 1947 (revision 83185589) 1948 (revision 83185587) 1951 (revision 83185584) 1956 (revision 83185478) 1960 (revision 83185487) 1964 (revision 83185493) 1965 (revision 83185494) 1969 (revision 83185500) 1970 (revision 83185503) 1971 (revision 83185505) 1975 (revision 83185510) 1976 (revision 83185513) 1977 (revision 83185514) 1980 (revision 83185518) 1981 (revision 83308867) 1983 (revision 83185524) 1985 (revision 83185526) 1988 (revision 83185280) 1990 (revision 83185531) 1995 (revision 83185538) 1999 (revision 83326325) 2000 (revision 83185544) 2001 (revision 83309058) 2002 (revision 83185545) 2003 (revision 83185546) 2004 (revision 83185283) 2005 (revision 83185285) 2006 (revision 83185547) 2007 (revision 83185549) 2008 (revision 83185551) 2009 (revision 83185552) 2010 (revision 83185287) 2012 (revision 83185289) 712 (revision 70630167) 749 (revision 78272323) ATP (Provincia di Genova) (revision 82754117) Abbazia di San Colombano (revision 83062997) Abbazia di San Fruttuoso (revision 83288120) Acacia dealbata (revision 83036867) Acquedotto (revision 82973825) Affresco (revision 82000422) Agricoltura (revision 82578266) Allevamento (revision 82971452) Altitudine (revision 82971213) Angelo (revision 82333116) Anni 1960 (revision 83161222) Anni 1970 (revision 81663175) Antica Roma (revision 83125874) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-21 18:46:08.840718 59 characters appeared 823241 times. First 34 characters: [ 0] Char i: 11.823147778111148 % [ 1] Char a: 11.252112078965942 % [ 2] Char e: 10.910170897707962 % [ 3] Char o: 8.936386793174782 % [ 4] Char n: 7.317055394471364 % [ 5] Char l: 6.931263141655967 % [ 6] Char r: 6.521784021932824 % [ 7] Char t: 6.386708145002497 % [ 8] Char s: 4.572415610981475 % [ 9] Char c: 4.116291584116923 % [10] Char d: 3.9770856893667834 % [11] Char u: 2.8944136650142545 % [12] Char m: 2.762860450342002 % [13] Char p: 2.6809889206198427 % [14] Char g: 2.1493098618751985 % [15] Char v: 1.5369739845318686 % [16] Char b: 1.2855287819727153 % [17] Char f: 0.9932692856648295 % [18] Char z: 0.9664241698360504 % [19] Char h: 0.7159507361756764 % [20] Char q: 0.2416060424590126 % [21] Char k: 0.18876610858788617 % [22] Char à: 0.15596890825408355 % [23] Char y: 0.12462936126844994 % [24] Char è: 0.11600491229178332 % [25] Char w: 0.10628722330398996 % [26] Char x: 0.10312897438295712 % [27] Char j: 0.07555503188009344 % [28] Char ù: 0.05575524056746445 % [29] Char ò: 0.03304014255849745 % [30] Char é: 0.021014502436103158 % [31] Char ì: 0.0191924357508919 % [32] Char á: 0.004737373381549267 % [33] Char ó: 0.003644133370422513 % The first 34 characters have an accumulated ratio of 0.9997947138201325. 872 sequences found. First 512 (typical positive ratio): 0.9989484485502651 Next 512 (512-1024): 1.214711123474171e-06 Rest: -4.336808689942018e-17 - Processing end: 2016-09-21 18:46:08.920456 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangLatvianModel.log ================================================ = Logs of language model for Latvian (lv) = - Generated by BuildLangModel.py - Started: 2016-09-21 00:16:33.485953 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Zigfrīds Anna Meierovics (revision 2546984) 1. Saeima (revision 2511127) 1. Saeimas deputāti (revision 2303859) 1. Saeimas frakcijas (revision 2429725) 1. Saeimas vēlēšanas (revision 2464758) 1887. gads (revision 2583253) 1919. gada Parīzes miera konference (revision 2482078) 1920 (revision 2401222) 1921 (revision 2473337) 1922 (revision 2486819) 1923 (revision 2544643) 1924 (revision 2539361) 1925 (revision 2486795) 22. augusts (revision 2583254) 31. jūlijs (revision 2559648) 5. februāris (revision 2581966) ASV (revision 2549746) Agrārā reforma Latvijā (revision 2473423) Agudas Izrael (Latvija) (revision 2311143) Aigars Kalvītis (revision 2545858) Alberts Kviesis (revision 2546934) Aleksandrs Bočagovs (revision 2329526) Aleksandrs Dauge (revision 2546805) Aleksandrs Jaunbērzs (revision 2462254) Aleksandrs Kerenskis (revision 2461214) Aleksandrs Millerāns (revision 2309419) Aleksandrs Neibergs (revision 2491897) Alfrēds Birznieks (revision 2567317) Alfrēds Jēkabs Bērziņš (revision 2564068) Alfrēds Riekstiņš (politiķis) (revision 2586148) Andrejs Bērziņš (revision 2564283) Andrejs Kurcijs (revision 2564338) Andrejs Petrevics (revision 2460269) Andrejs Sīmanis (revision 2547079) Andrejs Veckalns (revision 2564224) Andrievs Niedra (revision 2546988) Andris Bērziņš (politiķis, 1951) (revision 2218488) Andris Šķēle (revision 2457423) Angļu valoda (revision 2447598) Ansis Buševics (revision 2578312) Ansis Rudevics (revision 2414854) Antante (revision 2581862) Antons Dzenis (revision 2564295) Antons Laizāns (revision 2467408) Antons Rubins (1885) (revision 2465396) Antons Velkme (revision 2564425) Ants Pīps (revision 2564383) Apollo (portāls) (revision 2371202) Apolonija Laurinoviča (revision 2466232) Aprīļa pučs (revision 2150686) Apvienotā Karaliste (revision 2566258) Aristīds Briāns (revision 2536819) Arons Nuroks (revision 2337085) Arturs Alberings (revision 2442531) Arturs Ozols (inženieris) (revision 2491399) Artūrs Balfūrs (revision 2309461) Artūrs Vīgants (revision 2461471) Artūrs Žers (revision 2564230) Arveds Bergs (revision 2564118) Arveds Švābe (revision 2586288) Arvīds Kalniņš (revision 2545254) Aspazija (revision 2574081) Augusts Briedis (revision 2546879) Augusts Kalniņš (revision 2436647) Augusts Kirhenšteins (revision 2547109) Austroungārija (revision 2524307) Autoritatīvā vadība (revision 2385793) Balfūra nota (revision 2538973) Baltijas Antante (revision 2541901) Baltijas pārkrievošana (revision 2570657) Bermontiāde (revision 2499160) Bernards Kublinskis (revision 2441386) Bezpartijiskais nacionālais centrs (revision 2438819) Beļģija (revision 2579008) Brestļitovskas miera līgums (revision 2569020) Brizules muiža (revision 2584564) Bruno Kalniņš (revision 2566572) Brīvības piemineklis (revision 2578595) Bulduru konference (revision 2193449) Ceire-Cion (revision 2311779) Celmiņa 1. Ministru kabinets (revision 2112830) Delfi (portāls) (revision 2544918) Demokrātiskais Centrs (revision 2113060) Demokrātu savienība (revision 2179593) Diena (laikraksts) (revision 2548854) Donats Bicāns (revision 2479349) Dubulti (Jūrmala) (revision 2456811) Durbe (revision 2381790) Dāvids Komisārs (revision 2574685) Džovanni Džoliti (revision 2538055) Ebreju bloks (revision 2311643) Ebreju nacionāldemokrātu partija (revision 2312288) Eduards Grantskalns (revision 2565167) Eduards Jaunzems (revision 2452579) Eduards Laimiņš (revision 2449521) Eduards Radziņš (revision 2564393) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-21 00:19:18.361533 55 characters appeared 354745 times. First 39 characters: [ 0] Char a: 11.905171320244119 % [ 1] Char i: 9.3977364022044 % [ 2] Char s: 8.224217395594017 % [ 3] Char e: 6.367108768270166 % [ 4] Char r: 5.854064186951191 % [ 5] Char t: 5.831230884156225 % [ 6] Char u: 4.939604504644181 % [ 7] Char n: 4.463769750102186 % [ 8] Char ā: 3.9498794909019157 % [ 9] Char l: 3.8030134321836813 % [10] Char o: 3.6296494665182033 % [11] Char k: 3.524785409237621 % [12] Char m: 3.2739009711201 % [13] Char d: 3.177775585279567 % [14] Char v: 3.0046935122411873 % [15] Char p: 2.827101157169234 % [16] Char j: 2.8166711299665956 % [17] Char b: 2.0279355593454453 % [18] Char ī: 1.8855797826607845 % [19] Char g: 1.6146809680192813 % [20] Char z: 1.5343415692962552 % [21] Char ē: 1.4593581304880971 % [22] Char c: 1.2231321089796898 % [23] Char š: 0.8876798827326671 % [24] Char ņ: 0.46596851259355315 % [25] Char f: 0.4203019070036223 % [26] Char ļ: 0.34700982395805435 % [27] Char ū: 0.30162511099522193 % [28] Char h: 0.20070755049401684 % [29] Char ž: 0.18774048964749326 % [30] Char ķ: 0.14207388405756247 % [31] Char ģ: 0.1268516821942522 % [32] Char č: 0.08287643236691145 % [33] Char w: 0.0324176521163089 % [34] Char y: 0.02734358482853881 % [35] Char x: 0.015785987117506943 % [36] Char ö: 0.005074067287770088 % [37] Char é: 0.003946496779376736 % [38] Char q: 0.0031008188980817205 % The first 39 characters have an accumulated ratio of 0.9998590536864506. 970 sequences found. First 512 (typical positive ratio): 0.9904102202220861 Next 512 (512-1024): 0.0018774048964749328 Rest: -1.734723475976807e-17 - Processing end: 2016-09-21 00:19:18.484318 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangLithuanianModel.log ================================================ = Logs of language model for Lithuanian (lt) = - Generated by BuildLangModel.py - Started: 2016-09-21 00:23:03.857157 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Karūna (laivas) (revision 5080379) 1650 (revision 4990868) 1654 (revision 4991037) 1664 (revision 4991048) 1665 (revision 4991050) 1668 (revision 4991052) 1669 (revision 4991053) 1672 (revision 4991056) 1676 (revision 4991060) 1718 (revision 4990914) 1909 (revision 4990667) 1928 (revision 4990262) 1932 (revision 4990613) 1956 (revision 4990635) 1980 (revision 4990655) Baltijos jūra (revision 5052833) Burinis laivas (revision 4657401) Flagmanas (laivas) (revision 5005271) Grimzlė (revision 4487052) Kalmaras (Švedija) (revision 4978519) Karo laivas (revision 4726931) Karolis XI (revision 4944621) Karolis XII (revision 4915230) Kilis (revision 4325533) Koordinačių sistema (revision 5033980) Laivo vėliava (revision 4986001) Liepos 1 d. (revision 4910200) Nyderlandai (revision 5080140) Rugpjūčio 10 (revision 4910281) Varytuvas (revision 4620792) Vaza (laivas) (revision 5079282) XVIII a. (revision 4896219) XVII a. (revision 4768242) Švedija (revision 5057665) Švedų kalba (revision 4687559) 1590 (revision 4990983) 1596 (revision 4990989) 1608 (revision 4991000) 1610 (revision 4991002) 1623 m. (revision 4991015) 1634 m. (revision 4991026) 1643 m. (revision 4990870) 1644 m. (revision 4990872) 1645 m. (revision 4990873) 1646 m. (revision 4990874) 1647 m. (revision 4913295) 1648 m. (revision 4990875) 1649 m. (revision 4990876) 1651 m. (revision 4991035) 1652 m. (revision 4991072) 1653 m. (revision 4991036) 1654 m. (revision 4991037) 1655 m. (revision 4991038) 1662 m. (revision 4991046) 1668 m. (revision 4991052) 1677 m. (revision 4991061) 1702 (revision 4990595) 1704 (revision 4990863) 1722 (revision 4990918) 1723 (revision 4990919) 1737 (revision 4990931) 2 tūkstantmetis (revision 4296407) ATR (revision 5078529) Abiejų Tautų Respublika (revision 5078529) Adomas Freitagas (revision 4362991) Anglų kalba (revision 4911240) Armėnų kalendorius (revision 4817534) Bahajų kalendorius (revision 4706296) Bajorai (revision 5006456) Berberų kalendorius (revision 4926904) Birželio 21 (revision 4910142) Bizantijos kalendorius (revision 4927623) Budistų kalendorius (revision 4705734) Dešimtmetis (revision 4296419) Dominikonai (revision 4921895) Dominikonų ordinas (revision 4921895) Džohoro sultonatas (revision 4934526) Džu Ihai (revision 4991072) Džu Joulang (revision 4991072) Emanuelis Vladislovas Tiškevičius Logoiskis (revision 4939239) Filosofas (revision 5078172) Gegužės 26 (revision 4910130) Grafas (titulas) (revision 5008057) Grigaliaus kalendorius (revision 5000317) Hebrajų kalendorius (revision 4728592) Imperatorius Go-Komijas (revision 4907057) Inocentas X (revision 4905150) Iraniečių kalendorius (revision 4964854) Isaac Titsingh (revision 4990745) Japonija (revision 5035249) Japonijos imperatorius (revision 4720428) Japonų kalendorius (revision 4956765) John Churchill (revision 4903704) Jonas Kazimieras Vaza (revision 5037754) Jurgis Kasakauskis (revision 5047829) Jurgis Kazimieras Ancuta (revision 5059404) Jurgis Mikalojus Tiškevičius (revision 4939554) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-21 00:25:34.773941 60 characters appeared 353051 times. First 38 characters: [ 0] Char i: 13.032394753165974 % [ 1] Char a: 11.167225131779828 % [ 2] Char s: 8.586578143101137 % [ 3] Char o: 7.018815978428046 % [ 4] Char e: 5.525830545728521 % [ 5] Char r: 5.469181506354606 % [ 6] Char n: 5.142599794363987 % [ 7] Char t: 5.105777918770942 % [ 8] Char u: 4.270487833202568 % [ 9] Char k: 3.9617505686147325 % [10] Char l: 3.9051015292408184 % [11] Char m: 3.359854525266888 % [12] Char d: 3.0372382460324427 % [13] Char v: 2.7270847554602593 % [14] Char j: 2.4472385009531203 % [15] Char p: 2.329125253858508 % [16] Char g: 1.9427788053284087 % [17] Char ė: 1.5657794482950054 % [18] Char b: 1.5074309377398734 % [19] Char y: 1.2236192504765602 % [20] Char ų: 1.181698961339863 % [21] Char š: 0.9630336693565519 % [22] Char ž: 0.8171623929687212 % [23] Char c: 0.5959478942135839 % [24] Char č: 0.48010060869392807 % [25] Char f: 0.428266737666796 % [26] Char h: 0.42515104050123065 % [27] Char z: 0.4010751987673169 % [28] Char ū: 0.3685020011273159 % [29] Char ą: 0.3526402701026197 % [30] Char į: 0.29004308159444386 % [31] Char ę: 0.14813723796278724 % [32] Char x: 0.08752276583269838 % [33] Char w: 0.059198246145740985 % [34] Char ō: 0.01812769259965274 % [35] Char ö: 0.008780601102956797 % [36] Char é: 0.0076476203154785 % [37] Char q: 0.007364375118608926 % The first 38 characters have an accumulated ratio of 0.9996629382157253. 1016 sequences found. First 512 (typical positive ratio): 0.9928710196247589 Next 512 (512-1024): 0.008171623929687212 Rest: -4.85722573273506e-17 - Processing end: 2016-09-21 00:25:34.935858 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangMalteseModel.log ================================================ = Logs of language model for Maltese (mt) = - Generated by BuildLangModel.py - Started: 2016-09-21 02:05:23.411546 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Unjoni Ewropea (revision 246298) 1951 (revision 229183) 1952 (revision 229184) 1957 (revision 229188) 1958 (revision 229189) 1973 (revision 223536) 1979 (revision 243876) 1981 (revision 205545) 1985 (revision 216368) 1986 (revision 231433) 1990 (revision 237666) 1992 (revision 244087) 1995 (revision 214650) 1 ta' Mejju (revision 245374) 2007 (revision 214851) 2013 (revision 245606) Albanija (revision 243079) Awstrija (revision 243627) Awtonomija (revision 245824) Ażores (revision 246298) Bank Ċentrali Ewropew (revision 246298) Belt kapitali (revision 237400) Belġju (revision 244363) Brussell (revision 243311) Bulgarija (revision 243622) Danimarka (revision 244419) De facto (revision 215102) Estonja (revision 243826) European Free Trade Association (revision 246298) Ewropa (revision 244177) Ex Repubblika Jugoslava tal-Maċedonja (revision 246298) Federazzjoni (revision 246226) Finlandja (revision 245824) Frankfurt (revision 243576) Franza (revision 244461) Greċja (revision 244423) Groenlandja (revision 243829) Indja (revision 244873) Islanda (revision 243771) Isle of Man (revision 246298) Istitut tal-Unjoni Ewropea għall-Istudji dwar is-Sigurtà (revision 244412) Italja (revision 246323) Kilometru kwadru (revision 244871) Komunitajiet Ewropej (revision 246298) Komunità Ekonomika Ewropea (revision 246298) Kroazja (revision 245711) Kummissjoni Ewropea (revision 243311) Kunsill Ewropew (revision 246298) Kunsill tal-Ewropa (revision 243334) Kunsill tal-Unjoni Ewropea (revision 243311) Latvja (revision 245746) Lista ta' pajjiżi skont id-daqs (revision 244419) Lista ta' pajjiżi skont il-popolazzjoni (revision 246128) Litwanja (revision 243114) Liġijiet tal-Unjoni Ewropea (revision 246298) Lussemburgu (revision 244239) Lussemburgu (belt) (revision 243587) Madejra (revision 243625) Malta (revision 247210) Montenegro (revision 243930) Norveġja (revision 243829) Olanda (revision 243989) Organizzazzjoni Internazzjonali (revision 246724) Pajjiżi l-Baxxi (revision 243989) Pajjiżi membri tal-Unjoni Ewropea (revision 243625) Pajjiżi ġirien li jdawru l-Unjoni Ewropea (revision 246298) Parlament Ewropew (revision 243907) Patt ta' Stabilità u Tkabbir (revision 246298) Politika agrikola komuni (revision 244363) Politika reġjonali tal-Unjoni Ewropea (revision 246298) Polonja (revision 244530) Portugall (revision 243625) Relazzjonijiet ta' terzi pajjiżi ma l-UE (revision 246298) Renju Unit (revision 247318) Repubblika Federali tal-Ġermanja (revision 244859) Repubblika tal-Irlanda (revision 243686) Repubblika Ċeka (revision 246832) Rumanija (revision 243623) Segretarjat tal-Parlament Ewropew (revision 246298) Serbja (revision 243728) Slovakkja (revision 243831) Slovenja (revision 244588) Spanja (revision 246856) Stati Uniti tal-Amerika (revision 243926) Stati membri tal-Unjoni Ewropea (revision 243114) Strasburgu (revision 243503) Sui generis (revision 247150) Suq komuni (revision 246298) Svezja (revision 244871) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-21 02:07:45.508113 48 characters appeared 474337 times. First 31 characters: [ 0] Char a: 12.326257492036252 % [ 1] Char i: 12.069899670487438 % [ 2] Char t: 8.064941170518008 % [ 3] Char l: 7.795301652622502 % [ 4] Char e: 6.615971345267184 % [ 5] Char n: 6.128132530247482 % [ 6] Char r: 5.579577389071483 % [ 7] Char u: 4.376424356522894 % [ 8] Char o: 3.8337721915009797 % [ 9] Char j: 3.7378488289971057 % [10] Char m: 3.6084049947611088 % [11] Char s: 3.3533120966738834 % [12] Char k: 2.588033402412209 % [13] Char d: 2.3173397816320462 % [14] Char p: 2.0555006250830106 % [15] Char b: 2.017131280081461 % [16] Char f: 2.004692866042497 % [17] Char ħ: 1.6372326004507345 % [18] Char w: 1.4801712706366992 % [19] Char g: 1.4763765002519307 % [20] Char z: 1.3150987588992635 % [21] Char ż: 0.9910675321554084 % [22] Char h: 0.9750451683086075 % [23] Char ġ: 0.7640137708000851 % [24] Char ċ: 0.6723068198348432 % [25] Char x: 0.5892435125237964 % [26] Char v: 0.5668965313690478 % [27] Char q: 0.5647883255997318 % [28] Char c: 0.2759641352034524 % [29] Char à: 0.10730767365817974 % [30] Char y: 0.059029761540845424 % The first 31 characters have an accumulated ratio of 0.9994708403519017. 870 sequences found. First 512 (typical positive ratio): 0.9959115850692665 Next 512 (512-1024): 2.108205769315908e-06 Rest: -4.423544863740858e-17 - Processing end: 2016-09-21 02:07:45.646198 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangNederlandsModel.log ================================================ = Logs of language model for Nederlands (nl) = - Generated by BuildLangModel.py - Started: 2019-03-05 22:44:20.050852 - Maximum depth: 4 - Max number of pages: 100 == Parsed pages == Hoofdpagina (revision 42806222) 1193 (revision 49105208) 1678 (revision 51370454) 1877 (revision 52221957) 1 maart (revision 53328825) 28 februari (revision 53333556) 2 maart (revision 53304319) 4 maart (revision 53328727) Aardolie (revision 53232183) Adder (revision 53255935) Ajjoebiden (revision 52061408) Anorganische verbinding (revision 50266701) Anton Webern (revision 51435017) Antonio Vivaldi (revision 53013950) Atoombommen op Hiroshima en Nagasaki (revision 53186027) Baan (hemellichaam) (revision 52421076) Bacteriën (revision 53284887) Ballet (revision 53166893) België (revision 53089250) Biomolecuul (revision 52342598) Bolsjojtheater (revision 46840685) Citadel van Damascus (revision 52714519) De vier jaargetijden (revision 51236952) Desoxyribonucleïnezuur (revision 52928136) Dierenrijk (revision 53171437) Donald Trump (revision 53316008) Dragon 2 (revision 53325378) Eindhoven (revision 53148954) Emma Hamilton (revision 53200721) Fosfolipide (revision 45426802) Frankrijk (revision 53201265) Gangbare jaartelling (revision 53305089) Geologie (revision 52133989) George Romney (revision 48220482) Gesteente (revision 52807934) Heiligdomsvaart van Maastricht (revision 53142350) Het zwanenmeer (revision 53219336) Honing (revision 53181307) Horatio Nelson (revision 53314699) Hout (hoofdbetekenis) (revision 53044527) Howard Hughes (revision 53293454) India (revision 53279672) Internetencyclopedie (revision 52816473) Islamitische kalender (revision 53328122) James Lick (revision 53252724) Jammu en Kasjmir (gebied) (revision 53313902) Kasjmirconflict (revision 49694027) Keith Flint (revision 53324751) Kennedy Space Center (revision 53281818) Kernwapenprogramma van Noord-Korea (revision 52456973) Kim Jong-un (revision 52426396) Kredietcrisis (revision 53280092) Lemma (naslagwerk) (revision 53063550) Lijst van personen overleden in 2019 (revision 52904365) Lucifer (toneelstuk) (revision 51853284) Ludo Loos (revision 53312584) Luke Perry (revision 53334097) Macromolecuul (revision 53233815) Medina (Arabië) (revision 53164210) Mineraal (revision 53228621) Mohammed (revision 53205987) Moskou (hoofdbetekenis) (revision 53161394) Natuur (werkelijkheid) (revision 52651323) Natuurproduct (materiaal) (revision 44076415) Natuurproduct (scheikunde) (revision 52509420) Nederlandstalige Wikipedia (revision 52234843) Non-profit (revision 52177686) Organisme (revision 52466273) Oxytocine (revision 51856966) Pakistan (revision 53255621) Paul Williams (blueszanger) (revision 53316424) Peter van Gestel (revision 53319161) Planten (revision 52775791) Protestbeweging van de gele hesjes (revision 53334148) Proteïne (revision 52684512) Republiek Venetië (revision 53244002) Saladin (revision 51827810) Scheikunde (revision 53170134) Sedimentair gesteente (revision 52717620) Seksualiteit (revision 52702386) SpX-DM1 (revision 53331792) SpaceX (revision 53312861) Stof (scheikunde) (revision 53162151) Subductie (revision 53057979) Supramoleculaire chemie (revision 45112850) Syrië (revision 53321993) TNT-equivalent (revision 52284099) Tabak (hoofdbetekenis) (revision 53251285) Tektonische plaat (revision 52847756) Topconferentie (revision 52015958) Verliefdheid (revision 52492009) Vest (kleding) (revision 52737592) Vioolconcert (revision 52347055) Vriendschap (revision 53223707) Vroeg-islamitisch Egypte (revision 52269237) Wallonië (revision 53178812) Wikimedia Foundation (revision 52930105) Wikipedia (revision 52234843) Zuivere stof (revision 52503197) 1180-1189 (revision 46239029) == End of Parsed pages == - Wikipedia parsing ended at: 2019-03-05 22:48:03.613070 59 characters appeared 1279049 times. First 33 characters: [ 0] Char e: 17.793376172453126 % [ 1] Char n: 9.722301491186029 % [ 2] Char a: 7.944887177895452 % [ 3] Char i: 6.839221953185532 % [ 4] Char r: 6.648533402551426 % [ 5] Char t: 6.374267131282695 % [ 6] Char o: 5.982257130102131 % [ 7] Char d: 5.676483074534283 % [ 8] Char s: 4.556432161707644 % [ 9] Char l: 4.042534726972931 % [10] Char g: 2.9120854634967075 % [11] Char v: 2.647670261264424 % [12] Char m: 2.385287819309503 % [13] Char h: 2.3648820334482887 % [14] Char k: 2.06176620285853 % [15] Char u: 1.9499643876036021 % [16] Char c: 1.7972728175386556 % [17] Char b: 1.6535723025466575 % [18] Char p: 1.6050987882403254 % [19] Char w: 1.3385726426430888 % [20] Char j: 1.2271617428261155 % [21] Char z: 0.9909706352141316 % [22] Char f: 0.9094256748568664 % [23] Char y: 0.2506549788162924 % [24] Char ë: 0.12001103945196784 % [25] Char x: 0.09718157787543714 % [26] Char é: 0.034713290890341184 % [27] Char q: 0.02322037701448498 % [28] Char ï: 0.02009305351085064 % [29] Char ü: 0.0053164499561783795 % [30] Char è: 0.0050037176058149455 % [31] Char ó: 0.0043000698174972185 % [32] Char ö: 0.003909154379542926 % The first 33 characters have an accumulated ratio of 0.9998842890303653. 924 sequences found. First 512 (typical positive ratio): 0.9980487395086337 Next 512 (512-1024): 7.818308759085852e-07 Rest: -4.9439619065339e-17 - Processing end: 2019-03-05 22:48:03.706807 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangPolishModel.log ================================================ = Logs of language model for Polish (pl) = - Generated by BuildLangModel.py - Started: 2016-09-21 17:06:43.735784 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Krasnyj Krym (revision 46884814) 1913 (revision 46708474) 1915 (revision 46743905) 1917 (revision 46559521) 1925 (revision 46809935) 1928 (revision 46875978) 1929 (revision 46760445) 1935 (revision 46487358) 1936 (revision 46874348) 1939 (revision 46789269) 1941 (revision 46856112) 1942 (revision 46851808) 1943 (revision 46768330) 1944 (revision 46866229) 1949 (revision 46882598) 1953 (revision 46437607) 1957 (revision 46591716) 1959 (revision 46255886) Admirał Butakow (revision 45993412) Admirał Spiridow (revision 45993412) Aparat torpedowy (revision 46633263) Askold (revision 45787848) Avro 504 (revision 44668646) Ałmaz (1903) (revision 46472283) Batumi (revision 46594611) Bomba głębinowa (revision 46011227) Brest (revision 45771242) Burta (revision 45569092) Cagliari (revision 46235605) Cesariewicz (revision 40031486) Czerwona Ukraina (revision 45993524) Daty nowego i starego porządku (revision 45622575) Drednot (revision 45789788) Działo przeciwlotnicze (revision 45160162) Flota Bałtycka Marynarki Wojennej Rosji (revision 45700667) Gromoboj (revision 44328986) Hulk (okręt) (revision 46020688) II wojna światowa (revision 46871591) I wojna światowa (revision 46869119) Imperator Nikołaj I (okręt lotniczy) (revision 45520638) Imperium Rosyjskie (revision 46604959) Impierator Nikołaj I (1916) (revision 46534166) Język rosyjski (revision 46433952) Kanonierka (revision 41091952) Kanonierki typu Ardagan (revision 46534166) Kanonierki typu Bobr (revision 45788694) Kanonierki typu Chiwiniec (revision 46534166) Kanonierki typu Groziaszczij (revision 46534166) Kanonierki typu Mandżur (revision 46534166) Karabin maszynowy DSzK (revision 45587452) Karabin maszynowy Vickers 12,7 mm (revision 44572918) Kocioł parowy (revision 46716473) Konstrukcyjna linia wodna (revision 37082620) Kontrtorpedowce typu Biesstrasznyj (revision 46534166) Kontrtorpedowce typu Brawyj (revision 46534166) Kontrtorpedowce typu Grozowoj (revision 46534166) Kontrtorpedowce typu Prytkij (revision 46534166) Koń mechaniczny (revision 44722357) Krab (1915) (revision 42791389) Kronsztad (revision 46425497) Krążownik lekki (revision 40661490) Krążownik liniowy (revision 40601776) Krążownik pancernopokładowy (revision 40055901) Krążownik pancerny (revision 40324458) Krążowniki lekkie typu Swietłana (revision 45993412) Krążowniki liniowe typu Borodino (revision 45990866) Krążowniki typu Admirał Nachimow (revision 45993521) Krążowniki typu Bajan (revision 45991279) Krążowniki typu Diana (revision 45991349) Krążowniki typu Izumrud (revision 45991349) Lend-Lease Act (revision 46877263) Marynarka Wojenna Związku Socjalistycznych Republik Radzieckich (revision 45795993) Maszyna sterowa (revision 28497888) Mecidiye (1903) (revision 43956539) Mila morska (revision 45754209) Mina morska (revision 45781427) Morze Czarne (revision 46729213) Nadbudówka (revision 45292731) Neapol (revision 46823083) Niszczyciel (revision 45799132) Niszczyciele rakietowe projektu 61 (revision 46498775) Niszczyciele typu Finn (revision 46620140) Niszczyciele typu Lejtienant Szestakow (revision 46620140) Niszczyciele typu Ochotnik (revision 46620140) Niszczyciele typu Ukraina (revision 46620140) Noworosyjsk (revision 44721836) Odessa (revision 45629804) Oerlikon 20 mm (revision 45493862) Okres międzywojenny (revision 46668249) Okręt-baza wodnosamolotów (revision 45115462) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-21 17:21:04.404471 78 characters appeared 1159291 times. First 37 characters: [ 0] Char a: 9.685575062689178 % [ 1] Char i: 8.815819324052374 % [ 2] Char o: 7.920185699707839 % [ 3] Char e: 6.871613770830621 % [ 4] Char r: 5.8672067668945935 % [ 5] Char n: 5.763608964444647 % [ 6] Char s: 4.736688199942896 % [ 7] Char k: 4.722196583946568 % [ 8] Char z: 4.519227700378939 % [ 9] Char w: 4.279512219106333 % [10] Char t: 4.0191806888865695 % [11] Char c: 3.6891513864939864 % [12] Char y: 3.565282573572986 % [13] Char p: 3.0190004062828053 % [14] Char d: 2.851052928039638 % [15] Char l: 2.7930002044352973 % [16] Char m: 2.7530620008263673 % [17] Char u: 2.348504387595522 % [18] Char j: 1.881236031332944 % [19] Char ł: 1.6885320424293815 % [20] Char b: 1.394559260789569 % [21] Char g: 1.3928340684090534 % [22] Char h: 1.163901039514669 % [23] Char ę: 0.8066136975099435 % [24] Char ó: 0.5971753425153823 % [25] Char ą: 0.563275312238256 % [26] Char f: 0.5245447432956868 % [27] Char ż: 0.4545019326467643 % [28] Char ś: 0.39567287247119143 % [29] Char ń: 0.3857530162832283 % [30] Char ć: 0.1397405828217419 % [31] Char v: 0.12455888987320698 % [32] Char ź: 0.10204512930748191 % [33] Char x: 0.05468859846233603 % [34] Char é: 0.020961087423261287 % [35] Char á: 0.01707940456710179 % [36] Char q: 0.011386269711401192 % The first 37 characters have an accumulated ratio of 0.9993892818972973. 1321 sequences found. First 512 (typical positive ratio): 0.9894531815946438 Next 512 (512-1024): 1.7251923805153322e-06 Rest: 0.0003530230403650733 - Processing end: 2016-09-21 17:21:04.878014 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangPortugueseModel.log ================================================ = Logs of language model for Portuguese (pt) = - Generated by BuildLangModel.py - Started: 2016-09-20 23:44:39.722451 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Papagaio-das-mascarenhas (revision 46763149) Albinismo (revision 46498446) Alfred Newton (revision 43617011) Alphonse Milne-Edwards (revision 39740747) Animalia (revision 46727732) Asa (revision 46338820) August von Pelzeln (revision 34726241) Aves (revision 46728980) Bico (revision 45311553) Carl Wilhelm Hahn (revision 45025566) Carlos Lineu (revision 46625396) Carolus Linnaeus (revision 46625396) Cauda (revision 43275401) Charles Lucien Bonaparte (revision 45529712) Chordata (revision 46640101) Cladograma (revision 46700307) Classe (biologia) (revision 46701409) Classificação científica (revision 46306288) Coleção Leverian (revision 45026647) Comores (revision 46181501) Coracopsinae (revision 36946101) Coracopsis nigra (revision 44338845) Coracopsis vasa (revision 42905822) Cylindraspis indica (revision 42905410) Cúlmen (revision 45311553) Digital object identifier (revision 42172651) Eclectus roratus (revision 44380798) Edward Newton (revision 39261469) Endemismo (revision 45260961) Epíteto específico (revision 35101647) Espécie (revision 45685675) Esquilo-vermelho (revision 43489595) Estado de conservação (revision 46662839) Extinção (revision 46526607) Família (biologia) (revision 46636004) Filo (revision 46704246) França (revision 46740839) François-Nicolas Martinet (revision 43679514) François Levaillant (revision 40142351) Fredrik Hasselqvist (revision 44381122) Fregilupus varius (revision 46555765) Fumigação (revision 42458244) George Robert Gray (revision 39047844) Georges-Louis Leclerc, conde de Buffon (revision 45622418) Género (biologia) (revision 45296588) Hermann Schlegel (revision 43137605) Herpetologista (revision 46207704) Histoire Naturelle (revision 44293456) Holótipo (revision 44029660) Ilha da Reunião (revision 45458206) Ilha vulcânica (revision 37924535) Ilhas Mascarenhas (revision 45858660) Ilhas Molucas (revision 45476933) International Standard Book Number (revision 46326494) Jacques Barraband (revision 45007769) Jean Feuilley (revision 43140791) Johann Georg Wagler (revision 34585234) John Gerrard Keulemans (revision 39664498) Julian Hume (revision 41876605) Leiolopisma (revision 43997173) Lionel Walter Rothschild (revision 46022922) Lista Vermelha da IUCN (revision 46569884) Lista Vermelha da União Internacional para a Conservação da Natureza e dos Recursos Naturais (revision 46569884) Lista Vermelha de Espécies Ameaçadas da IUCN (revision 46569884) Lista de aves extintas (revision 45507420) Londres (revision 46310311) Língua inglesa (revision 46609785) Madagascar (revision 46617630) Mascarenotus grucheti (revision 43145662) Mathurin Jacques Brisson (revision 36018826) Maurício (revision 46723599) Maximiliano I José da Baviera (revision 46372080) Melanina (revision 46762903) Museu Nacional de História Natural (França) (revision 43731807) Naturhistorisches Museum (revision 46694247) Nesoenas duboisi (revision 43995805) Nome científico (revision 46671641) Nomenclatura binomial (revision 46671641) Nycticorax duboisi (revision 43816214) Nível do mar (revision 46414695) Ordem (biologia) (revision 46360024) Otto Finsch (revision 42362273) Papagaio (revision 46738207) Papagaio-cinzento (revision 46673943) Papagaio-cinzento-de-maurício (revision 46664408) Pedro Mascarenhas (c. 1484-1555) (revision 45541977) Periquito-de-maurício (revision 43010883) Periquito-de-reunião (revision 43048764) Peter Mundy (revision 43563846) Piton des Neiges (revision 45632497) Pleistoceno (revision 45916874) Plumagem (revision 34951058) Ponto quente (revision 45375495) Porphyrio coerulescens (revision 43672493) Praslin (revision 40728143) Psitacídeos (revision 46598835) Psittaciformes (revision 46598835) Psittacula (revision 42856453) Psittaculinae (revision 46760737) Psittaculini (revision 43015966) Psittrichasiidae (revision 44385977) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-20 23:47:27.346826 51 characters appeared 558324 times. First 38 characters: [ 0] Char a: 11.864795351802895 % [ 1] Char e: 11.44604208309154 % [ 2] Char o: 9.868284365350585 % [ 3] Char s: 8.346587286235232 % [ 4] Char i: 7.118089138206489 % [ 5] Char r: 6.394136737808154 % [ 6] Char n: 5.568272186042513 % [ 7] Char d: 5.243192125002687 % [ 8] Char t: 4.80061756256224 % [ 9] Char m: 4.498105042949971 % [10] Char c: 3.9747530107965985 % [11] Char u: 3.7229279056605127 % [12] Char l: 3.207814817202914 % [13] Char p: 2.77562848811801 % [14] Char g: 1.3850380782484721 % [15] Char v: 1.3210967108703908 % [16] Char f: 1.122466524813549 % [17] Char b: 0.9702251739133549 % [18] Char h: 0.9130898904578704 % [19] Char é: 0.7026386112723079 % [20] Char ã: 0.7022803963290133 % [21] Char q: 0.5903382265494588 % [22] Char ç: 0.5856814322866293 % [23] Char í: 0.41391736697688086 % [24] Char x: 0.3913498255493226 % [25] Char á: 0.34567742027926435 % [26] Char z: 0.3170202248156984 % [27] Char ó: 0.22925756370852768 % [28] Char j: 0.20454073262120204 % [29] Char ê: 0.20239144296143458 % [30] Char õ: 0.16155493942585308 % [31] Char y: 0.15080849112701586 % [32] Char w: 0.09241945537000021 % [33] Char ú: 0.08794176857881804 % [34] Char k: 0.08364318925928313 % [35] Char â: 0.07898639499645367 % [36] Char à: 0.06859816164091102 % [37] Char ô: 0.031164700066627977 % The first 38 characters have an accumulated ratio of 0.9998137282294869. 891 sequences found. First 512 (typical positive ratio): 0.9953179582313172 Next 512 (512-1024): 1.7910747164728723e-06 Rest: 2.42861286636753e-17 - Processing end: 2016-09-20 23:47:27.489355 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangRomanianModel.log ================================================ = Logs of language model for Romanian (ro) = - Generated by BuildLangModel.py - Started: 2016-09-28 18:53:56.086095 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == The Loving Kind (revision 10166481) 12 ianuarie (revision 10711676) 13 decembrie (revision 9938353) 2007 (revision 10716321) 2008 (revision 10752084) 2009 (revision 10654003) 21 noiembrie (revision 10447643) 25 ianuarie (revision 10228199) 31 ianuarie (revision 10718063) 4 Music (revision 9701591) Billboard (revision 10505294) Biology (revision 10112430) Bulgaria (revision 10481051) CD (revision 10477531) Call The Shots (revision 10101027) Call the Shots (revision 10101027) Can't Speak French (revision 9721506) Casă de discuri (revision 10611348) Channel 4 (revision 7953101) Chemistry (revision 10112479) Cheryl Cole (revision 10475016) Chitară (revision 10468266) Croația (revision 10737746) Dance (revision 10231736) Descărcare digitală (revision 10100743) Digital Spy (revision 9044016) Discografia Girls Aloud (revision 10172788) Estonia (revision 10749810) Europa (revision 10752724) Fascination Records (revision 9655292) Fiona Phillips (revision 5384082) Gen muzical (revision 10534645) Girls A Live (revision 10112444) Girls Aloud (revision 10112446) Good Morning Television (revision 10166481) Heat World (revision 10166481) I'll Stand By You (cântec de Girls Aloud) (revision 10112432) ITunes (revision 10744174) I Think We're Alone Now (revision 10112427) Irlanda (revision 10573806) Jump (cântec de Girls Aloud) (revision 10112438) Lady GaGa (revision 10753010) Life Got Cold (revision 10112437) Limba engleză (revision 10756676) Long Hot Summer (revision 10112429) Love Machine (revision 10112433) MSN Search (revision 10653298) MTV (revision 10170766) Mixed Up (revision 10112443) Muzică electronică (revision 10608432) Muzică pop (revision 10740529) Nadine Coyle (revision 10316187) Neil Tennant (revision 10499980) No Good Advice (revision 10112436) Out Of Control (revision 10112484) Out of Control (revision 10112484) Pet Shop Boys (revision 10612741) Poker Face (revision 10496402) PopJustice (revision 10625677) Regatul Unit (revision 10752338) Regatul Unit al Marii Britanii și Irlandei de Nord (revision 10752338) Regatul Unit al Marii Britanii și al Irlandei de Nord (revision 10752338) Republica Irlanda (revision 10573806) Romanian Top 100 (revision 10736281) România (revision 10732435) Sarah Harding (revision 10633651) Sarah Hearding (revision 10112425) See the Day (revision 10112431) Sexy! No No No... (revision 10112425) Slant Magazine (revision 7697473) Slovenia (revision 10521499) Something Kinda Ooooh (revision 10112426) Sound of the Underground (album) (revision 10112476) Sound of the Underground (cântec) (revision 10112434) Tangled Up (revision 10112482) The Guardian (revision 9752334) The Paul O'Grady Show (revision 10101027) The Promise (revision 10166482) The Show (revision 10112441) The Sound of Girls Aloud (revision 10112480) Tonalitate (revision 9966362) Turneul Out of Control (revision 10112446) UK Mix (revision 9721468) UK Singles Chart (revision 10226705) Ungaria (revision 10737745) Uniunea Europeană (revision 10751590) Untouchable (revision 10112410) Wake Me Up (revision 10112439) What Will The Neighbours Say? (revision 10112478) Whole Lotta History (revision 10475020) Wideboys (revision 10166481) Wikimedia Commons (revision 9703907) Xenomania (revision 10112484) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-28 18:58:13.756622 60 characters appeared 883554 times. First 33 characters: [ 0] Char e: 11.67014127036944 % [ 1] Char i: 10.97567324690964 % [ 2] Char a: 10.080198833348046 % [ 3] Char r: 7.490657050955572 % [ 4] Char n: 7.18246988865423 % [ 5] Char t: 6.516296683620921 % [ 6] Char l: 5.595130574928075 % [ 7] Char u: 5.551217016730161 % [ 8] Char o: 4.922732509840938 % [ 9] Char c: 4.495707110148333 % [10] Char s: 3.8308920563994957 % [11] Char d: 3.590499279048027 % [12] Char m: 2.971408651876399 % [13] Char p: 2.902369294915761 % [14] Char ă: 2.1349006399156134 % [15] Char g: 1.2248261000459508 % [16] Char f: 1.1199089133205216 % [17] Char b: 1.0781457613230203 % [18] Char ț: 1.0323081554721047 % [19] Char ș: 0.9732285745975912 % [20] Char î: 0.97017273420753 % [21] Char v: 0.9693804792915882 % [22] Char z: 0.7369102510995367 % [23] Char h: 0.533413916976212 % [24] Char â: 0.4986678799484808 % [25] Char x: 0.22081276300033725 % [26] Char j: 0.20055367300696958 % [27] Char k: 0.1901411798260208 % [28] Char y: 0.15471606715605385 % [29] Char w: 0.11827234102273318 % [30] Char á: 0.016297815413658927 % [31] Char é: 0.013355154297303842 % [32] Char q: 0.00520624659047438 % The first 33 characters have an accumulated ratio of 0.9996661211425673. 981 sequences found. First 512 (typical positive ratio): 0.997762564143313 Next 512 (512-1024): 1.1317927370596478e-06 Rest: 3.0357660829594124e-18 - Processing end: 2016-09-28 18:58:13.862425 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangSlovakModel.log ================================================ = Logs of language model for Slovak (sk) = - Generated by BuildLangModel.py - Started: 2016-09-21 13:26:28.712674 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Dôkaz (matematika) (revision 6358810) 1825 (revision 6122752) 1839 (revision 6165808) 1847 (revision 5941780) 1852 (revision 5941777) 1878 (revision 6221358) 1955 (revision 6226609) 1976 (revision 6310709) 1983 (revision 6356952) 1993 (revision 6348358) 1995 (revision 6277350) 2012 (revision 6291145) Adrien-Marie Legendre (revision 6060342) Algebra (revision 6319238) Algebraická geometria (revision 5964212) Algebraická rovnica (revision 5288111) Algebrické číslo (revision 6106622) Algoritmus (revision 6286937) Andrew Wiles (revision 5791970) Arabi (revision 6044956) Arabčina (revision 6322514) Aristoteles (revision 6359959) Arthur Cayley (revision 6332355) Axióma (revision 6338092) Babylonia (revision 6168813) Bernard Bolzano (revision 6261374) Boh (revision 6282272) Bolzanova veta (revision 6345299) Bytie (revision 5274918) Byzantská ríša (revision 6359782) Caroline Blundenová (revision 6358810) Cauchyho postupnosť (revision 6215169) Celé číslo (revision 6302805) Charles Hermite (revision 5751036) Daniel Marcus (revision 5657431) David Hilbert (revision 5968866) Dedukcia (revision 6338099) Definícia (revision 6106684) Derivácia (funkcia) (revision 5970574) Desiatková číselná sústava (revision 5924486) Diofantická rovnica (revision 6327292) Dynastia Chan (revision 6342042) Dôkaz (logika) (revision 5495754) Dôkaz sporom (revision 5940134) Dôkaz výpočtom (revision 6358810) Energia (revision 6277761) Eric Weisstein (revision 6054413) Ernst Kummer (revision 6001344) Európa (revision 6295124) Experiment (revision 6354302) Fenomén (filozofia) (revision 5420897) Filozofia (revision 6296369) Formula (logika) (revision 3916562) Formálny dôkaz (revision 6358810) Formálny jazyk (revision 5623029) Gabriel Cramer (revision 5923903) Galoisova teória (revision 6353573) Gentzenovský kalkul (revision 6358810) Geometria (revision 5970028) Geometrický dôkaz (revision 6358810) Georg Ferdinand Cantor (revision 6186696) Giordano Bruno (revision 6312876) Gottlob Frege (revision 5968855) Gödelova veta o neúplnosti (revision 5323549) Hardvér (revision 6214401) Henri Poincaré (revision 6315506) Hilbertovský kalkul (revision 6358810) Hmotnosť (revision 5979540) Hypotéza (revision 5983410) Idea (revision 5960449) India (revision 6362189) Intuícia (revision 5837951) Jazyk (lingvistika) (revision 6073293) John Taylor (revision 6355518) Kardinálne číslo (revision 6090126) Kenneth Appel (revision 5968422) Klasická mechanika (revision 6295646) Konečná množina (revision 5276494) Konfucianizmus (revision 5968816) Kresťanstvo (revision 6289571) Langlandsov program (revision 6088475) Latinčina (revision 6121105) Leonhard Euler (revision 6339382) Lineárna algebra (revision 5473535) Logická axióma (revision 5495754) Logický kalkul (revision 1608550) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-21 13:33:10.330458 62 characters appeared 550293 times. First 45 characters: [ 0] Char o: 8.867094438780795 % [ 1] Char a: 8.59705647718579 % [ 2] Char e: 8.562347694773512 % [ 3] Char n: 6.0867574183207855 % [ 4] Char i: 5.828531346028389 % [ 5] Char t: 5.366595613609477 % [ 6] Char r: 4.977711873492848 % [ 7] Char k: 4.264273759615332 % [ 8] Char s: 4.257731790155426 % [ 9] Char v: 4.117079446767449 % [10] Char l: 3.5979014815743615 % [11] Char d: 3.416361829061972 % [12] Char m: 3.2513588215732345 % [13] Char p: 2.878466562358598 % [14] Char u: 2.5987973679476206 % [15] Char c: 2.419438371921867 % [16] Char z: 2.127412124086623 % [17] Char h: 2.0687161203213558 % [18] Char j: 2.0312815173007834 % [19] Char y: 1.6700194260148686 % [20] Char b: 1.6574806512167153 % [21] Char á: 1.6422160558102683 % [22] Char ý: 1.2564215790497062 % [23] Char í: 1.1326693234331529 % [24] Char č: 0.9473135220691523 % [25] Char é: 0.8913433389121795 % [26] Char ž: 0.7668641978000811 % [27] Char ú: 0.6949025337411161 % [28] Char š: 0.6785476100913513 % [29] Char f: 0.6514711253822963 % [30] Char g: 0.6096752093884531 % [31] Char ť: 0.46375294615777407 % [32] Char ô: 0.4172322744428877 % [33] Char ľ: 0.36053520579036985 % [34] Char x: 0.23114958758334195 % [35] Char ó: 0.2251527822450949 % [36] Char ň: 0.09304134342977287 % [37] Char w: 0.09013380144759246 % [38] Char ä: 0.0694175648245571 % [39] Char ď: 0.06560141597294532 % [40] Char q: 0.01726353051919614 % [41] Char ě: 0.009994675563745132 % [42] Char ĺ: 0.009267790068200032 % [43] Char ö: 0.008904347320427481 % [44] Char ŕ: 0.00599680533824708 % The first 45 characters have an accumulated ratio of 0.9998128269848972. 1181 sequences found. First 512 (typical positive ratio): 0.9733303573968434 Next 512 (512-1024): 1.8172137388627513e-06 Rest: 0.0003522983638913346 - Processing end: 2016-09-21 13:33:10.831531 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangSloveneModel.log ================================================ = Logs of language model for Slovene (sl) = - Generated by BuildLangModel.py - Started: 2016-09-28 22:00:35.243966 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == XCOM: Enemy Unknown (revision 4704271) 1UP.com (revision 4547348) 2K Games (revision 4110089) Android (operacijski sistem) (revision 4619359) Animator videoigre (revision 4702643) App Store (revision 3903089) Artefakt (revision 4484504) Athlon (revision 4524746) Avstralazija (revision 4623530) Avtopsija (revision 4541344) Bralno-pisalni pomnilnik (revision 4256388) Civilization (serija) (revision 4645770) Deus Ex: Human Revolution (revision 4694860) Digitalna distribucija (revision 4696215) DirectX (revision 4477913) Dishonored (revision 4619444) Edge (magazine) (revision 4690049) Electronic Entertainment Expo (revision 4538691) Enoigralska videoigra (revision 4610359) Eurogamer (revision 4694860) Evropa (revision 4687833) Fantasy Flight Games (revision 4649361) Firaxis Games (revision 4110089) GameRankings (revision 3934020) GameSpot (revision 4238015) GameSpy (revision 4538691) GameTrailers (revision 4704271) Game Informer (revision 4704271) GamesTM (revision 4704271) Grafična kartica (revision 4257980) Granata (revision 3859332) Holograf (revision 4477482) IGN (revision 4576233) IOS (revision 4597264) Igra igranja vlog (revision 4642276) Igra na deski (revision 4649363) Igralna konzola (revision 4649866) Igralni pogon (revision 4622773) Intel (revision 4626025) International Standard Book Number (revision 4015087) Izdelovalec videoigre (revision 3851747) Joker (revija) (revision 3867772) Kotaku (revision 4613535) Kristal (revision 4156234) Linux (revision 4524740) Lovec prestreznik (revision 4102792) MTV (revision 4621758) Mac OS X (revision 4601645) Machinima (revision 4601716) Major (revision 4245802) Mednarodna različica (revision 4116054) Metacritic (revision 3934020) Michael McCann (skladatelj) (revision 4694860) MicroProse (revision 4382810) Microsoft Windows (revision 4691357) Nezemeljsko življenje (revision 4620576) NowGamer (revision 4704271) OS X (revision 4601645) Ognjena ekipa (revision 4694450) Operacijski sistem (revision 4698515) Ostrostrelec (revision 4529694) Pilot (revision 4069093) PlayStation 3 (revision 4382944) PlayStation Network (revision 4382944) PlayStation Vita (revision 3944025) Pogon igre (revision 4622773) Procesor (revision 4702518) Producent videoiger (revision 4599904) Razvijalec videoiger (revision 4093281) Računalniška miška (revision 4385579) Računalniška platforma (revision 4673669) Severna Amerika (revision 4643798) Sid Meier (revision 4061487) Stealth (revision 4618630) Steam (revision 4696215) Strateška videoigra (revision 4236795) Tablični računalnik (revision 4409985) Take-Two Interactive (revision 4110089) Telepatija (revision 4481192) The Bureau: XCOM Declassified (revision 4704271) The Guardian (revision 3929479) Trdi disk (revision 4644623) UFO: Enemy Unknown (revision 4704271) Unreal Engine (revision 4622773) Unreal Engine 3 (revision 4622773) Uporabniški vmesnik (revision 4552473) Valve Corporation (revision 4110105) Večigralska videoigra (revision 4618639) VideoGamer.com (revision 4704271) Vohunski satelit (revision 4215166) Vojaška taktika (revision 3970259) Vojaški čini (revision 4363026) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-28 22:06:46.133919 41 characters appeared 411226 times. First 29 characters: [ 0] Char a: 10.090315301075321 % [ 1] Char e: 9.90477255815537 % [ 2] Char i: 9.666703953543793 % [ 3] Char o: 9.177921629468953 % [ 4] Char n: 7.28309980400072 % [ 5] Char r: 5.808241696779873 % [ 6] Char s: 4.575586174025961 % [ 7] Char t: 4.4963110309173056 % [ 8] Char j: 4.343840126840229 % [ 9] Char l: 4.2672399118732764 % [10] Char v: 3.802775116359374 % [11] Char p: 3.5216644861949393 % [12] Char k: 3.5136397017698293 % [13] Char d: 3.0387183689747244 % [14] Char m: 2.9487435132992563 % [15] Char z: 2.350775485985808 % [16] Char u: 1.9719083910064055 % [17] Char g: 1.9342162217369525 % [18] Char b: 1.5392995579073308 % [19] Char c: 1.2924766430138173 % [20] Char h: 1.1864522184881305 % [21] Char č: 1.137087635509428 % [22] Char š: 0.6932927392723223 % [23] Char ž: 0.45303555709026183 % [24] Char f: 0.40707542811009034 % [25] Char x: 0.19381070263067024 % [26] Char y: 0.19040624863213904 % [27] Char w: 0.18919037220409216 % [28] Char q: 0.011186063138031156 % The first 29 characters have an accumulated ratio of 0.9998978663800442. 727 sequences found. First 512 (typical positive ratio): 0.9983524317161332 Next 512 (512-1024): 2.4317528560937295e-06 Rest: -3.859759734048396e-17 - Processing end: 2016-09-28 22:06:46.601266 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangSpanishModel.log ================================================ = Logs of language model for Spanish (es) = - Generated by BuildLangModel.py - Started: 2015-12-12 18:37:37.085123 - Maximum depth: 2 - Max number of pages: 50 == Parsed pages == Wikipedia:Portada (revision 84894710) 11 de diciembre (revision 87735970) 12 de diciembre (revision 87742023) 13 de diciembre (revision 87697780) 1474 (revision 66715698) 1915 (revision 86935345) 2000 (revision 87686385) 2015 (revision 87743360) Actuación (revision 87459085) Akiyuki Nosaka (revision 87726149) Alberto Podestá (revision 87729965) Alejandro Magno (revision 87717064) Argentina (revision 87742018) Arnold Peralta (revision 87733100) Atentados del 11 de diciembre de 2007 (revision 87720544) Cantante (revision 86761085) Canto (revision 87664585) Carlo Furno (revision 87726011) Ciencia ficción (revision 87662615) Copa Mundial de Clubes de la FIFA 2015 (revision 87734956) Corona de Castilla (revision 87209578) Crisis migratoria en Europa (revision 87609406) Dictadura de Primo de Rivera (revision 87371131) Dionisio Miguel Recio (revision 87724426) Disneyland (revision 87665192) Dolph Schayes (revision 87730770) Día Internacional de las Montañas (revision 87739490) El discurso del rey (revision 87570241) Elecciones regionales de Francia de 2015 (revision 87744011) Estados Unidos (revision 87510736) Fiction House (revision 87732511) Filoxeno de Eretria (revision 83958621) Frank Sinatra (revision 87742871) Fundación Wikimedia (revision 87703852) Geoffrey Marcy (revision 87706505) Gheorghe Gruia (revision 87737327) Grupo de Acción Republicana (revision 87739104) Guerra contra el Estado Islámico (revision 87648946) Here We Go Again (canción) (revision 87680365) Isaac Asimov (revision 87591711) Isabel I de Castilla (revision 87743713) John "Hot Rod" Williams (revision 87730438) José Subirà-Puig (revision 87740413) Julio Terrazas Sandoval (revision 87736542) Libertad Lamarque (revision 87508996) Mosaico de Issos (revision 87731652) Museo Arqueológico Nacional de Nápoles (revision 87302262) Philip K. Dick (revision 87725371) Planet Comics (revision 86698920) == End of Parsed pages == - Wikipedia parsing ended at: 2015-12-12 18:39:02.288858 52 characters appeared 991829 times. First 33 characters: [ 0] Char e: 12.571925200815867 % [ 1] Char a: 11.81988024145291 % [ 2] Char o: 8.07941691561751 % [ 3] Char n: 7.234513207417812 % [ 4] Char s: 7.042242160695039 % [ 5] Char i: 7.040528155559072 % [ 6] Char r: 6.8208330266608455 % [ 7] Char l: 5.722559029832763 % [ 8] Char d: 5.275707808503281 % [ 9] Char t: 4.668647518876742 % [10] Char c: 4.466999855821921 % [11] Char u: 3.673717949364255 % [12] Char m: 2.710547886782903 % [13] Char p: 2.4541528832086983 % [14] Char b: 1.3867309788280036 % [15] Char g: 1.2748165258325779 % [16] Char f: 0.925058654263991 % [17] Char y: 0.9045914164639268 % [18] Char v: 0.8877538365988492 % [19] Char ó: 0.8641610600214351 % [20] Char h: 0.7369213846338432 % [21] Char q: 0.5913317719082624 % [22] Char í: 0.5612862701130941 % [23] Char j: 0.43283670874717317 % [24] Char z: 0.38071078784750195 % [25] Char á: 0.37587124393418625 % [26] Char é: 0.29632124085905936 % [27] Char k: 0.2001353055819098 % [28] Char x: 0.18743150280945606 % [29] Char ñ: 0.17462687620547493 % [30] Char ú: 0.12865120902897575 % [31] Char w: 0.0972949974239511 % [32] Char ü: 0.004436248587206061 % The first 33 characters have an accumulated ratio of 0.9999263986029848. 897 sequences found. First 512 (typical positive ratio): 0.9970385677528184 Next 512 (512-1024): 1.0082383152741046e-06 Rest: 4.597017211338539e-17 - Processing end: 2015-12-12 18:39:02.460105 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangSwedishModel.log ================================================ = Logs of language model for Swedish (sv) = - Generated by BuildLangModel.py - Started: 2016-09-28 22:26:37.221506 - Maximum depth: 5 - Max number of pages: 100 == Parsed pages == Kakapo (revision 36509929) Akut hotad (revision 32517788) Aotearoa (revision 36575359) Art (revision 36771341) Artepitet (revision 36771341) Auckland (revision 35752058) Auktorsnamn (revision 35976965) BBC (revision 36508743) Basalomsättning (revision 30567523) Beilschmiedia tawa (revision 29101923) Berguv (revision 36295501) Betesmark (revision 34292168) Biotop (revision 35528052) BirdLife International (revision 36124283) Bonaparte (revision 37325183) British Museum (revision 36420244) Bröstben (revision 30602527) Dacrydium cupressinum (revision 32986501) Digital object identifier (revision 27637223) Djur (revision 37300775) Djurpark (revision 37147093) Domän (biologi) (revision 33377709) Don Merton (revision 36509929) Douglas Adams (revision 36556245) Däggdjur (revision 37328286) Ekologisk nisch (revision 33898643) Ekosystem (revision 36598266) Endemisk (revision 30647109) Eukaryoter (revision 37095313) Evolution (revision 37093592) Familj (biologi) (revision 30280200) Femininum (revision 30597527) Fjäder (biologi) (revision 36364943) Fjäderdräkt (revision 36364943) Fladdermöss (revision 37307257) Flygg (revision 36479633) Frukter (revision 34088588) Frö (revision 37333131) Fågelläte (revision 34034723) Fåglar (revision 37387306) Fåglarnas liv (revision 36509929) Genitiv (revision 37388438) George Edward Grey (revision 36509929) George Robert Gray (revision 20426710) Haasts örn (revision 29175076) Hauturu/Little Barrier Island (revision 36509929) Hermelin (revision 36578682) Hertz (revision 37104488) Hjortdjur (revision 36493550) Hund (revision 37351832) Husdjur (revision 37384850) Huskatt (revision 32922967) Hāngi (revision 29609696) IUCN (revision 30570280) Iller (revision 30663158) Infraröd (revision 36770733) Internationella naturvårdsunionen (revision 30570280) Jordbruk (revision 37352625) Kahurangi National Park (revision 35956142) Kamouflage (revision 36579595) Kaniner (revision 36877621) Kapiti Island (revision 37395588) Katt (revision 36734686) Kelp (revision 30312471) Kivier (revision 36373234) Klass (biologi) (revision 30280201) Kroppsfett (revision 35066611) Könsdimorfism (revision 30816932) Könsfördelning (revision 24769321) Lamm- och fårkött (revision 36187205) Lek (fortplantningsbeteende) (revision 30508235) Mandel (revision 36577529) Maori (revision 32560474) Maorier (revision 35862066) Maoripapegojor (revision 36545138) Mark Carwardine (revision 20375916) Markpapegoja (revision 36295722) Maskulinum (revision 32704551) Masterton (revision 29859631) Metrosideros umbellata (revision 29071212) Milford Sound (revision 20284758) Morrhår (revision 36533839) Muskelmage (revision 31196380) Mustela (revision 20934105) Mårddjur (revision 37306347) Māori (revision 32560474) NHNZ (revision 36509929) Nattpapegoja (revision 33486517) Nordön (revision 24810231) Nya Zeeland (revision 36575359) Näbb (revision 23648463) Ollonår (revision 36509929) Ordning (biologi) (revision 30280196) == End of Parsed pages == - Wikipedia parsing ended at: 2016-09-28 22:29:21.480287 48 characters appeared 594415 times. First 31 characters: [ 0] Char a: 10.070741821791172 % [ 1] Char e: 9.737136512369304 % [ 2] Char r: 9.110638190489809 % [ 3] Char n: 8.378826240925951 % [ 4] Char t: 7.481305148759705 % [ 5] Char s: 5.828587771169974 % [ 6] Char i: 5.359891658184939 % [ 7] Char l: 5.173489901836259 % [ 8] Char o: 4.694195133029954 % [ 9] Char d: 4.597293136949774 % [10] Char k: 3.297359588839447 % [11] Char m: 3.1898589369379975 % [12] Char g: 3.004466576381821 % [13] Char v: 2.2324470277499726 % [14] Char f: 2.1988005013332437 % [15] Char p: 2.06017681249632 % [16] Char u: 2.0499146219392173 % [17] Char ä: 2.0475593650900468 % [18] Char h: 2.028380845032511 % [19] Char å: 1.5443755625278637 % [20] Char c: 1.442594820117258 % [21] Char ö: 1.3515809661600062 % [22] Char b: 1.268642278542769 % [23] Char j: 0.7302978558751041 % [24] Char y: 0.6699023409570755 % [25] Char x: 0.2111319532649748 % [26] Char w: 0.10262190557102362 % [27] Char z: 0.09151855185350302 % [28] Char é: 0.021197311642539303 % [29] Char ā: 0.011103353717520588 % [30] Char q: 0.007570468443764037 % The first 31 characters have an accumulated ratio of 0.999936071599808. 748 sequences found. First 512 (typical positive ratio): 0.997323508584682 Next 512 (512-1024): 1.6823263208364526e-06 Rest: 1.7780915628762273e-17 - Processing end: 2016-09-28 22:29:21.590354 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangThaiModel.log ================================================ = Logs of language model for Thai (th) = - Generated by BuildLangModel.py - Started: 2015-12-04 03:01:52.148282 - Maximum depth: 3 - Max number of pages: 50 == Parsed pages == หน้าหลัก (revision 5512633) 26 พฤศจิกายน (revision 5570053) 27 พฤศจิกายน (revision 5888433) 28 พฤศจิกายน (revision 6110206) กล้องโทรทรรศน์อวกาศฮับเบิล (revision 5830742) การประชุมสภาสงฆ์แห่งแคลมงต์ (revision 5463877) ความเอนเอียงเพื่อยืนยัน (revision 6231756) คัมภีร์พระเวท (revision 6109417) คาบสมุทรไซนาย (revision 5661104) จักรวรรดิโรมันตะวันออก (revision 6150148) ชาวมุสลิม (revision 6242838) ซุคฮอย ซู-24 (revision 6015891) ดาวอังคาร (revision 6235017) ดาวเคราะห์นอกระบบ (revision 5823077) ดินแดนศักดิ์สิทธิ์ (revision 6179072) ทฤษฎี (revision 5606447) ทะกะอะกิ คะจิตะ (revision 6177601) ท่าอากาศยานนานาชาติตริภูวัน (revision 6010470) นกกาเหว่า (revision 6142782) ประเทศอัฟกานิสถาน (revision 6216996) ประเทศเนปาล (revision 6206980) ปรากฏการณ์การวางกรอบ (revision 6046655) ปารีส (revision 6222115) พ.ศ. 1638 (revision 4723508) พ.ศ. 2438 (revision 5737055) พ.ศ. 2515 (revision 6197082) พ.ศ. 2544 (revision 6189598) พินัยกรรม (revision 5607889) มูลนิธิวิกิมีเดีย (revision 5816103) ระบบสุริยะ (revision 6201228) รางวัลโนเบล (revision 5828030) รางวัลโนเบลสาขาฟิสิกส์ (revision 6177103) รายชื่อบทความวันนี้ในอดีต (revision 5410610) ลักกีสไตรก์ (เพลง) (revision 6195816) ลุฟต์ฮันซา (revision 6116038) วิกฤตการณ์ผู้ย้ายถิ่นยุโรป (revision 6219634) วิกิพีเดีย (revision 6086299) วิกิพีเดียภาษาไทย (revision 6209148) สงครามครูเสด (revision 6228828) สงครามอังกฤษ–แซนซิบาร์ (revision 5829349) สติ (จิตวิทยา) (revision 6039161) สมมติฐาน (revision 6221744) สมเด็จพระราชินีมารีแห่งโรมาเนีย (revision 6211695) สมเด็จพระสันตะปาปาเออร์บันที่ 2 (revision 5828365) สารานุกรม (revision 6070482) อัลเฟรด โนเบล (revision 6214514) อาร์เธอร์ แมคโดนัลด์ (revision 6188035) เซนต์ปีเตอร์สเบิร์ก (revision 6162201) เทือกเขาฮินดูกูช (revision 5218921) เนื้อหาเสรี (revision 6160507) == End of Parsed pages == - Wikipedia parsing ended at: 2015-12-04 03:05:06.181487 105 characters appeared 401052 times. First 64 characters: [ 0] Char า: 8.857704237854442 % [ 1] Char น: 6.7679502907353655 % [ 2] Char ร: 6.739026360671434 % [ 3] Char ก: 5.388079351306065 % [ 4] Char อ: 5.099837427565503 % [ 5] Char ง: 4.861713692987443 % [ 6] Char เ: 4.5198627609387305 % [ 7] Char ม: 4.133628556895365 % [ 8] Char ว: 3.864336794231172 % [ 9] Char ด: 3.3152808114658447 % [10] Char ย: 3.195844927839781 % [11] Char ล: 3.1312647736453125 % [12] Char ท: 2.69615910156289 % [13] Char ส: 2.6001615750575984 % [14] Char ะ: 2.392457835891605 % [15] Char ค: 2.384229476476866 % [16] Char บ: 2.3321165335168503 % [17] Char ต: 2.196473275285998 % [18] Char ห: 1.983782651626223 % [19] Char ป: 1.9192024974317545 % [20] Char แ: 1.7813151411787 % [21] Char จ: 1.76261432432702 % [22] Char พ: 1.5075351824701035 % [23] Char ข: 1.3519443862641254 % [24] Char ใ: 1.3295034060421091 % [25] Char ไ: 1.2227840778751882 % [26] Char ช: 1.0407627938521689 % [27] Char โ: 0.9382823175049619 % [28] Char ศ: 0.8078752879925796 % [29] Char ำ: 0.7393056262030859 % [30] Char ถ: 0.599672860377208 % [31] Char ซ: 0.541076967575277 % [32] Char e: 0.43734977010462484 % [33] Char ผ: 0.43585370475649043 % [34] Char ณ: 0.4019428901987772 % [35] Char a: 0.3897250231890129 % [36] Char i: 0.3657879776188624 % [37] Char ษ: 0.3647906007201061 % [38] Char ภ: 0.34185093204871186 % [39] Char ธ: 0.3181632307032505 % [40] Char o: 0.3176645422538723 % [41] Char n: 0.3139243788835363 % [42] Char ญ: 0.29248077556027646 % [43] Char r: 0.28350438347147006 % [44] Char t: 0.2705384837876385 % [45] Char s: 0.2488455362396896 % [46] Char l: 0.19598456060560726 % [47] Char ฟ: 0.19473783948216192 % [48] Char c: 0.16356981139602844 % [49] Char ฐ: 0.15833358267755804 % [50] Char ฤ: 0.15284800973439852 % [51] Char ๆ: 0.14910784636406252 % [52] Char d: 0.13090571796176056 % [53] Char ฮ: 0.1244227681198448 % [54] Char h: 0.12043326052481973 % [55] Char u: 0.12043326052481973 % [56] Char m: 0.09599752650529109 % [57] Char y: 0.08951457666337533 % [58] Char ฏ: 0.08677179019179557 % [59] Char p: 0.08253293837208142 % [60] Char f: 0.08153556147332515 % [61] Char S: 0.07604998853016566 % [62] Char ฝ: 0.07330720205858592 % [63] Char ฉ: 0.0673229406660483 % The first 64 characters have an accumulated ratio of 0.989480167160368. 2324 sequences found. First 512 (typical positive ratio): 0.8815720594354438 Next 512 (512-1024): 7.480326740672033e-06 Rest: 0.026341928296264486 - Processing end: 2015-12-04 03:05:06.800467 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangTurkishModel.log ================================================ = Logs of language model for Turkish (tr) = - Generated by BuildLangModel.py - Started: 2015-12-04 02:22:03.929245 - Maximum depth: 3 - Max number of pages: 50 == Parsed pages == Ana_Sayfa (revision 16293313) 1048 (revision 12894005) 1131 (revision 14840814) 16. yüzyıl (revision 15185081) 1859 (revision 16014427) 1866 (revision 16120346) 1869 (revision 12888270) 1892 (revision 13955858) 1895 (revision 15334635) 1902 (revision 16283638) 1906 (revision 15874323) 1918 (revision 16099474) 1926 (revision 16180584) 1927 (revision 15370980) 1940 (revision 15370990) 1943 (revision 16091797) 1944 (revision 16247827) 1945 (revision 16281147) 1948 (revision 15443886) 1961 (revision 15799529) 1964 (revision 16085332) 1975 (revision 15006928) 1980 (revision 16213240) 1981 (revision 16295456) 1983 (revision 16327128) 1993 (revision 16300456) 2002 (revision 16297206) 2015 (revision 16328338) 24 Ekim (revision 16213661) 4 Aralık (revision 16341162) ABD (revision 16325951) ABD Senatosu (revision 15970439) Adam Horowitz (revision 14362106) Akçe (revision 16261547) Altın Takım (revision 13503001) American Broadcasting Company (revision 16055235) Amerika Birleşik Devletleri (revision 16325951) Ana Sayfa/Kardeş projeler (revision 16293313) Ana Sayfa/Kategoriler (revision 16293313) Aptullah Kuran (revision 15744893) Avrupa (revision 16299756) Ayasofya (revision 16305207) BM Güvenlik Konseyi (revision 16085518) Birleşmiş Milletler (revision 16258474) Budapeşte (revision 16219173) CIA (revision 16054325) Charlie Pace (revision 16129416) Cuma (revision 14197127) Desmond Hume (revision 16035300) Diğerleri (Lost) (revision 16329444) == End of Parsed pages == - Wikipedia parsing ended at: 2015-12-04 02:24:44.728803 48 characters appeared 267623 times. First 36 characters: [ 0] Char a: 12.311722086666691 % [ 1] Char e: 8.716365932673948 % [ 2] Char i: 8.507863673899479 % [ 3] Char n: 7.322987934519828 % [ 4] Char r: 6.979220769515326 % [ 5] Char l: 6.609297407173524 % [ 6] Char ı: 4.514933320379788 % [ 7] Char d: 4.3475336574210734 % [ 8] Char t: 4.2634601659797555 % [ 9] Char k: 4.240293248338147 % [10] Char s: 3.929781819948211 % [11] Char m: 3.429451130881875 % [12] Char u: 3.0998830444319063 % [13] Char y: 2.9212735826143494 % [14] Char o: 2.7135186437638024 % [15] Char b: 2.3129551645411643 % [16] Char ü: 1.8305601536489764 % [17] Char ş: 1.5988909772328985 % [18] Char z: 1.2267256551193282 % [19] Char h: 1.1983274980102607 % [20] Char v: 1.194964558352608 % [21] Char c: 1.143773143563894 % [22] Char g: 1.1004285879763698 % [23] Char p: 1.0178497363828969 % [24] Char ç: 0.8295251155543433 % [25] Char ğ: 0.8205572764672693 % [26] Char f: 0.7047226882592303 % [27] Char ö: 0.6710932916827029 % [28] Char j: 0.1296600068006113 % [29] Char w: 0.11359262843627041 % [30] Char â: 0.07846859201189733 % [31] Char î: 0.04147625577771716 % [32] Char x: 0.024287897527492032 % [33] Char é: 0.014946398478456635 % [34] Char q: 0.01083613889688106 % [35] Char û: 0.009341499049035397 % The first 36 characters have an accumulated ratio of 0.99980569681978. 935 sequences found. First 512 (typical positive ratio): 0.991865243864388 Next 512 (512-1024): 3.7365996196141585e-06 Rest: 2.949029909160572e-17 - Processing end: 2015-12-04 02:24:44.883537 ================================================ FILE: third_party/uchardet/uchardet/script/BuildLangModelLogs/LangVietnameseModel.log ================================================ = Logs of language model for Vietnamese (vi) = - Generated by BuildLangModel.py - Started: 2016-02-13 03:37:17.480303 - Maximum depth: 3 - Max number of pages: 40 == Parsed pages == Chữ_Quốc_ngữ (revision 22887853) 1651 (revision 21455247) 1773 (revision 21354755) 1815 (revision 21361292) 1838 (revision 21361314) 1865 (revision 21361338) 1869 (revision 21361342) 1888 (revision 21389506) 1902 (revision 21354811) 1918 (revision 21354828) 1919 (revision 21354829) 1938 (revision 21354849) 1945 (revision 21354857) 22 tháng 2 (revision 21376086) 26 tháng 11 (revision 22579845) 28 tháng 12 (revision 22475308) A (revision 22549334) ASCII (revision 22528409) Alexandre de Rhodes (revision 22859954) Antonio Barbosa (revision 22145269) B (revision 22836557) BBC (revision 22863903) Biên khảo (revision 22531516) Bán nguyên âm (revision 22655600) Bình luận (revision 22117664) Bảng chữ cái Bồ Đào Nha (revision 22887853) Bảng chữ cái Hy Lạp (revision 21362081) Bảng chữ cái Latinh (revision 22442448) Bắc Kỳ (revision 22393289) Bồ Đào Nha (revision 22620858) C (revision 21341881) Cao Xuân Dục (revision 22620201) Chính tả (revision 22187359) Chính tả tiếng Việt (revision 20897580) Chữ Hán (revision 22889609) Chữ Nôm (revision 22781506) Chữ cái (revision 22169220) Công giáo (revision 22173119) D (revision 21447691) == End of Parsed pages == - Wikipedia parsing ended at: 2016-02-13 03:42:06.560479 101 characters appeared 222814 times. First 55 characters: [ 0] Char n: 11.262308472537633 % [ 1] Char h: 8.881398834902654 % [ 2] Char t: 7.022898022565907 % [ 3] Char c: 6.365398942615815 % [ 4] Char i: 6.198443544840091 % [ 5] Char g: 5.591210606155808 % [ 6] Char a: 3.5998635633308496 % [ 7] Char u: 2.8499106878382867 % [ 8] Char m: 2.615185760320267 % [ 9] Char o: 2.6012728105056238 % [10] Char đ: 2.222032726848403 % [11] Char r: 2.1102803234985235 % [12] Char à: 2.0447548179198796 % [13] Char v: 1.9437737305555307 % [14] Char l: 1.9119085874316697 % [15] Char á: 1.7539292863105551 % [16] Char p: 1.6453185167897888 % [17] Char b: 1.541195795596327 % [18] Char ư: 1.4397659033992478 % [19] Char s: 1.3760356171515256 % [20] Char y: 1.280440187779942 % [21] Char e: 1.2454334108269678 % [22] Char d: 1.1251537156552103 % [23] Char ế: 1.071745940560288 % [24] Char k: 1.0695019163966357 % [25] Char â: 0.9658280000359044 % [26] Char ữ: 0.9604423420431392 % [27] Char ê: 0.8374698178749989 % [28] Char ệ: 0.7459136319979893 % [29] Char ô: 0.7073164163831717 % [30] Char ạ: 0.6727584442629277 % [31] Char ộ: 0.6705144200992756 % [32] Char ố: 0.6476253736300233 % [33] Char ó: 0.6072329386842837 % [34] Char ả: 0.5484395055965963 % [35] Char ủ: 0.5475418959311353 % [36] Char q: 0.5138815334763525 % [37] Char ợ: 0.48560682901433483 % [38] Char ờ: 0.4851580241816044 % [39] Char ể: 0.4748355130288043 % [40] Char ớ: 0.4676546357051173 % [41] Char ấ: 0.418286104104769 % [42] Char ị: 0.40212913012647317 % [43] Char ầ: 0.3904602044754818 % [44] Char ọ: 0.3801376933226817 % [45] Char ề: 0.3787912788244904 % [46] Char ơ: 0.3590438661843511 % [47] Char í: 0.35679984202069887 % [48] Char ụ: 0.35276059852612496 % [49] Char ậ: 0.3469261357006292 % [50] Char ì: 0.32762752789322036 % [51] Char ă: 0.3253835037295682 % [52] Char ứ: 0.29665999443482005 % [53] Char ồ: 0.29665999443482005 % [54] Char x: 0.2939671654384374 % The first 55 characters have an accumulated ratio of 0.9603301408349568. 1494 sequences found. First 512 (typical positive ratio): 0.9321889118082535 Next 512 (512-1024): 0.009604423420431392 Rest: 0.0068905733918831966 - Processing end: 2016-02-13 03:42:07.174723 ================================================ FILE: third_party/uchardet/uchardet/script/README ================================================ # Supporting new or Updating languages # We generate statistical language data using Wikipedia as natural language text resource. Right now, we have automated scripts only to generate statistical data for single-byte encodings. Multi-byte encodings usually requires more in-depth knowledge of its specification. ## New single-byte encoding ## Uchardet uses language data, and therefore rather than supporting a charset, we in fact support a couple (language, charset). So for instance if uchardet supports (French, ISO-8859-15), it should be able to recognize French text encoded in ISO-8859-15, but may fail at detecting ISO-8859-15 for non-supported languages. This is why, though less flexible, it also makes uchardet much more accurate than other detection system, as well as making it an efficient language recognition system. Since many single-byte charsets actually share the same layout (or very similar ones), it is actually impossible to have an accurate single-byte encoding detector for random text. Therefore you need to describe the language and the codepoint layouts of every charset you want to add support for. I recommend having a look at langs/fr.py which is heavily commented as a base of a new language description, and charsets/windows-1252.py as a base for a new charset layout (note that charset layouts can be shared between languages. If yours is already there, you have nothing to do). The important name in the charset file are: - `name`: an iconv-compatible name. - `charmap`: fill it with CTR (control character), SYM (symbol), NUM (number), LET (letter), ILL (illegal codepoint). ## Tools ## You must install Python 3 and the [`Wikipedia` Python tool](https://github.com/goldsmith/Wikipedia). ## Run script ## Let's say you added (or modified) support for French (`fr`), run: > ./BuildLangModel.py fr --max-page=100 --max-depth=4 The options can be changed to any value. Bigger values mean the script will process more data, so more processing time now, but uchardet may possibly be more accurate in the end. ## Updating core code ## If you were only updating data for a language model, you have nothing else to do. Just build `uchardet` again and test it. If you were creating new models though, you will have to add these in src/nsSBCSGroupProber.cpp and src/nsSBCharSetProber.h, and increase the value of `NUM_OF_SBCS_PROBERS` in src/nsSBCSGroupProber.h. Finally add the new file in src/CMakeLists.txt. I will be looking to make this step more straightforward in the future. ================================================ FILE: third_party/uchardet/uchardet/script/charsets/codepoints.py ================================================ #!/usr/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### # Illegal codepoints. ILL = 255 # Control characters CTR = 254 # Symbols and punctuations. SYM = 253 # Return/Line feeds. RET = 252 # Numbers 0-9. NUM = 251 # Letters (should be all the rest). LET = 0 ================================================ FILE: third_party/uchardet/uchardet/script/charsets/db.py ================================================ #!/usr/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import importlib import sys import os def load(charset_names): ''' Load a list of charsets. This function will return a dictionary of charsets from our charset database. :param charset_names: a list of supported charset names. :return: a dictionary with all the loaded charsets. :rtype: dict ''' charsets = {} # Temporarily change the search path for modules. sys_path_backup = sys.path current_dir = os.path.dirname(os.path.realpath(__file__)) sys.path = [current_dir + '/../charsets'] for name in charset_names: try: charset = importlib.import_module(name.lower()) except ImportError: print('Unknown charset "{}": ' 'file "charsets/{}.py" does not exist.'.format(name, name.lower())) exit(1) charsets[charset.name] = charset # Set back the default module paths. sys.path = sys_path_backup return charsets ================================================ FILE: third_party/uchardet/uchardet/script/charsets/ibm852.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'IBM852' aliases = ['CP852'] language = \ { 'complete': [ 'bs', 'hr', 'cs', 'de', 'hu', 'pl', 'sr', 'sk', 'sl', 'hsb', 'dsb', 'tk' ], 'incomplete': [ 'ro' ] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 8X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,LET, # 9X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,SYM,SYM, # AX SYM,SYM,SYM,SYM,SYM,LET,LET,LET,LET,SYM,SYM,SYM,SYM,LET,LET,SYM, # BX SYM,SYM,SYM,SYM,SYM,SYM,LET,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # CX LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,LET,LET,SYM, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM, # EX SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET,LET,LET,SYM,SYM, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-1.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * # ISO-8859-1 is the full 8-bit range, IANA-defined, superset of ISO/CEI 8859-1. # It is basically the same as ISO/CEI 8859-1, but with control characters. # As far as I can see, `iconv` has no support for the ISO/CEI 8859-1 subset, # so there is no need for us to support it anyway. name = 'ISO-8859-1' aliases = ['ISO_8859-1:1987', 'ISO_8859-1', 'iso-ir-100', 'csISOLatin1', 'latin1', 'l1', 'IBM819', 'CP819'] language = \ { # Languages with complete coverage. # Some languages actually have several alphabets and only one of them is # compatible with ISO-8859-1 (ex: Kurdish). # Some don't have a ISO language code (like Leonese, for which I used # a Glottolog code). 'complete': [ 'af', 'sq', 'eu', 'br', 'co', 'da', 'en', 'fo', 'gl', 'de', 'is', 'id', 'it', 'ku', 'leon1250', 'lb', 'ms', 'gv', 'no', 'oc', 'pt', 'rm', 'gd', 'es', 'sw', 'sv', 'wa' ], 'incomplete': [ 'ca', 'cs', 'nl', 'et', 'fi', 'fr', 'gn', 'hu', 'ga', 'la', 'mi', 'ro', 'tr', 'cy' ] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # AX SYM,SYM,SYM,SYM,SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-10.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'ISO-8859-10' aliases = ['ISO_8859-10:1992', 'ISO_8859-10', 'iso-ir-157', 'csISOLatin6', 'latin6', 'l6'] language = \ { # Nordic languages. Supersedes ISO-8859-4. 'complete': [ 'et', 'lv', 'lt', 'kl', 'saam1281' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,SYM,LET,LET, # AX SYM,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-11.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * # ISO-8859-1 is the full 8-bit range, IANA-defined, superset of ISO/CEI 8859-1. # It is basically the same as ISO/CEI 8859-1, but with control characters. # As far as I can see, `iconv` has no support for the ISO/CEI 8859-1 subset, # so there is no need for us to support it anyway. name = 'ISO-8859-11' aliases = [] language = \ { # Designed for Thai language. 'complete': ['th'], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # AX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,SYM,LET,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,ILL,ILL,ILL,SYM, # DX LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET, # EX NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,LET,LET,ILL,ILL,ILL,ILL, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-13.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'ISO-8859-13' aliases = ['csISO885913'] language = \ { # Designed to cover Baltic languages. 'complete': [ 'lv', 'lt' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,LET,SYM,SYM,SYM,SYM,LET, # AX SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,LET,SYM,SYM,SYM,SYM,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,SYM, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-15.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * # ISO-8859-15 is the full 8-bit range, IANA-defined, superset of ISO/CEI 8859-15. # It is basically the same as ISO/CEI 8859-15, but with control characters. # As far as I can see, `iconv` has no support for the ISO/CEI 8859-15 subset, # so there is no need for us to support it anyway. name = 'ISO-8859-15' aliases = ['ISO_8859-15', 'csISO885915', 'Latin-9'] language = \ { # Languages with complete coverage. 'complete': [ 'af', 'sq', 'br', 'ca', 'da', 'nl', 'en', 'et', 'fo', 'fi', 'fr', 'gl', 'de', 'is', 'ga', 'it', 'ku', 'la', 'lb', 'ms', 'no', 'oc', 'pt', 'rm', 'gd', 'sco', 'es', 'sw', 'sv', 'tl', 'wa' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # AX SYM,SYM,SYM,SYM,LET,LET,SYM,SYM,LET,SYM,SYM,SYM,LET,LET,LET,SYM, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-16.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * # ISO-8859-1 is the full 8-bit range, IANA-defined, superset of ISO/CEI 8859-1. # It is basically the same as ISO/CEI 8859-1, but with control characters. # As far as I can see, `iconv` has no support for the ISO/CEI 8859-1 subset, # so there is no need for us to support it anyway. name = 'ISO-8859-16' aliases = ['ISO_8859-16:2001', 'ISO_8859-16', 'iso-ir-226', 'csISO885916', 'latin10', 'l10'] language = \ { # Languages with complete coverage. # Some languages actually have several alphabets and only one of them is # compatible with ISO-8859-1 (ex: Kurdish). # Some don't have a ISO language code (like Leonese, for which I used # a Glottolog code). 'complete': [ 'sq', 'hr', 'hu', 'pl', 'ro', 'sr', 'sl', 'fr', 'de', 'it', 'ga' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,LET,LET,LET,SYM,SYM,LET,SYM,LET,SYM,LET,SYM,LET,SYM,LET,LET, # AX SYM,SYM,LET,LET,LET,SYM,SYM,SYM,LET,LET,LET,SYM,LET,LET,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-2.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'ISO-8859-2' aliases = ['ISO_8859-2:1987', 'ISO_8859-2', 'iso-ir-101', 'csISOLatin2', 'latin2', 'l2'] language = \ { 'complete': [ 'bs', 'hr', 'cs', 'de', 'hu', 'pl', 'sr', 'sk', 'sl', 'hsb', 'dsb', 'tk' ], 'incomplete': [ 'ro' ] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,LET,SYM,LET,SYM,LET,LET,SYM,SYM,LET,LET,LET,LET,SYM,LET,LET, # AX SYM,LET,SYM,LET,SYM,LET,LET,SYM,SYM,LET,LET,LET,LET,SYM,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,SYM, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-3.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * # ISO-8859-3 is the full 8-bit range, IANA-defined, superset of ISO/CEI 8859-3. # It is basically the same as ISO/CEI 8859-3, but with control characters. name = 'ISO-8859-3' aliases = ['ISO_8859-3:1988', 'ISO_8859-3', 'iso-ir-109', 'csISOLatin3', 'latin3', 'l3'] language = \ { # Languages with complete coverage. 'complete': [ 'eo', 'tr', 'mt' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,LET,SYM,SYM,SYM,ILL,LET,SYM,SYM,LET,LET,LET,LET,SYM,ILL,LET, # AX SYM,LET,SYM,SYM,SYM,SYM,LET,SYM,SYM,LET,LET,LET,LET,SYM,ILL,LET, # BX LET,LET,LET,ILL,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX ILL,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,ILL,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX ILL,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,SYM, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-4.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'ISO-8859-4' aliases = ['ISO_8859-2:1988', 'ISO_8859-4', 'iso-ir-110', 'csISOLatin4', 'latin4', 'l4'] language = \ { # Nordic languages. Largely superseded by ISO-8859-10. 'complete': [ 'et', 'lv', 'lt', 'kl', 'saam1281' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,LET,LET,LET,SYM,LET,LET,SYM,SYM,LET,LET,LET,LET,SYM,LET,SYM, # AX SYM,LET,SYM,LET,SYM,LET,LET,SYM,SYM,LET,LET,LET,LET,LET,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,SYM, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-6.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'ISO-8859-6' aliases = ['ISO_8859-6:1987', 'ISO_8859-6', 'iso-ir-127', 'ECMA-114', 'ASMO-708', 'arabic', 'csISOLatinArabic'] language = \ { # Dedicated to Arabic. 'complete': [ 'ar' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,ILL,ILL,ILL,SYM,ILL,ILL,ILL,ILL,ILL,ILL,ILL,SYM,SYM,ILL,ILL, # AX ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,SYM,ILL,ILL,ILL,SYM, # BX ILL,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,ILL,ILL,ILL,ILL,ILL, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # EX SYM,SYM,SYM,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-7.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'ISO-8859-7' aliases = ['ISO_8859-7:1987', 'ISO_8859-7', 'iso-ir-126', 'ELOT_928', 'ECMA-118', 'greek', 'greek8', 'csISOLatinGreek'] language = \ { # Dedicated to modern Greek. 'complete': [ 'el' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, # AX SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,LET,LET,LET,SYM,LET,SYM,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,ILL,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,ILL, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/iso-8859-9.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * # ISO-8859-5 is the full 8-bit range, IANA-defined, superset of ISO/CEI 8859-5. # It is basically the same as ISO/CEI 8859-5, but with control characters. name = 'ISO-8859-9' aliases = ['ISO_8859-9:1989', 'ISO_8859-9', 'iso-ir-148', 'csISOLatin5', 'latin5', 'l5'] language = \ { # Specifically made to cover Turkish. 'complete': [ 'tr' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # AX SYM,SYM,SYM,SYM,SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/mac-centraleurope.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'MAC-CENTRALEUROPE' aliases = [] language = \ { 'complete': [ 'bs', 'hr', 'cs', 'de', 'hu', 'pl', 'sr', 'sk', 'sl', 'hsb', 'dsb', 'tk' ], 'incomplete': [ 'ro' ] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 8X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 9X SYM,SYM,LET,SYM,SYM,SYM,SYM,LET,SYM,SYM,SYM,LET,SYM,SYM,LET,LET, # AX LET,LET,SYM,SYM,LET,LET,SYM,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # BX LET,LET,SYM,SYM,LET,LET,SYM,SYM,SYM,SYM,SYM,LET,LET,LET,LET,LET, # CX SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET,LET,LET,LET,SYM,SYM,LET,LET, # DX LET,LET,SYM,SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/tis-620.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * # ISO-8859-1 is the full 8-bit range, IANA-defined, superset of ISO/CEI 8859-1. # It is basically the same as ISO/CEI 8859-1, but with control characters. # As far as I can see, `iconv` has no support for the ISO/CEI 8859-1 subset, # so there is no need for us to support it anyway. name = 'TIS-620' aliases = [] language = \ { # Designed for Thai language. 'complete': ['th'], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 8X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 9X ILL,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # AX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,SYM,LET,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,ILL,ILL,ILL,SYM, # DX LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET, # EX NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,LET,LET,ILL,ILL,ILL,ILL, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/viscii.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'VISCII' aliases = ['csVISCII'] language = \ { # Dedicated to Vietnamese. 'complete': ['vi'], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,LET,CTR,CTR,LET,LET,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,LET,CTR,CTR,CTR,CTR,LET,CTR,CTR,CTR,CTR,LET,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 8X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 9X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # AX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/windows-1250.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'WINDOWS-1250' aliases = ['cswindows1250'] language = \ { # used under Microsoft Windows to represent texts in Central European and # Eastern European languages that use Latin script, such as Polish, Czech, # Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), # Romanian (before 1993 spelling reform) and Albanian. 'complete': [ 'pl', 'hu', 'sl', 'bs', 'hr', 'sr', 'ro', 'sq', 'de' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM,LET,SYM,LET,LET,LET,LET, # 8X ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,LET,SYM,LET,LET,LET,LET, # 9X SYM,SYM,SYM,LET,SYM,LET,SYM,SYM,SYM,SYM,LET,SYM,SYM,SYM,SYM,LET, # AX SYM,SYM,SYM,LET,SYM,SYM,SYM,SYM,SYM,LET,LET,SYM,LET,SYM,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,SYM, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/windows-1251.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # Python 3.6: needs tmp renaming Python/Lib/encodings/cp1251.py as cp1252.py ??? # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! name = 'WINDOWS-1251' aliases = ['CP-1251', 'cswindows1251'] language = \ { # Languages with complete coverage. # Basically a mix of ISO-8859-1 and ISO-8859-15. 'complete': [ 'be', 'mk', 'ru', 'sr' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X SYM,LET,SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,LET,LET,LET,LET, # 8X LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,LET,SYM,LET,LET,LET,LET, # 9X CTR,LET,LET,LET,SYM,LET,SYM,SYM,LET,SYM,LET,SYM,SYM,CTR,SYM,LET, # AX SYM,SYM,LET,LET,LET,LET,SYM,SYM,LET,SYM,LET,SYM,LET,LET,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/windows-1252.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'WINDOWS-1252' aliases = ['CP-1252', 'cswindows1252'] language = \ { # Languages with complete coverage. # Basically a mix of ISO-8859-1 and ISO-8859-15. 'complete': [ 'af', 'sq', 'eu', 'br', 'co', 'da', 'en', 'fo', 'gl', 'de', 'is', 'id', 'it', 'ku', 'leon1250', 'lb', 'ms', 'gv', 'no', 'oc', 'pt', 'rm', 'gd', 'es', 'sw', 'sv', 'wa', 'ca', 'et', 'fi', 'fr', 'ga', 'la' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X SYM,ILL,SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,LET,ILL,LET,ILL, # 8X ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,LET,ILL,LET,LET, # 9X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # AX SYM,SYM,SYM,SYM,SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/windows-1253.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'WINDOWS-1253' aliases = ['cswindows1253'] language = \ { # Greek support. 'complete': ['el'], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X SYM,ILL,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,ILL,SYM,ILL,ILL,ILL,ILL, # 8X ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,ILL,SYM,ILL,ILL,ILL,ILL, # 9X SYM,SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,SYM,SYM,SYM,SYM, # AX SYM,SYM,SYM,SYM,SYM,LET,SYM,SYM,LET,LET,LET,SYM,LET,SYM,LET,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,ILL,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,ILL, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/windows-1256.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'WINDOWS-1256' aliases = ['cswindows1256'] language = \ { # Dedicated to Arabic (and possibly some other languages that use Arabic # script, like Persian and Urdu). # Also contains some French characters for colonial historic reasons # (upper-case letters with diacritics were not included). 'complete': ['ar', 'fr', 'fa', 'ur'], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,LET,LET,LET,LET, # 8X LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,LET,SYM,LET,SYM,SYM,LET, # 9X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,LET,SYM,SYM,SYM,SYM,SYM, # AX SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX SYM,SYM,SYM,SYM,LET,SYM,SYM,SYM,SYM,LET,SYM,LET,LET,SYM,SYM,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/windows-1257.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'WINDOWS-1257' aliases = ['CP-1257'] language = \ { # Designed to support the Estonian, Latvian and Lithuanian languages. 'complete': [ 'et', 'lv', 'lt' ], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM,ILL,SYM,ILL,SYM,SYM,SYM, # 8X ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,ILL,SYM,ILL,SYM,SYM,ILL, # 9X SYM,ILL,SYM,SYM,SYM,ILL,SYM,SYM,LET,SYM,LET,SYM,SYM,SYM,SYM,LET, # AX SYM,SYM,SYM,SYM,SYM,LET,SYM,SYM,LET,SYM,LET,SYM,SYM,SYM,SYM,LET, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # CX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # EX LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,SYM, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/charsets/windows-1258.py ================================================ #!/usr/bin/python # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### from codepoints import * name = 'WINDOWS-1258' aliases = ['cswindows1258'] language = \ { # Dedicated to Vietnamese. 'complete': ['vi'], 'incomplete': [] } # X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF # charmap = \ [ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, # 0X CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, # 1X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # 2X NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, # 3X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 4X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,SYM, # 5X SYM,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET, # 6X LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,SYM,SYM,SYM,CTR, # 7X SYM,ILL,SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,LET,ILL,ILL,ILL, # 8X ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,LET,ILL,ILL,LET, # 9X SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # AX SYM,SYM,SYM,SYM,SYM,LET,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, # BX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET, # CX LET,LET,SYM,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,SYM,LET, # DX LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,LET,SYM,LET,LET,LET, # EX LET,LET,SYM,LET,LET,LET,LET,SYM,LET,LET,LET,LET,LET,LET,LET,LET, # FX ] ================================================ FILE: third_party/uchardet/uchardet/script/debug.sh ================================================ mkdir --parents debug \ && cd debug cmake \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_INSTALL_PREFIX=`pwd`/root \ .. \ && make \ && make install ================================================ FILE: third_party/uchardet/uchardet/script/gen.sh ================================================ #!/bin/bash python ./BuildLangModel.py ar --max-page=100 --max-depth=4 python ./BuildLangModel.py cs --max-page=100 --max-depth=4 python ./BuildLangModel.py da --max-page=100 --max-depth=4 python ./BuildLangModel.py de --max-page=100 --max-depth=4 python ./BuildLangModel.py el --max-page=100 --max-depth=4 python ./BuildLangModel.py eo --max-page=100 --max-depth=4 python ./BuildLangModel.py es --max-page=100 --max-depth=4 python ./BuildLangModel.py et --max-page=100 --max-depth=4 python ./BuildLangModel.py fi --max-page=100 --max-depth=4 python ./BuildLangModel.py fr --max-page=100 --max-depth=4 python ./BuildLangModel.py ga --max-page=100 --max-depth=4 python ./BuildLangModel.py hr --max-page=100 --max-depth=4 python ./BuildLangModel.py hu --max-page=100 --max-depth=4 python ./BuildLangModel.py it --max-page=100 --max-depth=4 python ./BuildLangModel.py lt --max-page=100 --max-depth=4 python ./BuildLangModel.py lv --max-page=100 --max-depth=4 python ./BuildLangModel.py mt --max-page=100 --max-depth=4 python ./BuildLangModel.py pl --max-page=100 --max-depth=4 python ./BuildLangModel.py pt --max-page=100 --max-depth=4 python ./BuildLangModel.py ro --max-page=100 --max-depth=4 python ./BuildLangModel.py sk --max-page=100 --max-depth=4 python ./BuildLangModel.py sl --max-page=100 --max-depth=4 python ./BuildLangModel.py sv --max-page=100 --max-depth=4 python ./BuildLangModel.py th --max-page=100 --max-depth=4 python ./BuildLangModel.py tr --max-page=100 --max-depth=4 python ./BuildLangModel.py vi --max-page=100 --max-depth=4 ================================================ FILE: third_party/uchardet/uchardet/script/header-template.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" ================================================ FILE: third_party/uchardet/uchardet/script/langs/af.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Africaans' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'af' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['WINDOWS-1252', 'ISO-8859-1', 'ISO-8859-9', 'ISO-8859-15'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = ['è', 'é', 'ê', 'ë', 'î', 'ï','ô', 'û'] # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Tuisblad'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/ar.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Arabic' code = 'ar' use_ascii = False charsets = ['ISO-8859-6', 'WINDOWS-1256'] ## Optional Properties ## # No alphabet. Arabic is complicated because letters have different # forms (glyphs) depending on positions. Some charsets would encode # glyphs while others would encode only the forms. In doubt, I will # just let the defaults for now. start_pages = ['الصفحة_الرئيسية'] wikipedia_code = code case_mapping = False ================================================ FILE: third_party/uchardet/uchardet/script/langs/be.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Belarusian' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'be' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['WINDOWS-1251'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = ['б', 'в', 'г', 'д', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'т', 'ф', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я'] # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Галоўная_старонка'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/cs.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Czech' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'cs' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-2', 'Windows-1250', 'IBM852', 'MAC-CENTRALEUROPE'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = 'áčďéěíňóřšťúůýž' # The starred page which was rewarded on the main page when I created # the data. start_pages = ['Sociální fobie'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True # A function to clean content returned by the `wikipedia` python lib, # in case some unwanted data has been overlooked. # Note that we are already cleaning away the '=' from the title syntax # of Wikipedia, as well as double spaces. But sometimes, Wikipedia in # some language may return weird syntax or UI text which should be # discarded. If you encounter one of these cases, use this function. def clean_wikipedia_content(content): # Do your garbage text cleaning here. return content ================================================ FILE: third_party/uchardet/uchardet/script/langs/da.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Danish' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'da' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-15', 'ISO-8859-1', 'WINDOWS-1252'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = 'æøå' # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Forside'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/de.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'German' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'de' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-1', 'WINDOWS-1252'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = ['ä', 'ö', 'ü', 'ß'] # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Wikipedia:Hauptseite'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/el.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Greek' code = 'el' use_ascii = False charsets = ['ISO-8859-7', 'WINDOWS-1253'] ## Optional Properties ## alphabet = 'αβγδεζηθικλμνξοπρσςτυφχψωάέήίόύώ' start_pages = ['Πύλη:Κύρια'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/eo.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Esperanto' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'eo' # Esperanto actually does use ASCII, but not q, w, x, or y. # So I just use the alphabet variable below instead. use_ascii = False # The charsets we want to support and create data for. charsets = ['ISO-8859-3'] ## Optional Properties ## # Alphabet characters. alphabet = 'abcĉdefgĝhĥijĵklmnoprsŝtuŭvz' # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Vikipedio:Ĉefpaĝo'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/es.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Spanish' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'es' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-15', 'ISO-8859-1', 'WINDOWS-1252'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = 'ñáéíóúü' # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Wikipedia:Portada'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/et.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Estonian' code = 'et' use_ascii = True charsets = ['ISO-8859-4', 'ISO-8859-13', 'ISO-8859-15', 'WINDOWS-1252', 'WINDOWS-1257'] ## Optional Properties ## # Alphabet characters. alphabet = 'äöüõšž' start_pages = ['Harilik pohl'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/fi.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Finnish' code = 'fi' use_ascii = True charsets = ['ISO-8859-1', 'ISO-8859-4', 'ISO-8859-9', 'ISO-8859-13', 'ISO-8859-15', 'WINDOWS-1252'] ## Optional Properties ## # Alphabet characters. # 'å' (Swedish o), 'š' and 'ž' are rare enough that I don't want to include them # here. alphabet = 'äö' # Some random high quality page found on the Finnish home page. start_pages = ['Yhdistynyt kuningaskunta'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/fr.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'French' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'fr' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-15', 'ISO-8859-1', 'WINDOWS-1252'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = ['œ', 'à', 'â', 'ç', 'è', 'é', 'î', 'ï', 'ù', 'û', 'ê'] # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Wikipédia:Accueil_principal', 'Bœuf (animal)'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True # A function to clean content returned by the `wikipedia` python lib, # in case some unwanted data has been overlooked. # Note that we are already cleaning away the '=' from the title syntax # of Wikipedia, as well as double spaces. But sometimes, Wikipedia in # some language may return weird syntax or UI text which should be # discarded. If you encounter one of these cases, use this function. def clean_wikipedia_content(content): # Do your garbage text cleaning here. return content ================================================ FILE: third_party/uchardet/uchardet/script/langs/ga.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Irish' code = 'ga' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-15', 'ISO-8859-1', 'ISO-8859-9', 'WINDOWS-1252'] ## Optional Properties ## # XXX: Irish gaelic also uses sometimes the dotless 'i' but without any # semantic difference from the dotted 'i'. Only for stylistic reasons. # So I don't add it in the glyph list. alphabet = 'áéíóú' start_pages = ['Tracy Caldwell Dyson'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/hr.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Croatian' code = 'hr' use_ascii = True charsets = ['ISO-8859-2', 'ISO-8859-13', 'ISO-8859-16', 'Windows-1250', 'IBM852', 'MAC-CENTRALEUROPE'] ## Optional Properties ## # Alphabet characters. alphabet = 'čćđšž' # The starred page which was rewarded on the main page when I created # the data. start_pages = ['Fizika čvrstog stanja'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/hu.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Hungarian' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'hu' # Q, W, X, Y are only used for foreign words. use_ascii = False # The charsets we want to support and create data for. charsets = ['ISO-8859-2', 'WINDOWS-1250'] ## Optional Properties ## # Alphabet characters: I separate to make missing letters fully visible. alphabet = 'abcdefghijklmnop' + 'rstuv' + 'z' + 'áéíóöőúüű' # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Kezdőlap'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/it.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Italian' code = 'it' use_ascii = True charsets = ['ISO-8859-1', 'ISO-8859-3', 'ISO-8859-9', 'ISO-8859-15', 'WINDOWS-1252'] ## Optional Properties ## alphabet = 'óéèò' start_pages = ['Pieve Ligure'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/lt.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Lithuanian' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'lt' # ASCII characters are also used. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-4', 'ISO-8859-10', 'ISO-8859-13', ] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = 'ąčęėįšųūž' # The start page. Just taking the page which was in front page the day # I created the data. start_pages = ['Karūna (laivas)'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/lv.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Latvian' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'lv' # ASCII characters are also used. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-4', 'ISO-8859-10', 'ISO-8859-13'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = 'āčēģīķļņšūž' # The start page. Just taking a starred page. start_pages = ['Zigfrīds Anna Meierovics'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/mt.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Maltese' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'mt' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-3'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = 'ċġħż' # The starred page which was rewarded on the main page when I created # the data. start_pages = ['Unjoni Ewropea'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True # A function to clean content returned by the `wikipedia` python lib, # in case some unwanted data has been overlooked. # Note that we are already cleaning away the '=' from the title syntax # of Wikipedia, as well as double spaces. But sometimes, Wikipedia in # some language may return weird syntax or UI text which should be # discarded. If you encounter one of these cases, use this function. def clean_wikipedia_content(content): # Do your garbage text cleaning here. return content ================================================ FILE: third_party/uchardet/uchardet/script/langs/nl.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Nederlands' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'nl' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['WINDOWS-1252', 'ISO-8859-1', 'ISO-8859-9', 'ISO-8859-15'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = ['ë', 'ï', 'ö'] # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Hoofdpagina'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/pl.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Polish' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'pl' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-2', 'ISO-8859-13', 'ISO-8859-16', 'Windows-1250', 'IBM852', 'MAC-CENTRALEUROPE'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = 'ąćęłńóśźż' # The starred page which was rewarded on the main page when I created # the data. start_pages = ['Krasnyj Krym'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True # A function to clean content returned by the `wikipedia` python lib, # in case some unwanted data has been overlooked. # Note that we are already cleaning away the '=' from the title syntax # of Wikipedia, as well as double spaces. But sometimes, Wikipedia in # some language may return weird syntax or UI text which should be # discarded. If you encounter one of these cases, use this function. def clean_wikipedia_content(content): # Do your garbage text cleaning here. return content ================================================ FILE: third_party/uchardet/uchardet/script/langs/pt.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Portuguese' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'pt' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-15', 'ISO-8859-1', 'WINDOWS-1252', 'ISO-8859-9'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = 'áâãàçéêíóôõú' # The starred page which was rewarded on the main page when I created # the data. start_pages = ['Papagaio-das-mascarenhas'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True # A function to clean content returned by the `wikipedia` python lib, # in case some unwanted data has been overlooked. # Note that we are already cleaning away the '=' from the title syntax # of Wikipedia, as well as double spaces. But sometimes, Wikipedia in # some language may return weird syntax or UI text which should be # discarded. If you encounter one of these cases, use this function. def clean_wikipedia_content(content): # Do your garbage text cleaning here. return content ================================================ FILE: third_party/uchardet/uchardet/script/langs/ro.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Romanian' code = 'ro' use_ascii = True charsets = ['ISO-8859-2', 'ISO-8859-16', 'Windows-1250', 'IBM852'] ## Optional Properties ## # Alphabet characters. # Note: Wikipedia explains that s and t with cedilla (şţ), or even # bare s and t, were often used in place of s and t with comma (șț) # because of missing characters in most common encoding at the time. # It may be worth adding some common_replacement_letters logics in # the training and models. # https://en.wikipedia.org/wiki/Romanian_alphabet#ISO_8859 alphabet = 'ăâîșț' # The starred page which was rewarded on the main page when I created # the data. start_pages = ['The Loving Kind'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/sk.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Slovak' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'sk' # ASCII characters are also used in French. use_ascii = True # The charsets we want to support and create data for. charsets = ['ISO-8859-2', 'Windows-1250', 'IBM852', 'MAC-CENTRALEUROPE'] ## Optional Properties ## # Alphabet characters. # If use_ascii=True, there is no need to add any ASCII characters. # If case_mapping=True, there is no need to add several cases of a same # character (provided Python algorithms know the right cases). alphabet = 'áäčďĺľňóŕšťúýž' # The starred page which was rewarded on the main page when I created # the data. start_pages = ['Dôkaz (matematika)'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # 'a' and 'A' will be considered the same character, and so on. # This uses Python algorithm to determine upper/lower-case of a given # character. case_mapping = True # A function to clean content returned by the `wikipedia` python lib, # in case some unwanted data has been overlooked. # Note that we are already cleaning away the '=' from the title syntax # of Wikipedia, as well as double spaces. But sometimes, Wikipedia in # some language may return weird syntax or UI text which should be # discarded. If you encounter one of these cases, use this function. def clean_wikipedia_content(content): # Do your garbage text cleaning here. return content ================================================ FILE: third_party/uchardet/uchardet/script/langs/sl.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Slovene' code = 'sl' use_ascii = True charsets = ['ISO-8859-2', 'ISO-8859-16', 'Windows-1250', 'IBM852', 'MAC-CENTRALEUROPE'] ## Optional Properties ## # Alphabet characters. alphabet = 'čšž' # The starred page which was rewarded on the main page when I created # the data. start_pages = ['XCOM: Enemy Unknown'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/sv.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Swedish' code = 'sv' use_ascii = True charsets = ['ISO-8859-1', 'ISO-8859-4', 'ISO-8859-9', 'ISO-8859-15', 'WINDOWS-1252'] ## Optional Properties ## alphabet = 'åäö' start_pages = ['Kakapo'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/th.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Thai' code = 'th' use_ascii = False charsets = ['ISO-8859-11', 'TIS-620'] ## Optional Properties ## # The start page. Though optional, it is advised to choose one yourself. start_pages = ['หน้าหลัก'] wikipedia_code = code case_mapping = False ================================================ FILE: third_party/uchardet/uchardet/script/langs/tr.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## # The human name for the language, in English. name = 'Turkish' # Use 2-letter ISO 639-1 if possible, 3-letter ISO code otherwise, # or use another catalog as a last resort. code = 'tr' # Turkish use most latin alphabet, but not all. # So I just use the alphabet variable below instead. use_ascii = False # The charsets we want to support and create data for. charsets = ['ISO-8859-3', 'ISO-8859-9'] ## Optional Properties ## # Alphabet characters. alphabet = 'abcçdefgğhıijklmnoöprsştuüvyzâîû' # The start page. Though optional, it is advised to choose one yourself. start_pages = ['Ana_Sayfa'] # give possibility to select another code for the Wikipedia URL. wikipedia_code = code # Python algorithm will lower 'I' in 'i' and 'İ' into a decomposed 'ı' + dot. # This is wrong when it comes to Turkish. custom_case_mapping = { 'İ': 'i', 'I': 'ı' } case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/langs/vi.py ================================================ #!/bin/python3 # -*- coding: utf-8 -*- # ##### BEGIN LICENSE BLOCK ##### # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Jehan # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ##### END LICENSE BLOCK ##### import re ## Mandatory Properties ## name = 'Vietnamese' code = 'vi' # It actually uses ASCII, but not all of it. use_ascii = False # From Wikipedia: # For systems that lack support for Unicode, dozens of 8-bit Vietnamese code # pages are available.[1] The most common are VISCII (TCVN 5712:1993), VPS, and # Windows-1258.[3] Where ASCII is required, such as when ensuring readability in # plain text e-mail, Vietnamese letters are often encoded according to Vietnamese # Quoted-Readable (VIQR) or VSCII Mnemonic (VSCII-MNEM),[4] though usage of either # variable-width scheme has declined dramatically following the adoption of # Unicode on the World Wide Web. charsets = ['WINDOWS-1258', 'VISCII'] ## Optional Properties ## alphabet = 'aăâbcdđeêghiklmnoôơpqrstuưvxy' start_pages = ['Chữ_Quốc_ngữ'] wikipedia_code = code case_mapping = True ================================================ FILE: third_party/uchardet/uchardet/script/release.sh ================================================ mkdir --parents release \ && cd release cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ .. \ && make ================================================ FILE: third_party/uchardet/uchardet/script/requirements.txt ================================================ requests==2.13.0 wikipedia==1.4.0 ================================================ FILE: third_party/uchardet/uchardet/script/win32.sh ================================================ mkdir --parents win32 \ && cd win32 \ && cmake .. \ -G "MSYS Makefiles" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="" \ && make ================================================ FILE: third_party/uchardet/uchardet/src/CMakeLists.txt ================================================ set( UCHARDET_HEADERS uchardet.h ) file( GLOB UCHARDET_SOURCES LangModels/*.cpp CharDistribution.cpp JpCntx.cpp nsBig5Prober.cpp nsCharSetProber.cpp nsEscCharsetProber.cpp nsEscSM.cpp nsEUCJPProber.cpp nsEUCKRProber.cpp nsEUCTWProber.cpp # nsGB2312Prober.cpp nsGB18030Prober.cpp nsHebrewProber.cpp nsLatin1Prober.cpp nsMBCSGroupProber.cpp nsMBCSSM.cpp nsSBCharSetProber.cpp nsSBCSGroupProber.cpp nsSJISProber.cpp nsUniversalDetector.cpp nsUTF8Prober.cpp uchardet.cpp ) set (UCHARDET_LIBRARY libuchardet) set (UCHARDET_LIBRARY libuchardet PARENT_SCOPE) if (BUILD_STATIC AND BUILD_SHARED_LIBS) set (UCHARDET_STATIC_LIBRARY libuchardet_static) endif () add_definitions( -DVERSION="${UCHARDET_VERSION}" # -Wall ) if (CMAKE_BUILD_TYPE MATCHES Debug) add_definitions( -O0 -g3 ) endif (CMAKE_BUILD_TYPE MATCHES Debug) add_library( ${UCHARDET_LIBRARY} ${UCHARDET_SOURCES} ) target_compile_definitions("${UCHARDET_LIBRARY}" PRIVATE BUILDING_UCHARDET) if(BUILD_SHARED_LIBS) target_compile_definitions("${UCHARDET_LIBRARY}" PUBLIC UCHARDET_SHARED) endif() target_include_directories(${UCHARDET_LIBRARY} PUBLIC "$" "$" ) if (UCHARDET_STATIC_LIBRARY) add_library( ${UCHARDET_STATIC_LIBRARY} STATIC ${UCHARDET_SOURCES} ) target_compile_definitions("${UCHARDET_STATIC_LIBRARY}" PRIVATE BUILDING_UCHARDET) target_include_directories(${UCHARDET_STATIC_LIBRARY} PUBLIC "$" "$" ) endif (UCHARDET_STATIC_LIBRARY) set_target_properties( ${UCHARDET_LIBRARY} PROPERTIES LINKER_LANGUAGE CXX OUTPUT_NAME ${PACKAGE_NAME} VERSION ${UCHARDET_VERSION} SOVERSION ${UCHARDET_VERSION_MAJOR} ) if (UCHARDET_STATIC_LIBRARY) set_target_properties( ${UCHARDET_STATIC_LIBRARY} PROPERTIES LINKER_LANGUAGE CXX OUTPUT_NAME ${PACKAGE_NAME} ) endif (UCHARDET_STATIC_LIBRARY) if (NOT WIN32) install( TARGETS ${UCHARDET_LIBRARY} EXPORT UchardetTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) else (NOT WIN32) install( TARGETS ${UCHARDET_LIBRARY} EXPORT UchardetTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endif (NOT WIN32) if (UCHARDET_STATIC_LIBRARY) install( TARGETS ${UCHARDET_STATIC_LIBRARY} EXPORT UchardetTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endif (UCHARDET_STATIC_LIBRARY) install( FILES ${UCHARDET_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME} ) include(symbols.cmake) if (BUILD_BINARY) add_subdirectory(tools) endif (BUILD_BINARY) ================================================ FILE: third_party/uchardet/uchardet/src/CharDistribution.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "CharDistribution.h" #include "tables/JISFreq.tab" #include "tables/Big5Freq.tab" #include "tables/EUCKRFreq.tab" #include "tables/EUCTWFreq.tab" //#include "tables/GB2312Freq.tab" #include "tables/GB18030Freq.tab" //return confidence base on received data float CharDistributionAnalysis::GetConfidence() const { //if we didn't receive any character in our consideration range, or the // number of frequent characters is below the minimum threshold, return // negative answer if ((mTotalChars <= 0) || (mFreqChars < mDataThreshold)) return SURE_NO; if (mTotalChars != mFreqChars) { float r = (float)mFreqChars / ((mTotalChars - mFreqChars) * mTypicalDistributionRatio); if (r < SURE_YES) return r; } //normalize confidence, (we don't want to be 100% sure) return SURE_YES; } EUCTWDistributionAnalysis::EUCTWDistributionAnalysis() { mCharToFreqOrder = EUCTWCharToFreqOrder; mTableSize = EUCTW_TABLE_SIZE; mTypicalDistributionRatio = EUCTW_TYPICAL_DISTRIBUTION_RATIO; } EUCKRDistributionAnalysis::EUCKRDistributionAnalysis() { mCharToFreqOrder = EUCKRCharToFreqOrder; mTableSize = EUCKR_TABLE_SIZE; mTypicalDistributionRatio = EUCKR_TYPICAL_DISTRIBUTION_RATIO; } //GB2312DistributionAnalysis::GB2312DistributionAnalysis() //{ // mCharToFreqOrder = GB2312CharToFreqOrder; // mTableSize = GB2312_TABLE_SIZE; // mTypicalDistributionRatio = GB2312_TYPICAL_DISTRIBUTION_RATIO; //} GB18030DistributionAnalysis::GB18030DistributionAnalysis() { mCharToFreqOrder = GB18030CharToFreqOrder; mTableSize = GB18030_TABLE_SIZE; mTypicalDistributionRatio = GB18030_TYPICAL_DISTRIBUTION_RATIO; } Big5DistributionAnalysis::Big5DistributionAnalysis() { mCharToFreqOrder = Big5CharToFreqOrder; mTableSize = BIG5_TABLE_SIZE; mTypicalDistributionRatio = BIG5_TYPICAL_DISTRIBUTION_RATIO; } SJISDistributionAnalysis::SJISDistributionAnalysis() { mCharToFreqOrder = JISCharToFreqOrder; mTableSize = JIS_TABLE_SIZE; mTypicalDistributionRatio = JIS_TYPICAL_DISTRIBUTION_RATIO; } EUCJPDistributionAnalysis::EUCJPDistributionAnalysis() { mCharToFreqOrder = JISCharToFreqOrder; mTableSize = JIS_TABLE_SIZE; mTypicalDistributionRatio = JIS_TYPICAL_DISTRIBUTION_RATIO; } ================================================ FILE: third_party/uchardet/uchardet/src/CharDistribution.h ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: et sw=2 ts=2 fdm=marker */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef CharDistribution_h__ #define CharDistribution_h__ #include "nscore.h" class CharDistributionAnalysis { public: CharDistributionAnalysis() : mCharToFreqOrder(nullptr) , mTableSize(0) , mTypicalDistributionRatio(0.0f) { Reset(PR_FALSE); }; //feed a block of data and do distribution analysis static void HandleData(const char*, PRUint32) { } //Feed a character with known length void HandleOneChar(const char* aStr, PRUint32 aCharLen) { PRInt32 order; //we only care about 2-bytes character in our distribution analysis order = (aCharLen == 2) ? GetOrder(aStr) : -1; if (order >= 0) { mTotalChars++; //order is valid if ((PRUint32)order < mTableSize) { if (512 > mCharToFreqOrder[order]) mFreqChars++; } } }; //return confidence base on existing data float GetConfidence() const; //Reset analyser, clear any state void Reset(PRBool aIsPreferredLanguage) { mDone = PR_FALSE; mTotalChars = 0; mFreqChars = 0; mDataThreshold = aIsPreferredLanguage ? 0 : MINIMUM_DATA_THRESHOLD; }; //This function is for future extension. Caller can use this function to control //analyser's behavior static void SetOpion(){} //It is not necessary to receive all data to draw conclusion. For charset detection, // certain amount of data is enough PRBool GotEnoughData() const { return (mTotalChars >= ENOUGH_DATA_THRESHOLD); } protected: //we do not handle character base on its original encoding string, but //convert this encoding string to a number, here called order. //This allow multiple encoding of a language to share one frequency table virtual PRInt32 GetOrder(const char*) { return -1; } //If this flag is set to PR_TRUE, detection is done and conclusion has been made PRBool mDone; //The number of characters whose frequency order is less than 512 PRUint32 mFreqChars; //Total character encounted. PRUint32 mTotalChars; //Number of hi-byte characters needed to trigger detection PRUint32 mDataThreshold; //Mapping table to get frequency order from char order (get from GetOrder()) const PRInt16 *mCharToFreqOrder; //Size of above table PRUint32 mTableSize; //This is a constant value varies from language to language, it is used in //calculating confidence. See my paper for further detail. float mTypicalDistributionRatio; }; class EUCTWDistributionAnalysis: public CharDistributionAnalysis { public: EUCTWDistributionAnalysis(); protected: //for EUC-TW encoding, we are interested // first byte range: 0xc4 -- 0xfe // second byte range: 0xa1 -- 0xfe //no validation needed here. State machine has done that PRInt32 GetOrder(const char* str) override { if ((unsigned char)*str >= (unsigned char)0xc4) return 94*((unsigned char)str[0]-(unsigned char)0xc4) + (unsigned char)str[1] - (unsigned char)0xa1; else return -1; }; }; class EUCKRDistributionAnalysis : public CharDistributionAnalysis { public: EUCKRDistributionAnalysis(); protected: //for euc-KR encoding, we are interested // first byte range: 0xb0 -- 0xfe // second byte range: 0xa1 -- 0xfe //no validation needed here. State machine has done that PRInt32 GetOrder(const char* str) override { if ((unsigned char)*str >= (unsigned char)0xb0) return 94*((unsigned char)str[0]-(unsigned char)0xb0) + (unsigned char)str[1] - (unsigned char)0xa1; else return -1; }; }; //class GB2312DistributionAnalysis : public CharDistributionAnalysis //{ //public: // GB2312DistributionAnalysis(); //protected: // //for GB2312 encoding, we are interested // // first byte range: 0xa1 -- 0xf7 // // second byte range: 0xa1 -- 0xfe // // //no validation needed here. State machine has done that // PRInt32 GetOrder(const char* str) // { // if ((unsigned char)* str >= (unsigned char)0xa1 && (unsigned char)str[1] >= (unsigned char)0xa1) // return 94 * ((unsigned char)str[0] - (unsigned char)0xa1) + (unsigned char)str[1] - (unsigned char)0xa1; // else // return -1; // } //}; class GB18030DistributionAnalysis : public CharDistributionAnalysis { public: GB18030DistributionAnalysis(); protected: //for GB18030 encoding, we are interested // first byte range: 0xb0 -- 0xfe // second byte range: 0xa1 -- 0xfe //no validation needed here. State machine has done that PRInt32 GetOrder(const char* str) override { if ((unsigned char)* str >= (unsigned char)0xb0 && (unsigned char)str[1] >= (unsigned char)0xa1) return 94 * ((unsigned char)str[0] - (unsigned char)0xb0) + (unsigned char)str[1] - (unsigned char)0xa1; else return -1; } }; class Big5DistributionAnalysis : public CharDistributionAnalysis { public: Big5DistributionAnalysis(); protected: //for big5 encoding, we are interested // first byte range: 0xa4 -- 0xfe // second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe //no validation needed here. State machine has done that PRInt32 GetOrder(const char* str) override { if ((unsigned char)*str >= (unsigned char)0xa4) if ((unsigned char)str[1] >= (unsigned char)0xa1) return 157*((unsigned char)str[0]-(unsigned char)0xa4) + (unsigned char)str[1] - (unsigned char)0xa1 +63; else return 157*((unsigned char)str[0]-(unsigned char)0xa4) + (unsigned char)str[1] - (unsigned char)0x40; else return -1; }; }; class SJISDistributionAnalysis : public CharDistributionAnalysis { public: SJISDistributionAnalysis(); protected: //for sjis encoding, we are interested // first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe // second byte range: 0x40 -- 0x7e, 0x81 -- oxfe //no validation needed here. State machine has done that PRInt32 GetOrder(const char* str) override { PRInt32 order; if ((unsigned char)*str >= (unsigned char)0x81 && (unsigned char)*str <= (unsigned char)0x9f) order = 188 * ((unsigned char)str[0]-(unsigned char)0x81); else if ((unsigned char)*str >= (unsigned char)0xe0 && (unsigned char)*str <= (unsigned char)0xef) order = 188 * ((unsigned char)str[0]-(unsigned char)0xe0 + 31); else return -1; order += (unsigned char)*(str+1) - 0x40; if ((unsigned char)str[1] > (unsigned char)0x7f) order--; return order; }; }; class EUCJPDistributionAnalysis : public CharDistributionAnalysis { public: EUCJPDistributionAnalysis(); protected: //for euc-JP encoding, we are interested // first byte range: 0xa0 -- 0xfe // second byte range: 0xa1 -- 0xfe //no validation needed here. State machine has done that PRInt32 GetOrder(const char* str) override { if ((unsigned char)*str >= (unsigned char)0xa0) return 94*((unsigned char)str[0]-(unsigned char)0xa1) + (unsigned char)str[1] - (unsigned char)0xa1; else return -1; }; }; #endif //CharDistribution_h__ ================================================ FILE: third_party/uchardet/uchardet/src/JpCntx.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nscore.h" #include "JpCntx.h" //This is hiragana 2-char sequence table, the number in each cell represents its frequency category const PRUint8 jp2CharContext[83][83] = { { 0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,}, { 2,4,0,4,0,3,0,4,0,3,4,4,4,2,4,3,3,4,3,2,3,3,4,2,3,3,3,2,4,1,4,3,3,1,5,4,3,4,3,4,3,5,3,0,3,5,4,2,0,3,1,0,3,3,0,3,3,0,1,1,0,4,3,0,3,3,0,4,0,2,0,3,5,5,5,5,4,0,4,1,0,3,4,}, { 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,}, { 0,4,0,5,0,5,0,4,0,4,5,4,4,3,5,3,5,1,5,3,4,3,4,4,3,4,3,3,4,3,5,4,4,3,5,5,3,5,5,5,3,5,5,3,4,5,5,3,1,3,2,0,3,4,0,4,2,0,4,2,1,5,3,2,3,5,0,4,0,2,0,5,4,4,5,4,5,0,4,0,0,4,4,}, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, { 0,3,0,4,0,3,0,3,0,4,5,4,3,3,3,3,4,3,5,4,4,3,5,4,4,3,4,3,4,4,4,4,5,3,4,4,3,4,5,5,4,5,5,1,4,5,4,3,0,3,3,1,3,3,0,4,4,0,3,3,1,5,3,3,3,5,0,4,0,3,0,4,4,3,4,3,3,0,4,1,1,3,4,}, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, { 0,4,0,3,0,3,0,4,0,3,4,4,3,2,2,1,2,1,3,1,3,3,3,3,3,4,3,1,3,3,5,3,3,0,4,3,0,5,4,3,3,5,4,4,3,4,4,5,0,1,2,0,1,2,0,2,2,0,1,0,0,5,2,2,1,4,0,3,0,1,0,4,4,3,5,4,3,0,2,1,0,4,3,}, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, { 0,3,0,5,0,4,0,2,1,4,4,2,4,1,4,2,4,2,4,3,3,3,4,3,3,3,3,1,4,2,3,3,3,1,4,4,1,1,1,4,3,3,2,0,2,4,3,2,0,3,3,0,3,1,1,0,0,0,3,3,0,4,2,2,3,4,0,4,0,3,0,4,4,5,3,4,4,0,3,0,0,1,4,}, { 1,4,0,4,0,4,0,4,0,3,5,4,4,3,4,3,5,4,3,3,4,3,5,4,4,4,4,3,4,2,4,3,3,1,5,4,3,2,4,5,4,5,5,4,4,5,4,4,0,3,2,2,3,3,0,4,3,1,3,2,1,4,3,3,4,5,0,3,0,2,0,4,5,5,4,5,4,0,4,0,0,5,4,}, { 0,5,0,5,0,4,0,3,0,4,4,3,4,3,3,3,4,0,4,4,4,3,4,3,4,3,3,1,4,2,4,3,4,0,5,4,1,4,5,4,4,5,3,2,4,3,4,3,2,4,1,3,3,3,2,3,2,0,4,3,3,4,3,3,3,4,0,4,0,3,0,4,5,4,4,4,3,0,4,1,0,1,3,}, { 0,3,1,4,0,3,0,2,0,3,4,4,3,1,4,2,3,3,4,3,4,3,4,3,4,4,3,2,3,1,5,4,4,1,4,4,3,5,4,4,3,5,5,4,3,4,4,3,1,2,3,1,2,2,0,3,2,0,3,1,0,5,3,3,3,4,3,3,3,3,4,4,4,4,5,4,2,0,3,3,2,4,3,}, { 0,2,0,3,0,1,0,1,0,0,3,2,0,0,2,0,1,0,2,1,3,3,3,1,2,3,1,0,1,0,4,2,1,1,3,3,0,4,3,3,1,4,3,3,0,3,3,2,0,0,0,0,1,0,0,2,0,0,0,0,0,4,1,0,2,3,2,2,2,1,3,3,3,4,4,3,2,0,3,1,0,3,3,}, { 0,4,0,4,0,3,0,3,0,4,4,4,3,3,3,3,3,3,4,3,4,2,4,3,4,3,3,2,4,3,4,5,4,1,4,5,3,5,4,5,3,5,4,0,3,5,5,3,1,3,3,2,2,3,0,3,4,1,3,3,2,4,3,3,3,4,0,4,0,3,0,4,5,4,4,5,3,0,4,1,0,3,4,}, { 0,2,0,3,0,3,0,0,0,2,2,2,1,0,1,0,0,0,3,0,3,0,3,0,1,3,1,0,3,1,3,3,3,1,3,3,3,0,1,3,1,3,4,0,0,3,1,1,0,3,2,0,0,0,0,1,3,0,1,0,0,3,3,2,0,3,0,0,0,0,0,3,4,3,4,3,3,0,3,0,0,2,3,}, { 2,3,0,3,0,2,0,1,0,3,3,4,3,1,3,1,1,1,3,1,4,3,4,3,3,3,0,0,3,1,5,4,3,1,4,3,2,5,5,4,4,4,4,3,3,4,4,4,0,2,1,1,3,2,0,1,2,0,0,1,0,4,1,3,3,3,0,3,0,1,0,4,4,4,5,5,3,0,2,0,0,4,4,}, { 0,2,0,1,0,3,1,3,0,2,3,3,3,0,3,1,0,0,3,0,3,2,3,1,3,2,1,1,0,0,4,2,1,0,2,3,1,4,3,2,0,4,4,3,1,3,1,3,0,1,0,0,1,0,0,0,1,0,0,0,0,4,1,1,1,2,0,3,0,0,0,3,4,2,4,3,2,0,1,0,0,3,3,}, { 0,1,0,4,0,5,0,4,0,2,4,4,2,3,3,2,3,3,5,3,3,3,4,3,4,2,3,0,4,3,3,3,4,1,4,3,2,1,5,5,3,4,5,1,3,5,4,2,0,3,3,0,1,3,0,4,2,0,1,3,1,4,3,3,3,3,0,3,0,1,0,3,4,4,4,5,5,0,3,0,1,4,5,}, { 0,2,0,3,0,3,0,0,0,2,3,1,3,0,4,0,1,1,3,0,3,4,3,2,3,1,0,3,3,2,3,1,3,0,2,3,0,2,1,4,1,2,2,0,0,3,3,0,0,2,0,0,0,1,0,0,0,0,2,2,0,3,2,1,3,3,0,2,0,2,0,0,3,3,1,2,4,0,3,0,2,2,3,}, { 2,4,0,5,0,4,0,4,0,2,4,4,4,3,4,3,3,3,1,2,4,3,4,3,4,4,5,0,3,3,3,3,2,0,4,3,1,4,3,4,1,4,4,3,3,4,4,3,1,2,3,0,4,2,0,4,1,0,3,3,0,4,3,3,3,4,0,4,0,2,0,3,5,3,4,5,2,0,3,0,0,4,5,}, { 0,3,0,4,0,1,0,1,0,1,3,2,2,1,3,0,3,0,2,0,2,0,3,0,2,0,0,0,1,0,1,1,0,0,3,1,0,0,0,4,0,3,1,0,2,1,3,0,0,0,0,0,0,3,0,0,0,0,0,0,0,4,2,2,3,1,0,3,0,0,0,1,4,4,4,3,0,0,4,0,0,1,4,}, { 1,4,1,5,0,3,0,3,0,4,5,4,4,3,5,3,3,4,4,3,4,1,3,3,3,3,2,1,4,1,5,4,3,1,4,4,3,5,4,4,3,5,4,3,3,4,4,4,0,3,3,1,2,3,0,3,1,0,3,3,0,5,4,4,4,4,4,4,3,3,5,4,4,3,3,5,4,0,3,2,0,4,4,}, { 0,2,0,3,0,1,0,0,0,1,3,3,3,2,4,1,3,0,3,1,3,0,2,2,1,1,0,0,2,0,4,3,1,0,4,3,0,4,4,4,1,4,3,1,1,3,3,1,0,2,0,0,1,3,0,0,0,0,2,0,0,4,3,2,4,3,5,4,3,3,3,4,3,3,4,3,3,0,2,1,0,3,3,}, { 0,2,0,4,0,3,0,2,0,2,5,5,3,4,4,4,4,1,4,3,3,0,4,3,4,3,1,3,3,2,4,3,0,3,4,3,0,3,4,4,2,4,4,0,4,5,3,3,2,2,1,1,1,2,0,1,5,0,3,3,2,4,3,3,3,4,0,3,0,2,0,4,4,3,5,5,0,0,3,0,2,3,3,}, { 0,3,0,4,0,3,0,1,0,3,4,3,3,1,3,3,3,0,3,1,3,0,4,3,3,1,1,0,3,0,3,3,0,0,4,4,0,1,5,4,3,3,5,0,3,3,4,3,0,2,0,1,1,1,0,1,3,0,1,2,1,3,3,2,3,3,0,3,0,1,0,1,3,3,4,4,1,0,1,2,2,1,3,}, { 0,1,0,4,0,4,0,3,0,1,3,3,3,2,3,1,1,0,3,0,3,3,4,3,2,4,2,0,1,0,4,3,2,0,4,3,0,5,3,3,2,4,4,4,3,3,3,4,0,1,3,0,0,1,0,0,1,0,0,0,0,4,2,3,3,3,0,3,0,0,0,4,4,4,5,3,2,0,3,3,0,3,5,}, { 0,2,0,3,0,0,0,3,0,1,3,0,2,0,0,0,1,0,3,1,1,3,3,0,0,3,0,0,3,0,2,3,1,0,3,1,0,3,3,2,0,4,2,2,0,2,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,2,1,2,0,1,0,1,0,0,0,1,3,1,2,0,0,0,1,0,0,1,4,}, { 0,3,0,3,0,5,0,1,0,2,4,3,1,3,3,2,1,1,5,2,1,0,5,1,2,0,0,0,3,3,2,2,3,2,4,3,0,0,3,3,1,3,3,0,2,5,3,4,0,3,3,0,1,2,0,2,2,0,3,2,0,2,2,3,3,3,0,2,0,1,0,3,4,4,2,5,4,0,3,0,0,3,5,}, { 0,3,0,3,0,3,0,1,0,3,3,3,3,0,3,0,2,0,2,1,1,0,2,0,1,0,0,0,2,1,0,0,1,0,3,2,0,0,3,3,1,2,3,1,0,3,3,0,0,1,0,0,0,0,0,2,0,0,0,0,0,2,3,1,2,3,0,3,0,1,0,3,2,1,0,4,3,0,1,1,0,3,3,}, { 0,4,0,5,0,3,0,3,0,4,5,5,4,3,5,3,4,3,5,3,3,2,5,3,4,4,4,3,4,3,4,5,5,3,4,4,3,4,4,5,4,4,4,3,4,5,5,4,2,3,4,2,3,4,0,3,3,1,4,3,2,4,3,3,5,5,0,3,0,3,0,5,5,5,5,4,4,0,4,0,1,4,4,}, { 0,4,0,4,0,3,0,3,0,3,5,4,4,2,3,2,5,1,3,2,5,1,4,2,3,2,3,3,4,3,3,3,3,2,5,4,1,3,3,5,3,4,4,0,4,4,3,1,1,3,1,0,2,3,0,2,3,0,3,0,0,4,3,1,3,4,0,3,0,2,0,4,4,4,3,4,5,0,4,0,0,3,4,}, { 0,3,0,3,0,3,1,2,0,3,4,4,3,3,3,0,2,2,4,3,3,1,3,3,3,1,1,0,3,1,4,3,2,3,4,4,2,4,4,4,3,4,4,3,2,4,4,3,1,3,3,1,3,3,0,4,1,0,2,2,1,4,3,2,3,3,5,4,3,3,5,4,4,3,3,0,4,0,3,2,2,4,4,}, { 0,2,0,1,0,0,0,0,0,1,2,1,3,0,0,0,0,0,2,0,1,2,1,0,0,1,0,0,0,0,3,0,0,1,0,1,1,3,1,0,0,0,1,1,0,1,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,1,2,2,0,3,4,0,0,0,1,1,0,0,1,0,0,0,0,0,1,1,}, { 0,1,0,0,0,1,0,0,0,0,4,0,4,1,4,0,3,0,4,0,3,0,4,0,3,0,3,0,4,1,5,1,4,0,0,3,0,5,0,5,2,0,1,0,0,0,2,1,4,0,1,3,0,0,3,0,0,3,1,1,4,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,}, { 1,4,0,5,0,3,0,2,0,3,5,4,4,3,4,3,5,3,4,3,3,0,4,3,3,3,3,3,3,2,4,4,3,1,3,4,4,5,4,4,3,4,4,1,3,5,4,3,3,3,1,2,2,3,3,1,3,1,3,3,3,5,3,3,4,5,0,3,0,3,0,3,4,3,4,4,3,0,3,0,2,4,3,}, { 0,1,0,4,0,0,0,0,0,1,4,0,4,1,4,2,4,0,3,0,1,0,1,0,0,0,0,0,2,0,3,1,1,1,0,3,0,0,0,1,2,1,0,0,1,1,1,1,0,1,0,0,0,1,0,0,3,0,0,0,0,3,2,0,2,2,0,1,0,0,0,2,3,2,3,3,0,0,0,0,2,1,0,}, { 0,5,1,5,0,3,0,3,0,5,4,4,5,1,5,3,3,0,4,3,4,3,5,3,4,3,3,2,4,3,4,3,3,0,3,3,1,4,4,3,4,4,4,3,4,5,5,3,2,3,1,1,3,3,1,3,1,1,3,3,2,4,5,3,3,5,0,4,0,3,0,4,4,3,5,3,3,0,3,4,0,4,3,}, { 0,5,0,5,0,3,0,2,0,4,4,3,5,2,4,3,3,3,4,4,4,3,5,3,5,3,3,1,4,0,4,3,3,0,3,3,0,4,4,4,4,5,4,3,3,5,5,3,2,3,1,2,3,2,0,1,0,0,3,2,2,4,4,3,1,5,0,4,0,3,0,4,3,1,3,2,1,0,3,3,0,3,3,}, { 0,4,0,5,0,5,0,4,0,4,5,5,5,3,4,3,3,2,5,4,4,3,5,3,5,3,4,0,4,3,4,4,3,2,4,4,3,4,5,4,4,5,5,0,3,5,5,4,1,3,3,2,3,3,1,3,1,0,4,3,1,4,4,3,4,5,0,4,0,2,0,4,3,4,4,3,3,0,4,0,0,5,5,}, { 0,4,0,4,0,5,0,1,1,3,3,4,4,3,4,1,3,0,5,1,3,0,3,1,3,1,1,0,3,0,3,3,4,0,4,3,0,4,4,4,3,4,4,0,3,5,4,1,0,3,0,0,2,3,0,3,1,0,3,1,0,3,2,1,3,5,0,3,0,1,0,3,2,3,3,4,4,0,2,2,0,4,4,}, { 2,4,0,5,0,4,0,3,0,4,5,5,4,3,5,3,5,3,5,3,5,2,5,3,4,3,3,4,3,4,5,3,2,1,5,4,3,2,3,4,5,3,4,1,2,5,4,3,0,3,3,0,3,2,0,2,3,0,4,1,0,3,4,3,3,5,0,3,0,1,0,4,5,5,5,4,3,0,4,2,0,3,5,}, { 0,5,0,4,0,4,0,2,0,5,4,3,4,3,4,3,3,3,4,3,4,2,5,3,5,3,4,1,4,3,4,4,4,0,3,5,0,4,4,4,4,5,3,1,3,4,5,3,3,3,3,3,3,3,0,2,2,0,3,3,2,4,3,3,3,5,3,4,1,3,3,5,3,2,0,0,0,0,4,3,1,3,3,}, { 0,1,0,3,0,3,0,1,0,1,3,3,3,2,3,3,3,0,3,0,0,0,3,1,3,0,0,0,2,2,2,3,0,0,3,2,0,1,2,4,1,3,3,0,0,3,3,3,0,1,0,0,2,1,0,0,3,0,3,1,0,3,0,0,1,3,0,2,0,1,0,3,3,1,3,3,0,0,1,1,0,3,3,}, { 0,2,0,3,0,2,1,4,0,2,2,3,1,1,3,1,1,0,2,0,3,1,2,3,1,3,0,0,1,0,4,3,2,3,3,3,1,4,2,3,3,3,3,1,0,3,1,4,0,1,1,0,1,2,0,1,1,0,1,1,0,3,1,3,2,2,0,1,0,0,0,2,3,3,3,1,0,0,0,0,0,2,3,}, { 0,5,0,4,0,5,0,2,0,4,5,5,3,3,4,3,3,1,5,4,4,2,4,4,4,3,4,2,4,3,5,5,4,3,3,4,3,3,5,5,4,5,5,1,3,4,5,3,1,4,3,1,3,3,0,3,3,1,4,3,1,4,5,3,3,5,0,4,0,3,0,5,3,3,1,4,3,0,4,0,1,5,3,}, { 0,5,0,5,0,4,0,2,0,4,4,3,4,3,3,3,3,3,5,4,4,4,4,4,4,5,3,3,5,2,4,4,4,3,4,4,3,3,4,4,5,5,3,3,4,3,4,3,3,4,3,3,3,3,1,2,2,1,4,3,3,5,4,4,3,4,0,4,0,3,0,4,4,4,4,4,1,0,4,2,0,2,4,}, { 0,4,0,4,0,3,0,1,0,3,5,2,3,0,3,0,2,1,4,2,3,3,4,1,4,3,3,2,4,1,3,3,3,0,3,3,0,0,3,3,3,5,3,3,3,3,3,2,0,2,0,0,2,0,0,2,0,0,1,0,0,3,1,2,2,3,0,3,0,2,0,4,4,3,3,4,1,0,3,0,0,2,4,}, { 0,0,0,4,0,0,0,0,0,0,1,0,1,0,2,0,0,0,0,0,1,0,2,0,1,0,0,0,0,0,3,1,3,0,3,2,0,0,0,1,0,3,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,0,2,0,0,0,0,0,0,2,}, { 0,2,1,3,0,2,0,2,0,3,3,3,3,1,3,1,3,3,3,3,3,3,4,2,2,1,2,1,4,0,4,3,1,3,3,3,2,4,3,5,4,3,3,3,3,3,3,3,0,1,3,0,2,0,0,1,0,0,1,0,0,4,2,0,2,3,0,3,3,0,3,3,4,2,3,1,4,0,1,2,0,2,3,}, { 0,3,0,3,0,1,0,3,0,2,3,3,3,0,3,1,2,0,3,3,2,3,3,2,3,2,3,1,3,0,4,3,2,0,3,3,1,4,3,3,2,3,4,3,1,3,3,1,1,0,1,1,0,1,0,1,0,1,0,0,0,4,1,1,0,3,0,3,1,0,2,3,3,3,3,3,1,0,0,2,0,3,3,}, { 0,0,0,0,0,0,0,0,0,0,3,0,2,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,3,0,3,0,3,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,2,3,0,0,0,0,0,0,0,0,3,}, { 0,2,0,3,1,3,0,3,0,2,3,3,3,1,3,1,3,1,3,1,3,3,3,1,3,0,2,3,1,1,4,3,3,2,3,3,1,2,2,4,1,3,3,0,1,4,2,3,0,1,3,0,3,0,0,1,3,0,2,0,0,3,3,2,1,3,0,3,0,2,0,3,4,4,4,3,1,0,3,0,0,3,3,}, { 0,2,0,1,0,2,0,0,0,1,3,2,2,1,3,0,1,1,3,0,3,2,3,1,2,0,2,0,1,1,3,3,3,0,3,3,1,1,2,3,2,3,3,1,2,3,2,0,0,1,0,0,0,0,0,0,3,0,1,0,0,2,1,2,1,3,0,3,0,0,0,3,4,4,4,3,2,0,2,0,0,2,4,}, { 0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,2,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,3,1,0,0,0,0,0,0,0,3,}, { 0,3,0,3,0,2,0,3,0,3,3,3,2,3,2,2,2,0,3,1,3,3,3,2,3,3,0,0,3,0,3,2,2,0,2,3,1,4,3,4,3,3,2,3,1,5,4,4,0,3,1,2,1,3,0,3,1,1,2,0,2,3,1,3,1,3,0,3,0,1,0,3,3,4,4,2,1,0,2,1,0,2,4,}, { 0,1,0,3,0,1,0,2,0,1,4,2,5,1,4,0,2,0,2,1,3,1,4,0,2,1,0,0,2,1,4,1,1,0,3,3,0,5,1,3,2,3,3,1,0,3,2,3,0,1,0,0,0,0,0,0,1,0,0,0,0,4,0,1,0,3,0,2,0,1,0,3,3,3,4,3,3,0,0,0,0,2,3,}, { 0,0,0,1,0,0,0,0,0,0,2,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,0,3,}, { 0,1,0,3,0,4,0,3,0,2,4,3,1,0,3,2,2,1,3,1,2,2,3,1,1,1,2,1,3,0,1,2,0,1,3,2,1,3,0,5,5,1,0,0,1,3,2,1,0,3,0,0,1,0,0,0,0,0,3,4,0,1,1,1,3,2,0,2,0,1,0,2,3,3,1,2,3,0,1,0,1,0,4,}, { 0,0,0,1,0,3,0,3,0,2,2,1,0,0,4,0,3,0,3,1,3,0,3,0,3,0,1,0,3,0,3,1,3,0,3,3,0,0,1,2,1,1,1,0,1,2,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,2,2,1,2,0,0,2,0,0,0,0,2,3,3,3,3,0,0,0,0,1,4,}, { 0,0,0,3,0,3,0,0,0,0,3,1,1,0,3,0,1,0,2,0,1,0,0,0,0,0,0,0,1,0,3,0,2,0,2,3,0,0,2,2,3,1,2,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,2,0,0,0,0,2,3,}, { 2,4,0,5,0,5,0,4,0,3,4,3,3,3,4,3,3,3,4,3,4,4,5,4,5,5,5,2,3,0,5,5,4,1,5,4,3,1,5,4,3,4,4,3,3,4,3,3,0,3,2,0,2,3,0,3,0,0,3,3,0,5,3,2,3,3,0,3,0,3,0,3,4,5,4,5,3,0,4,3,0,3,4,}, { 0,3,0,3,0,3,0,3,0,3,3,4,3,2,3,2,3,0,4,3,3,3,3,3,3,3,3,0,3,2,4,3,3,1,3,4,3,4,4,4,3,4,4,3,2,4,4,1,0,2,0,0,1,1,0,2,0,0,3,1,0,5,3,2,1,3,0,3,0,1,2,4,3,2,4,3,3,0,3,2,0,4,4,}, { 0,3,0,3,0,1,0,0,0,1,4,3,3,2,3,1,3,1,4,2,3,2,4,2,3,4,3,0,2,2,3,3,3,0,3,3,3,0,3,4,1,3,3,0,3,4,3,3,0,1,1,0,1,0,0,0,4,0,3,0,0,3,1,2,1,3,0,4,0,1,0,4,3,3,4,3,3,0,2,0,0,3,3,}, { 0,3,0,4,0,1,0,3,0,3,4,3,3,0,3,3,3,1,3,1,3,3,4,3,3,3,0,0,3,1,5,3,3,1,3,3,2,5,4,3,3,4,5,3,2,5,3,4,0,1,0,0,0,0,0,2,0,0,1,1,0,4,2,2,1,3,0,3,0,2,0,4,4,3,5,3,2,0,1,1,0,3,4,}, { 0,5,0,4,0,5,0,2,0,4,4,3,3,2,3,3,3,1,4,3,4,1,5,3,4,3,4,0,4,2,4,3,4,1,5,4,0,4,4,4,4,5,4,1,3,5,4,2,1,4,1,1,3,2,0,3,1,0,3,2,1,4,3,3,3,4,0,4,0,3,0,4,4,4,3,3,3,0,4,2,0,3,4,}, { 1,4,0,4,0,3,0,1,0,3,3,3,1,1,3,3,2,2,3,3,1,0,3,2,2,1,2,0,3,1,2,1,2,0,3,2,0,2,2,3,3,4,3,0,3,3,1,2,0,1,1,3,1,2,0,0,3,0,1,1,0,3,2,2,3,3,0,3,0,0,0,2,3,3,4,3,3,0,1,0,0,1,4,}, { 0,4,0,4,0,4,0,0,0,3,4,4,3,1,4,2,3,2,3,3,3,1,4,3,4,0,3,0,4,2,3,3,2,2,5,4,2,1,3,4,3,4,3,1,3,3,4,2,0,2,1,0,3,3,0,0,2,0,3,1,0,4,4,3,4,3,0,4,0,1,0,2,4,4,4,4,4,0,3,2,0,3,3,}, { 0,0,0,1,0,4,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,3,2,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,2,}, { 0,2,0,3,0,4,0,4,0,1,3,3,3,0,4,0,2,1,2,1,1,1,2,0,3,1,1,0,1,0,3,1,0,0,3,3,2,0,1,1,0,0,0,0,0,1,0,2,0,2,2,0,3,1,0,0,1,0,1,1,0,1,2,0,3,0,0,0,0,1,0,0,3,3,4,3,1,0,1,0,3,0,2,}, { 0,0,0,3,0,5,0,0,0,0,1,0,2,0,3,1,0,1,3,0,0,0,2,0,0,0,1,0,0,0,1,1,0,0,4,0,0,0,2,3,0,1,4,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,3,0,0,0,0,0,3,}, { 0,2,0,5,0,5,0,1,0,2,4,3,3,2,5,1,3,2,3,3,3,0,4,1,2,0,3,0,4,0,2,2,1,1,5,3,0,0,1,4,2,3,2,0,3,3,3,2,0,2,4,1,1,2,0,1,1,0,3,1,0,1,3,1,2,3,0,2,0,0,0,1,3,5,4,4,4,0,3,0,0,1,3,}, { 0,4,0,5,0,4,0,4,0,4,5,4,3,3,4,3,3,3,4,3,4,4,5,3,4,5,4,2,4,2,3,4,3,1,4,4,1,3,5,4,4,5,5,4,4,5,5,5,2,3,3,1,4,3,1,3,3,0,3,3,1,4,3,4,4,4,0,3,0,4,0,3,3,4,4,5,0,0,4,3,0,4,5,}, { 0,4,0,4,0,3,0,3,0,3,4,4,4,3,3,2,4,3,4,3,4,3,5,3,4,3,2,1,4,2,4,4,3,1,3,4,2,4,5,5,3,4,5,4,1,5,4,3,0,3,2,2,3,2,1,3,1,0,3,3,3,5,3,3,3,5,4,4,2,3,3,4,3,3,3,2,1,0,3,2,1,4,3,}, { 0,4,0,5,0,4,0,3,0,3,5,5,3,2,4,3,4,0,5,4,4,1,4,4,4,3,3,3,4,3,5,5,2,3,3,4,1,2,5,5,3,5,5,2,3,5,5,4,0,3,2,0,3,3,1,1,5,1,4,1,0,4,3,2,3,5,0,4,0,3,0,5,4,3,4,3,0,0,4,1,0,4,4,}, { 1,3,0,4,0,2,0,2,0,2,5,5,3,3,3,3,3,0,4,2,3,4,4,4,3,4,0,0,3,4,5,4,3,3,3,3,2,5,5,4,5,5,5,4,3,5,5,5,1,3,1,0,1,0,0,3,2,0,4,2,0,5,2,3,2,4,1,3,0,3,0,4,5,4,5,4,3,0,4,2,0,5,4,}, { 0,3,0,4,0,5,0,3,0,3,4,4,3,2,3,2,3,3,3,3,3,2,4,3,3,2,2,0,3,3,3,3,3,1,3,3,3,0,4,4,3,4,4,1,1,4,4,2,0,3,1,0,1,1,0,4,1,0,2,3,1,3,3,1,3,4,0,3,0,1,0,3,1,3,0,0,1,0,2,0,0,4,4,}, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}, { 0,3,0,3,0,2,0,3,0,1,5,4,3,3,3,1,4,2,1,2,3,4,4,2,4,4,5,0,3,1,4,3,4,0,4,3,3,3,2,3,2,5,3,4,3,2,2,3,0,0,3,0,2,1,0,1,2,0,0,0,0,2,1,1,3,1,0,2,0,4,0,3,4,4,4,5,2,0,2,0,0,1,3,}, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,4,2,1,1,0,1,0,3,2,0,0,3,1,1,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,1,0,0,0,2,0,0,0,1,4,0,4,2,1,0,0,0,0,0,1,}, { 0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,3,1,0,0,0,2,0,2,1,0,0,1,2,1,0,1,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,1,3,1,0,0,0,0,0,1,0,0,2,1,0,0,0,0,0,0,0,0,2,}, { 0,4,0,4,0,4,0,3,0,4,4,3,4,2,4,3,2,0,4,4,4,3,5,3,5,3,3,2,4,2,4,3,4,3,1,4,0,2,3,4,4,4,3,3,3,4,4,4,3,4,1,3,4,3,2,1,2,1,3,3,3,4,4,3,3,5,0,4,0,3,0,4,3,3,3,2,1,0,3,0,0,3,3,}, { 0,4,0,3,0,3,0,3,0,3,5,5,3,3,3,3,4,3,4,3,3,3,4,4,4,3,3,3,3,4,3,5,3,3,1,3,2,4,5,5,5,5,4,3,4,5,5,3,2,2,3,3,3,3,2,3,3,1,2,3,2,4,3,3,3,4,0,4,0,2,0,4,3,2,2,1,2,0,3,0,0,4,1,}, }; #define MINIMUM_DATA_THRESHOLD 4 void JapaneseContextAnalysis::HandleData(const char* aBuf, PRUint32 aLen) { PRUint32 charLen; PRInt32 order; PRUint32 i; if (mDone) return; //The buffer we got is byte oriented, and a character may span in more than one //buffers. In case the last one or two byte in last buffer is not complete, we //record how many byte needed to complete that character and skip these bytes here. //We can choose to record those bytes as well and analyse the character once it //is complete, but since a character will not make much difference, by simply skipping //this character will simply our logic and improve performance. for (i = mNeedToSkipCharNum; i < aLen; ) { order = GetOrder(aBuf+i, &charLen); i+= charLen; if (i > aLen){ mNeedToSkipCharNum = i - aLen; mLastCharOrder = -1; } else { if (order != -1 && mLastCharOrder != -1) { mTotalRel ++; if (mTotalRel > MAX_REL_THRESHOLD) { mDone = PR_TRUE; break; } mRelSample[(int)jp2CharContext[mLastCharOrder][order]]++; } mLastCharOrder = order; } } return; } void JapaneseContextAnalysis::Reset(PRBool aIsPreferredLanguage) { mTotalRel = 0; for (PRUint32 i = 0; i < NUM_OF_CATEGORY; i++) mRelSample[i] = 0; mNeedToSkipCharNum = 0; mLastCharOrder = -1; mDone = PR_FALSE; mDataThreshold = aIsPreferredLanguage ? 0 : MINIMUM_DATA_THRESHOLD; } #define DONT_KNOW (float)-1 float JapaneseContextAnalysis::GetConfidence() const { //This is just one way to calculate confidence. It works well for me. if (mTotalRel > mDataThreshold) return ((float)(mTotalRel - mRelSample[0]))/mTotalRel; else return (float)DONT_KNOW; } PRInt32 SJISContextAnalysis::GetOrder(const char* str, PRUint32 *charLen) { //find out current char's byte length if (((unsigned char)*str >= (unsigned char)0x81 && (unsigned char)*str <= (unsigned char)0x9f) || ((unsigned char)*str >= (unsigned char)0xe0 && (unsigned char)*str <= (unsigned char)0xfc) ) *charLen = 2; else *charLen = 1; //return its order if it is hiragana if (*str == '\202' && (unsigned char)*(str+1) >= (unsigned char)0x9f && (unsigned char)*(str+1) <= (unsigned char)0xf1) return (unsigned char)*(str+1) - (unsigned char)0x9f; return -1; } PRInt32 EUCJPContextAnalysis::GetOrder(const char* str, PRUint32 *charLen) { //find out current char's byte length if ((unsigned char)*str == (unsigned char)0x8e || ((unsigned char)*str >= (unsigned char)0xa1 && (unsigned char)*str <= (unsigned char)0xfe)) *charLen = 2; else if ((unsigned char)*str == (unsigned char)0x8f) *charLen = 3; else *charLen = 1; //return its order if it is hiragana if ((unsigned char)*str == (unsigned char)0xa4 && (unsigned char)*(str+1) >= (unsigned char)0xa1 && (unsigned char)*(str+1) <= (unsigned char)0xf3) return (unsigned char)*(str+1) - (unsigned char)0xa1; return -1; } ================================================ FILE: third_party/uchardet/uchardet/src/JpCntx.h ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef __JPCNTX_H__ #define __JPCNTX_H__ #define NUM_OF_CATEGORY 6 #include "nscore.h" #define ENOUGH_REL_THRESHOLD 100 #define MAX_REL_THRESHOLD 1000 //hiragana frequency category table extern const PRUint8 jp2CharContext[83][83]; class JapaneseContextAnalysis { public: JapaneseContextAnalysis() {Reset(PR_FALSE);} void HandleData(const char* aBuf, PRUint32 aLen); void HandleOneChar(const char* aStr, PRUint32 aCharLen) { PRInt32 order; //if we received enough data, stop here if (mTotalRel > MAX_REL_THRESHOLD) mDone = PR_TRUE; if (mDone) return; //Only 2-bytes characters are of our interest order = (aCharLen == 2) ? GetOrder(aStr) : -1; if (order != -1 && mLastCharOrder != -1) { mTotalRel++; //count this sequence to its category counter mRelSample[(int)jp2CharContext[mLastCharOrder][order]]++; } mLastCharOrder = order; }; float GetConfidence(void) const; void Reset(PRBool aIsPreferredLanguage); static void SetOpion(){} PRBool GotEnoughData() const {return mTotalRel > ENOUGH_REL_THRESHOLD;} protected: virtual PRInt32 GetOrder(const char* str, PRUint32 *charLen) = 0; virtual PRInt32 GetOrder(const char* str) = 0; //category counters, each integer counts sequences in its category PRUint32 mRelSample[NUM_OF_CATEGORY]; //total sequence received PRUint32 mTotalRel; //Number of sequences needed to trigger detection PRUint32 mDataThreshold; //The order of previous char PRInt32 mLastCharOrder; //if last byte in current buffer is not the last byte of a character, we //need to know how many byte to skip in next buffer. PRUint32 mNeedToSkipCharNum; //If this flag is set to PR_TRUE, detection is done and conclusion has been made PRBool mDone; }; class SJISContextAnalysis : public JapaneseContextAnalysis { //SJISContextAnalysis(){}; protected: PRInt32 GetOrder(const char* str, PRUint32 *charLen) override; PRInt32 GetOrder(const char* str) override { //We only interested in Hiragana, so first byte is '\202' if (*str == '\202' && (unsigned char)*(str+1) >= (unsigned char)0x9f && (unsigned char)*(str+1) <= (unsigned char)0xf1) return (unsigned char)*(str+1) - (unsigned char)0x9f; return -1; }; }; class EUCJPContextAnalysis : public JapaneseContextAnalysis { protected: PRInt32 GetOrder(const char* str, PRUint32 *charLen) override; PRInt32 GetOrder(const char* str) override //We only interested in Hiragana, so first byte is '\244' { if (*str == '\244' && (unsigned char)*(str+1) >= (unsigned char)0xa1 && (unsigned char)*(str+1) <= (unsigned char)0xf3) return (unsigned char)*(str+1) - (unsigned char)0xa1; return -1; } }; #endif /* __JPCNTX_H__ */ ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangAfricaansModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Africaans *********/ /** * Generated by BuildLangModel.py * On: 2019-03-05 22:07:18.720938 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 3, 16, 21, 8, 0, 20, 10, 18, 1, 22, 11, 9, 14, 2, 6, /* 4X */ 17, 29, 5, 4, 7, 13, 12, 15, 27, 19, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 3, 16, 21, 8, 0, 20, 10, 18, 1, 22, 11, 9, 14, 2, 6, /* 6X */ 17, 29, 5, 4, 7, 13, 12, 15, 27, 19, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM, 53,SYM,SYM,SYM,SYM,SYM,SYM, 32,SYM, 54,ILL, 37,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 32,SYM, 55,ILL, 37, 56, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 57,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 48, 28, 45, 44, 43, 51, 42, 39, 35, 26, 24, 23, 52, 38, 49, 30, /* CX */ 58, 59, 41, 31, 33, 60, 40,SYM, 36, 50, 61, 47, 34, 62, 63, 46, /* DX */ 48, 28, 45, 44, 43, 51, 42, 39, 35, 26, 24, 23, 52, 38, 49, 30, /* EX */ 64, 65, 41, 31, 33, 66, 40,SYM, 36, 50, 67, 47, 34, 68, 69, 70, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 3, 16, 21, 8, 0, 20, 10, 18, 1, 22, 11, 9, 14, 2, 6, /* 4X */ 17, 29, 5, 4, 7, 13, 12, 15, 27, 19, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 3, 16, 21, 8, 0, 20, 10, 18, 1, 22, 11, 9, 14, 2, 6, /* 6X */ 17, 29, 5, 4, 7, 13, 12, 15, 27, 19, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 88,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 48, 28, 45, 44, 43, 51, 42, 39, 35, 26, 24, 23, 52, 38, 49, 30, /* CX */ 89, 90, 41, 31, 33, 91, 40,SYM, 36, 50, 92, 47, 34, 93, 94, 46, /* DX */ 48, 28, 45, 44, 43, 51, 42, 39, 35, 26, 24, 23, 52, 38, 49, 30, /* EX */ 95, 96, 41, 31, 33, 97, 40,SYM, 36, 50, 98, 47, 34, 99,100,101, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_9_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 3, 16, 21, 8, 0, 20, 10, 18, 1, 22, 11, 9, 14, 2, 6, /* 4X */ 17, 29, 5, 4, 7, 13, 12, 15, 27, 19, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 3, 16, 21, 8, 0, 20, 10, 18, 1, 22, 11, 9, 14, 2, 6, /* 6X */ 17, 29, 5, 4, 7, 13, 12, 15, 27, 19, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,102,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 48, 28, 45, 44, 43, 51, 42, 39, 35, 26, 24, 23, 52, 38, 49, 30, /* CX */ 103,104, 41, 31, 33,105, 40,SYM, 36, 50,106, 47, 34,107,108, 46, /* DX */ 48, 28, 45, 44, 43, 51, 42, 39, 35, 26, 24, 23, 52, 38, 49, 30, /* EX */ 109,110, 41, 31, 33,111, 40,SYM, 36, 50,112, 47, 34,113,114,115, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 3, 16, 21, 8, 0, 20, 10, 18, 1, 22, 11, 9, 14, 2, 6, /* 4X */ 17, 29, 5, 4, 7, 13, 12, 15, 27, 19, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 3, 16, 21, 8, 0, 20, 10, 18, 1, 22, 11, 9, 14, 2, 6, /* 6X */ 17, 29, 5, 4, 7, 13, 12, 15, 27, 19, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 32,SYM, 32,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM, 37, 71,SYM,SYM, 37,SYM,SYM,SYM, 72, 73, 74,SYM, /* BX */ 48, 28, 45, 44, 43, 51, 42, 39, 35, 26, 24, 23, 52, 38, 49, 30, /* CX */ 75, 76, 41, 31, 33, 77, 40,SYM, 36, 50, 78, 47, 34, 79, 80, 46, /* DX */ 48, 28, 45, 44, 43, 51, 42, 39, 35, 26, 24, 23, 52, 38, 49, 30, /* EX */ 81, 82, 41, 31, 33, 83, 40,SYM, 36, 50, 84, 47, 34, 85, 86, 87, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 825 * First 512 sequences: 0.9986034713711631 * Next 512 sequences (512-1024): 0.0013965286288368912 * Rest: -1.1709383462843448e-17 * Negative sequences: TODO */ constexpr PRUint8 AfricaansLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, 3,0,3,0,2,3,2,2,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3, 3,3,3,0,3,2,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3, 3,3,2,3,2,0,2,0,0,0,2,0,0,0,2,0,2,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0, 3,0,3,0,2,3,0,2,2,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3, 3,2,0,0,2,0,2,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2, 3,3,2,2,2,0,2,2,0,2,2,3,0,2,0,0,0,0,2,2,0,0,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, 3,2,3,0,2,2,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,0,3, 3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,3, 3,3,0,2,2,0,0,0,2,2,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3, 2,3,2,0,0,0,0,2,0,0,2,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,0,2, 2,2,0,0,0,0,2,0,0,2,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,0,0, 2,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0, 3,3,3,3,3,3,3,0,2,3,0,3,0,3,2,0,0,3,0,3,2,0,0,0,2, 0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,0,2, 2,3,3,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3, 2,2,0,2,0,0,2,0,2,2,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,2,0,2,0,2,2,3,0,3,2,2,3,3,3,2,3,0,3, 0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,2,3,2,2,0,3,2,3,3,3,2,3,2,3,2,0,0, 0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,2,0,2, 2,2,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 3,3,3,3,2,3,3,3,2,3,0,2,0,3,3,3,2,0,0,3,2,2,0,0,3, 0,2,0,2,2,0,0,0,2,2,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0, 3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,0,3,3,2,0,0, 2,0,0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,0,0, 0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,2,3,3,3,3,3,2,3,0,3,0,3,2,2,2,0,3,3,2,3,2,0,0, 3,0,0,0,3,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,2,3,0,2,3,2,2,2,0,2,0,3,3,2,2,2,2,2,0,2,0,0,0, 2,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,3,0,3,3,0,3,2,3,2,0,2,0,2,0,2,0,0,0,2,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,3,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,2,3,2,2,0,2,2,0,3,2,2,2,2,2,3,2,2,2,0,0, 2,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,2,2,2,2,2,2,3,2,0,2,2,2,0,3,3,0,0,0,2,0,0,0, 0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,0,3,0,0,2,3,0,2,0,0,2,2,0,2,2,3,2,3,2,2,0,0,0, 0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,2,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, 0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,2,0,0,2,0,0,0,0,0,2,3,0,2,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,3,0,3,2,0,2,2,2,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,2,0,0,2,0,0,2,2,2,0,0,0,2,2,0,0,0,0,2,0,0,0,0, 2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,0,2,0,2,0,3,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,0,2,0,3,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,2,2,0,2,2,2,2,0,0,0,0,0,0,0,2,0,0,2,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,2,0,2,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,0,0,0,0,0,0,2,0,0,2,2,0,0,0,0,0,0,2,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,2,0,2,2,2,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,2,2,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Windows_1252AfricaansModel = { Windows_1252_CharToOrderMap, AfricaansLangModel, 50, (float)0.9986034713711631, PR_TRUE, "WINDOWS-1252" }; const SequenceModel Iso_8859_1AfricaansModel = { Iso_8859_1_CharToOrderMap, AfricaansLangModel, 50, (float)0.9986034713711631, PR_TRUE, "ISO-8859-1" }; const SequenceModel Iso_8859_9AfricaansModel = { Iso_8859_9_CharToOrderMap, AfricaansLangModel, 50, (float)0.9986034713711631, PR_TRUE, "ISO-8859-9" }; const SequenceModel Iso_8859_15AfricaansModel = { Iso_8859_15_CharToOrderMap, AfricaansLangModel, 50, (float)0.9986034713711631, PR_TRUE, "ISO-8859-15" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangArabicModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Arabic *********/ /** * Generated by BuildLangModel.py * On: 2015-12-13 18:33:58.848027 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_6_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 52, 72, 61, 68, 74, 69, 59, 78, 60, 90, 86, 67, 65, 71, 75, /* 4X */ 64, 85, 76, 55, 57, 79, 81, 70, 82, 87, 91,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 37, 58, 49, 47, 38, 54, 66, 46, 39, 88, 63, 45, 51, 43, 40, /* 6X */ 62, 89, 42, 44, 41, 50, 77, 73, 83, 56, 80,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,ILL,ILL,ILL,SYM,ILL,ILL,ILL,ILL,ILL,ILL,ILL,SYM,SYM,ILL,ILL, /* AX */ ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,SYM,ILL,ILL,ILL,SYM, /* BX */ ILL, 32, 34, 15, 35, 22, 31, 0, 9, 8, 7, 27, 19, 18, 25, 11, /* CX */ 30, 5, 26, 12, 21, 23, 28,SYM, 33, 10, 29,ILL,ILL,ILL,ILL,ILL, /* DX */ 36, 13, 14, 17, 1, 3, 6, 16, 4, 24, 2,SYM,SYM,SYM,SYM,SYM, /* EX */ SYM,SYM,SYM,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1256_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 52, 72, 61, 68, 74, 69, 59, 78, 60, 90, 86, 67, 65, 71, 75, /* 4X */ 64, 85, 76, 55, 57, 79, 81, 70, 82, 87, 91,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 37, 58, 49, 47, 38, 54, 66, 46, 39, 88, 63, 45, 51, 43, 40, /* 6X */ 62, 89, 42, 44, 41, 50, 77, 73, 83, 56, 80,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM, 48,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 95,SYM, 96, 92, 97, 98, /* 8X */ 53,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 84,SYM, 99,SYM,100,SYM,SYM,101, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,102,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 103, 32, 34, 15, 35, 22, 31, 0, 9, 8, 7, 27, 19, 18, 25, 11, /* CX */ 30, 5, 26, 12, 21, 23, 28,SYM, 20, 33, 10, 29, 36, 13, 14, 17, /* DX */ 104, 1, 93, 3, 6, 16, 4,105,106, 94,107,108, 24, 2,109,110, /* EX */ SYM,SYM,SYM,SYM,111,SYM,SYM,SYM,SYM,112,SYM,113,114,SYM,SYM,115, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1479 * First 512 sequences: 0.9696025116913417 * Next 512 sequences (512-1024): 0.029166911858880054 * Rest: 0.0012305764497782395 * Negative sequences: TODO */ constexpr PRUint8 ArabicLangModel[] = { 2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,1,3,1,3,3,3,3,2,2,3, 3,2,1,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2, 1,2,3,2,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,0,3,1,3,3,3,3,2,2,3, 2,2,0,2,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,1,3,2,3,3,3,2,2,2,2, 0,2,1,3,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2, 2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,3,2,3,2,3,3,2,3, 1,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 3,2,3,3,3,2,2,3,3,3,3,3,3,3,3,1,3,2,3,3,3,3,0,3,2,2,3,2,2,2,3,2, 0,3,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,2,3,3,2,2, 0,3,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,1,3,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,3,3,2,2,1,2,2,2,2,2,2,2, 1,2,2,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,0,3,2,0,2,2,3,0,3,2,0,3,3,3,0,2,0, 0,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,2,0,2,0,0,3,3,2,3,0,2,0,2, 2,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,3,3,2,3,3,1,0,0,2,2,0,1,0,1,0,1, 0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,3,3,3,3,2,3,2,3,2,3,2,3,2,2,2,2,2,2,2,2,2,2,1,3,2,2,2, 1,3,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,0,2,0,2,1,3,2,0,3,2,0,2,0,3,0,2,0, 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,3,3,3,3,3,3,2,3,3,3,3,3,3,0,3,3,3,3,3,3,0,3,2,3,2,3,2,3,2,2, 0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,2,3,3,1,3,2,1,2,0,2,2,0,3,2,2,0,0,2,0,2,1,2,0,3,0, 0,1,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,2,2,3,2,2,2,2,2,2,2,2,2,2,1,0,2,3,3,0,1,3,0, 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,2,1,3,3,3,3,0,2,3,0,3,2,2,0,3,2,0,3,2,3,0,2,0, 0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,2,2,0,2,3,1,2,1,0,1,0,0,1,0,3,2,0,2,2,2, 0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,3,3,2,3,3,2,2,3,2,3,2,2,0,2,1,2,1,1,0,2,1,0,0,0,1,0,2, 1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,3,3,3,2,3,2,3,3,2,1,2,2,2,3,3,2,2,2,0,0,0,2,3,1,0,0,2,1,2, 0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,3,3,1,2,3,2,0,2,3,3,3,2,3,0,2,2,2,3,2,2,0,3,0,2,2,2,3,2,3,1, 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,2,3,3,2,3,0,3,2,0,2,1,3,0,2,0,0,2,2,2,0,0,0,2,0,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,2,3,2,3,2,2,0,0,2,0,0,1,3,2,0,3,0,1,2,0,2,0,2,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,2,3,3,2,2,0,2,2,1,2,2,2,2,0,0,0,0,1,2,2,0,0,1,0,2, 2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,2,3,2,2,1,1,2,3,1,2,2,0,0,0,0,0,0,1,0,0,2,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,2,3,2,3,2,0,2,0,1,2,0,2,1,2,0,0,0,2,2,0,0,0,2,0,2, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,2,3,2,1,2,2,2,0,0,2,0,0,2,2,1,0,2,1,0,2,0,2,0,2,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,2,2,2,2,2,2,0,0,0,2,2,0,3,3,0,2,0,0,0,0,2,2,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,3,2,2,3,2,2,2,2,2,2,0,2,2,2,2,2,2,0,1,0,1,2,0,1,1,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,1,1,1,0,0,2,2,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,2,3,2,2,1,2,3,2,0,0,0,2,0,0,3,0,0,0,1,0,0,0,2,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,3,2,2,2,3,2,2,0,2,0,2,2,2,2,0,1,2,1,1,0,2,0,1,0,3,1,2,0,1,2,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,3,2,1,2,1,1,0,2,2,0,2,0,2,2,0,0,0,2,0,0,2,2,1,2,0,0,0,0, 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,1,0,1,1,1,0,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0, 0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,2,2,1,2,2,2,2,2,1,2,0,2,1,2,0,0,1,0,1,0,1,0,0,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,1,1,2,2,2,2,2,0,2,0,2,1,2,0,0,1,0,0,0,2,0,0,0,1,2, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,1,2,2,2,2,2,2,0,2,0,2,1,2,0,0,1,0,0,0,1,0,0,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,1,2,2,2,2,2,1,1,2,0,2,2,2,0,0,2,0,0,0,1,0,0,0,2,2, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,2,2,2,2,1,2,2,2,1,0,1,1,1,0,0,0,0,2,0,2,0,0,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,2,2,2,1,2,2,2,0,1,0,2,1,2,0,0,0,0,2,0,1,0,0,0,0,2, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,2,2,2,0,1,2,1,1,2,0,2,1,0,0,0,1,0,1,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,2,1,2,0,0,2,1,2,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,2,2,1,0,0,1,2,0,2,0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,2,2,2,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,2,1,1,1,1,1,0,1,1,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0, 2,2,1,0,2,2,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,2,2,2,1,0,0,1,2,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,0,2,2,2,2,1,0,2,0,1,0,2,0,0,0,0,0,0,2,0,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,2,2,2,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,2,0,0,0,0,0,1,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,2,2,2,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,0,0,1, 2,2,2,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,2,1,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,1,0,2,2,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,1,0,0,1,2,2,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,2,1,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,0,1,1,0,1,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,2,0,2,0,0,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,1,0,2,1,1,0,0,0,0,0,0,1,0,0,2,0,1,0,2,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,1,0,1,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_6ArabicModel = { Iso_8859_6_CharToOrderMap, ArabicLangModel, 64, (float)0.9696025116913417, PR_FALSE, "ISO-8859-6" }; const SequenceModel Windows_1256ArabicModel = { Windows_1256_CharToOrderMap, ArabicLangModel, 64, (float)0.9696025116913417, PR_FALSE, "WINDOWS-1256" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangBelarusianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Belarusian *********/ /** * Generated by BuildLangModel.py * On: 2019-03-05 18:36:38.571630 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1251_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 35, 48, 44, 47, 34, 56, 51, 54, 31, 57, 50, 42, 46, 38, 37, /* 4X */ 49, 60, 40, 36, 39, 43, 45, 52, 41, 53, 55,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 35, 48, 44, 47, 34, 56, 51, 54, 31, 57, 50, 42, 46, 38, 37, /* 6X */ 49, 60, 40, 36, 39, 43, 45, 52, 41, 53, 55,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM, 64,SYM, 65,SYM,SYM,SYM,SYM,SYM,SYM, 66,SYM, 67, 68, 69, 70, /* 8X */ 71,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, 72,SYM, 73, 74, 75, 76, /* 9X */ CTR, 20, 20, 77,SYM, 62,SYM,SYM, 32,SYM, 63,SYM,SYM,CTR,SYM, 61, /* AX */ SYM,SYM, 2, 2, 62, 78,SYM,SYM, 32,SYM, 63,SYM, 79, 80, 81, 61, /* BX */ 0, 21, 13, 19, 11, 8, 28, 17, 33, 24, 6, 7, 14, 1, 12, 16, /* CX */ 3, 4, 9, 15, 30, 25, 18, 22, 27, 59, 58, 5, 26, 23, 29, 10, /* DX */ 0, 21, 13, 19, 11, 8, 28, 17, 33, 24, 6, 7, 14, 1, 12, 16, /* EX */ 3, 4, 9, 15, 30, 25, 18, 22, 27, 59, 58, 5, 26, 23, 29, 10, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1419 * First 512 sequences: 0.9748335015136226 * Next 512 sequences (512-1024): 0.023605173837262638 * Rest: 0.0015613246491147821 * Negative sequences: TODO */ constexpr PRUint8 BelarusianLangModel[] = { 3,3,3,3,3,0,3,3,3,3,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,0,3,3,3, 3,1,3,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,2,3,3,3,2,3,3,3,3,3,2,1,3,2,2,3,3,0,2,3,2,0,2,3,3,2,3, 3,2,3,3,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,3,0,3,3,3,3,3,3,2,3,3,2,3,3,3,3,3,3,3,1,3,3,0,3,3,3, 3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,2,2,3,3,3,3,3,3,1,3,3,3,3,3,2,2,3,3,0,3,3,3,0,3,2,3,3,1, 2,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,1,3,1,0,2,2,3,0,3,3,2,0,2, 3,2,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0, 2,3,3,3,3,0,3,3,3,3,3,3,1,3,3,2,3,3,3,3,3,3,3,1,3,3,0,3,3,3, 2,1,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,1,2,3,3,3,0,1,3,3,3,3,2,2,3,2,0,1,0,2,1,2,1,2,0,1, 1,2,2,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0, 3,2,3,2,2,3,3,2,3,2,3,2,3,2,2,3,1,2,2,2,0,1,2,2,0,1,3,1,2,3, 2,2,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,0,3,3,2,3,3,3,2,3,3,2,3,3,3,3,3,3,3,2,3,2,0,3,3,2, 2,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,2,3,2,3,3,3,3,1,1,1,3,3,2,3,2,2,2,2,0,2,3,3,0,2,2,1,0,1, 2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,1,3,3,0,3,3,3,3,3,3,2,3,3,1,3,3,3,3,3,3,3,1,3,3,0,3,3,3, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,1,3,3,3,3,3,2,2,1,3,3,3,3,3,3,3,2,2,0,3,3,3,0,2,1,2,3,1, 1,0,1,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,2,3,3,0,3,3,3,3,2,3,1,3,3,1,3,3,3,3,3,3,3,1,3,3,0,3,3,2, 2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,2,3,2,2,3,3,2,3,2,3,2,3,1,2,3,2,1,0,1,0,0,1,2,0,1,1,1,0,2, 0,2,3,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,3,3,3,3,2,3,2,3,2,2,3,3,1,2,2,1,3,1,2,0,1,0,1,1,1, 2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,2,3,3,0,3,3,3,3,2,3,2,3,3,1,3,3,3,3,2,3,3,2,3,3,0,3,3,3, 2,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,3,3,1,3,1,1,3,2,1,2,1,0,1,2,2,0,1,1,2,0,0, 0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,3,3,3,3,1,3,3,3,3,3,3,1,1,0,3,0,3,2,2,0,0,3,2,1,2, 0,1,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,1,1,3,3,2,3,3,3,0,3,3,2,3,0,0,3,1,0,2,0,3,0,0,3,1,0,3, 0,1,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, 3,3,3,3,2,1,2,3,3,1,1,2,3,2,3,3,1,1,0,2,0,1,2,3,0,1,0,1,0,1, 0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,3,2,3,3,0,3,3,2,3,2,3,0,3,2,0,3,3,3,3,0,2,3,2,0,2,0,3,3,0, 1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,2,3,2,3,2,2,3,1,1,2,1,0,0,2,2,0,2,0,2,2,2, 1,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0, 3,3,0,0,0,3,3,2,2,1,0,0,3,3,2,3,1,1,1,0,0,1,2,3,0,0,0,0,1,1, 0,0,1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,2,3,3,0,3,3,2,3,2,3,3,3,3,0,3,3,3,3,3,3,3,1,3,3,0,2,2,1, 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,1,3,0,2,3,0,3,0,3,1,2,3,1,2,2,3,2,0,3,2,0,0,1,0,3,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,0,2,2,2,3,0,0,3,3,2,3,2,0,2,1,0,1,1,1,0,2,1,0,0,1, 0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,1,1,3,0,3,1,2,3,2,2,1,3,3,0,2,2,3,2,0,3,2,1,0,1,0,3,1,2, 2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,0,2,2,3,3,3,2,3,0,0,3,2,3,3,2,0,2,1,0,0,3,3,0,0,0,2,0,1, 0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,1,1,2,3,2,1,2,0,0,2,3,2,1,3,2,1,2,1,0,2,2,3,0,0,0,0,2,0, 0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,2,1,3,2,0,2,2,2,3,0,3,0,2,2,0,0,3,3,0,0,3,3,0,0,2,0,2,1,2, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,2,3,3,2,1,1,2,3,3,2,0,3,0,0,3,0,0,2,1,0,0,0,1,0,0,0,0,0,1, 1,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,1,2,0,0,1,0,1,1,0,0,1,1,0,1,0,1,1,1,0,1,0,1,1,0,0,1,0, 0,3,0,0,2,3,3,2,3,2,2,2,2,2,3,2,2,2,2,2,2,2,1,0,1,2,1,1,0,0,1, 0,3,0,3,3,0,2,3,0,2,0,2,0,3,3,0,2,2,1,2,3,0,0,1,3,1,0,1,2,2, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,0,2,2,0,2,2,2,2,2,2,2,2,2,1,2,2,2,2,0,2,2,1,2,2,0,2,0,1, 1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,2,2,3,2,3,2,2,2,2,1,2,3,2,2,2,2,2,1,1,1,2,2,0,0,0, 0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,1,2,0,3,2,3,1,2,2,2,1,2,2,2,2,2,2,2,2,1,2,1,1,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,2,2,1,3,1,0,2,2,2,1,1,1,3,2,2,0,0,2,2,2,1,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,0,0,1,1,2,2,3,2,3,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,2,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,2,2,2,2,2,2,1,0,1,2,2,1,1,2,1,0,1,2,0,1,1,1,2,1,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,3,2,2,2,1,2,2,0,0,2,2,1,2,0,2,1,2,0,2,2,2,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,3,3,2,2,2,2,2,0,2,2,2,2,2,2,2,1,2,2,1,2,0,2,0,1,0,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,0,1,0,0,0,0,0,2,1,1,1,3,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,2,2,2,2,2,2,1,0,2,2,2,1,0,2,1,1,2,1,1,1,1,0,1,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,0,0,2,2,3,1,2,3,2,1,2,0,2,1,2,2,2,2,1,2,0,0,1,1,1,0,0,0,0, 0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, 0,2,0,0,2,2,1,2,0,2,2,0,2,2,1,0,0,1,0,0,2,0,0,2,2,2,0,1,0,0,0, 0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,2,2,0,2,0,0,1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,3,2,2,1,1,0,0,1,2,1,0,2,1,2,1,0,0,0,2,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,2,2,1,2,1,1,2,0,1,2,0,1,0,1,1,0,0,1,1,1,0,2,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,1,2,3,0,2,0,2,2,1,0,0,1,1,0,0,0,0,2,1,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,2,2,1,1,2,0,2,2,0,0,1,1,0,1,0,1,1,1,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,2,2,1,2,1,0,2,0,1,2,1,0,1,0,0,0,0,0,1,1,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,1,2,2,0,2,0,2,2,0,0,1,0,1,1,0,1,0,1,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,2,2,2,0,0,0,1,0,0,1,0,0,0,1,1,0,2,2,0,1,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,0,0,1,1,2,1,2,2,1,0,1,0,2,0,1,2,1,1,1,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,0,2,1,2,1,0,1,2,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,0,1,2,0,1,0,0,1,1,0,1,0,2,1,0,1,0,2,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,0,2,0,2,2,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,2,2,1,2,1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0, 0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Windows_1251BelarusianModel = { Windows_1251_CharToOrderMap, BelarusianLangModel, 61, (float)0.9748335015136226, PR_TRUE, "WINDOWS-1251" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangBulgarianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /**************************************************************** CTR: Control characters that usually does not exist in any text RET: Carriage/Return SYM: symbol (punctuation) that does not belong to word NUM: 0 - 9 *****************************************************************/ //Character Mapping Table: //this talbe is modified base on win1251BulgarianCharToOrderMap, so //only number <64 is sure valid constexpr unsigned char Latin5_BulgarianCharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, //00 CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, //10 SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, //20 NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, //30 SYM, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, //40 110,186,108, 91, 74,119, 84, 96,111,187,115,SYM,SYM,SYM,SYM,SYM, //50 SYM, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, //60 116,195, 85, 93, 97,113,196,197,198,199,200,SYM,SYM,SYM,SYM,SYM, //70 194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209, //80 210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225, //90 81,226,227,228,229,230,105,231,232,233,234,235,236, 45,237,238, //a0 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, //b0 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,239, 67,240, 60, 56, //c0 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, //d0 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,241, 42, 16, //e0 62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,NUM,SYM, //f0 }; constexpr unsigned char win1251BulgarianCharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, //00 CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, //10 SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, //20 NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, //30 SYM, 77, 90, 99,100, 72,109,107,101, 79,185, 81,102, 76, 94, 82, //40 110,186,108, 91, 74,119, 84, 96,111,187,115,SYM,SYM,SYM,SYM,SYM, //50 SYM, 65, 69, 70, 66, 63, 68,112,103, 92,194,104, 95, 86, 87, 71, //60 116,195, 85, 93, 97,113,196,197,198,199,200,SYM,SYM,SYM,SYM,SYM, //70 206,207,208,209,210,211,212,213,120,214,215,216,217,218,219,220, //80 221, 78, 64, 83,121, 98,117,105,ILL,223,224,225,226,227,228,229, //90 88,230,231,232,233,122, 89,106,234,235,236,237,238, 45,239,240, //a0 73, 80,118,114,241,242,243,244,245, 62, 58,246,247,248,249,250, //b0 31, 32, 35, 43, 37, 44, 55, 47, 40, 59, 33, 46, 38, 36, 41, 30, //c0 39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,251, 67,NUM, 60, 56, //d0 1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, //e0 7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,SYM, 42, 16, //f0 }; //Model Table: //total sequences: 100% //first 512 sequences: 96.9392% //first 1024 sequences:3.0618% //rest sequences: 0.2992% //negative sequences: 0.0020% constexpr PRUint8 BulgarianLangModel[] = { 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,2,2,1,2,2, 3,1,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,0,1, 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,3,0,3,1,0, 0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 3,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3,2,3,3,3,3,3,3,3,3,0,3,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,1,3,2,3,3,3,3,3,3,3,3,0,3,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,1,3,3,3,3,2,2,2,1,1,2,0,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,3,2,3,2,2,3,3,1,1,2,3,3,2,3,3,3,3,2,1,2,0,2,0,3,0,0, 0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,3,1,3,3,3,3,3,2,3,2,3,3,3,3,3,2,3,3,1,3,0,3,0,2,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,3,3,1,3,3,2,3,3,3,1,3,3,2,3,2,2,2,0,0,2,0,2,0,2,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,3,3,1,2,2,3,2,1,1,2,0,2,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,3,2,3,3,1,2,3,2,2,2,3,3,3,3,3,2,2,3,1,2,0,2,1,2,0,0, 0,0,0,0,0,0,0,0,0,0,3,0,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,1,3,3,3,3,3,2,3,3,3,2,3,3,2,3,2,2,2,3,1,2,0,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,3,3,3,3,3,1,1,1,2,2,1,3,1,3,2,2,3,0,0,1,0,1,0,1,0,0, 0,0,0,1,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,2,2,3,2,2,3,1,2,1,1,1,2,3,1,3,1,2,2,0,1,1,1,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,1,3,2,2,3,3,1,2,3,1,1,3,3,3,3,1,2,2,1,1,1,0,2,0,2,0,1, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,2,2,3,3,3,2,2,1,1,2,0,2,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,0,1,2,1,3,3,2,3,3,3,3,3,2,3,2,1,0,3,1,2,1,2,1,2,3,2,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,2,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,1,3,3,2,3,3,2,2,2,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,3,0,3,3,3,3,3,2,1,1,2,1,3,3,0,3,1,1,1,1,3,2,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,2,2,2,3,3,3,3,3,3,3,3,3,3,3,1,1,3,1,3,3,2,3,2,2,2,3,0,2,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,3,2,2,3,2,1,1,1,1,1,3,1,3,1,1,0,0,0,1,0,0,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,2,0,3,2,0,3,0,2,0,0,2,1,3,1,0,0,1,0,0,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,2,1,1,1,1,2,1,1,2,1,1,1,2,2,1,2,1,1,1,0,1,1,0,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,2,1,3,1,1,2,1,3,2,1,1,0,1,2,3,2,1,1,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,3,2,2,1,0,1,0,0,1,0,0,0,2,1,0,3,0,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,2,3,2,3,3,1,3,2,1,1,1,2,1,1,2,1,3,0,1,0,0,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,1,1,2,2,3,3,2,3,2,2,2,3,1,2,2,1,1,2,1,1,2,2,0,1,1,0,1,0,2,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,1,3,1,0,2,2,1,3,2,1,0,0,2,0,2,0,1,0,0,0,0,0,0,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,3,3,1,2,0,2,3,1,2,3,2,0,1,3,1,2,1,1,1,0,0,1,0,0,2,2,2,3, 2,2,2,2,1,2,1,1,2,2,1,1,2,0,1,1,1,0,0,1,1,0,0,1,1,0,0,0,1,1,0,1, 3,3,3,3,3,2,1,2,2,1,2,0,2,0,1,0,1,2,1,2,1,1,0,0,0,1,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1, 3,3,2,3,3,1,1,3,1,0,3,2,1,0,0,0,1,2,0,2,0,1,0,0,0,1,0,1,2,1,2,2, 1,1,1,1,1,1,1,2,2,2,1,1,1,1,1,1,1,0,1,2,1,1,1,0,0,0,0,0,1,1,0,0, 3,1,0,1,0,2,3,2,2,2,3,2,2,2,2,2,1,0,2,1,2,1,1,1,0,1,2,1,2,2,2,1, 1,1,2,2,2,2,1,2,1,1,0,1,2,1,2,2,2,1,1,1,0,1,1,1,1,2,0,1,0,0,0,0, 2,3,2,3,3,0,0,2,1,0,2,1,0,0,0,0,2,3,0,2,0,0,0,0,0,1,0,0,2,0,1,2, 2,1,2,1,2,2,1,1,1,2,1,1,1,0,1,2,2,1,1,1,1,1,0,1,1,1,0,0,1,2,0,0, 3,3,2,2,3,0,2,3,1,1,2,0,0,0,1,0,0,2,0,2,0,0,0,1,0,1,0,1,2,0,2,2, 1,1,1,1,2,1,0,1,2,2,2,1,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,0,1,1,0,0, 2,3,2,3,3,0,0,3,0,1,1,0,1,0,0,0,2,2,1,2,0,0,0,0,0,0,0,0,2,0,1,2, 2,2,1,1,1,1,1,2,2,2,1,0,2,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0, 3,3,3,3,2,2,2,2,2,0,2,1,1,1,1,2,1,2,1,1,0,2,0,1,0,1,0,0,2,0,1,2, 1,1,1,1,1,1,1,2,2,1,1,0,2,0,1,0,2,0,0,1,1,1,0,0,2,0,0,0,1,1,0,0, 2,3,3,3,3,1,0,0,0,0,0,0,0,0,0,0,2,0,0,1,1,0,0,0,0,0,0,1,2,0,1,2, 2,2,2,1,1,2,1,1,2,2,2,1,2,0,1,1,1,1,1,1,0,1,1,1,1,0,0,1,1,1,0,0, 2,3,3,3,3,0,2,2,0,2,1,0,0,0,1,1,1,2,0,2,0,0,0,3,0,0,0,0,2,0,2,2, 1,1,1,2,1,2,1,1,2,2,2,1,2,0,1,1,1,0,1,1,1,1,0,2,1,0,0,0,1,1,0,0, 2,3,3,3,3,0,2,1,0,0,2,0,0,0,0,0,1,2,0,2,0,0,0,0,0,0,0,0,2,0,1,2, 1,1,1,2,1,1,1,1,2,2,2,0,1,0,1,1,1,0,0,1,1,1,0,0,1,0,0,0,0,1,0,0, 3,3,2,2,3,0,1,0,1,0,0,0,0,0,0,0,1,1,0,3,0,0,0,0,0,0,0,0,1,0,2,2, 1,1,1,1,1,2,1,1,2,2,1,2,2,1,0,1,1,1,1,1,0,1,0,0,1,0,0,0,1,1,0,0, 3,1,0,1,0,2,2,2,2,3,2,1,1,1,2,3,0,0,1,0,2,1,1,0,1,1,1,1,2,1,1,1, 1,2,2,1,2,1,2,2,1,1,0,1,2,1,2,2,1,1,1,0,0,1,1,1,2,1,0,1,0,0,0,0, 2,1,0,1,0,3,1,2,2,2,2,1,2,2,1,1,1,0,2,1,2,2,1,1,2,1,1,0,2,1,1,1, 1,2,2,2,2,2,2,2,1,2,0,1,1,0,2,1,1,1,1,1,0,0,1,1,1,1,0,1,0,0,0,0, 2,1,1,1,1,2,2,2,2,1,2,2,2,1,2,2,1,1,2,1,2,3,2,2,1,1,1,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,3,2,0,1,2,0,1,2,1,1,0,1,0,1,2,1,2,0,0,0,1,1,0,0,0,1,0,0,2, 1,1,0,0,1,1,0,1,1,1,1,0,2,0,1,1,1,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0, 2,0,0,0,0,1,2,2,2,2,2,2,2,1,2,1,1,1,1,1,1,1,0,1,1,1,1,1,2,1,1,1, 1,2,2,2,2,1,1,2,1,2,1,1,1,0,2,1,2,1,1,1,0,2,1,1,1,1,0,1,0,0,0,0, 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0, 1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,3,2,0,0,0,0,1,0,0,0,0,0,0,1,1,0,2,0,0,0,0,0,0,0,0,1,0,1,2, 1,1,1,1,1,1,0,0,2,2,2,2,2,0,1,1,0,1,1,1,1,1,0,0,1,0,0,0,1,1,0,1, 2,3,1,2,1,0,1,1,0,2,2,2,0,0,1,0,0,1,1,1,1,0,0,0,0,0,0,0,1,0,1,2, 1,1,1,1,2,1,1,1,1,1,1,1,1,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0, 2,2,2,2,2,0,0,2,0,0,2,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,2,0,2,2, 1,1,1,1,1,0,0,1,2,1,1,0,1,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, 1,2,2,2,2,0,0,2,0,1,1,0,0,0,1,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,1,1, 0,0,0,1,1,1,1,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 1,2,2,3,2,0,0,1,0,0,1,0,0,0,0,0,0,1,0,2,0,0,0,1,0,0,0,0,0,0,0,2, 1,1,0,0,1,0,0,0,1,1,0,0,1,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, 2,1,2,2,2,1,2,1,2,2,1,1,2,1,1,1,0,1,1,1,1,2,0,1,0,1,1,1,1,0,1,1, 1,1,2,1,1,1,1,1,1,0,0,1,2,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0, 1,0,0,1,3,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,1,0,0,1,0,2,0,0,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,2,0,0,1, 0,2,0,1,0,0,1,1,2,0,1,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, 1,2,2,2,2,0,1,1,0,2,1,0,1,1,1,0,0,1,0,2,0,1,0,0,0,0,0,0,0,0,0,1, 0,1,0,0,1,0,0,0,1,1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,2,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1, 0,1,0,1,1,1,0,0,1,1,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, 2,0,1,0,0,1,2,1,1,1,1,1,1,2,2,1,0,0,1,0,1,0,0,0,0,1,1,1,1,0,0,0, 1,1,2,1,1,1,1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,1,2,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 0,1,1,0,1,1,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,2,0,0,2,0,1,0,0,1,0,0,1, 1,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0, 1,1,1,1,1,1,1,2,0,0,0,0,0,0,2,1,0,1,1,0,0,1,1,1,0,1,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, }; const SequenceModel Latin5BulgarianModel = { Latin5_BulgarianCharToOrderMap, BulgarianLangModel, 64, (float)0.969392, PR_FALSE, "ISO-8859-5" }; const SequenceModel Win1251BulgarianModel = { win1251BulgarianCharToOrderMap, BulgarianLangModel, 64, (float)0.969392, PR_FALSE, "WINDOWS-1251" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangCroatianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Croatian *********/ /** * Generated by BuildLangModel.py * On: 2016-09-25 23:50:27.590137 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1250_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 4X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 6X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM, 23,SYM, 49, 50, 24, 51, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, 23,SYM, 52, 53, 24, 54, /* 9X */ SYM,SYM,SYM, 40,SYM, 55,SYM,SYM,SYM,SYM, 56,SYM,SYM,SYM,SYM, 57, /* AX */ SYM,SYM,SYM, 40,SYM,SYM,SYM,SYM,SYM, 58, 59,SYM, 60,SYM, 61, 62, /* BX */ 63, 41, 43, 64, 36, 65, 25, 39, 18, 31, 66, 47, 67, 68, 69, 70, /* CX */ 26, 71, 72, 44, 73, 74, 32,SYM, 75, 76, 48, 77, 33, 78, 79, 80, /* DX */ 81, 41, 43, 82, 36, 83, 25, 39, 18, 31, 84, 47, 85, 86, 87, 88, /* EX */ 26, 89, 90, 44, 91, 92, 32,SYM, 93, 94, 48, 95, 33, 96, 97,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_2_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 4X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 6X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 98,SYM, 40,SYM, 99,100,SYM,SYM, 23,101,102,103,SYM, 24,104, /* AX */ SYM,105,SYM, 40,SYM,106,107,SYM,SYM, 23,108,109,110,SYM, 24,111, /* BX */ 112, 41, 43,113, 36,114, 25, 39, 18, 31,115, 47,116,117,118,119, /* CX */ 26,120,121, 44,122,123, 32,SYM,124,125, 48,126, 33,127,128,129, /* DX */ 130, 41, 43,131, 36,132, 25, 39, 18, 31,133, 47,134,135,136,137, /* EX */ 26,138,139, 44,140,141, 32,SYM,142,143, 48,144, 33,145,146,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_16_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 4X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 6X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,147,148, 40,SYM,SYM, 23,SYM, 23,SYM,149,SYM,150,SYM,151,152, /* AX */ SYM,SYM, 18, 40, 24,SYM,SYM,SYM, 24, 18,153,SYM, 45, 45,154,155, /* BX */ 46, 41, 43,156, 36, 25,157, 39, 35, 31, 42, 47,158,159,160,161, /* CX */ 26,162,163, 44,164,165, 32,166,167,168, 48,169, 33,170,171,172, /* DX */ 46, 41, 43,173, 36, 25,174, 39, 35, 31, 42, 47,175,176,177,178, /* EX */ 26,179,180, 44,181,182, 32,183,184,185, 48,186, 33,187,188,189, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Mac_Centraleurope_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 4X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 6X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ 36,190,191, 31,192, 32, 33, 41,193, 18, 36, 18, 25, 25, 31,194, /* 8X */ 195,196,197,198,199,200,201, 44,202,203, 32, 37, 48,204,205, 33, /* 9X */ SYM,SYM,206,SYM,SYM,SYM,SYM,207,SYM,SYM,SYM,208,SYM,SYM,209,210, /* AX */ 211,212,SYM,SYM,213,214,SYM,SYM, 40,215,216,217,218,219,220,221, /* BX */ 222,223,SYM,SYM,224,225,SYM,SYM,SYM,SYM,SYM,226,227, 37,228, 38, /* CX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 38,229,230,231,SYM,SYM,232,233, /* DX */ 234, 23,SYM,SYM, 23,235,236, 41,237,238,239, 24, 24,240, 44,241, /* EX */ 242,243, 48,244,245,246,247,248,249,249,249,249, 40,249,249,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_13_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 4X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 6X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 34,SYM,249,SYM,SYM,SYM,SYM,249, /* AX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 34,SYM,249,SYM,SYM,SYM,SYM,249, /* BX */ 249,249,249, 25, 36,249,249,249, 18, 31,249,249,249,249,249,249, /* CX */ 23,249,249, 44, 38, 37, 32,SYM,249, 40,249,249, 33,249, 24,249, /* DX */ 249,249,249, 25, 36,249,249,249, 18, 31,249,249,249,249,249,249, /* EX */ 23,249,249, 44, 38, 37, 32,SYM,249, 40,249,249, 33,249, 24,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Ibm852_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 4X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 20, 15, 2, 22, 17, 21, 1, 7, 9, 10, 12, 4, 3, /* 6X */ 14, 30, 6, 8, 5, 11, 13, 28, 29, 27, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ 39, 33, 31, 43, 36,249, 25, 39, 40, 47,249,249,249,249, 36, 25, /* 8X */ 31,249,249,249, 32,249,249,249,249, 32, 33,249,249, 40,SYM, 18, /* 9X */ 41,249, 44, 48,249,249, 24, 24,249,249,SYM,249, 18,249,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 41, 43,249,249,SYM,SYM,SYM,SYM,249,249,SYM, /* BX */ SYM,SYM,SYM,SYM,SYM,SYM,249,249,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* CX */ 26, 26,249, 47,249,249,249,249,249,SYM,SYM,SYM,SYM,249,249,SYM, /* DX */ 44,249,249,249,249,249, 23, 23,249, 48,249,249,249,249,249,SYM, /* EX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,249,249,249,SYM,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 712 * First 512 sequences: 0.9989731099787131 * Next 512 sequences (512-1024): 0.0010268900212868262 * Rest: 3.7513395167998453e-17 * Negative sequences: TODO */ constexpr PRUint8 CroatianLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,2,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,0,3,3,2,0,0,0,0,3,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,0,0, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,0,3,3,2,0,2,3,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,3,3,3,3,0,0,0,0,3,2,0,2, 3,3,3,3,3,3,3,3,3,0,3,3,3,3,2,2,0,3,3,0,3,2,0,3,0,2,0,2,3,0,0, 3,3,3,3,3,3,0,3,3,3,3,3,3,3,2,3,3,3,0,3,3,3,3,2,2,0,0,3,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,2,0, 3,3,3,3,3,2,3,3,3,3,3,3,3,2,3,3,0,3,2,3,3,2,3,0,0,0,0,2,3,0,0, 3,3,3,3,3,0,3,3,3,3,3,3,2,0,2,3,0,0,2,0,3,0,0,3,0,0,0,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,2,2,2,2,3,3,0,2,0,3,0,2,0,0,0, 3,3,3,3,3,3,3,3,3,0,3,3,3,3,0,3,3,3,0,3,2,2,3,0,3,0,0,2,3,2,2, 3,3,3,3,3,0,3,3,2,0,3,3,3,3,0,3,0,3,0,3,0,3,0,0,0,0,0,2,2,0,0, 3,3,3,3,3,2,3,2,2,0,3,3,3,3,2,3,3,2,0,0,0,3,2,0,0,0,0,3,2,0,0, 3,3,3,3,3,0,2,3,0,3,3,3,0,3,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,3,3,0,3,3,2,2,0,3,3,0,0,2,3,0,3,0,0,0,0,2,0,0,2, 3,3,3,3,2,3,3,3,3,3,3,3,3,3,0,3,0,2,0,0,0,3,0,0,0,0,0,2,0,0,3, 3,3,3,3,3,3,3,0,3,2,3,3,2,3,0,2,3,2,0,3,3,2,2,0,0,0,0,3,3,2,0, 3,3,3,3,3,3,3,0,3,2,3,3,2,0,2,2,0,2,0,0,0,0,3,0,0,0,0,0,0,0,0, 3,3,3,2,3,3,2,0,0,3,3,3,2,3,3,0,0,0,2,0,2,0,0,0,0,3,0,0,0,0,0, 3,3,3,3,3,0,0,2,0,0,2,3,0,0,0,3,0,0,0,3,0,0,0,0,0,0,2,0,0,0,0, 3,3,3,3,3,0,0,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 3,3,3,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,3,3,2,2,2,3,0,3,3,0,0,0,2,2,2,0,0,2,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,3,2,2,2,0,0,3,0,0,0,0,0,0,0,2,2,3,2,0,0,0,0,2,2,0,0, 2,3,2,0,0,0,2,0,0,0,0,2,0,2,3,0,0,2,0,0,0,0,2,0,0,0,0,0,3,0,0, 0,3,2,0,0,0,2,0,0,0,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, }; const SequenceModel Windows_1250CroatianModel = { Windows_1250_CharToOrderMap, CroatianLangModel, 31, (float)0.9989731099787131, PR_TRUE, "WINDOWS-1250" }; const SequenceModel Iso_8859_2CroatianModel = { Iso_8859_2_CharToOrderMap, CroatianLangModel, 31, (float)0.9989731099787131, PR_TRUE, "ISO-8859-2" }; const SequenceModel Iso_8859_16CroatianModel = { Iso_8859_16_CharToOrderMap, CroatianLangModel, 31, (float)0.9989731099787131, PR_TRUE, "ISO-8859-16" }; const SequenceModel Mac_CentraleuropeCroatianModel = { Mac_Centraleurope_CharToOrderMap, CroatianLangModel, 31, (float)0.9989731099787131, PR_TRUE, "MAC-CENTRALEUROPE" }; const SequenceModel Iso_8859_13CroatianModel = { Iso_8859_13_CharToOrderMap, CroatianLangModel, 31, (float)0.9989731099787131, PR_TRUE, "ISO-8859-13" }; const SequenceModel Ibm852CroatianModel = { Ibm852_CharToOrderMap, CroatianLangModel, 31, (float)0.9989731099787131, PR_TRUE, "IBM852" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangCzechModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Czech *********/ /** * Generated by BuildLangModel.py * On: 2016-09-21 03:28:11.733089 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1250_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 3, 22, 14, 15, 1, 30, 32, 17, 4, 21, 12, 10, 16, 2, 0, /* 4X */ 8, 40, 9, 6, 5, 13, 7, 36, 34, 20, 19,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 3, 22, 14, 15, 1, 30, 32, 17, 4, 21, 12, 10, 16, 2, 0, /* 6X */ 8, 40, 9, 6, 5, 13, 7, 36, 34, 20, 19,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM, 29,SYM, 46, 38, 26, 47, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, 29,SYM, 46, 38, 26, 48, /* 9X */ SYM,SYM,SYM, 49,SYM, 50,SYM,SYM,SYM,SYM, 51,SYM,SYM,SYM,SYM, 52, /* AX */ SYM,SYM,SYM, 53,SYM,SYM,SYM,SYM,SYM, 54, 55,SYM, 45,SYM, 45, 56, /* BX */ 57, 18, 58, 59, 42, 60, 61, 62, 25, 24, 63, 64, 23, 11, 65, 39, /* CX */ 66, 67, 35, 37, 68, 69, 41,SYM, 27, 31, 33, 70, 43, 28, 71, 72, /* DX */ 73, 18, 74, 75, 42, 76, 77, 78, 25, 24, 79, 80, 23, 11, 81, 39, /* EX */ 82, 83, 35, 37, 84, 85, 41,SYM, 27, 31, 33, 86, 43, 28, 87,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Mac_Centraleurope_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 3, 22, 14, 15, 1, 30, 32, 17, 4, 21, 12, 10, 16, 2, 0, /* 4X */ 8, 40, 9, 6, 5, 13, 7, 36, 34, 20, 19,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 3, 22, 14, 15, 1, 30, 32, 17, 4, 21, 12, 10, 16, 2, 0, /* 6X */ 8, 40, 9, 6, 5, 13, 7, 36, 34, 20, 19,SYM,SYM,SYM,SYM,CTR, /* 7X */ 42, 88, 89, 24, 90, 41, 43, 18, 91, 25, 42, 25, 92, 93, 24, 94, /* 8X */ 95, 39, 11, 39, 44, 44, 96, 37, 97, 98, 41, 99, 33, 23, 23, 43, /* 9X */ SYM,SYM,100,SYM,SYM,SYM,SYM,101,SYM,SYM,SYM,102,SYM,SYM,103,104, /* AX */ 105,106,SYM,SYM,107,108,SYM,SYM,109,110,111, 45, 45,112,113,114, /* BX */ 115,116,SYM,SYM,117, 35,SYM,SYM,SYM,SYM,SYM, 35,118,119,120,121, /* CX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,122,123,124, 27,SYM,SYM, 27,125, /* DX */ 126, 29,SYM,SYM, 29, 46, 46, 18, 38, 38, 11, 26, 26,127, 37,128, /* EX */ 129, 31, 33, 31,130,131,132,133, 28, 28,134,135,136,137,138,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Ibm852_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 3, 22, 14, 15, 1, 30, 32, 17, 4, 21, 12, 10, 16, 2, 0, /* 4X */ 8, 40, 9, 6, 5, 13, 7, 36, 34, 20, 19,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 3, 22, 14, 15, 1, 30, 32, 17, 4, 21, 12, 10, 16, 2, 0, /* 6X */ 8, 40, 9, 6, 5, 13, 7, 36, 34, 20, 19,SYM,SYM,SYM,SYM,CTR, /* 7X */ 139, 43, 24,140, 42, 31,141,142,143,144,145,146,147,148, 42,149, /* 8X */ 24,150,151,152, 41, 45, 45, 46, 46, 41, 43, 38, 38,153,SYM, 25, /* 9X */ 18, 11, 37, 33,154,155, 26, 26,156,157,SYM,158, 25,159,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 18,160, 23,161,SYM,SYM,SYM,SYM,162,163,SYM, /* BX */ SYM,SYM,SYM,SYM,SYM,SYM,164,165,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* CX */ 166,167, 39,168, 39, 35, 11,169, 23,SYM,SYM,SYM,SYM,170, 31,SYM, /* DX */ 37,171,172,173,174, 35, 29, 29,175, 33,176,177, 28, 28,178,SYM, /* EX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,179, 27, 27,SYM,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_2_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 3, 22, 14, 15, 1, 30, 32, 17, 4, 21, 12, 10, 16, 2, 0, /* 4X */ 8, 40, 9, 6, 5, 13, 7, 36, 34, 20, 19,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 3, 22, 14, 15, 1, 30, 32, 17, 4, 21, 12, 10, 16, 2, 0, /* 6X */ 8, 40, 9, 6, 5, 13, 7, 36, 34, 20, 19,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,180,SYM,181,SYM, 45, 46,SYM,SYM, 29,182, 38,183,SYM, 26,184, /* AX */ SYM,185,SYM,186,SYM, 45, 46,SYM,SYM, 29,187, 38,188,SYM, 26,189, /* BX */ 190, 18,191,192, 42,193,194,195, 25, 24,196,197, 23, 11,198, 39, /* CX */ 199,200, 35, 37,201,202, 41,SYM, 27, 31, 33,203, 43, 28,204,205, /* DX */ 206, 18,207,208, 42,209,210,211, 25, 24,212,213, 23, 11,214, 39, /* EX */ 215,216, 35, 37,217,218, 41,SYM, 27, 31, 33,219, 43, 28,220,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1025 * First 512 sequences: 0.9786035192432675 * Next 512 sequences (512-1024): 0.02139445610866691 * Rest: 2.0246480655940202e-06 * Negative sequences: TODO */ constexpr PRUint8 CzechLangModel[] = { 2,2,3,2,3,3,3,3,3,3,3,2,3,3,3,3,3,3,2,3, 2,3,3,0,0,3,3,3,0,2,3,0,3,0,3,2,2,0,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,2,3, 2,3,3,0,0,3,3,3,0,3,3,2,3,2,3,2,2,2,2,2,2, 3,3,3,3,3,3,3,2,0,2,3,3,3,3,3,3,2,3,3,3, 3,2,2,3,3,2,2,0,3,2,3,3,3,0,2,0,0,2,0,0,2, 3,3,3,2,2,3,3,3,3,3,3,0,3,3,3,3,3,3,0,3, 3,3,3,0,0,3,3,3,0,3,3,0,3,0,3,2,2,0,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3, 0,2,3,0,2,3,3,2,0,3,3,0,3,0,2,2,2,2,2,0,2, 3,3,3,3,3,2,2,3,2,3,3,3,3,3,2,2,2,3,3,3, 3,2,2,3,3,2,0,3,3,3,0,3,2,0,0,2,2,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2, 3,2,3,0,2,2,0,0,2,0,2,2,2,2,0,2,2,0,2,0,0, 3,3,3,3,3,2,2,0,2,3,3,3,3,3,2,3,0,2,3,3, 3,2,2,3,3,2,2,2,3,3,0,3,0,0,0,2,0,2,0,0,0, 3,3,3,3,3,3,3,0,2,3,3,3,2,3,2,2,2,2,3,0, 3,2,2,3,2,2,0,3,2,2,2,3,2,0,2,2,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,2,2,2,3,3,2,3,3,2,3,3, 3,0,3,0,3,3,2,0,3,2,2,3,3,0,0,2,2,2,2,2,2, 3,3,3,3,3,3,2,2,2,2,2,3,3,3,2,2,2,2,3,3, 3,0,2,0,3,2,2,0,3,3,2,3,2,0,0,2,0,2,0,0,0, 0,2,3,0,2,3,3,3,3,3,3,2,3,0,3,2,3,3,0,3, 0,3,2,0,0,3,3,2,0,2,0,0,2,0,0,0,0,0,2,0,0, 3,3,3,3,3,3,2,3,0,3,3,0,2,3,3,3,2,2,3,2, 3,2,3,0,3,2,2,2,3,0,2,3,2,0,0,0,0,2,0,0,0, 2,2,3,3,3,3,3,3,3,3,3,0,3,2,3,3,3,3,3,3, 2,3,3,0,0,3,3,2,0,3,2,0,2,0,2,2,2,0,2,2,0, 3,3,3,3,3,3,2,2,2,2,2,3,3,2,2,3,2,3,2,2, 2,0,2,0,2,0,0,0,0,0,2,2,0,0,0,2,0,0,0,0,2, 3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,2,3,2,3,2, 3,0,2,3,3,2,2,2,2,2,2,3,2,0,2,2,2,0,0,0,0, 3,3,3,3,3,2,2,0,3,3,3,3,2,3,2,2,2,2,3,2, 3,2,3,3,3,2,3,2,2,2,2,3,2,0,0,2,0,2,0,0,0, 3,3,3,3,3,3,2,3,2,3,3,2,2,3,2,2,2,0,3,0, 3,2,2,0,2,2,2,2,3,0,2,2,0,0,0,0,2,2,2,0,0, 0,0,3,0,0,3,3,3,2,3,3,0,3,0,3,3,3,3,0,3, 0,2,2,0,0,2,3,2,0,3,2,0,0,0,0,2,0,0,0,2,0, 3,3,3,3,3,3,2,3,3,2,3,3,3,3,2,3,3,3,3,2, 3,2,2,0,2,2,0,2,2,2,2,2,0,2,0,2,0,2,0,0,0, 2,2,3,2,2,3,3,3,3,2,3,2,3,2,3,2,3,3,0,3, 0,2,3,0,0,2,3,2,0,3,2,0,2,2,2,0,0,0,2,0,0, 2,3,3,3,3,2,3,2,2,2,2,3,2,2,2,2,3,2,2,2, 0,2,2,0,0,2,0,0,0,3,2,2,0,2,0,2,0,2,0,2,0, 3,3,3,3,3,3,3,3,0,3,3,3,2,3,2,2,2,2,3,2, 3,3,2,3,2,2,0,2,3,2,0,2,0,0,0,2,0,2,0,0,0, 0,0,3,2,0,3,3,2,3,3,3,0,3,0,3,3,2,3,0,2, 0,3,0,0,0,2,3,3,0,3,0,0,0,0,0,2,0,0,2,2,0, 2,0,3,0,0,3,2,2,2,2,2,0,3,0,0,2,3,3,0,3, 0,0,0,0,0,3,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,0,0,2,3,3,3,3,2,0,0,0,3,0, 0,0,3,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,2,2,0,0,2,2,3,2,2,2,3,2,0,3,0, 0,0,2,0,0,0,0,0,0,3,0,2,0,0,0,2,0,0,0,2,0, 2,3,2,3,3,0,2,0,0,0,0,3,2,2,0,0,0,0,2,2, 0,0,2,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 0,0,2,0,0,3,3,3,2,3,2,0,2,2,3,2,3,2,0,3, 0,2,3,0,0,2,2,2,0,3,2,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,3,3,2,2,2,0,3,3,3,3,0,0,0,0,2,0, 0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,2,0,0, 3,3,2,3,3,2,2,0,2,3,3,2,0,3,0,2,2,0,2,2, 3,0,0,0,2,0,0,0,2,0,2,2,0,2,0,0,0,2,0,0,0, 0,0,2,2,0,0,3,3,0,2,2,0,2,0,2,2,3,2,0,3, 0,2,2,0,0,2,3,2,0,0,0,0,0,0,0,2,0,0,0,0,0, 3,3,3,3,3,2,2,2,2,3,3,0,0,2,2,2,2,2,2,0, 2,0,0,0,2,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0, 0,0,2,0,0,2,3,2,2,2,2,0,2,0,2,2,2,2,0,3, 0,2,2,0,0,3,2,2,0,0,2,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,3,3,0,0,3,2,2,2,2,2,2,2,2,0,2,0, 2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0, 2,0,0,2,0,0,2,0,0,0,0,0,2,3,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 2,2,2,2,3,0,2,0,0,0,2,0,2,2,2,0,0,2,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0, 0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,2,2,0,0,3, 0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 2,0,0,2,0,0,0,0,0,0,0,0,2,2,0,0,0,0,2,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,2,0,2,0,0,0,0,0,0,0,2,0,0,2,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Windows_1250CzechModel = { Windows_1250_CharToOrderMap, CzechLangModel, 41, (float)0.9786035192432675, PR_TRUE, "WINDOWS-1250" }; const SequenceModel Mac_CentraleuropeCzechModel = { Mac_Centraleurope_CharToOrderMap, CzechLangModel, 41, (float)0.9786035192432675, PR_TRUE, "MAC-CENTRALEUROPE" }; const SequenceModel Ibm852CzechModel = { Ibm852_CharToOrderMap, CzechLangModel, 41, (float)0.9786035192432675, PR_TRUE, "IBM852" }; const SequenceModel Iso_8859_2CzechModel = { Iso_8859_2_CharToOrderMap, CzechLangModel, 41, (float)0.9786035192432675, PR_TRUE, "ISO-8859-2" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangDanishModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Danish *********/ /** * Generated by BuildLangModel.py * On: 2016-02-19 17:56:42.163975 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 4, 15, 24, 7, 0, 13, 10, 18, 5, 23, 11, 8, 12, 2, 9, /* 4X */ 17, 29, 1, 6, 3, 16, 14, 25, 27, 20, 26,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 4, 15, 24, 7, 0, 13, 10, 18, 5, 23, 11, 8, 12, 2, 9, /* 6X */ 17, 29, 1, 6, 3, 16, 14, 25, 27, 20, 26,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 39,SYM, 39,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM, 53, 42,SYM,SYM, 54,SYM,SYM,SYM, 55, 56, 57,SYM, /* BX */ 58, 33, 40, 35, 32, 21, 22, 38, 41, 28, 49, 45, 59, 34, 60, 50, /* CX */ 43, 47, 51, 36, 52, 61, 30,SYM, 19, 62, 37, 44, 31, 46, 63, 48, /* DX */ 64, 33, 40, 35, 32, 21, 22, 38, 41, 28, 49, 45, 65, 34, 66, 50, /* EX */ 43, 47, 51, 36, 52, 67, 30,SYM, 19, 68, 37, 44, 31, 46, 69, 70, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 4, 15, 24, 7, 0, 13, 10, 18, 5, 23, 11, 8, 12, 2, 9, /* 4X */ 17, 29, 1, 6, 3, 16, 14, 25, 27, 20, 26,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 4, 15, 24, 7, 0, 13, 10, 18, 5, 23, 11, 8, 12, 2, 9, /* 6X */ 17, 29, 1, 6, 3, 16, 14, 25, 27, 20, 26,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 42,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 71, 33, 40, 35, 32, 21, 22, 38, 41, 28, 49, 45, 72, 34, 73, 50, /* CX */ 43, 47, 51, 36, 52, 74, 30,SYM, 19, 75, 37, 44, 31, 46, 76, 48, /* DX */ 77, 33, 40, 35, 32, 21, 22, 38, 41, 28, 49, 45, 78, 34, 79, 50, /* EX */ 43, 47, 51, 36, 52, 80, 30,SYM, 19, 81, 37, 44, 31, 46, 82, 83, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 4, 15, 24, 7, 0, 13, 10, 18, 5, 23, 11, 8, 12, 2, 9, /* 4X */ 17, 29, 1, 6, 3, 16, 14, 25, 27, 20, 26,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 4, 15, 24, 7, 0, 13, 10, 18, 5, 23, 11, 8, 12, 2, 9, /* 6X */ 17, 29, 1, 6, 3, 16, 14, 25, 27, 20, 26,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM, 84,SYM,SYM,SYM,SYM,SYM,SYM, 39,SYM, 85,ILL, 86,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 39,SYM, 87,ILL, 88, 89, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 42,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 90, 33, 40, 35, 32, 21, 22, 38, 41, 28, 49, 45, 91, 34, 92, 50, /* CX */ 43, 47, 51, 36, 52, 93, 30,SYM, 19, 94, 37, 44, 31, 46, 95, 48, /* DX */ 96, 33, 40, 35, 32, 21, 22, 38, 41, 28, 49, 45, 97, 34, 98, 50, /* EX */ 43, 47, 51, 36, 52, 99, 30,SYM, 19,100, 37, 44, 31, 46,101,102, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 964 * First 512 sequences: 0.9968082796759031 * Next 512 sequences (512-1024): 0.0031917203240968304 * Rest: 3.903127820947816e-17 * Negative sequences: TODO */ constexpr PRUint8 DanishLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,3,3,2,3,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,2,3,3,3,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,2,3,3,2,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,3,3,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,3,3,3,3,3,3,2,2,2,2,3,2, 3,3,3,3,3,3,3,2,3,3,2,3,3,2,3,2,3,2,3,3,3,3,3,2,2,2,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,2,3,0, 3,3,3,3,3,3,3,2,3,3,3,2,2,3,3,3,3,2,3,3,3,3,3,3,2,2,2,2,2,0, 3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,2,2,2,2,3,3,3,2,2,0,0,2,0, 3,3,3,3,3,3,3,2,3,3,2,2,2,2,2,3,3,2,2,3,3,3,3,3,2,2,0,0,2,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,2,3,3,2,3,0,2,2,3,2,3,3,0,2, 3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,3,2,3,3,2,2,0,2,0,2,0, 3,3,3,3,3,3,2,2,3,3,2,2,3,2,3,2,3,2,2,3,3,3,3,3,2,3,2,2,2,0, 3,3,3,3,2,2,3,3,3,2,3,3,3,2,3,3,0,2,2,2,2,0,0,3,0,0,2,0,0,0, 3,3,3,3,3,2,3,3,3,3,3,3,3,2,3,3,3,3,2,2,2,0,0,0,2,2,2,0,0,0, 3,3,3,3,2,0,3,3,3,2,3,3,2,2,3,3,0,2,2,2,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,0,3,3,3,3,2,3,3,3,3,3,3,2,2,2,0,0,0,0,0,2,0,0,0,0,0, 3,3,2,3,3,3,3,3,3,3,2,2,2,2,2,2,3,2,2,3,3,2,3,2,2,0,0,0,0,0, 3,3,2,3,3,3,2,2,3,3,2,3,2,2,0,2,3,2,3,0,3,0,0,2,3,2,2,0,2,2, 3,2,2,2,3,3,2,2,2,3,0,2,2,2,0,2,2,0,2,0,2,0,0,0,2,2,2,0,0,0, 3,2,2,2,3,3,2,2,0,3,0,2,2,0,0,2,2,2,2,2,2,0,0,2,2,0,2,0,0,0, 3,2,0,2,2,3,2,0,2,2,0,0,2,2,2,2,2,2,2,2,0,0,0,0,2,2,0,0,2,0, 2,3,2,2,2,0,2,2,2,2,2,2,2,0,2,2,0,2,0,0,0,0,0,0,2,0,0,0,0,0, 0,0,0,0,3,2,2,2,2,2,0,0,0,0,2,2,3,0,2,0,0,0,0,0,0,0,0,0,0,2, }; const SequenceModel Iso_8859_15DanishModel = { Iso_8859_15_CharToOrderMap, DanishLangModel, 30, (float)0.9968082796759031, PR_TRUE, "ISO-8859-15" }; const SequenceModel Iso_8859_1DanishModel = { Iso_8859_1_CharToOrderMap, DanishLangModel, 30, (float)0.9968082796759031, PR_TRUE, "ISO-8859-1" }; const SequenceModel Windows_1252DanishModel = { Windows_1252_CharToOrderMap, DanishLangModel, 30, (float)0.9968082796759031, PR_TRUE, "WINDOWS-1252" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangEsperantoModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Esperanto *********/ /** * Generated by BuildLangModel.py * On: 2015-12-04 01:27:38.177516 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_3_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 18, 17, 10, 2, 19, 15, 21, 3, 11, 9, 7, 13, 4, 1, /* 4X */ 14, 32, 5, 8, 6, 12, 16, 27, 33, 25, 20,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 18, 17, 10, 2, 19, 15, 21, 3, 11, 9, 7, 13, 4, 1, /* 6X */ 14, 32, 5, 8, 6, 12, 16, 27, 33, 25, 20,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 56,SYM,SYM,SYM,ILL, 34,SYM,SYM, 57, 53, 58, 28,SYM,ILL, 40, /* AX */ SYM, 59,SYM,SYM,SYM,SYM, 34,SYM,SYM, 60, 53, 61, 28,SYM,ILL, 40, /* BX */ 44, 29, 46,ILL, 43, 62, 24, 38, 41, 31, 48, 50, 54, 35, 49, 52, /* CX */ ILL, 42, 63, 30, 47, 64, 36,SYM, 22, 51, 39, 55, 37, 23, 26, 45, /* DX */ 44, 29, 46,ILL, 43, 65, 24, 38, 41, 31, 48, 50, 54, 35, 49, 52, /* EX */ ILL, 42, 66, 30, 47, 67, 36,SYM, 22, 51, 39, 55, 37, 23, 26,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 989 * First 512 sequences: 0.9942980632768038 * Next 512 sequences (512-1024): 0.0057019367231962385 * Rest: -5.0306980803327406e-17 * Negative sequences: TODO */ constexpr PRUint8 EsperantoLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,0,2,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,0,0,0,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,0,0,2,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,3,2,2,2,3,0,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,3,2,3,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,0,3,3,3,2,2,2, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,2,3,3,3,3,0,0,2,3,2,2,2,3,3,2,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,2,2,3,2,2,0,3,3,3,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,3,3,3,3,0,0,0,3,0,2,0,3,2,3,2,2,0, 3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,2,3,3,2,3,3,3,0,0,0,3,2,0,2,3,2,2,0,0,0, 3,3,3,3,3,3,2,3,3,2,3,2,3,3,3,3,3,2,2,2,3,3,0,0,2,3,0,3,2,2,2,2,0,0,0, 3,3,3,3,3,3,3,3,3,2,3,2,3,3,2,2,0,2,2,2,2,2,2,0,0,0,0,0,0,3,3,2,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,3,2,3,2,0,0,0,2,0,2,2, 3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,2,2,3,3,3,2,0,0,0,2,3,2,2,0,3,2,2,0,0,0, 3,3,3,3,2,3,3,3,3,2,2,2,3,2,3,2,0,2,2,2,2,3,0,0,0,2,2,0,0,3,2,2,0,0,0, 3,3,3,3,3,3,2,3,3,2,3,0,3,3,2,2,3,2,2,2,2,3,0,2,2,3,2,2,2,2,2,3,0,2,0, 3,3,3,3,2,3,2,2,2,2,2,3,3,2,2,2,0,0,2,0,2,2,0,0,2,2,0,0,0,3,2,2,0,0,0, 3,3,3,3,0,3,3,3,3,3,2,0,3,2,2,2,0,3,2,2,3,3,0,0,0,3,0,0,0,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,2,3,2,3,2,2,2,2,2,3,2,0,2,0,0,0,3,2,0,0,3,3,3,0,0,0, 3,3,3,3,0,3,3,3,2,2,2,2,3,3,2,3,2,0,2,3,0,0,0,0,0,2,0,0,0,0,0,2,0,3,0, 3,3,3,3,3,2,2,3,3,3,2,2,3,2,2,2,2,3,3,2,2,0,0,0,0,3,2,2,0,2,2,2,2,0,0, 3,3,3,3,3,3,3,3,2,2,2,0,3,3,2,0,2,0,2,2,0,2,0,0,0,2,0,2,0,2,2,2,0,2,0, 3,3,3,3,0,0,2,3,0,0,2,2,3,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,3,2,3,3,3,3,3,3,2,2,2,2,3,2,0,2,2,3,2,0,0,2,0,3,0,0,0,0,0,0,0,0, 3,3,3,3,0,0,2,2,0,2,3,2,3,3,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,2,3,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,2,0,2,0,2,0,0,0, 3,3,3,3,2,2,3,2,0,2,0,2,3,2,2,0,3,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,2,2,2,3,2,0,0,2,0,0,0,0,0,0,2,0,2,0,0,0,2,0,3,0,0,2,0,0,0,0, 3,3,2,2,2,2,0,2,0,2,0,0,3,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,3,3,3,3,3,2,3,0,0,2,2,2,2,3,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,3,3,2,2,2,2,2,2,0,0,2,2,2,0,2,2,3,0,0,0,0,0,0,3,0,0,0,0,0,0,0, 2,2,2,0,3,3,3,3,3,2,2,0,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0, 2,0,0,2,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,3,0,0,2,2,0,0,0,0,2,2,2,2,0,0,0,2,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0, 3,3,3,2,2,0,2,0,0,0,2,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_3EsperantoModel = { Iso_8859_3_CharToOrderMap, EsperantoLangModel, 35, (float)0.9942980632768038, PR_FALSE, "ISO-8859-3" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangEstonianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Estonian *********/ /** * Generated by BuildLangModel.py * On: 2016-09-26 23:47:54.476870 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_4_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 4X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 6X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 55, 56, 57,SYM, 58, 59,SYM,SYM, 29, 45, 60, 61,SYM, 32,SYM, /* AX */ SYM, 62,SYM, 63,SYM, 64, 65,SYM,SYM, 29, 45, 66, 67, 68, 32, 69, /* BX */ 37, 43, 70, 71, 18, 44, 47, 72, 73, 33, 74, 75, 76, 36, 77, 39, /* CX */ 78, 79, 31, 80, 81, 20, 24,SYM, 38, 82, 52, 83, 21, 84, 34, 85, /* DX */ 37, 43, 86, 87, 18, 44, 47, 88, 89, 33, 90, 91, 92, 36, 93, 39, /* EX */ 94, 95, 31, 96, 97, 20, 24,SYM, 38, 98, 52, 99, 21,100, 34,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 4X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 6X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,101,SYM,SYM,SYM,SYM,SYM,SYM, 29,SYM,102,ILL, 32,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 29,SYM,103,ILL, 32,104, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 50,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 40, 43,105,106, 18, 44, 47, 48, 41, 33,107,108, 35, 36,109,110, /* CX */ 46,111, 53, 42,112, 20, 24,SYM, 38, 54, 52,113, 21,114,115,116, /* DX */ 40, 43,117,118, 18, 44, 47, 48, 41, 33,119,120, 35, 36,121,122, /* EX */ 46,123, 53, 42,124, 20, 24,SYM, 38, 54, 52,125, 21,126,127,128, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 4X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 6X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 29,SYM, 29,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM, 32, 50,SYM,SYM, 32,SYM,SYM,SYM,129,130,131,SYM, /* BX */ 40, 43,132,133, 18, 44, 47, 48, 41, 33,134,135, 35, 36,136,137, /* CX */ 46,138, 53, 42,139, 20, 24,SYM, 38, 54, 52,140, 21,141,142,143, /* DX */ 40, 43,144,145, 18, 44, 47, 48, 41, 33,146,147, 35, 36,148,149, /* EX */ 46,150, 53, 42,151, 20, 24,SYM, 38, 54, 52,152, 21,153,154,155, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_13_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 4X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 6X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 38,SYM,156,SYM,SYM,SYM,SYM, 47, /* AX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 38,SYM,157,SYM,SYM,SYM,SYM, 47, /* BX */ 158,159, 37,160, 18, 44,161, 45,162, 33,163,164,165,166, 39,167, /* CX */ 29,168,169, 42, 31, 20, 24,SYM,170, 51,171, 34, 21, 49, 32,172, /* DX */ 173,174, 37,175, 18, 44,176, 45,177, 33,178,179,180,181, 39,182, /* EX */ 29,183,184, 42, 31, 20, 24,SYM,185, 51,186, 34, 21, 49, 32,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1257_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 4X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 23, 10, 2, 22, 15, 16, 1, 17, 8, 5, 12, 7, 9, /* 6X */ 14, 28, 11, 3, 4, 6, 13, 27, 26, 25, 30,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM,ILL,SYM,ILL,SYM,SYM,SYM, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,ILL,SYM,ILL,SYM,SYM,ILL, /* 9X */ SYM,ILL,SYM,SYM,SYM,ILL,SYM,SYM, 38,SYM,187,SYM,SYM,SYM,SYM, 47, /* AX */ SYM,SYM,SYM,SYM,SYM, 50,SYM,SYM, 38,SYM,188,SYM,SYM,SYM,SYM, 47, /* BX */ 189,190, 37,191, 18, 44,192, 45,193, 33,194,195,196,197, 39,198, /* CX */ 29,199,200, 42, 31, 20, 24,SYM,201, 51,202, 34, 21, 49, 32,203, /* DX */ 204,205, 37,206, 18, 44,207, 45,208, 33,209,210,211,212, 39,213, /* EX */ 29,214,215, 42, 31, 20, 24,SYM,216, 51,217, 34, 21, 49, 32,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 853 * First 512 sequences: 0.9972721312183132 * Next 512 sequences (512-1024): 0.0027278687816868537 * Rest: -5.204170427930421e-18 * Negative sequences: TODO */ constexpr PRUint8 EstonianLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,3,0,3,3,3,3,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,2,3,3,2,2,3,3,2,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,3,0,3,3,3,2,0,2,0,2, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,2,2,0,2,2,0, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,3,3,0,3,3,2,3,3,3,2,2,0,3,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,0,0,0,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,3,3,0,0,2,2,2,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,3,3,3,3,2,3,3,3,3,2,3,3,0,2,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,0,3,3,2,2,3,3,0,2,0,0,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,0,2,3,3,0,3,3,3,2,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,2,2,3,0,2,0,3,0,0,0,2,2,2,0,0,0,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,0,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,2,2,3,2,3,3,3,2,3,3,3,3,3,2,3,3,0,2,0,2,2,0,0, 3,3,3,3,2,3,3,3,3,3,2,2,2,2,2,2,2,2,3,0,3,2,0,2,3,2,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,3,2,3,0,3,3,0,2,3,3,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,3,3,3,0,2,2,2,2,2,0,3,2,0,2,0,2,0,0, 3,3,3,3,3,3,3,3,3,3,0,3,3,3,0,0,3,3,3,0,3,3,3,2,0,3,0,2,0,0,0,2,0, 3,3,3,2,3,0,3,3,0,3,0,2,3,0,3,0,0,0,3,0,3,3,0,0,2,0,0,0,0,0,0,0,0, 2,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,3,0,0,0,0,0,0,2,0,0,0,0,0,0, 3,3,3,3,2,3,3,3,2,3,0,3,2,0,0,0,2,3,0,2,0,2,0,2,0,2,2,0,0,0,0,0,0, 0,3,3,3,3,3,3,3,2,0,3,3,3,3,3,3,3,3,0,3,3,0,0,0,0,0,0,0,0,0,2,0,0, 3,0,2,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,0,3,0,3,2,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,3,3,2,0,3,2,3,0,0,0,2,0,2,2,0,0,3,3,3,2,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,2,3,0,0,2,0,0,2,3,0,3,0,0,2,0,0,0,0, 2,3,3,3,3,3,0,3,3,2,3,3,2,3,3,3,2,2,0,3,0,0,0,0,3,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,2,3,2,3,2,0,3,3,0,0,0,0,0,0,0,3,2,0,2,0,0,0,2,3,0, 3,3,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,2,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0, 3,3,3,2,2,2,2,2,2,3,0,2,0,0,0,2,2,0,0,0,0,0,2,0,0,2,0,2,0,0,0,0,0, 3,3,2,0,0,0,3,0,0,2,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0, 2,3,3,0,0,2,3,2,2,2,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, 2,3,2,2,0,2,2,2,2,3,2,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 0,0,0,2,2,2,2,2,2,0,0,0,2,0,0,2,2,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,0,0,0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_4EstonianModel = { Iso_8859_4_CharToOrderMap, EstonianLangModel, 33, (float)0.9972721312183132, PR_TRUE, "ISO-8859-4" }; const SequenceModel Windows_1252EstonianModel = { Windows_1252_CharToOrderMap, EstonianLangModel, 33, (float)0.9972721312183132, PR_TRUE, "WINDOWS-1252" }; const SequenceModel Iso_8859_15EstonianModel = { Iso_8859_15_CharToOrderMap, EstonianLangModel, 33, (float)0.9972721312183132, PR_TRUE, "ISO-8859-15" }; const SequenceModel Iso_8859_13EstonianModel = { Iso_8859_13_CharToOrderMap, EstonianLangModel, 33, (float)0.9972721312183132, PR_TRUE, "ISO-8859-13" }; const SequenceModel Windows_1257EstonianModel = { Windows_1257_CharToOrderMap, EstonianLangModel, 33, (float)0.9972721312183132, PR_TRUE, "WINDOWS-1257" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangFinnishModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Finnish *********/ /** * Generated by BuildLangModel.py * On: 2016-09-21 18:15:05.189948 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 4X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 6X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 27,SYM, 27,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM, 28, 61,SYM,SYM, 28,SYM,SYM,SYM, 62, 63, 64,SYM, /* BX */ 49, 35, 65, 46, 11, 56, 39, 37, 40, 30, 51, 31, 66, 36, 67, 57, /* CX */ 68, 58, 52, 33, 34, 59, 22,SYM, 69, 70, 38, 71, 32, 72, 73, 55, /* DX */ 49, 35, 74, 46, 11, 56, 39, 37, 40, 30, 51, 31, 75, 36, 76, 57, /* EX */ 77, 58, 52, 33, 34, 59, 22,SYM, 78, 79, 38, 80, 32, 81, 82, 83, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 4X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 6X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM, 84,SYM,SYM,SYM,SYM,SYM,SYM, 27,SYM, 85,ILL, 28,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 27,SYM, 86,ILL, 28, 87, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 88,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 49, 35, 89, 46, 11, 56, 39, 37, 40, 30, 51, 31, 90, 36, 91, 57, /* CX */ 92, 58, 52, 33, 34, 59, 22,SYM, 93, 94, 38, 95, 32, 96, 97, 55, /* DX */ 49, 35, 98, 46, 11, 56, 39, 37, 40, 30, 51, 31, 99, 36,100, 57, /* EX */ 101, 58, 52, 33, 34, 59, 22,SYM,102,103, 38,104, 32,105,106,107, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_4_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 4X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 6X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,108,109, 47,SYM,110,111,SYM,SYM, 27,112,113,114,SYM, 28,SYM, /* AX */ SYM,115,SYM, 47,SYM,116,117,SYM,SYM, 27,118,119,120, 45, 28, 45, /* BX */ 53, 35,121, 46, 11, 56, 39,122, 43, 30,123, 31,124, 36,125,126, /* CX */ 127, 54,128,129, 34, 59, 22,SYM,130,131, 38,132, 32,133,134, 55, /* DX */ 53, 35,135, 46, 11, 56, 39,136, 43, 30,137, 31,138, 36,139,140, /* EX */ 141, 54,142,143, 34, 59, 22,SYM,144,145, 38,146, 32,147,148,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_13_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 4X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 6X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,149,SYM, 47,SYM,SYM,SYM,SYM, 39, /* AX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,150,SYM, 47,SYM,SYM,SYM,SYM, 39, /* BX */ 151,152, 53, 41, 11, 56,153,154, 43, 30,155,156,157,158,159,160, /* CX */ 27,161, 54, 33,162, 59, 22,SYM,163,164,165,166, 32, 60, 28, 55, /* DX */ 167,168, 53, 41, 11, 56,169,170, 43, 30,171,172,173,174,175,176, /* EX */ 27,177, 54, 33,178, 59, 22,SYM,179,180,181,182, 32, 60, 28,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_9_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 4X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 6X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,183,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 49, 35,184, 46, 11, 56, 39, 37, 40, 30, 51, 31,185, 36,186, 57, /* CX */ 50, 58, 52, 33, 34, 59, 22,SYM,187,188, 38,189, 32, 48, 42, 55, /* DX */ 49, 35,190, 46, 11, 56, 39, 37, 40, 30, 51, 31,191, 36,192, 57, /* EX */ 50, 58, 52, 33, 34, 59, 22,SYM,193,194, 38,195, 32, 44, 42,196, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 4X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 19, 21, 18, 4, 23, 20, 14, 1, 15, 9, 6, 12, 2, 7, /* 6X */ 16, 29, 10, 5, 3, 8, 13, 24, 26, 17, 25,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,197,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 49, 35,198, 46, 11, 56, 39, 37, 40, 30, 51, 31,199, 36,200, 57, /* CX */ 201, 58, 52, 33, 34, 59, 22,SYM,202,203, 38,204, 32,205,206, 55, /* DX */ 49, 35,207, 46, 11, 56, 39, 37, 40, 30, 51, 31,208, 36,209, 57, /* EX */ 210, 58, 52, 33, 34, 59, 22,SYM,211,212, 38,213, 32,214,215,216, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 919 * First 512 sequences: 0.9985378147555799 * Next 512 sequences (512-1024): 0.0014621852444200612 * Rest: 3.881443777498106e-17 * Negative sequences: TODO */ constexpr PRUint8 FinnishLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,2,3,3,0,3,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,0,0,0,2, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,0,3,3,2,3,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,0,2,3,2,3,2,2,0,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2, 3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,0,0,2,2,0,0,0,0,0,0,0, 3,3,2,2,3,3,2,3,3,2,3,3,3,2,2,2,3,3,2,3,3,3,3,2,2,2,2,0,0,0, 3,3,2,2,3,2,2,3,3,3,2,3,0,2,2,2,2,3,2,2,0,0,2,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,0,3,3,2,2,0,0,0,0,2, 3,3,3,2,3,2,2,3,3,2,2,3,2,0,2,0,2,3,0,2,0,0,3,2,0,0,0,0,0,0, 3,3,2,3,3,3,3,3,3,2,3,3,3,2,3,2,3,3,2,0,2,2,3,2,3,0,0,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,2,3,2,2,2,0,0, 3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,0,0,3,2, 3,3,3,3,3,3,3,3,3,3,3,2,2,0,3,2,0,3,3,3,2,3,2,0,2,2,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,3,3,3,3,3,3,3,2,3,2,0,0,0,0, 3,3,2,3,3,3,3,3,3,3,3,0,2,0,3,0,2,3,3,2,2,3,0,0,0,2,0,0,0,2, 2,3,3,3,2,3,3,2,0,3,3,3,3,3,3,3,3,3,3,2,0,0,3,2,0,0,0,0,0,0, 3,3,2,3,3,3,3,3,3,2,3,2,0,2,0,2,2,3,0,2,2,2,0,3,0,2,0,0,0,0, 3,3,3,2,3,3,2,3,2,2,3,0,2,0,3,0,0,2,2,2,2,2,0,2,2,0,0,0,0,0, 3,3,3,2,3,2,2,3,2,2,2,2,2,2,2,0,2,3,2,2,2,0,0,2,2,3,0,0,0,0, 3,3,0,2,2,2,3,2,0,0,0,0,2,2,3,0,2,0,0,2,0,2,0,3,2,0,2,0,0,0, 3,3,2,2,3,0,0,2,2,2,2,0,2,2,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,0,0,2,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,0,0,0,2,0,0,3,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_15FinnishModel = { Iso_8859_15_CharToOrderMap, FinnishLangModel, 30, (float)0.9985378147555799, PR_TRUE, "ISO-8859-15" }; const SequenceModel Windows_1252FinnishModel = { Windows_1252_CharToOrderMap, FinnishLangModel, 30, (float)0.9985378147555799, PR_TRUE, "WINDOWS-1252" }; const SequenceModel Iso_8859_4FinnishModel = { Iso_8859_4_CharToOrderMap, FinnishLangModel, 30, (float)0.9985378147555799, PR_TRUE, "ISO-8859-4" }; const SequenceModel Iso_8859_13FinnishModel = { Iso_8859_13_CharToOrderMap, FinnishLangModel, 30, (float)0.9985378147555799, PR_TRUE, "ISO-8859-13" }; const SequenceModel Iso_8859_9FinnishModel = { Iso_8859_9_CharToOrderMap, FinnishLangModel, 30, (float)0.9985378147555799, PR_TRUE, "ISO-8859-9" }; const SequenceModel Iso_8859_1FinnishModel = { Iso_8859_1_CharToOrderMap, FinnishLangModel, 30, (float)0.9985378147555799, PR_TRUE, "ISO-8859-1" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangFrenchModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: French *********/ /** * Generated by BuildLangModel.py * On: 2015-12-03 21:10:27.685575 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 18, 11, 10, 0, 17, 15, 19, 4, 25, 26, 7, 13, 3, 8, /* 4X */ 12, 20, 5, 1, 6, 9, 16, 30, 21, 22, 29,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 18, 11, 10, 0, 17, 15, 19, 4, 25, 26, 7, 13, 3, 8, /* 6X */ 12, 20, 5, 1, 6, 9, 16, 30, 21, 22, 29,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM, 56,SYM,SYM,SYM,SYM,SYM,SYM, 51,SYM, 35,ILL, 57,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 51,SYM, 35,ILL, 58, 59, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 60,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 24, 38, 32, 46, 49, 61, 47, 27, 23, 14, 28, 41, 62, 39, 33, 36, /* CX */ 48, 45, 54, 40, 31, 55, 42,SYM, 52, 37, 43, 34, 44, 53, 50, 63, /* DX */ 24, 38, 32, 46, 49, 64, 47, 27, 23, 14, 28, 41, 65, 39, 33, 36, /* EX */ 48, 45, 54, 40, 31, 55, 42,SYM, 52, 37, 43, 34, 44, 53, 50, 66, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 18, 11, 10, 0, 17, 15, 19, 4, 25, 26, 7, 13, 3, 8, /* 4X */ 12, 20, 5, 1, 6, 9, 16, 30, 21, 22, 29,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 18, 11, 10, 0, 17, 15, 19, 4, 25, 26, 7, 13, 3, 8, /* 6X */ 12, 20, 5, 1, 6, 9, 16, 30, 21, 22, 29,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 67,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 24, 38, 32, 46, 49, 68, 47, 27, 23, 14, 28, 41, 69, 39, 33, 36, /* CX */ 48, 45, 54, 40, 31, 55, 42,SYM, 52, 37, 43, 34, 44, 53, 50, 70, /* DX */ 24, 38, 32, 46, 49, 71, 47, 27, 23, 14, 28, 41, 72, 39, 33, 36, /* EX */ 48, 45, 54, 40, 31, 55, 42,SYM, 52, 37, 43, 34, 44, 53, 50, 73, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 18, 11, 10, 0, 17, 15, 19, 4, 25, 26, 7, 13, 3, 8, /* 4X */ 12, 20, 5, 1, 6, 9, 16, 30, 21, 22, 29,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 18, 11, 10, 0, 17, 15, 19, 4, 25, 26, 7, 13, 3, 8, /* 6X */ 12, 20, 5, 1, 6, 9, 16, 30, 21, 22, 29,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 51,SYM, 51,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM, 74, 75,SYM,SYM, 76,SYM,SYM,SYM, 35, 35, 77,SYM, /* BX */ 24, 38, 32, 46, 49, 78, 47, 27, 23, 14, 28, 41, 79, 39, 33, 36, /* CX */ 48, 45, 54, 40, 31, 55, 42,SYM, 52, 37, 43, 34, 44, 53, 50, 80, /* DX */ 24, 38, 32, 46, 49, 81, 47, 27, 23, 14, 28, 41, 82, 39, 33, 36, /* EX */ 48, 45, 54, 40, 31, 55, 42,SYM, 52, 37, 43, 34, 44, 53, 50, 83, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 914 * First 512 sequences: 0.997057879992383 * Next 512 sequences (512-1024): 0.002942120007616917 * Rest: 3.8163916471489756e-17 * Negative sequences: TODO */ constexpr PRUint8 FrenchLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,0,0,3,3,3,0,3,3,0,0,0,2,0,2,0, 3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,0,3,3,0,0,3,0,0,2,3,0,0,0,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,0,3,3,2,2,3,0,0,3,0, 3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,0,3,3,3,2,3,2,0,2,2,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,2,3,0,2,3,2,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,0,2,3,3,3,2,3,3,3,0,2,0,0,0, 3,3,3,2,3,3,3,3,3,3,2,3,3,3,3,2,2,2,3,3,2,2,3,3,2,0,2,0,3,3,2,3,2,0,0,0,0,0, 3,3,3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,3,3,3,2,3,0,0,2,2,2,2,0,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,0,3,3,0,0,3,3,0,0,2,3,0,3,3, 3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,2,0,3,3,2,3,3,2,0,0,0,0,0,2,0, 3,3,3,2,3,3,3,2,3,3,3,2,2,3,3,3,2,2,2,3,0,0,3,3,0,3,0,0,2,2,3,2,2,2,3,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,2,2,2,3,3,0,3,3,0,0,3,0,2,2,2,3,2,0,0,2,0,0, 3,3,3,2,3,3,3,3,3,3,2,2,3,2,3,0,0,2,2,3,0,0,3,3,0,0,2,2,3,2,2,3,2,0,0,0,0,0, 3,3,3,3,3,2,3,2,3,3,2,3,3,3,3,2,0,2,3,2,0,0,3,3,0,2,2,0,3,0,2,2,3,0,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,0,0,3,2,2,0,3,0,0,2,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,2,2,2,3,3,3,2,2,3,3,0,2,3,3,0,0,0,0,2,0,2,0,2,0,0,0,0,0, 3,2,3,2,3,3,0,2,3,3,0,0,0,2,3,0,2,2,0,0,0,0,2,3,0,0,2,0,3,0,0,0,0,0,0,2,0,0, 3,3,3,2,3,3,3,3,3,3,2,2,2,3,3,2,0,3,0,0,0,0,0,3,0,2,0,0,3,0,0,0,0,0,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,2,2,0,3,2,0,0,3,2,0,3,0,0,0,0,0,0,3,2,0,2,0,0, 3,3,3,3,3,3,3,3,3,3,0,2,0,3,3,0,0,2,2,0,0,0,3,3,0,2,2,0,2,2,2,3,3,0,0,2,0,0, 0,0,2,0,0,0,0,2,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,0,3,0,3,2,3,2,2,3,3,2,3,0,3,2,2,2,2,3,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,0,2,2,2,0,3,2,0,0,2,2,0,0,0,0,0,0,0, 0,3,0,3,0,3,3,3,0,0,3,3,2,3,0,3,3,2,3,0,3,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,2,3,2,2,2,3,3,2,2,2,2,3,0,0,0,0,0,0,0,0,0,3,2,0,0,0,0,0,0,2,0,0,0,0,0, 3,3,3,2,3,3,2,3,3,3,0,0,2,3,2,2,2,2,2,3,0,0,3,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0, 0,0,3,0,0,0,0,0,3,3,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,3,2,0,0,0,3,0,3,0,0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,2,3,2,0,2,3,3,0,2,0,2,2,2,0,0,2,2,2,0,3,0,0,0,2,0,0,3,2,0,0,0,0,0,0,0, 3,2,3,2,3,2,2,2,3,2,0,2,0,0,2,0,0,2,2,2,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0, 0,2,0,3,0,0,3,3,0,0,0,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,2,2,0,3,3,0,0,0,3,2,2,0,3,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,3,0,0,3,3,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,3,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,0,2,2,0,3,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,0,2,2,3,0,0,2,2,0,2,0,2,0,2,2,0,2,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Windows_1252FrenchModel = { Windows_1252_CharToOrderMap, FrenchLangModel, 38, (float)0.997057879992383, PR_TRUE, "WINDOWS-1252" }; const SequenceModel Iso_8859_1FrenchModel = { Iso_8859_1_CharToOrderMap, FrenchLangModel, 38, (float)0.997057879992383, PR_TRUE, "ISO-8859-1" }; const SequenceModel Iso_8859_15FrenchModel = { Iso_8859_15_CharToOrderMap, FrenchLangModel, 38, (float)0.997057879992383, PR_TRUE, "ISO-8859-15" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangGermanModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: German *********/ /** * Generated by BuildLangModel.py * On: 2015-12-03 22:50:46.518374 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 5, 15, 12, 8, 0, 17, 14, 7, 3, 23, 16, 9, 13, 2, 11, /* 4X */ 18, 30, 1, 4, 6, 10, 21, 19, 28, 25, 20,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 5, 15, 12, 8, 0, 17, 14, 7, 3, 23, 16, 9, 13, 2, 11, /* 6X */ 18, 30, 1, 4, 6, 10, 21, 19, 28, 25, 20,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM, 59,SYM,SYM,SYM,SYM,SYM,SYM, 36,SYM, 54,ILL, 42,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 36,SYM, 54,ILL, 42, 56, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 60,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 41, 31, 37, 44, 22, 49, 50, 35, 32, 29, 48, 43, 57, 33, 47, 52, /* CX */ 53, 39, 51, 34, 40, 55, 26,SYM, 38, 58, 46, 61, 24, 45, 62, 27, /* DX */ 41, 31, 37, 44, 22, 49, 50, 35, 32, 29, 48, 43, 57, 33, 47, 52, /* EX */ 53, 39, 51, 34, 40, 55, 26,SYM, 38, 58, 46, 63, 24, 45, 64, 56, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 5, 15, 12, 8, 0, 17, 14, 7, 3, 23, 16, 9, 13, 2, 11, /* 4X */ 18, 30, 1, 4, 6, 10, 21, 19, 28, 25, 20,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 5, 15, 12, 8, 0, 17, 14, 7, 3, 23, 16, 9, 13, 2, 11, /* 6X */ 18, 30, 1, 4, 6, 10, 21, 19, 28, 25, 20,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 65,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 41, 31, 37, 44, 22, 49, 50, 35, 32, 29, 48, 43, 57, 33, 47, 52, /* CX */ 53, 39, 51, 34, 40, 55, 26,SYM, 38, 58, 46, 66, 24, 45, 67, 27, /* DX */ 41, 31, 37, 44, 22, 49, 50, 35, 32, 29, 48, 43, 57, 33, 47, 52, /* EX */ 53, 39, 51, 34, 40, 55, 26,SYM, 38, 58, 46, 68, 24, 45, 69, 56, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1188 * First 512 sequences: 0.9934041448127945 * Next 512 sequences (512-1024): 0.006482829516922903 * Rest: 0.0001130256702826099 * Negative sequences: TODO */ constexpr PRUint8 GermanLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,3,3,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,2,3,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,2,2,3,3,2,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,0,0,3,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,0,3,0,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,3,0,0,2,2, 3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,3,3,3,2,3,2,2,3,2,3,3,3,0,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,2,3,2,2,3,2,3,3,2,0,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,2,2, 3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,3,3,3,3,2,2,2,2,0,3,3,3,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,0,3,0,3,3,1,2, 3,3,2,3,2,3,3,3,2,3,3,3,3,2,2,2,3,2,2,2,2,2,2,2,1,3,2,0,1,2,3, 3,3,2,3,3,3,3,2,3,3,3,3,3,3,2,3,2,3,3,2,2,2,3,2,3,3,3,0,0,2,2, 3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,2,3,2,2,2,3,2,3,2,3,3,2,0,2,2,1, 3,3,3,3,3,3,3,3,2,3,3,3,2,2,3,3,2,2,2,2,2,2,3,2,3,3,3,0,0,2,0, 3,3,3,3,3,3,3,3,2,3,3,3,1,3,2,2,3,3,3,2,2,2,3,2,3,3,3,0,1,2,1, 3,3,3,3,3,3,3,2,2,3,3,3,2,3,3,2,3,3,2,2,2,2,3,2,3,2,3,0,0,2,0, 3,3,2,3,3,3,3,3,3,3,3,3,2,2,2,2,2,3,3,2,2,2,3,2,2,2,2,0,0,2,0, 3,3,3,3,3,3,2,2,2,2,3,3,1,2,2,2,2,2,2,2,2,2,3,3,3,2,3,0,0,0,0, 3,2,2,3,3,3,3,2,2,3,3,3,2,3,2,3,2,2,2,3,3,2,2,2,3,3,3,0,0,2,2, 3,2,2,3,2,3,2,0,2,2,2,3,1,2,2,2,2,2,2,2,2,2,2,1,0,2,3,0,0,2,1, 2,3,3,3,3,2,3,3,3,3,3,2,3,3,3,2,2,3,2,0,2,2,0,0,0,0,0,2,0,0,2, 3,2,2,3,2,3,2,2,2,2,3,3,2,2,2,1,2,1,2,0,2,0,3,2,3,2,2,0,0,2,0, 2,3,3,0,3,1,3,3,3,3,0,0,3,2,3,3,2,2,2,1,1,0,0,0,0,0,0,2,0,0,0, 3,3,3,2,3,3,2,2,2,3,2,3,3,3,2,2,3,2,3,2,2,2,0,2,2,2,1,0,0,1,0, 2,3,3,2,3,0,3,3,2,3,0,1,3,3,3,2,2,3,2,2,2,2,0,0,0,0,1,3,1,0,0, 3,2,2,3,2,2,3,2,1,2,2,2,0,2,2,3,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0, 3,1,2,3,1,3,3,2,1,2,2,2,2,0,0,2,2,2,3,2,0,2,0,0,0,2,0,0,2,2,0, 2,3,2,0,2,2,2,2,2,2,2,2,2,2,2,3,2,2,2,1,2,2,0,2,0,0,0,0,0,0,2, 0,1,0,2,0,2,0,0,0,0,3,2,0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Windows_1252GermanModel = { Windows_1252_CharToOrderMap, GermanLangModel, 31, (float)0.9934041448127945, PR_TRUE, "WINDOWS-1252" }; const SequenceModel Iso_8859_1GermanModel = { Iso_8859_1_CharToOrderMap, GermanLangModel, 31, (float)0.9934041448127945, PR_TRUE, "ISO-8859-1" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangGreekModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Greek *********/ /** * Generated by BuildLangModel.py * On: 2016-05-25 15:21:50.073117 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1253_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 32, 46, 41, 40, 30, 52, 48, 42, 33, 56, 49, 39, 44, 36, 34, /* 4X */ 47, 59, 35, 38, 37, 43, 54, 50, 58, 53, 57,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 32, 46, 41, 40, 30, 52, 48, 42, 33, 56, 49, 39, 44, 36, 34, /* 6X */ 47, 59, 35, 38, 37, 43, 54, 50, 58, 53, 57,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,ILL,SYM,ILL,ILL,ILL,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,ILL,SYM,ILL,ILL,ILL,ILL, /* 9X */ SYM,SYM, 17,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 62,SYM,SYM, 19, 22, 15,SYM, 16,SYM, 24, 28, /* BX */ 55, 0, 25, 18, 20, 5, 29, 10, 26, 3, 8, 14, 13, 4, 31, 1, /* CX */ 11, 6,ILL, 7, 2, 12, 27, 23, 45, 21, 51, 60, 17, 19, 22, 15, /* DX */ 61, 0, 25, 18, 20, 5, 29, 10, 26, 3, 8, 14, 13, 4, 31, 1, /* EX */ 11, 6, 9, 7, 2, 12, 27, 23, 45, 21, 51, 60, 16, 24, 28,ILL, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_7_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 32, 46, 41, 40, 30, 52, 48, 42, 33, 56, 49, 39, 44, 36, 34, /* 4X */ 47, 59, 35, 38, 37, 43, 54, 50, 58, 53, 57,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 32, 46, 41, 40, 30, 52, 48, 42, 33, 56, 49, 39, 44, 36, 34, /* 6X */ 47, 59, 35, 38, 37, 43, 54, 50, 58, 53, 57,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,SYM, 17,SYM, 19, 22, 15,SYM, 16,SYM, 24, 28, /* BX */ 55, 0, 25, 18, 20, 5, 29, 10, 26, 3, 8, 14, 13, 4, 31, 1, /* CX */ 11, 6,ILL, 7, 2, 12, 27, 23, 45, 21, 51, 60, 17, 19, 22, 15, /* DX */ 61, 0, 25, 18, 20, 5, 29, 10, 26, 3, 8, 14, 13, 4, 31, 1, /* EX */ 11, 6, 9, 7, 2, 12, 27, 23, 45, 21, 51, 60, 16, 24, 28,ILL, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1579 * First 512 sequences: 0.958419074626211 * Next 512 sequences (512-1024): 0.03968891876305471 * Rest: 0.0018920066107342773 * Negative sequences: TODO */ constexpr PRUint8 GreekLangModel[] = { 1,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,2,3,2,3,1,2, 3,3,3,3,3,1,3,0,3,0,0,0,0,0,0,1,0,0,1,0,0,0,2, 2,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3,1,2,3,2,3,1,2, 3,3,3,3,3,2,2,0,2,0,0,0,0,0,0,0,0,1,0,0,1,0,2, 3,3,2,3,2,3,3,3,2,3,3,1,3,2,2,3,3,3,2,3,0,3,3, 2,2,2,2,2,3,3,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,3,3,3,3,3,3,3,1,3,3,1,3,3,3,3,3,3,2, 3,1,3,3,2,3,3,0,2,0,0,1,0,0,0,1,0,0,0,0,0,0,2, 3,3,3,3,3,3,2,3,2,2,3,1,2,2,2,3,3,3,3,3,3,3,3, 2,2,1,3,2,3,2,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,3,2,3,3,3,3,2,3,3,3,3,3,2,2,3,1,3,3,1, 3,3,3,3,3,2,2,0,3,0,0,0,0,0,0,1,0,0,0,0,0,0,2, 3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,3,3,3,3, 3,3,2,3,2,3,2,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,3,2,3,2,3,3,0,3,3,3,3,2,3,3,3,2,3,2,3,3, 3,3,2,2,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,3,3,2,3,2,3,2,3,2,3,3,3,3,1,3,3,3,3, 2,3,2,2,2,3,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0, 1,1,0,1,1,1,0,1,1,0,2,1,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 1,1,3,0,3,2,3,3,3,3,0,3,0,3,3,1,0,0,3,1,2,0,0, 2,1,1,3,2,0,0,0,2,0,0,1,0,0,0,0,0,0,1,0,0,0,2, 3,3,3,3,2,3,3,2,1,1,3,2,3,1,3,3,3,3,1,3,0,3,3, 1,2,1,1,1,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,2,3,2,3,3,3,3,2,3,0,3,3,2,2,3,3,2,3,1,2, 3,0,3,3,2,1,3,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,2, 3,3,1,3,2,3,1,2,1,2,3,3,2,3,1,3,3,3,1,3,1,3,3, 1,2,3,0,3,2,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,2, 3,3,3,3,2,3,1,2,2,2,3,2,3,3,3,3,3,3,2,3,2,3,3, 2,3,2,2,2,3,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1, 3,3,3,1,3,3,3,3,3,3,2,3,0,3,3,0,0,0,3,0,3,3,0, 3,0,2,3,2,0,3,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2, 2,2,3,2,3,3,3,3,3,3,2,3,1,3,3,0,0,0,3,0,3,1,0, 3,1,2,2,3,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2, 2,2,3,3,3,2,3,3,3,3,2,3,1,3,3,0,0,0,3,0,3,1,0, 3,0,3,3,3,0,3,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2, 3,3,0,3,3,3,3,0,3,0,3,0,2,3,3,3,3,3,3,3,2,3,3, 2,2,0,0,0,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,3,3,3,2,3,1,3,3,0,0,0,3,0,3,3,0, 3,0,3,3,3,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2, 3,3,1,3,2,3,3,1,0,0,3,0,3,1,0,3,3,3,0,3,0,3,3, 0,3,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,1,3,2,3,1,3,3,2,3,1,3,1,3,2,2,1,2,3,1,2,0,2, 2,0,3,3,2,1,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,3,1,3,1,3,3,3,3,1,2,0,3,3,0,0,0,2,0,2,1,0, 2,0,1,3,2,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2, 3,3,3,3,3,3,3,1,0,1,3,1,2,2,2,3,2,3,0,3,0,3,3, 0,2,1,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,3,2,3,3,3,3,2,3,2,3,0,3,3,0,0,0,3,0,2,1,0, 2,0,2,3,2,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,2, 3,3,1,3,2,3,3,1,1,1,2,1,2,0,3,3,3,3,2,3,2,2,2, 0,2,2,0,0,2,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,0,3,3,3,3,1,1,0,3,0,3,3,3,2,2,3,1,3,0,2,3, 0,2,0,0,1,3,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,2,3,1,3,3,3,2,0,3,1,3,1,2,3,3,3,2,3,0,3,3, 0,2,0,2,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,3,2,3,0,3,3,2,3,2,3,0,3,2,0,0,0,1,0,2,1,0, 1,0,2,2,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,1,3,1,3,1,1,1,0,2,0,2,2,1,2,2,2,1,2,0,3,2, 0,2,1,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,0,0,1,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,2,1,2,2,2,3,3,2,3,2,2,2,2,2,2,0, 3,3,1,3,1,3,0,0,1,0,3,1,2,1,1,2,2,3,1,2,0,2,2, 0,3,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,0,1,1,0,0,0,1,0,0,1,1,1,1,0,0,0,1,0,0,0,0, 0,0,0,1,1,0,0,2,0,2,2,1,3,3,3,2,3,2,2,2,2,2,0, 0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 0,0,1,0,0,0,0,2,0,3,2,3,2,3,3,3,2,2,3,1,2,2,0, 0,0,1,0,1,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,1,0,0, 0,1,0,1,0,0,0,2,0,2,2,2,3,3,2,2,2,2,2,2,2,2,0, 0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,1,0,0,0,3,0,3,3,3,2,2,2,2,2,2,2,1,2,2,0, 0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,3,0,3,2,2,1,2,2,2,2,3,2,1,2,1,0, 1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0, 0,0,0,0,0,0,1,3,0,3,3,3,2,1,2,2,2,1,1,3,2,2,0, 0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,2,2,2,1,1,3,2,2,1,2,2,2,2,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,3,0,3,3,2,1,1,2,2,2,2,1,1,2,2,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,3,0,2,2,2,2,1,1,2,2,1,2,1,2,1,0, 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,2,2,2,2,1,2,1,2,2,2,3,2,1,0, 0,0,0,0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,3,0,2,2,2,2,2,2,1,2,1,1,1,2,2,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,2,2,1,2,2,2,2,2,2,2,1,1,2,0, 1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0, 0,0,0,0,0,0,0,3,0,2,2,2,1,1,1,2,2,1,1,1,2,2,0, 2,2,0,2,0,3,0,0,0,0,3,0,2,0,0,2,1,1,0,1,0,1,2, 0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Windows_1253GreekModel = { Windows_1253_CharToOrderMap, GreekLangModel, 46, (float)0.958419074626211, PR_FALSE, "WINDOWS-1253" }; const SequenceModel Iso_8859_7GreekModel = { Iso_8859_7_CharToOrderMap, GreekLangModel, 46, (float)0.958419074626211, PR_FALSE, "ISO-8859-7" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangHebrewModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Simon Montagu * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shoshannah Forbes * Shy Shalom * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /**************************************************************** CTR: Control characters that usually does not exist in any text RET: Carriage/Return SYM: symbol (punctuation) that does not belong to word NUM: 0 - 9 *****************************************************************/ //Windows-1255 language model //Character Mapping Table: constexpr unsigned char win1255_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, //00 CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, //10 SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, //20 NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, //30 SYM, 69, 91, 79, 80, 92, 89, 97, 90, 68,111,112, 82, 73, 95, 85, //40 78,121, 86, 71, 67,102,107, 84,114,103,115,SYM,SYM,SYM,SYM,SYM, //50 SYM, 50, 74, 60, 61, 42, 76, 70, 64, 53,105, 93, 56, 65, 54, 49, //60 66,110, 51, 43, 44, 63, 81, 77, 98, 75,108,SYM,SYM,SYM,SYM,SYM, //70 124,ILL,203,204,205, 40, 58,206,207,208,ILL,210,ILL,ILL,ILL,ILL, ILL, 83, 52, 47, 46, 72, 32, 94,216,113,ILL,109,ILL,ILL,ILL,ILL, 34,116,222,118,100,223,224,117,119,104,125,225,226, 87, 99,227, 106,122,123,228, 55,229,230,101,231,232,120,233, 48, 39, 57,234, 30, 59, 41, 88, 33, 37, 36, 31, 29, 35,235, 62, 28,236,126,237, 238, 38, 45,239,240,241,242,243,127,ILL,ILL,ILL,ILL,ILL,ILL,ILL, 9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23, 12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,ILL,ILL,128, 96,ILL, }; //Model Table: //total sequences: 100% //first 512 sequences: 98.4004% //first 1024 sequences: 1.5981% //rest sequences: 0.087% //negative sequences: 0.0015% constexpr PRUint8 HebrewLangModel[] = { 0,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,2,1,2,0,1,0,0, 3,0,3,1,0,0,1,3,2,0,1,1,2,0,2,2,2,1,1,1,1,2,1,1,1,2,0,0,2,2,0,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2, 1,2,1,2,1,2,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2, 1,2,1,3,1,1,0,0,2,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,1,2,2,1,3, 1,2,1,1,2,2,0,0,2,2,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,2,2,3,2, 1,2,1,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,2,3,2,2,2,1,2,2,2,2, 1,2,1,1,2,2,0,1,2,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,2,2,2,2,2, 0,2,0,2,2,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,2,2,2, 0,2,1,2,2,2,0,0,2,1,0,0,0,0,1,0,1,0,0,0,0,0,0,2,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,2,3,2,2,2, 1,2,1,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,1,0,2,0,2, 0,2,1,2,2,2,0,0,1,2,0,0,0,0,1,0,1,0,0,0,0,0,0,1,0,0,0,2,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,2,3,2,1,2,1,1,1, 0,1,1,1,1,1,3,0,1,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,0,0,1,0,0,1,0,0,0,0, 0,0,1,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2, 0,2,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,2,1,2,3,3,2,3,3,3,3,2,3,2,1,2,0,2,1,2, 0,2,0,2,2,2,0,0,1,2,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,1,2,2,3,3,2,3,2,3,2,2,3,1,2,2,0,2,2,2, 0,2,1,2,2,2,0,0,1,2,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,2,2,2,3,3,3,3,1,3,2,2,2, 0,2,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,2,3,2,2,2,1,2,2,0,2,2,2,2, 0,2,0,2,2,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,1,3,2,3,3,2,3,3,2,2,1,2,2,2,2,2,2, 0,2,1,2,1,2,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,2,3,2,3,3,2,3,3,3,3,2,3,2,3,3,3,3,3,2,2,2,2,2,2,2,1, 0,2,0,1,2,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,3,3,3,2,1,2,3,3,3,3,3,3,3,2,3,2,3,2,1,2,3,0,2,1,2,2, 0,2,1,1,2,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,1,3,1,2,2,2,1,2,3,3,1,2,1,2,2,2,2, 0,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,0,2,3,3,3,1,3,3,3,1,2,2,2,2,1,1,2,2,2,2,2,2, 0,2,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,3,3,3,3,3,2,3,3,3,2,2,3,3,3,2,1,2,3,2,3,2,2,2,2,1,2,1,1,1,2,2, 0,2,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,1,0,0,0,0,0, 1,0,1,0,0,0,0,0,2,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,3,2,3,1,2,2,2,2,3,2,3,1,1,2,2,1,2,2,1,1,0,2,2,2,2, 0,1,0,1,2,2,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0, 3,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2,0, 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,1,0,1,0,1,1,0,1,1,0,0,0,1,1,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 3,2,2,1,2,2,2,2,2,2,2,1,2,2,1,2,2,1,1,1,1,1,1,1,1,2,1,1,0,3,3,3, 0,3,0,2,2,2,2,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 2,2,2,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,2,2,2,1,1,1,2,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,0,2,2,0,0,0,0,0,0, 0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,0,2,1,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 0,3,1,1,2,2,2,2,2,1,2,2,2,1,1,2,2,2,2,2,2,2,1,2,2,1,0,1,1,1,1,0, 0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,1,1,1,1,2,1,1,2,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0, 0,0,2,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,0,0, 2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,1,2,1,2,1,1,1,1,0,0,0,0, 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,2,1,2,2,2,2,2,2,2,2,2,2,1,2,1,2,1,1,2,1,1,1,2,1,2,1,2,0,1,0,1, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,1,2,2,2,1,2,2,2,2,2,2,2,2,1,2,1,1,1,1,1,1,2,1,2,1,1,0,1,0,1, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,1,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2, 0,2,0,1,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,1,1,1,1,1,1,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,2,0,1,1,1,0,1,0,0,0,1,1,0,1,1,0,0,0,0,0,1,1,0,0, 0,1,1,1,2,1,2,2,2,0,2,0,2,0,1,1,2,1,1,1,1,2,1,0,1,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,1,0,0,0,0,0,1,0,1,2,2,0,1,0,0,1,1,2,2,1,2,0,2,0,0,0,1,2,0,1, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,2,0,2,1,2,0,2,0,0,1,1,1,1,1,1,0,1,0,0,0,1,0,0,1, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,1,0,2,1,1,0,1,0,0,1,1,1,2,2,0,0,1,0,0,0,1,0,0,1, 1,1,2,1,0,1,1,1,0,1,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,2,2,1, 0,2,0,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,1,0,0,1,0,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,1,1,1,1,1,1,1,2,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,1,1,0,1,0,0,0,1,1,0,1, 2,0,1,0,1,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1,2,1,1,2,0,1,0,0,0,1,1,0,1, 1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,0,0,2,1,1,2,0,2,0,0,0,1,1,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,2,1,1,0,1,0,0,2,2,1,2,1,1,0,1,0,0,0,1,1,0,1, 2,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,2,2,0,0,0,0,0,1,1,0,1,0,0,1,0,0,0,0,1,0,1, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,2,2,0,0,0,0,2,1,1,1,0,2,1,1,0,0,0,2,1,0,1, 1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,0,2,1,1,0,1,0,0,0,1,1,0,1, 2,2,1,1,1,0,1,1,0,1,1,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,2,1,1,0,1,0,0,1,1,0,1,2,1,0,2,0,0,0,1,1,0,1, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 0,1,0,0,2,0,2,1,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,1,2,0,1,0,0,1,1,1,0,1,0,0,1,0,0,0,1,0,0,1, 1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,2,1,1,1,1,1,0,1,0,0,0,0,1,0,1, 0,1,1,1,2,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0, }; const SequenceModel Win1255Model = { win1255_CharToOrderMap, HebrewLangModel, 64, (float)0.984004, PR_FALSE, "WINDOWS-1255" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangHungarianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Hungarian *********/ /** * Generated by BuildLangModel.py * On: 2015-12-12 18:02:46.730481 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_2_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 15, 23, 16, 0, 24, 13, 20, 7, 22, 9, 4, 12, 6, 8, /* 4X */ 21, 34, 5, 3, 2, 19, 17, 32, 33, 18, 10,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 15, 23, 16, 0, 24, 13, 20, 7, 22, 9, 4, 12, 6, 8, /* 6X */ 21, 34, 5, 3, 2, 19, 17, 32, 33, 18, 10,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 55,SYM, 42,SYM, 56, 46,SYM,SYM, 37, 52, 57, 58,SYM, 48, 59, /* AX */ SYM, 60,SYM, 42,SYM, 61, 46,SYM,SYM, 37, 52, 62, 63,SYM, 48, 64, /* BX */ 65, 11, 40, 36, 35, 66, 38, 39, 41, 14, 50, 67, 53, 28, 45, 68, /* CX */ 49, 43, 54, 26, 69, 27, 25,SYM, 44, 70, 30, 31, 29, 47, 51, 71, /* DX */ 72, 11, 40, 36, 35, 73, 38, 39, 41, 14, 50, 74, 53, 28, 45, 75, /* EX */ 49, 43, 54, 26, 76, 27, 25,SYM, 44, 77, 30, 31, 29, 47, 51,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1250_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 15, 23, 16, 0, 24, 13, 20, 7, 22, 9, 4, 12, 6, 8, /* 4X */ 21, 34, 5, 3, 2, 19, 17, 32, 33, 18, 10,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 15, 23, 16, 0, 24, 13, 20, 7, 22, 9, 4, 12, 6, 8, /* 6X */ 21, 34, 5, 3, 2, 19, 17, 32, 33, 18, 10,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM, 37,SYM, 46, 78, 48, 79, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, 37,SYM, 46, 80, 48, 81, /* 9X */ SYM,SYM,SYM, 42,SYM, 82,SYM,SYM,SYM,SYM, 52,SYM,SYM,SYM,SYM, 83, /* AX */ SYM,SYM,SYM, 42,SYM,SYM,SYM,SYM,SYM, 84, 52,SYM, 85,SYM, 86, 87, /* BX */ 88, 11, 40, 36, 35, 89, 38, 39, 41, 14, 50, 90, 53, 28, 45, 91, /* CX */ 49, 43, 54, 26, 92, 27, 25,SYM, 44, 93, 30, 31, 29, 47, 51, 94, /* DX */ 95, 11, 40, 36, 35, 96, 38, 39, 41, 14, 50, 97, 53, 28, 45, 98, /* EX */ 49, 43, 54, 26, 99, 27, 25,SYM, 44,100, 30, 31, 29, 47, 51,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1084 * First 512 sequences: 0.9748272224933486 * Next 512 sequences (512-1024): 0.024983863604162403 * Rest: 0.0001889139024889644 * Negative sequences: TODO */ constexpr PRUint8 HungarianLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3,1,0,2,2,0,0, 3,2,3,3,3,3,3,3,2,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,0,0,2,2,1,2,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,3,3,3,2,3,2,2,3,3,3,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,3,3,3,2,3,2,2,3,3,3,3,3,2, 3,3,3,3,3,2,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,3,3,3,3,3,2, 3,3,3,3,3,2,3,3,3,3,3,3,2,3,3,3,3,3,3,3,2,2,2,3,3,3,2,3,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,1,3,3,3,2,3,3,2,3,0,2,2,2,2, 3,2,3,3,3,3,3,2,2,3,3,2,3,3,0,3,3,3,2,3,3,3,2,3,3,0,2,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,3,2,2,2,3,2,2,2,2,2,3,3,2,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,2,2,3,3,3,3,3,2,2, 1,2,3,3,3,3,3,3,2,3,3,0,3,3,2,3,3,3,2,2,2,3,3,3,2,0,0,0,2,0,0,0, 3,3,3,2,3,2,2,3,3,2,3,3,3,2,3,3,2,2,2,3,2,3,2,2,2,2,3,2,2,2,2,3, 3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,2,3,3,3,3,2,3,2,2,3,3,2,3,2,2,2, 0,1,3,3,3,3,3,2,2,3,3,0,3,3,2,3,3,3,0,0,2,3,2,3,0,0,0,0,0,2,0,0, 3,3,2,3,3,3,2,3,3,2,2,3,2,1,3,3,3,2,2,3,1,2,2,2,2,2,3,3,3,2,2,2, 3,3,3,3,2,3,3,3,3,2,2,3,3,2,3,2,2,3,2,3,2,2,3,2,2,3,3,3,3,2,2,2, 3,3,2,2,2,2,2,3,3,2,0,3,0,2,3,2,2,2,1,2,2,0,2,1,2,3,2,3,3,2,2,2, 3,3,3,3,2,2,3,3,3,2,3,3,3,2,3,3,2,3,1,3,3,2,2,2,2,2,2,2,2,2,2,3, 3,2,3,3,3,3,3,2,2,3,2,3,3,3,0,3,3,2,2,2,2,2,2,3,2,0,0,0,1,0,0,0, 3,3,2,2,2,2,2,3,3,2,0,3,2,2,2,2,2,2,2,3,2,0,2,2,2,2,2,2,3,2,2,2, 3,3,3,3,3,3,2,3,3,2,2,3,1,2,3,2,2,2,2,3,2,3,3,3,2,2,2,2,3,3,2,0, 3,3,3,2,2,2,3,2,3,2,2,3,2,2,3,2,3,2,0,3,2,2,2,2,2,2,3,0,2,2,3,2, 3,3,2,3,2,2,2,3,3,3,3,2,2,2,3,2,2,2,2,2,3,0,0,2,2,2,2,0,3,0,0,0, 3,3,2,2,2,3,2,3,3,0,0,2,2,2,3,2,2,2,2,3,0,2,2,2,2,3,2,3,2,3,2,2, 2,0,3,3,3,3,3,0,0,3,3,0,2,3,0,3,3,3,0,0,2,2,2,2,1,0,0,0,0,0,0,0, 2,2,3,3,3,3,3,3,2,3,3,2,3,3,2,3,3,3,0,0,2,3,3,2,2,2,0,0,1,2,2,0, 2,2,3,3,3,3,2,3,2,3,3,2,2,2,2,3,3,2,0,0,2,2,3,2,2,1,0,0,1,2,1,0, 0,2,3,2,2,3,3,2,2,2,3,0,3,3,0,2,2,3,0,2,1,2,3,2,2,0,0,0,0,0,0,0, 0,0,3,2,3,2,3,0,0,3,2,0,2,3,0,0,2,2,0,0,1,0,2,0,0,0,0,0,0,0,0,0, 2,2,3,3,3,2,3,0,0,2,2,0,0,3,0,2,2,2,0,0,2,2,3,2,1,0,0,0,0,0,0,0, 2,2,2,2,3,2,2,2,0,3,2,0,2,2,0,2,2,3,0,2,2,0,2,2,2,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_2HungarianModel = { Iso_8859_2_CharToOrderMap, HungarianLangModel, 32, (float)0.9748272224933486, PR_FALSE, "ISO-8859-2" }; const SequenceModel Windows_1250HungarianModel = { Windows_1250_CharToOrderMap, HungarianLangModel, 32, (float)0.9748272224933486, PR_FALSE, "WINDOWS-1250" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangIrishModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Irish *********/ /** * Generated by BuildLangModel.py * On: 2016-09-27 00:33:40.158624 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 16, 8, 11, 5, 19, 12, 3, 1, 27, 25, 9, 13, 2, 10, /* 4X */ 21, 30, 4, 6, 7, 15, 23, 26, 29, 24, 28,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 16, 8, 11, 5, 19, 12, 3, 1, 27, 25, 9, 13, 2, 10, /* 6X */ 21, 30, 4, 6, 7, 15, 23, 26, 29, 24, 28,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 44,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 45, 14, 46, 47, 33, 48, 49, 39, 35, 18, 42, 37, 50, 17, 51, 40, /* CX */ 52, 32, 43, 22, 53, 54, 38,SYM, 36, 55, 20, 56, 31, 57, 58, 59, /* DX */ 60, 14, 61, 62, 33, 63, 64, 39, 35, 18, 42, 37, 65, 17, 66, 40, /* EX */ 67, 32, 43, 22, 68, 69, 38,SYM, 36, 70, 20, 71, 31, 72, 73, 74, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 16, 8, 11, 5, 19, 12, 3, 1, 27, 25, 9, 13, 2, 10, /* 4X */ 21, 30, 4, 6, 7, 15, 23, 26, 29, 24, 28,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 16, 8, 11, 5, 19, 12, 3, 1, 27, 25, 9, 13, 2, 10, /* 6X */ 21, 30, 4, 6, 7, 15, 23, 26, 29, 24, 28,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM, 75,SYM,SYM,SYM,SYM,SYM,SYM, 34,SYM, 76,ILL, 77,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 34,SYM, 78,ILL, 79, 80, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 81,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 82, 14, 83, 84, 33, 85, 86, 39, 35, 18, 42, 37, 87, 17, 88, 40, /* CX */ 89, 32, 43, 22, 90, 91, 38,SYM, 36, 92, 20, 93, 31, 94, 95, 96, /* DX */ 97, 14, 98, 99, 33,100,101, 39, 35, 18, 42, 37,102, 17,103, 40, /* EX */ 104, 32, 43, 22,105,106, 38,SYM, 36,107, 20,108, 31,109,110,111, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 16, 8, 11, 5, 19, 12, 3, 1, 27, 25, 9, 13, 2, 10, /* 4X */ 21, 30, 4, 6, 7, 15, 23, 26, 29, 24, 28,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 16, 8, 11, 5, 19, 12, 3, 1, 27, 25, 9, 13, 2, 10, /* 6X */ 21, 30, 4, 6, 7, 15, 23, 26, 29, 24, 28,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 34,SYM, 34,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,112,113,SYM,SYM,114,SYM,SYM,SYM,115,116,117,SYM, /* BX */ 118, 14,119,120, 33,121,122, 39, 35, 18, 42, 37,123, 17,124, 40, /* CX */ 125, 32, 43, 22,126,127, 38,SYM, 36,128, 20,129, 31,130,131,132, /* DX */ 133, 14,134,135, 33,136,137, 39, 35, 18, 42, 37,138, 17,139, 40, /* EX */ 140, 32, 43, 22,141,142, 38,SYM, 36,143, 20,144, 31,145,146,147, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_9_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 16, 8, 11, 5, 19, 12, 3, 1, 27, 25, 9, 13, 2, 10, /* 4X */ 21, 30, 4, 6, 7, 15, 23, 26, 29, 24, 28,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 16, 8, 11, 5, 19, 12, 3, 1, 27, 25, 9, 13, 2, 10, /* 6X */ 21, 30, 4, 6, 7, 15, 23, 26, 29, 24, 28,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,148,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 149, 14,150,151, 33,152,153, 39, 35, 18, 42, 37,154, 17,155, 40, /* CX */ 156, 32, 43, 22,157,158, 38,SYM, 36,159, 20,160, 31,161,162,163, /* DX */ 164, 14,165,166, 33,167,168, 39, 35, 18, 42, 37,169, 17,170, 40, /* EX */ 171, 32, 43, 22,172,173, 38,SYM, 36,174, 20,175, 31, 41,176,177, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 701 * First 512 sequences: 0.9974076651249096 * Next 512 sequences (512-1024): 0.0025923348750903907 * Rest: -2.7755575615628914e-17 * Negative sequences: TODO */ constexpr PRUint8 IrishLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,0,3,0,3,0,3,3,3,3,2,3,3,2, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,0,2,3,3,3,3,3,3,3,0,3,3,3,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,0,2,3,0,2, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,2,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,3,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,0,3,3,3,3,3,3,2,3,3,0, 3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,3,3,3,3,2,3,3,3,0,3,0,0, 3,3,3,3,3,3,3,3,3,3,3,0,2,3,3,3,3,3,3,2,3,0,3,3,3,3,2,2,3,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,0,3,3,3,2,3,3,3,3,2,3,0,3,3,2,0,3,0,2, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,3,0,0, 2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,0,3,3,3,0,3,3,3,3,3,2,3,2, 3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,2,3,3,3,3,0,3,2,3,2,3,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,2,3,3,2,3,0,3,0,2,0,2,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,0,3,3,3,3,3,3,2,3,3,3,0,3,0,0,0,2,2,0, 0,3,3,0,3,2,3,3,3,3,0,3,3,3,0,0,3,3,0,3,0,3,0,2,0,0,0,0,2,0,0, 3,3,3,2,3,3,3,3,3,3,2,3,3,3,3,0,3,3,2,2,0,3,0,2,2,2,0,2,3,2,0, 3,3,3,3,3,3,3,2,2,3,3,2,0,0,3,3,3,3,3,2,3,3,3,0,2,0,0,2,0,0,0, 2,0,3,0,3,0,3,3,3,3,3,3,3,2,0,0,3,0,0,0,3,0,0,2,0,0,0,0,0,0,0, 3,3,3,0,2,2,3,3,0,2,3,2,0,2,0,0,2,0,0,2,2,2,0,2,0,0,0,0,0,0,0, 3,3,0,3,3,3,2,3,2,3,3,0,3,2,3,3,2,3,3,3,0,0,3,2,2,0,0,0,0,0,0, 2,3,3,0,3,0,3,3,3,3,0,3,2,2,0,0,3,0,0,0,0,3,0,0,0,0,0,0,0,0,0, 3,3,0,3,3,3,3,3,2,3,3,0,0,2,3,3,0,3,3,0,2,3,3,0,2,0,0,0,0,0,0, 0,3,3,0,3,0,3,3,3,3,0,3,3,3,0,0,3,0,0,2,3,3,0,2,0,0,0,0,2,0,0, 3,3,2,0,3,3,3,2,0,2,3,0,2,0,3,2,0,3,3,0,0,0,3,2,2,0,0,0,0,0,0, 3,0,3,0,2,3,3,2,3,3,3,2,0,3,0,3,2,0,0,2,0,0,0,0,2,0,3,0,0,0,0, 3,3,3,3,3,3,3,0,0,3,3,0,0,2,2,3,2,0,2,0,0,2,0,2,3,2,2,0,0,0,0, 3,3,3,3,3,3,3,2,0,2,3,2,0,2,0,2,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0, 3,3,2,0,2,3,0,0,0,0,3,0,0,0,0,3,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0, 3,3,2,3,0,3,2,0,0,0,3,2,2,2,0,2,2,0,0,0,0,0,0,0,2,0,0,0,2,0,2, 3,3,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,3,0,3,0,2,2,0,0,0,0,0,0, 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_1IrishModel = { Iso_8859_1_CharToOrderMap, IrishLangModel, 31, (float)0.9974076651249096, PR_TRUE, "ISO-8859-1" }; const SequenceModel Windows_1252IrishModel = { Windows_1252_CharToOrderMap, IrishLangModel, 31, (float)0.9974076651249096, PR_TRUE, "WINDOWS-1252" }; const SequenceModel Iso_8859_15IrishModel = { Iso_8859_15_CharToOrderMap, IrishLangModel, 31, (float)0.9974076651249096, PR_TRUE, "ISO-8859-15" }; const SequenceModel Iso_8859_9IrishModel = { Iso_8859_9_CharToOrderMap, IrishLangModel, 31, (float)0.9974076651249096, PR_TRUE, "ISO-8859-9" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangItalianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Italian *********/ /** * Generated by BuildLangModel.py * On: 2016-09-21 18:46:08.841217 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_3_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 4X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 6X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 59,SYM,SYM,SYM,ILL, 60,SYM,SYM, 61, 48, 47, 62,SYM,ILL, 58, /* AX */ SYM, 63,SYM,SYM,SYM,SYM, 64,SYM,SYM, 46, 48, 47, 65,SYM,ILL, 58, /* BX */ 22, 32, 50,ILL, 39, 66, 67, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* CX */ ILL, 44, 29, 33, 51, 68, 34,SYM, 69, 28, 45, 70, 36, 71, 72, 73, /* DX */ 22, 32, 50,ILL, 39, 74, 75, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* EX */ ILL, 44, 29, 33, 51, 76, 34,SYM, 77, 28, 45, 78, 36, 79, 80,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 4X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 6X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 35,SYM, 35,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM, 41, 81,SYM,SYM, 41,SYM,SYM,SYM, 52, 52, 82,SYM, /* BX */ 22, 32, 50, 43, 39, 53, 54, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* CX */ 56, 44, 29, 33, 51, 83, 34,SYM, 57, 28, 45, 84, 36, 85, 86, 87, /* DX */ 22, 32, 50, 43, 39, 53, 54, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* EX */ 56, 44, 29, 33, 51, 88, 34,SYM, 57, 28, 45, 89, 36, 90, 91, 92, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_9_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 4X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 6X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 93,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 22, 32, 50, 43, 39, 53, 54, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* CX */ 47, 44, 29, 33, 51, 94, 34,SYM, 57, 28, 45, 95, 36, 96, 48, 97, /* DX */ 22, 32, 50, 43, 39, 53, 54, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* EX */ 47, 44, 29, 33, 51, 98, 34,SYM, 57, 28, 45, 99, 36, 46, 48,100, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 4X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 6X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,101,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 22, 32, 50, 43, 39, 53, 54, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* CX */ 56, 44, 29, 33, 51,102, 34,SYM, 57, 28, 45,103, 36,104,105,106, /* DX */ 22, 32, 50, 43, 39, 53, 54, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* EX */ 56, 44, 29, 33, 51,107, 34,SYM, 57, 28, 45,108, 36,109,110,111, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 4X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 16, 9, 10, 2, 17, 14, 19, 0, 27, 21, 5, 12, 4, 3, /* 6X */ 13, 20, 6, 8, 7, 11, 15, 25, 26, 23, 18,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,112,SYM,SYM,SYM,SYM,SYM,SYM, 35,SYM, 52,ILL, 41,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 35,SYM, 52,ILL, 41,113, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,114,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 22, 32, 50, 43, 39, 53, 54, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* CX */ 56, 44, 29, 33, 51,115, 34,SYM, 57, 28, 45,116, 36,117,118,119, /* DX */ 22, 32, 50, 43, 39, 53, 54, 38, 24, 30, 55, 40, 31, 37, 42, 49, /* EX */ 56, 44, 29, 33, 51,120, 34,SYM, 57, 28, 45,121, 36,122,123,124, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 872 * First 512 sequences: 0.9989484485502651 * Next 512 sequences (512-1024): 0.0010515514497349433 * Rest: -4.336808689942018e-17 * Negative sequences: TODO */ constexpr PRUint8 ItalianLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,0,3,3,3,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,0,3,3,3,0,2,0,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,2,3,2,3,0,3,3,2,2,0, 3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,2,3,2,0,3,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,2,3,3,0,2,3,3,2,3,2,2,3,3,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,3,0,0,3,2,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,3,3,3,3,3,0,3,0,0,3,2,0,3,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,0,2,3,3,2,3,2,3,2,2,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,0,3,0,3,2,3,3,3,0,3,2,3,0,0, 3,3,3,3,3,3,2,3,3,3,3,3,3,3,2,3,3,0,0,2,0,0,0,3,0,2,3,0,0,3,2,2,2,2, 3,3,3,3,2,3,3,3,3,3,3,3,3,3,2,2,2,2,2,3,0,3,2,3,0,2,0,2,0,3,2,0,2,2, 3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,3,2,0,3,2,2,0,3,0,2,2,2,0,2,2,0,0,2, 3,3,3,3,2,3,3,0,2,2,2,3,2,2,2,3,2,0,0,2,0,2,2,3,2,0,0,0,0,2,2,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,0,2,3,0,2,0,3,0,3,0,2,2,2,2,3,2,0, 3,3,3,3,0,3,3,3,2,3,0,3,2,2,3,2,2,3,0,2,0,2,0,0,2,2,2,2,2,0,2,0,0,0, 3,3,3,3,3,2,2,2,2,0,2,3,0,2,3,0,3,2,3,3,0,3,0,3,0,2,0,2,0,3,2,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,0,2,0,2,0,3,0,3,0,3,0,2,0,0,3,0,3,0, 2,3,0,2,0,0,2,0,2,0,0,3,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,2,2,3,3,2,2,2,2,2,0,3,0,3,0,3,0,2,2,2,0,0,0,0,2,2, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,2,0,0,0,2,0,2,0,2,2,2,0,0,0,0,0,0, 2,0,0,0,2,0,3,0,2,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,2,3,2,0,2,0,2,0,0,2,2,0,3,0,0,0,2,0,3,0,0,0,0,0,0,0,0, 3,3,3,3,0,3,0,3,2,3,0,2,0,3,0,3,0,0,0,0,0,2,0,2,0,2,3,0,0,0,0,0,0,0, 3,3,3,3,2,2,2,2,0,2,2,3,2,0,0,0,0,0,0,2,0,3,0,2,0,2,0,2,0,0,0,0,0,2, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,3,2,2,3,3,2,3,2,3,0,2,2,0,2,3,0,2,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0, 0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,3,2,2,0,2,2,0,0,0,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,3,2,2,0,0,2,2,0,0,0,0,2,2,0,2,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_3ItalianModel = { Iso_8859_3_CharToOrderMap, ItalianLangModel, 34, (float)0.9989484485502651, PR_TRUE, "ISO-8859-3" }; const SequenceModel Iso_8859_15ItalianModel = { Iso_8859_15_CharToOrderMap, ItalianLangModel, 34, (float)0.9989484485502651, PR_TRUE, "ISO-8859-15" }; const SequenceModel Iso_8859_9ItalianModel = { Iso_8859_9_CharToOrderMap, ItalianLangModel, 34, (float)0.9989484485502651, PR_TRUE, "ISO-8859-9" }; const SequenceModel Iso_8859_1ItalianModel = { Iso_8859_1_CharToOrderMap, ItalianLangModel, 34, (float)0.9989484485502651, PR_TRUE, "ISO-8859-1" }; const SequenceModel Windows_1252ItalianModel = { Windows_1252_CharToOrderMap, ItalianLangModel, 34, (float)0.9989484485502651, PR_TRUE, "WINDOWS-1252" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangLatvianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Latvian *********/ /** * Generated by BuildLangModel.py * On: 2016-09-21 00:19:18.362275 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_4_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 17, 22, 13, 3, 25, 19, 28, 1, 16, 11, 9, 12, 7, 10, /* 4X */ 15, 38, 4, 2, 5, 6, 14, 33, 35, 34, 20,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 17, 22, 13, 3, 25, 19, 28, 1, 16, 11, 9, 12, 7, 10, /* 6X */ 15, 38, 4, 2, 5, 6, 14, 33, 35, 34, 20,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 55, 56, 57,SYM, 58, 26,SYM,SYM, 23, 21, 31, 59,SYM, 29,SYM, /* AX */ SYM, 60,SYM, 61,SYM, 62, 26,SYM,SYM, 23, 21, 31, 63, 48, 29, 48, /* BX */ 8, 42, 64, 65, 40, 52, 53, 66, 32, 37, 67, 43, 46, 45, 49, 18, /* CX */ 68, 24, 51, 30, 69, 70, 36,SYM, 71, 72, 73, 74, 39, 75, 27, 44, /* DX */ 8, 42, 76, 77, 40, 52, 53, 78, 32, 37, 79, 43, 46, 45, 49, 18, /* EX */ 80, 24, 51, 30, 81, 82, 36,SYM, 83, 84, 85, 86, 39, 87, 27,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_10_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 17, 22, 13, 3, 25, 19, 28, 1, 16, 11, 9, 12, 7, 10, /* 4X */ 15, 38, 4, 2, 5, 6, 14, 33, 35, 34, 20,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 17, 22, 13, 3, 25, 19, 28, 1, 16, 11, 9, 12, 7, 10, /* 6X */ 15, 38, 4, 2, 5, 6, 14, 33, 35, 34, 20,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 88, 21, 31, 18, 89, 30,SYM, 26, 90, 23, 91, 29,SYM, 27, 48, /* AX */ SYM, 92, 21, 31, 18, 93, 30,SYM, 26, 94, 23, 95, 29, 96, 27, 48, /* BX */ 8, 42, 97, 98, 40, 52, 53, 99, 32, 37,100, 43, 46, 45, 49,101, /* CX */ 50, 24, 51, 47,102,103, 36,104,105,106,107,108, 39,109, 54, 44, /* DX */ 8, 42,110,111, 40, 52, 53,112, 32, 37,113, 43, 46, 45, 49,114, /* EX */ 50, 24, 51, 47,115,116, 36,117,118,119,120,121, 39,122, 54,123, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_13_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 17, 22, 13, 3, 25, 19, 28, 1, 16, 11, 9, 12, 7, 10, /* 4X */ 15, 38, 4, 2, 5, 6, 14, 33, 35, 34, 20,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 17, 22, 13, 3, 25, 19, 28, 1, 16, 11, 9, 12, 7, 10, /* 6X */ 15, 38, 4, 2, 5, 6, 14, 33, 35, 34, 20,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,124,SYM,125,SYM,SYM,SYM,SYM, 53, /* AX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,126,SYM,127,SYM,SYM,SYM,SYM, 53, /* BX */ 128,129, 8,130, 40, 52,131, 21, 32, 37,132, 46, 31, 30, 18, 26, /* CX */ 23,133, 24, 47, 51,134, 36,SYM,135, 41,136, 27, 39,137, 29, 44, /* DX */ 138,139, 8,140, 40, 52,141, 21, 32, 37,142, 46, 31, 30, 18, 26, /* EX */ 23,143, 24, 47, 51,144, 36,SYM,145, 41,146, 27, 39,147, 29,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 970 * First 512 sequences: 0.9904102202220861 * Next 512 sequences (512-1024): 0.009589779777913882 * Rest: -1.734723475976807e-17 * Negative sequences: TODO */ constexpr PRUint8 LatvianLangModel[] = { 2,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,2,3,3,2,3,3,3,3,3,0,3,3,2,2,3,2,2,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,2,3,3,3,3,3,2,3,3,3,2,3,0,0,2,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,3,3,0,2,2,2,3,2,2,0,0,0,2,2,0,2,2,2, 3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,3,3,3,3,0,3,3,2,3,2,2,2,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,3,3,2,3,2,2,2,2,0,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,3,3,0,0,2,0,2,2,0,0,0,0, 3,3,3,2,3,3,2,3,3,3,2,3,3,3,3,3,3,3,2,3,3,2,3,3,3,2,3,0,2,2,2,2,2,0,2,0,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,3,3,3,2,3,3,3,0,3,0,2,2,2,0,0,3,0,2,0,0,0,2, 2,2,3,2,3,3,2,3,0,3,0,3,3,3,3,3,3,3,0,2,3,0,3,3,3,3,3,0,0,2,0,2,2,0,0,0,0,0,0, 3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,3,3,2,0,2,2,0,2,2,0,2,0, 3,2,3,2,3,3,3,3,2,3,2,3,3,3,3,3,3,3,0,3,3,2,3,3,3,3,3,0,2,3,2,3,2,2,2,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,2,2,2,2,2,2,3,3,2,0,3,2,2,0,0,0,0,0,2,0,2,0,0, 3,3,3,3,0,3,3,3,3,2,3,3,2,2,2,3,3,3,3,2,0,3,2,2,0,2,0,3,0,0,0,2,0,0,2,2,0,2,0, 3,3,3,3,3,2,3,3,3,2,3,2,3,2,3,2,2,2,3,2,3,3,2,2,2,0,0,2,0,3,0,0,0,2,2,0,0,2,0, 3,3,3,3,2,2,3,2,3,2,3,2,2,2,2,3,3,2,3,2,2,3,2,0,2,0,0,2,0,0,0,0,0,0,2,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,3,3,2,3,2,3,2,2,2,2,2,0,0,2,0,0,0,0,0,0,0, 3,3,3,3,2,0,3,3,3,2,3,2,2,2,2,2,0,0,2,2,0,3,2,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,0,3,2,3,3,3,2,2,2,2,2,2,2,3,0,0,3,2,2,0,0,2,3,2,0,0,0,2,0,2,0,2,0,0, 0,0,3,0,3,3,0,3,0,3,0,3,3,3,3,3,3,3,0,3,3,0,3,3,3,2,2,0,0,2,2,0,2,0,0,0,0,0,0, 3,3,3,3,3,3,3,2,3,3,3,2,2,2,2,0,0,0,0,2,2,2,0,3,0,2,3,3,2,2,0,0,0,0,2,0,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,2,3,0,0,2,2,0,0,0,0,2,2,0,0,0,0, 2,0,3,0,3,3,0,3,0,3,0,3,3,3,3,2,3,2,0,3,3,0,3,3,2,2,3,0,0,2,2,3,0,0,0,0,0,0,0, 3,3,3,3,2,2,3,2,3,2,3,3,2,2,2,2,0,2,3,0,2,3,2,2,0,0,0,2,3,0,0,2,0,0,2,0,0,0,0, 3,3,3,3,2,3,3,3,3,3,3,2,2,2,3,2,2,2,3,2,2,2,0,0,2,0,2,2,0,0,3,0,0,0,0,0,0,0,0, 3,3,2,3,0,0,3,2,3,0,3,0,2,2,2,2,2,2,0,2,0,3,2,3,0,0,0,2,0,0,3,2,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,2,2,3,3,2,2,0,0,0,0,0,2,2,0,2,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0, 3,3,2,2,2,0,3,2,3,2,3,2,2,0,2,2,2,0,2,2,0,2,0,2,2,0,2,2,0,0,2,3,0,0,0,0,0,0,0, 0,2,3,0,3,3,0,3,0,3,2,3,2,3,3,3,2,0,0,2,3,0,3,2,0,2,0,0,2,2,0,0,0,0,0,0,0,0,0, 3,3,2,3,2,2,2,3,2,2,3,2,2,2,0,0,2,0,2,0,0,2,0,0,0,0,0,2,2,0,0,0,0,2,2,0,2,0,0, 3,3,2,3,2,0,3,2,3,2,3,2,2,0,2,0,0,0,2,0,2,2,0,0,2,0,0,2,0,0,2,2,0,0,0,0,0,0,0, 3,3,2,3,0,2,3,0,2,0,2,0,0,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,0,3,0,0,2,0,0,0,2,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,2,3,0,0,3,2,2,0,2,2,2,0,0,2,0,0,2,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,0,2,0,0,0,2,2,0,2,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,3,0,0,0,0,0, 2,0,2,2,2,0,0,2,0,2,2,0,2,2,0,0,0,0,0,2,0,0,2,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0, 2,2,0,0,0,0,2,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, 0,0,2,0,0,2,0,2,0,2,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,2,2,0,2,0,0,2,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_4LatvianModel = { Iso_8859_4_CharToOrderMap, LatvianLangModel, 39, (float)0.9904102202220861, PR_TRUE, "ISO-8859-4" }; const SequenceModel Iso_8859_10LatvianModel = { Iso_8859_10_CharToOrderMap, LatvianLangModel, 39, (float)0.9904102202220861, PR_TRUE, "ISO-8859-10" }; const SequenceModel Iso_8859_13LatvianModel = { Iso_8859_13_CharToOrderMap, LatvianLangModel, 39, (float)0.9904102202220861, PR_TRUE, "ISO-8859-13" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangLithuanianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Lithuanian *********/ /** * Generated by BuildLangModel.py * On: 2016-09-21 00:25:34.775158 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_10_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 18, 23, 12, 4, 25, 16, 26, 0, 14, 9, 10, 11, 6, 3, /* 4X */ 15, 37, 5, 2, 7, 8, 13, 33, 32, 19, 27,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 18, 23, 12, 4, 25, 16, 26, 0, 14, 9, 10, 11, 6, 3, /* 6X */ 15, 37, 5, 2, 7, 8, 13, 33, 32, 19, 27,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 29, 50, 60, 47, 61, 62,SYM, 56, 55, 21, 63, 22,SYM, 28, 64, /* AX */ SYM, 29, 50, 65, 47, 66, 67,SYM, 56, 55, 21, 68, 22, 69, 28, 70, /* BX */ 41, 39, 71, 53, 38, 43, 72, 30, 24, 36, 31, 73, 17, 40, 74, 46, /* CX */ 75, 57, 34, 44, 59, 76, 35, 77, 48, 20, 54, 78, 45, 79, 80, 52, /* DX */ 41, 39, 81, 53, 38, 43, 82, 30, 24, 36, 31, 83, 17, 40, 84, 46, /* EX */ 85, 57, 34, 44, 59, 86, 35, 87, 48, 20, 54, 88, 45, 89, 90, 91, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_4_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 18, 23, 12, 4, 25, 16, 26, 0, 14, 9, 10, 11, 6, 3, /* 4X */ 15, 37, 5, 2, 7, 8, 13, 33, 32, 19, 27,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 18, 23, 12, 4, 25, 16, 26, 0, 14, 9, 10, 11, 6, 3, /* 6X */ 15, 37, 5, 2, 7, 8, 13, 33, 32, 19, 27,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 29, 92, 93,SYM, 94, 56,SYM,SYM, 21, 50, 95, 96,SYM, 22,SYM, /* AX */ SYM, 29,SYM, 97,SYM, 98, 56,SYM,SYM, 21, 50, 99,100,101, 22,102, /* BX */ 41, 39,103, 53, 38, 43,104, 30, 24, 36, 31,105, 17, 40,106, 47, /* CX */ 55, 57, 34,107, 59,108, 35,SYM, 48, 20, 54,109, 45,110, 28, 52, /* DX */ 41, 39,111, 53, 38, 43,112, 30, 24, 36, 31,113, 17, 40,114, 47, /* EX */ 55, 57, 34,115, 59,116, 35,SYM, 48, 20, 54,117, 45,118, 28,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_13_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 18, 23, 12, 4, 25, 16, 26, 0, 14, 9, 10, 11, 6, 3, /* 4X */ 15, 37, 5, 2, 7, 8, 13, 33, 32, 19, 27,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 18, 23, 12, 4, 25, 16, 26, 0, 14, 9, 10, 11, 6, 3, /* 6X */ 15, 37, 5, 2, 7, 8, 13, 33, 32, 19, 27,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 48,SYM,119,SYM,SYM,SYM,SYM,120, /* AX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 48,SYM,121,SYM,SYM,SYM,SYM,122, /* BX */ 29, 30, 41, 49, 38, 43, 31, 50, 24, 36,123, 17,124,125, 47, 56, /* CX */ 21, 51, 57, 44, 34,126, 35,SYM, 20, 42, 58, 28, 45,127, 22, 52, /* DX */ 29, 30, 41, 49, 38, 43, 31, 50, 24, 36,128, 17,129,130, 47, 56, /* EX */ 21, 51, 57, 44, 34,131, 35,SYM, 20, 42, 58, 28, 45,132, 22,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1016 * First 512 sequences: 0.9928710196247589 * Next 512 sequences (512-1024): 0.0071289803752411715 * Rest: -4.85722573273506e-17 * Negative sequences: TODO */ constexpr PRUint8 LithuanianLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,3,3,3,0,2,3,2,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,0,3,3,3,3,3,3,3,0,0,0,0,2,2,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,0,3,3,2,3,2,3,3,2,3,0,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,0,3,3,3,2,3,3,3,0,0,0,0,2,3,0,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,0,3,3,3,3,3,2,3,0,0,2,0,2,3,0,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,2,2,3,3,3,3,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,2,2,3,3,2,2,3,3,3,3,3,2,3,3,3,3,3,3,2,3,3,3,2,2,2,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,2,3,3,3,3,2,0,2,0,2,3,2,3,3,3,3,0,2,2,2,2,0, 3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,0,3,2,0,3,3,3,3,3,2,3,0,0,0,0,0,2,0,0,0,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,2,2,3,2,3,3,3,0,3,2,2,3,2,3,3,2,3,0,2,2,0,2,0, 3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,3,3,2,3,3,3,3,0,2,0,2,2,0, 3,3,3,3,3,2,2,3,3,2,2,3,2,2,2,3,2,3,3,3,3,2,3,2,0,2,0,2,3,3,0,3,0,2,2,2,2,0, 3,3,3,3,3,3,2,2,3,3,2,3,2,3,2,2,2,3,2,3,3,2,3,2,0,2,2,2,2,3,2,3,0,2,2,2,2,2, 3,3,3,3,3,2,2,2,3,2,3,0,2,0,2,2,0,3,0,3,3,2,0,2,0,0,0,3,2,3,0,3,0,0,0,0,0,0, 3,3,2,3,3,2,2,2,3,2,0,0,0,0,0,2,2,3,0,2,3,0,0,0,0,0,0,0,3,3,3,3,0,0,2,2,0,0, 3,3,3,3,3,3,2,3,3,3,3,2,2,3,3,2,2,3,0,3,2,3,2,2,2,2,3,0,2,2,2,2,0,0,2,0,2,0, 3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,2,3,2,3,3,2,2,2,0,0,3,3,3,3,2,2,0,2,2,2,0,0, 2,0,3,0,0,3,3,3,2,3,3,3,3,3,3,0,3,0,2,0,0,2,2,2,2,0,0,2,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,2,3,0,3,2,2,2,0,3,2,2,3,2,2,2,0,0,2,2,3,3,2,3,0,2,2,2,0,0, 2,3,3,2,2,3,3,3,2,3,3,3,3,3,3,3,3,0,3,2,0,2,2,2,3,2,0,3,2,0,0,0,0,0,2,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,2,3,0,3,2,3,2,3,2,2,2,2,3,2,0,0,2,2,2,2,0,0,2,0,0,0, 3,3,3,3,3,2,3,3,3,2,2,3,3,3,2,2,2,3,2,3,2,2,0,0,0,2,0,0,2,2,2,2,0,0,2,0,0,0, 3,3,2,3,3,2,0,2,3,3,3,2,2,2,0,0,2,2,2,2,0,0,0,2,0,2,3,2,3,2,0,0,0,0,0,0,2,2, 3,3,0,2,3,0,0,0,2,2,0,0,2,0,0,2,0,2,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0, 3,3,2,3,3,3,0,2,3,2,3,2,0,0,2,0,2,2,2,2,2,0,0,2,0,2,0,0,2,2,0,0,0,0,0,2,0,0, 3,3,2,3,3,3,3,3,3,2,2,3,2,0,2,0,0,0,2,2,2,0,0,0,0,2,0,0,2,2,0,0,0,2,2,0,0,0, 3,3,2,3,3,2,2,2,3,2,3,3,3,2,0,2,2,2,2,3,3,0,0,2,0,0,2,2,2,2,0,2,0,2,2,0,2,0, 2,0,3,0,0,3,3,3,0,3,2,3,3,2,0,2,3,0,2,0,0,2,2,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0, 0,0,3,0,0,2,0,0,0,2,2,2,0,2,3,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,3,0,0,3,0,3,0,3,3,2,2,3,2,3,3,2,0,0,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,0,0,2,2,0,2,2,0,0,0,0,3,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0, 3,3,2,2,3,2,2,0,2,0,2,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0, 2,0,2,0,2,0,2,0,0,2,0,2,2,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,0,2,2,2,0,2,2,2,2,0,0,0,2,0,0,0,0,0,0,2,0,2,0,2,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,0,2,2,0,0,0,0,2,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_10LithuanianModel = { Iso_8859_10_CharToOrderMap, LithuanianLangModel, 38, (float)0.9928710196247589, PR_TRUE, "ISO-8859-10" }; const SequenceModel Iso_8859_4LithuanianModel = { Iso_8859_4_CharToOrderMap, LithuanianLangModel, 38, (float)0.9928710196247589, PR_TRUE, "ISO-8859-4" }; const SequenceModel Iso_8859_13LithuanianModel = { Iso_8859_13_CharToOrderMap, LithuanianLangModel, 38, (float)0.9928710196247589, PR_TRUE, "ISO-8859-13" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangMalteseModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Maltese *********/ /** * Generated by BuildLangModel.py * On: 2016-09-21 02:07:45.509404 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_3_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 15, 28, 13, 4, 16, 19, 22, 1, 9, 12, 3, 10, 5, 8, /* 4X */ 14, 27, 6, 11, 2, 7, 26, 18, 25, 30, 20,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 15, 28, 13, 4, 16, 19, 22, 1, 9, 12, 3, 10, 5, 8, /* 6X */ 14, 27, 6, 11, 2, 7, 26, 18, 25, 30, 20,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 17,SYM,SYM,SYM,ILL, 48,SYM,SYM, 49, 50, 51, 52,SYM,ILL, 21, /* AX */ SYM, 17,SYM,SYM,SYM,SYM, 53,SYM,SYM, 54, 55, 56, 57,SYM,ILL, 21, /* BX */ 29, 36, 47,ILL, 58, 24, 59, 40, 33, 31, 60, 39, 45, 35, 61, 62, /* CX */ ILL, 37, 32, 34, 44, 23, 38,SYM, 63, 43, 42, 64, 46, 65, 66, 41, /* DX */ 29, 36, 47,ILL, 67, 24, 68, 40, 33, 31, 69, 39, 45, 35, 70, 71, /* EX */ ILL, 37, 32, 34, 44, 23, 38,SYM, 72, 43, 42, 73, 46, 74, 75,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 870 * First 512 sequences: 0.9959115850692665 * Next 512 sequences (512-1024): 0.004088414930733575 * Rest: -4.423544863740858e-17 * Negative sequences: TODO */ constexpr PRUint8 MalteseLangModel[] = { 3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,3,3,3,3,3,2,0,3,0,0,3,3,3,2,3,3, 3,3,3,3,3,2,2,3,3,3,3,3,3,3,2,3,3,2,3,3,2,0,3,3,0,3,3,3,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3, 3,3,3,3,3,3,2,3,3,3,2,3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,3,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,3,2,3,3,3,3,3,2,3,0,3, 3,3,3,3,3,3,3,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2, 3,3,2,2,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,0,3,3,2,2,2,2,2,0,0,0, 3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,0,2,3,2,2,3,2,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,0,0,3,2,0,0,3,3,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,3,3,2,3,0,0,0,2,0,3,2,0,0,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,2,3,3,2,2,0,3,0,0,2,2,0,2,2,2, 3,3,2,3,3,2,3,3,3,3,2,3,2,2,3,0,0,0,2,3,0,0,3,0,2,0,2,0,2,0,0, 3,3,3,3,3,3,3,3,3,3,0,3,3,3,0,3,2,3,3,3,0,3,2,0,0,2,0,3,3,0,2, 3,3,3,3,3,3,3,3,3,3,0,3,2,2,0,2,3,0,0,2,0,0,2,0,0,0,0,2,2,0,2, 3,3,3,3,3,2,3,3,3,3,3,3,2,3,0,3,2,3,2,0,0,2,3,2,0,2,0,3,0,0,0, 3,3,3,3,3,3,3,2,3,2,2,3,3,3,2,2,2,2,3,2,0,2,2,3,2,3,2,2,0,0,2, 3,3,2,3,3,3,3,3,3,2,2,2,2,3,2,2,0,3,3,3,2,3,3,0,0,0,3,0,2,2,3, 3,3,2,2,3,2,2,3,2,3,2,0,0,0,2,0,0,0,2,2,3,0,0,0,0,0,2,2,0,0,0, 3,3,2,3,3,2,0,3,3,3,3,0,0,3,0,2,2,0,2,3,0,3,0,0,0,0,3,0,0,0,0, 3,3,3,2,3,2,3,3,3,0,3,2,2,2,2,2,0,0,2,0,2,0,2,0,0,0,0,2,0,0,2, 3,3,2,2,3,3,3,3,3,3,2,0,0,3,0,2,0,2,2,3,2,2,0,3,0,0,2,0,0,2,0, 3,3,2,2,3,0,2,2,0,3,0,0,2,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0, 3,3,3,3,3,2,3,3,3,3,3,0,2,2,0,3,2,0,2,0,0,0,3,0,0,3,2,0,2,0,0, 3,3,0,2,3,2,3,3,3,3,0,2,0,3,2,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,2, 3,3,3,2,3,0,3,3,3,3,2,3,2,3,0,3,3,0,3,3,0,0,2,2,2,2,0,3,0,2,0, 3,3,3,3,3,0,2,2,3,2,0,3,3,3,0,2,3,0,0,0,2,0,3,0,0,0,0,2,2,0,2, 0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0,2,0,0,0,0,0,0,0,2,0,2,0,2, }; const SequenceModel Iso_8859_3MalteseModel = { Iso_8859_3_CharToOrderMap, MalteseLangModel, 31, (float)0.9959115850692665, PR_TRUE, "ISO-8859-3" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangNederlandsModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Nederlands *********/ /** * Generated by BuildLangModel.py * On: 2019-03-05 22:48:03.613070 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 17, 16, 7, 0, 22, 10, 13, 3, 20, 14, 9, 12, 1, 6, /* 4X */ 18, 27, 4, 8, 5, 15, 11, 19, 25, 23, 21,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 17, 16, 7, 0, 22, 10, 13, 3, 20, 14, 9, 12, 1, 6, /* 6X */ 18, 27, 4, 8, 5, 15, 11, 19, 25, 23, 21,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM, 55,SYM,SYM,SYM,SYM,SYM,SYM, 45,SYM, 53,ILL, 44,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 45,SYM, 53,ILL, 44, 59, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 54,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 38, 33, 43, 41, 37, 52, 47, 35, 30, 26, 39, 24, 60, 34, 40, 28, /* CX */ 56, 46, 58, 31, 36, 48, 32,SYM, 50, 61, 42, 62, 29, 63, 64, 65, /* DX */ 38, 33, 43, 41, 37, 52, 47, 35, 30, 26, 39, 24, 66, 34, 40, 28, /* EX */ 56, 46, 58, 31, 36, 48, 32,SYM, 50, 67, 42, 68, 29, 69, 70, 71, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 17, 16, 7, 0, 22, 10, 13, 3, 20, 14, 9, 12, 1, 6, /* 4X */ 18, 27, 4, 8, 5, 15, 11, 19, 25, 23, 21,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 17, 16, 7, 0, 22, 10, 13, 3, 20, 14, 9, 12, 1, 6, /* 6X */ 18, 27, 4, 8, 5, 15, 11, 19, 25, 23, 21,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 54,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 38, 33, 43, 41, 37, 52, 47, 35, 30, 26, 39, 24, 72, 34, 40, 28, /* CX */ 56, 46, 58, 31, 36, 48, 32,SYM, 50, 73, 42, 74, 29, 75, 76, 77, /* DX */ 38, 33, 43, 41, 37, 52, 47, 35, 30, 26, 39, 24, 78, 34, 40, 28, /* EX */ 56, 46, 58, 31, 36, 48, 32,SYM, 50, 79, 42, 80, 29, 81, 82, 83, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_9_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 17, 16, 7, 0, 22, 10, 13, 3, 20, 14, 9, 12, 1, 6, /* 4X */ 18, 27, 4, 8, 5, 15, 11, 19, 25, 23, 21,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 17, 16, 7, 0, 22, 10, 13, 3, 20, 14, 9, 12, 1, 6, /* 6X */ 18, 27, 4, 8, 5, 15, 11, 19, 25, 23, 21,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 54,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 38, 33, 43, 41, 37, 52, 47, 35, 30, 26, 39, 24, 84, 34, 40, 28, /* CX */ 57, 46, 58, 31, 36, 48, 32,SYM, 50, 85, 42, 86, 29, 87, 51, 88, /* DX */ 38, 33, 43, 41, 37, 52, 47, 35, 30, 26, 39, 24, 89, 34, 40, 28, /* EX */ 57, 46, 58, 31, 36, 48, 32,SYM, 50, 90, 42, 91, 29, 49, 51, 92, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 17, 16, 7, 0, 22, 10, 13, 3, 20, 14, 9, 12, 1, 6, /* 4X */ 18, 27, 4, 8, 5, 15, 11, 19, 25, 23, 21,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 17, 16, 7, 0, 22, 10, 13, 3, 20, 14, 9, 12, 1, 6, /* 6X */ 18, 27, 4, 8, 5, 15, 11, 19, 25, 23, 21,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 45,SYM, 45,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM, 44, 54,SYM,SYM, 44,SYM,SYM,SYM, 53, 53, 93,SYM, /* BX */ 38, 33, 43, 41, 37, 52, 47, 35, 30, 26, 39, 24, 94, 34, 40, 28, /* CX */ 56, 46, 58, 31, 36, 48, 32,SYM, 50, 95, 42, 96, 29, 97, 98, 99, /* DX */ 38, 33, 43, 41, 37, 52, 47, 35, 30, 26, 39, 24,100, 34, 40, 28, /* EX */ 56, 46, 58, 31, 36, 48, 32,SYM, 50,101, 42,102, 29,103,104,105, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 924 * First 512 sequences: 0.9980487395086337 * Next 512 sequences (512-1024): 0.0019512604913663406 * Rest: -4.9439619065339e-17 * Negative sequences: TODO */ constexpr PRUint8 NederlandsLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,2,2,0,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,0,3,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,0,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,2,0,2,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,0,2,3,0,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,3,2,0,2,2,0,2,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,2,2,0,0,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,3,0,0,2,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,3,0,2,2,0,0,2,2,2,0, 3,2,3,3,3,2,3,3,3,3,2,2,2,0,2,3,2,2,2,2,3,2,2,3,0,0,2,0,0,0,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,3,0,2,2,0,0,2,0,0,0, 3,3,3,3,3,3,3,2,3,3,2,0,3,2,2,3,2,3,2,2,2,3,2,3,0,0,2,2,0,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,3,0,2,0,0,0,2,0,2,2, 3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,3,2,2,2,2,0,0,0, 3,2,3,3,3,3,3,3,2,3,2,2,2,3,3,3,3,3,2,0,2,2,2,3,0,2,2,2,0,0,2,2,0, 3,3,3,3,3,3,3,3,3,3,2,2,2,3,2,3,3,3,3,2,3,2,3,3,0,0,2,0,0,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,3,0,2,2,0,0,0,0,0,0, 3,2,3,3,3,3,3,3,3,2,2,2,2,3,2,2,2,3,2,3,2,2,2,3,0,0,2,2,0,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,2,0,0,2,2,0,2,0,2,2, 3,2,3,3,2,2,3,2,2,2,2,2,2,2,2,3,2,2,0,3,2,3,2,3,0,0,2,0,0,2,2,0,0, 3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,2,3,2,3,3,3,0,0,2,0,0,2,0,0,0, 3,3,3,2,3,3,3,3,3,3,2,2,3,2,2,2,3,2,3,3,2,3,2,2,0,0,2,2,0,0,2,0,2, 2,3,2,3,3,2,0,3,2,3,0,2,2,0,0,0,0,0,0,0,0,2,2,0,0,2,0,0,0,0,0,0,0, 3,0,3,3,2,3,3,0,2,2,0,2,2,2,0,2,2,0,3,2,0,0,2,3,0,2,0,0,0,0,0,0,0, 2,3,2,2,2,2,2,2,2,2,2,2,2,0,2,2,2,2,2,0,0,2,2,0,0,0,3,2,0,0,0,0,0, 2,0,2,2,0,0,2,0,2,2,0,0,0,0,0,3,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 2,3,0,0,2,2,0,3,3,2,0,0,2,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,2,2,0,0,2,2,2,0,2,2,2,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,3,2,0,0,2,2,2,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 0,2,0,0,2,2,0,0,0,0,0,0,2,2,2,0,0,2,2,2,0,2,0,0,0,0,0,0,0,0,0,2,0, 0,2,0,2,2,2,0,0,0,2,0,0,2,2,0,0,0,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Windows_1252NederlandsModel = { Windows_1252_CharToOrderMap, NederlandsLangModel, 33, (float)0.9980487395086337, PR_TRUE, "WINDOWS-1252" }; const SequenceModel Iso_8859_1NederlandsModel = { Iso_8859_1_CharToOrderMap, NederlandsLangModel, 33, (float)0.9980487395086337, PR_TRUE, "ISO-8859-1" }; const SequenceModel Iso_8859_9NederlandsModel = { Iso_8859_9_CharToOrderMap, NederlandsLangModel, 33, (float)0.9980487395086337, PR_TRUE, "ISO-8859-9" }; const SequenceModel Iso_8859_15NederlandsModel = { Iso_8859_15_CharToOrderMap, NederlandsLangModel, 33, (float)0.9980487395086337, PR_TRUE, "ISO-8859-15" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangPolishModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Polish *********/ /** * Generated by BuildLangModel.py * On: 2016-09-21 17:21:04.405363 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Ibm852_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 4X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 6X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,CTR, /* 7X */ 47, 39, 34, 54, 40, 78, 30, 47, 19, 58, 49, 49, 77, 32, 40, 30, /* 8X */ 34, 79, 80, 55, 38, 74, 74, 28, 28, 38, 39, 76, 76, 19,SYM, 44, /* 9X */ 35, 37, 24, 51, 25, 25, 45, 45, 23, 23,SYM, 32, 44, 56,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 35, 54, 46, 56,SYM,SYM,SYM,SYM, 27, 27,SYM, /* BX */ SYM,SYM,SYM,SYM,SYM,SYM, 53, 53,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* CX */ 70, 70, 69, 58, 69, 81, 37, 77, 46,SYM,SYM,SYM,SYM, 65, 82,SYM, /* DX */ 24, 57, 55, 29, 29, 83, 41, 41, 84, 51, 85, 86, 60, 60, 65,SYM, /* EX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 87, 50, 50,SYM,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_16_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 4X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 6X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 25, 25, 19,SYM,SYM, 41,SYM, 41,SYM, 62,SYM, 32,SYM, 32, 27, /* AX */ SYM,SYM, 44, 19, 45,SYM,SYM,SYM, 45, 44, 62,SYM, 75, 75, 88, 27, /* BX */ 61, 35, 54, 53, 40, 30, 89, 47, 43, 34, 64, 58, 90, 37, 77, 91, /* CX */ 70, 29, 66, 24, 55, 49, 38, 28, 92, 68, 51, 93, 39, 23, 72, 57, /* DX */ 61, 35, 54, 53, 40, 30, 94, 47, 43, 34, 64, 58, 95, 37, 77, 96, /* EX */ 70, 29, 66, 24, 55, 49, 38, 28, 97, 68, 51, 98, 39, 23, 72, 99, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_2_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 4X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 6X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 25,SYM, 19,SYM, 74, 28,SYM,SYM, 41, 56, 76, 32,SYM, 45, 27, /* AX */ SYM, 25,SYM, 19,SYM, 74, 28,SYM,SYM, 41, 56, 76, 32,SYM, 45, 27, /* BX */ 100, 35, 54, 53, 40,101, 30, 47, 44, 34, 23, 58, 46, 37, 77, 69, /* CX */ 70, 29,102, 24, 55, 49, 38,SYM, 50,103, 51,104, 39, 60, 65, 57, /* DX */ 105, 35, 54, 53, 40,106, 30, 47, 44, 34, 23, 58, 46, 37, 77, 69, /* EX */ 70, 29,107, 24, 55, 49, 38,SYM, 50,108, 51,109, 39, 60, 65,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Mac_Centraleurope_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 4X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 6X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,CTR, /* 7X */ 40, 63, 63, 34, 25, 38, 39, 35, 25, 44, 40, 44, 30, 30, 34, 32, /* 8X */ 32, 69, 37, 69,110,111, 71, 24, 71, 55, 38, 67, 51, 46, 46, 39, /* 9X */ SYM,SYM, 23,SYM,SYM,SYM,SYM, 57,SYM,SYM,SYM, 23,SYM,SYM,112,113, /* AX */ 114, 73,SYM,SYM, 73,115,SYM,SYM, 19,116,117, 74, 74,118,119,120, /* BX */ 121, 29,SYM,SYM, 29,122,SYM,SYM,SYM,SYM,SYM,123, 49, 67, 49, 42, /* CX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 42,124,125, 50,SYM,SYM, 50,126, /* DX */ 127, 41,SYM,SYM, 41, 28, 28, 35, 76, 76, 37, 45, 45, 59, 24, 55, /* EX */ 59,128, 51,129,130,131,132,133, 60, 60,134, 27, 19, 27,135,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_13_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 4X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 6X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 48,SYM,136,SYM,SYM,SYM,SYM,137, /* AX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 48,SYM,138,SYM,SYM,SYM,SYM,139, /* BX */ 25,140, 63, 30, 40, 52, 23,141, 44, 34, 32, 71,142,143, 73,144, /* CX */ 41, 29,145, 24, 42, 67, 38,SYM,146, 19, 28, 59, 39, 27, 45, 57, /* DX */ 25,147, 63, 30, 40, 52, 23,148, 44, 34, 32, 71,149,150, 73,151, /* EX */ 41, 29,152, 24, 42, 67, 38,SYM,153, 19, 28, 59, 39, 27, 45,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1250_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 4X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 20, 11, 14, 3, 26, 21, 22, 1, 18, 7, 15, 16, 5, 2, /* 6X */ 13, 36, 4, 6, 10, 17, 31, 9, 33, 12, 8,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM, 41,SYM, 28, 76, 45, 32, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, 41,SYM, 28, 76, 45, 32, /* 9X */ SYM,SYM,SYM, 19,SYM, 25,SYM,SYM,SYM,SYM, 56,SYM,SYM,SYM,SYM, 27, /* AX */ SYM,SYM,SYM, 19,SYM,SYM,SYM,SYM,SYM, 25, 56,SYM, 74,SYM, 74, 27, /* BX */ 154, 35, 54, 53, 40,155, 30, 47, 44, 34, 23, 58, 46, 37, 77, 69, /* CX */ 70, 29,156, 24, 55, 49, 38,SYM, 50,157, 51,158, 39, 60, 65, 57, /* DX */ 159, 35, 54, 53, 40,160, 30, 47, 44, 34, 23, 58, 46, 37, 77, 69, /* EX */ 70, 29,161, 24, 55, 49, 38,SYM, 50,162, 51,163, 39, 60, 65,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1321 * First 512 sequences: 0.9894531815946438 * Next 512 sequences (512-1024): 0.010193795364991133 * Rest: 0.0003530230403650733 * Negative sequences: TODO */ constexpr PRUint8 PolishLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,3,3,3,3,3,3,3,2,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,2,3,3,3,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,0,0,0,3,3,3,3,2,3,2,2,0,0,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,2,2,3,3,3,3,2,3,2,2,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,2,3,3,3,2,2,2,0,2,2,0,1,2,2,2, 3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,2,2,3,2,1,2,3,2,3,3,3,3,2,0,0,0,2,0,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,2,3,2,3,3,2,0,0,0,0,2,0,0,2,2,2, 3,3,3,3,3,2,3,3,1,3,3,3,2,2,2,3,3,3,2,3,2,2,2,3,3,3,2,3,2,0,0,2,0,1,2,2,0, 3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,2,3,3,3,3,3,3,2,3,2,3,1,2,0,0,0,2,0,0,2,2,2, 3,3,3,3,3,3,3,3,3,2,2,3,3,3,2,3,2,3,0,3,2,2,2,3,3,3,1,0,2,0,0,0,0,0,1,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,2,3,2,3,2,2,3,3,3,3,2,1,0,0,0,2,0,0,2,2,0, 3,3,3,3,2,3,2,3,3,2,3,2,3,1,2,3,2,3,3,2,1,2,3,2,3,3,0,0,0,0,0,2,0,0,2,0,2, 3,2,2,2,3,3,3,3,3,3,3,3,0,3,3,3,3,2,3,3,3,3,2,0,0,0,3,3,3,3,3,2,2,0,0,0,0, 3,3,3,3,3,3,3,2,2,2,2,3,3,3,2,3,2,3,1,3,2,2,3,2,3,2,2,0,0,0,0,2,0,0,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,2,3,3,2,2,1,0,0,2,2,0,2,2,1, 3,3,3,3,2,3,3,3,2,3,3,3,2,2,3,3,3,3,2,0,3,3,2,3,2,3,3,2,0,0,0,2,0,1,2,2,0, 3,3,3,3,2,3,3,2,1,2,2,3,3,3,2,2,3,3,2,2,3,2,1,3,3,2,2,1,1,0,0,1,0,0,2,2,0, 3,3,2,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,3,3,3,2,0,1,0,3,3,2,3,2,2,2,2,2,2,2, 3,3,3,3,2,3,3,2,2,3,2,3,0,2,3,2,3,3,2,2,2,2,1,3,3,3,1,1,3,1,0,1,0,0,0,2,0, 3,0,3,3,1,3,2,3,2,2,3,2,3,2,2,0,2,3,0,2,2,3,1,3,3,3,0,2,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,2,2,1,2,3,2,2,3,2,3,2,3,2,1,2,3,2,2,2,0,0,0,0,0,0,0,2,2,0, 3,3,3,3,3,3,2,2,2,3,2,1,2,2,3,3,2,3,2,3,2,2,3,2,3,2,2,1,0,0,0,2,0,0,2,2,2, 3,3,3,3,3,3,2,2,1,2,3,2,3,2,2,3,3,3,2,2,2,1,1,2,2,2,2,0,2,0,0,2,0,0,2,2,0, 0,0,0,0,0,0,3,3,3,1,3,3,0,3,3,2,0,0,0,3,3,3,0,0,0,0,0,3,3,0,2,0,2,0,0,0,0, 0,0,0,0,3,2,2,2,3,3,2,3,1,2,3,3,2,0,3,3,3,2,0,0,0,0,2,3,1,0,0,1,3,0,0,0,0, 0,0,0,0,0,0,2,2,3,2,3,3,0,3,3,0,0,0,0,3,2,3,0,0,0,0,0,3,0,0,2,0,0,0,0,0,0, 3,3,3,3,3,2,2,2,1,2,2,2,2,1,1,3,2,3,2,2,2,2,2,2,2,2,3,0,0,0,0,1,0,0,2,1,1, 3,2,3,3,0,3,2,2,0,2,0,2,3,0,2,3,2,3,0,0,3,1,0,2,2,3,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,3,3,0,2,0,3,0,3,0,2,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,1,3,0,0,0,0,0,0, 1,0,0,0,0,0,3,2,0,0,0,3,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,0,0,0,2,0,2,0,0,0,0,2,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,2,2,2,1,0,0,0,2,2,1,2,0,2,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,2,2,0, 0,0,0,0,2,3,2,0,0,2,0,2,0,0,3,2,2,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0, 2,3,2,2,0,1,0,1,0,1,1,0,1,2,1,2,1,2,1,0,2,0,2,0,0,0,2,0,0,0,0,2,0,2,0,0,0, 2,1,2,2,2,2,2,0,1,0,2,2,1,1,2,2,2,1,1,0,1,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 0,1,0,1,2,2,2,2,2,0,2,2,0,2,1,2,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, 1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Ibm852PolishModel = { Ibm852_CharToOrderMap, PolishLangModel, 37, (float)0.9894531815946438, PR_TRUE, "IBM852" }; const SequenceModel Iso_8859_16PolishModel = { Iso_8859_16_CharToOrderMap, PolishLangModel, 37, (float)0.9894531815946438, PR_TRUE, "ISO-8859-16" }; const SequenceModel Iso_8859_2PolishModel = { Iso_8859_2_CharToOrderMap, PolishLangModel, 37, (float)0.9894531815946438, PR_TRUE, "ISO-8859-2" }; const SequenceModel Mac_CentraleuropePolishModel = { Mac_Centraleurope_CharToOrderMap, PolishLangModel, 37, (float)0.9894531815946438, PR_TRUE, "MAC-CENTRALEUROPE" }; const SequenceModel Iso_8859_13PolishModel = { Iso_8859_13_CharToOrderMap, PolishLangModel, 37, (float)0.9894531815946438, PR_TRUE, "ISO-8859-13" }; const SequenceModel Windows_1250PolishModel = { Windows_1250_CharToOrderMap, PolishLangModel, 37, (float)0.9894531815946438, PR_TRUE, "WINDOWS-1250" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangPortugueseModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Portuguese *********/ /** * Generated by BuildLangModel.py * On: 2016-09-20 23:47:27.348423 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 17, 10, 7, 1, 16, 14, 18, 4, 28, 34, 12, 9, 6, 2, /* 4X */ 13, 21, 5, 3, 8, 11, 15, 32, 24, 31, 26,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 17, 10, 7, 1, 16, 14, 18, 4, 28, 34, 12, 9, 6, 2, /* 6X */ 13, 21, 5, 3, 8, 11, 15, 32, 24, 31, 26,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 51,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 36, 25, 35, 20, 41, 42, 43, 22, 39, 19, 29, 44, 52, 23, 45, 47, /* CX */ 48, 53, 46, 27, 37, 30, 38,SYM, 54, 55, 33, 56, 40, 57, 58, 49, /* DX */ 36, 25, 35, 20, 41, 42, 43, 22, 39, 19, 29, 44, 59, 23, 45, 47, /* EX */ 48, 60, 46, 27, 37, 30, 38,SYM, 61, 62, 33, 63, 40, 64, 65, 50, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_9_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 17, 10, 7, 1, 16, 14, 18, 4, 28, 34, 12, 9, 6, 2, /* 4X */ 13, 21, 5, 3, 8, 11, 15, 32, 24, 31, 26,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 17, 10, 7, 1, 16, 14, 18, 4, 28, 34, 12, 9, 6, 2, /* 6X */ 13, 21, 5, 3, 8, 11, 15, 32, 24, 31, 26,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 66,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 36, 25, 35, 20, 41, 42, 43, 22, 39, 19, 29, 44, 67, 23, 45, 47, /* CX */ 68, 69, 46, 27, 37, 30, 38,SYM, 70, 71, 33, 72, 40, 73, 74, 49, /* DX */ 36, 25, 35, 20, 41, 42, 43, 22, 39, 19, 29, 44, 75, 23, 45, 47, /* EX */ 76, 77, 46, 27, 37, 30, 38,SYM, 78, 79, 33, 80, 40, 81, 82, 50, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 17, 10, 7, 1, 16, 14, 18, 4, 28, 34, 12, 9, 6, 2, /* 4X */ 13, 21, 5, 3, 8, 11, 15, 32, 24, 31, 26,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 17, 10, 7, 1, 16, 14, 18, 4, 28, 34, 12, 9, 6, 2, /* 6X */ 13, 21, 5, 3, 8, 11, 15, 32, 24, 31, 26,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 83,SYM, 84,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM, 85, 86,SYM,SYM, 87,SYM,SYM,SYM, 88, 89, 50,SYM, /* BX */ 36, 25, 35, 20, 41, 42, 43, 22, 39, 19, 29, 44, 90, 23, 45, 47, /* CX */ 48, 91, 46, 27, 37, 30, 38,SYM, 92, 93, 33, 94, 40, 95, 96, 49, /* DX */ 36, 25, 35, 20, 41, 42, 43, 22, 39, 19, 29, 44, 97, 23, 45, 47, /* EX */ 48, 98, 46, 27, 37, 30, 38,SYM, 99,100, 33,101, 40,102,103, 50, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 17, 10, 7, 1, 16, 14, 18, 4, 28, 34, 12, 9, 6, 2, /* 4X */ 13, 21, 5, 3, 8, 11, 15, 32, 24, 31, 26,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 17, 10, 7, 1, 16, 14, 18, 4, 28, 34, 12, 9, 6, 2, /* 6X */ 13, 21, 5, 3, 8, 11, 15, 32, 24, 31, 26,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,104,SYM,SYM,SYM,SYM,SYM,SYM,105,SYM,106,ILL,107,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,108,SYM,109,ILL,110, 50, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,111,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 36, 25, 35, 20, 41, 42, 43, 22, 39, 19, 29, 44,112, 23, 45, 47, /* CX */ 48,113, 46, 27, 37, 30, 38,SYM,114,115, 33,116, 40,117,118, 49, /* DX */ 36, 25, 35, 20, 41, 42, 43, 22, 39, 19, 29, 44,119, 23, 45, 47, /* EX */ 48,120, 46, 27, 37, 30, 38,SYM,121,122, 33,123, 40,124,125, 50, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 891 * First 512 sequences: 0.9953179582313172 * Next 512 sequences (512-1024): 0.0046820417686827855 * Rest: 2.42861286636753e-17 * Negative sequences: TODO */ constexpr PRUint8 PortugueseLangModel[] = { 2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,3,3,3,3,0,3,2,3,0,0,3,2,2,3,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,2,3,3,2,3,2,3,2,3,0,2,3,3,2,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,2,3,2,3,2,3,0,2,3,3,0,3,0,0,0, 3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,3,0,3,0,3,2,3,0,2,3,3,2,2,3,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,3,0,3,3,3,3,2,3,3,2,2,2,3,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,3,2,3,3,3,2,2,3,3,0,3, 3,3,3,3,3,2,3,3,3,2,3,3,2,2,3,3,3,2,3,3,3,3,3,3,2,3,3,3,3,2,0,3,2,3,3,2,0,3, 3,3,3,3,3,3,2,3,2,3,2,3,3,2,3,2,2,2,2,3,3,2,0,3,0,3,0,3,2,3,2,3,3,3,0,2,0,2, 3,3,3,3,3,3,3,0,3,3,3,3,3,2,2,2,2,2,3,3,3,0,0,3,0,3,2,3,0,3,2,3,2,2,2,3,0,3, 3,3,3,3,3,2,3,2,2,3,2,3,2,3,2,0,2,3,0,3,3,2,0,3,0,3,2,3,0,2,2,3,2,3,0,3,0,3, 3,3,3,2,3,3,3,2,3,3,3,3,3,2,2,0,2,2,3,3,2,2,3,3,0,3,2,3,0,3,2,3,0,2,3,3,0,2, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,2,3,2,2,3,3,3,2,3,0,3,3,0,2,2,0,2,0,0,0, 3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,0,3,2,3,0,3,0,3,2,2,2,3,0,3, 3,3,3,3,3,3,2,2,3,0,2,3,3,3,0,0,0,2,3,3,2,2,3,3,0,3,2,3,0,2,2,2,0,3,0,2,0,2, 3,3,3,3,3,3,3,2,2,3,2,3,3,2,2,2,0,2,3,3,2,0,0,2,0,3,0,2,0,3,2,3,2,2,0,2,0,0, 3,3,3,0,3,3,0,2,0,0,0,3,0,0,0,2,0,0,0,3,2,0,0,3,0,3,0,2,0,3,2,0,0,0,0,2,0,2, 3,3,3,2,3,3,0,2,2,2,2,3,3,2,2,0,3,2,0,3,0,0,0,3,0,2,0,3,0,3,0,2,0,2,0,0,0,2, 3,3,3,3,3,3,3,3,3,2,2,3,3,2,2,2,3,2,2,3,2,0,0,2,0,2,2,2,3,2,0,2,2,2,0,0,0,0, 3,3,3,3,3,3,3,2,3,2,0,3,3,0,0,0,2,2,2,2,3,0,0,2,0,3,0,2,0,0,3,3,2,0,2,0,0,0, 2,2,2,3,2,3,3,3,3,3,3,2,3,3,2,2,2,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0,0,0, 0,2,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,2,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,3,0,0,2,0,0,0,0, 3,0,3,3,0,3,3,3,3,3,3,0,3,3,3,3,3,3,0,0,0,2,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,0,0,0,3,0,3,3,2,3,0,3,2,0,2,2,2,0,0,2,3,2,0,2,2,0,2,0,0,0,0,0,0,2, 0,0,0,3,0,3,2,2,3,0,3,2,3,3,3,3,3,3,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,0,3,2,2,0,0,2,2,3,0,0,0,0,0,2,2,2,2,0,0,0,0,2,2,2,0,2,2,0,2,0,0,2,0,0, 0,0,0,3,2,3,3,3,3,3,3,0,3,3,3,2,3,2,0,0,0,2,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,2,0,2,0,0,0,2,3,0,2,0,0,0,0,0,0,2,0,0,0,0,3,0,0,0,0,0,0,0,2,2,0,0,0, 0,0,0,3,0,0,3,0,2,3,0,2,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,2,3,2,2,3,2,3,2,3,2,2,0,2,2,2,0,0,0,0,0,3,0,2,0,2,0,0,0,2,0,2,0,0,0, 3,3,3,2,3,2,2,2,3,2,2,2,2,0,0,2,0,2,3,0,0,0,0,0,0,0,2,0,0,0,0,2,2,0,2,0,0,0, 0,0,0,3,0,2,3,3,2,3,2,0,3,2,0,2,0,3,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,2,2,0,0,3,2,2,2,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,2,0,0,0, 0,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,2,0,0,3,2,2,3,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_1PortugueseModel = { Iso_8859_1_CharToOrderMap, PortugueseLangModel, 38, (float)0.9953179582313172, PR_TRUE, "ISO-8859-1" }; const SequenceModel Iso_8859_9PortugueseModel = { Iso_8859_9_CharToOrderMap, PortugueseLangModel, 38, (float)0.9953179582313172, PR_TRUE, "ISO-8859-9" }; const SequenceModel Iso_8859_15PortugueseModel = { Iso_8859_15_CharToOrderMap, PortugueseLangModel, 38, (float)0.9953179582313172, PR_TRUE, "ISO-8859-15" }; const SequenceModel Windows_1252PortugueseModel = { Windows_1252_CharToOrderMap, PortugueseLangModel, 38, (float)0.9953179582313172, PR_TRUE, "WINDOWS-1252" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangRomanianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Romanian *********/ /** * Generated by BuildLangModel.py * On: 2016-09-28 18:58:13.757152 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_16_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 17, 9, 11, 0, 16, 15, 23, 1, 26, 27, 6, 12, 4, 8, /* 4X */ 13, 32, 3, 10, 5, 7, 21, 29, 25, 28, 22,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 17, 9, 11, 0, 16, 15, 23, 1, 26, 27, 6, 12, 4, 8, /* 6X */ 13, 32, 3, 10, 5, 7, 21, 29, 25, 28, 22,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 60, 61, 46,SYM,SYM, 38,SYM, 38,SYM, 19,SYM, 62,SYM, 63, 64, /* AX */ SYM,SYM, 41, 46, 40,SYM,SYM,SYM, 40, 41, 19,SYM, 65, 66, 67, 68, /* BX */ 69, 30, 24, 14, 33, 35, 53, 42, 45, 31, 58, 49, 70, 37, 20, 48, /* CX */ 43, 52, 59, 34, 71, 44, 36, 56, 50, 72, 47, 73, 39, 74, 18, 57, /* DX */ 75, 30, 24, 14, 33, 35, 53, 42, 45, 31, 58, 49, 76, 37, 20, 48, /* EX */ 43, 52, 59, 34, 77, 44, 36, 56, 50, 78, 47, 79, 39, 80, 18, 81, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_2_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 17, 9, 11, 0, 16, 15, 23, 1, 26, 27, 6, 12, 4, 8, /* 4X */ 13, 32, 3, 10, 5, 7, 21, 29, 25, 28, 22,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 17, 9, 11, 0, 16, 15, 23, 1, 26, 27, 6, 12, 4, 8, /* 6X */ 13, 32, 3, 10, 5, 7, 21, 29, 25, 28, 22,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 82,SYM, 46,SYM, 83, 56,SYM,SYM, 38, 84, 85, 86,SYM, 40, 87, /* AX */ SYM, 88,SYM, 46,SYM, 89, 56,SYM,SYM, 38, 90, 91, 92,SYM, 40, 93, /* BX */ 94, 30, 24, 14, 33, 95, 35, 42, 41, 31, 96, 49, 51, 37, 20, 97, /* CX */ 43, 52, 98, 34, 99, 44, 36,SYM, 55,100, 47, 50, 39, 54,101, 57, /* DX */ 102, 30, 24, 14, 33,103, 35, 42, 41, 31,104, 49, 51, 37, 20,105, /* EX */ 43, 52,106, 34,107, 44, 36,SYM, 55,108, 47, 50, 39, 54,109,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1250_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 17, 9, 11, 0, 16, 15, 23, 1, 26, 27, 6, 12, 4, 8, /* 4X */ 13, 32, 3, 10, 5, 7, 21, 29, 25, 28, 22,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 17, 9, 11, 0, 16, 15, 23, 1, 26, 27, 6, 12, 4, 8, /* 6X */ 13, 32, 3, 10, 5, 7, 21, 29, 25, 28, 22,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM, 38,SYM, 56,110, 40,111, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, 38,SYM, 56,112, 40,113, /* 9X */ SYM,SYM,SYM, 46,SYM,114,SYM,SYM,SYM,SYM,115,SYM,SYM,SYM,SYM,116, /* AX */ SYM,SYM,SYM, 46,SYM,SYM,SYM,SYM,SYM,117,118,SYM,119,SYM,120,121, /* BX */ 122, 30, 24, 14, 33,123, 35, 42, 41, 31,124, 49, 51, 37, 20,125, /* CX */ 43, 52,126, 34,127, 44, 36,SYM, 55,128, 47, 50, 39, 54,129, 57, /* DX */ 130, 30, 24, 14, 33,131, 35, 42, 41, 31,132, 49, 51, 37, 20,133, /* EX */ 43, 52,134, 34,135, 44, 36,SYM, 55,136, 47, 50, 39, 54,137,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Ibm852_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 2, 17, 9, 11, 0, 16, 15, 23, 1, 26, 27, 6, 12, 4, 8, /* 4X */ 13, 32, 3, 10, 5, 7, 21, 29, 25, 28, 22,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 2, 17, 9, 11, 0, 16, 15, 23, 1, 26, 27, 6, 12, 4, 8, /* 6X */ 13, 32, 3, 10, 5, 7, 21, 29, 25, 28, 22,SYM,SYM,SYM,SYM,CTR, /* 7X */ 42, 39, 31, 24, 33,138, 35, 42, 46, 49, 44, 44, 20,139, 33, 35, /* 8X */ 31,140,141,142, 36,143,144, 56, 56, 36, 39,145,146, 46,SYM, 41, /* 9X */ 30, 37, 34, 47,147,148, 40, 40,149,150,SYM,151, 41,152,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 30, 24, 51,153,SYM,SYM,SYM,SYM,154,155,SYM, /* BX */ SYM,SYM,SYM,SYM,SYM,SYM, 14, 14,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* CX */ 43, 43,156, 49,157,158, 37, 20, 51,SYM,SYM,SYM,SYM,159,160,SYM, /* DX */ 34, 57,161, 52, 52,162, 38, 38,163, 47,164, 50, 54, 54,165,SYM, /* EX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 50, 55, 55,SYM,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 981 * First 512 sequences: 0.997762564143313 * Next 512 sequences (512-1024): 0.002237435856687006 * Rest: 3.0357660829594124e-18 * Negative sequences: TODO */ constexpr PRUint8 RomanianLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,2,3,3,3,2,2,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,0,3,3,3,3,3,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,2,3,3,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,0,3,3,3,3,2,3,3,3,3,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,2,3,3,0,2,2,3,3,3,3,0,2,2,3,3,2,3,0, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,2,3,0,3,3,3,2,2,2,0, 3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,2,2,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,0,3,2,3,3,3,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,2,2,3,2,0,3,2,3,3,0,3,3,2,2,0,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,0,2,2,3,3,3,0,2,3,3,3,2,2,2, 3,3,3,3,3,2,3,3,3,2,3,3,3,2,3,3,2,3,0,0,0,3,2,3,3,0,2,2,3,3,3,2,0, 3,3,3,2,3,3,3,3,3,3,3,2,3,3,3,2,2,3,3,2,2,2,2,3,3,2,0,0,3,2,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,0,0,2,3,0,2,0,2,3,3,0,2,2,3,0,2,2,0, 2,3,0,3,3,3,3,3,0,3,3,3,3,3,0,3,0,3,3,3,0,3,3,0,0,0,2,2,0,0,0,0,0, 3,3,3,3,3,2,3,3,3,0,2,3,3,2,3,3,2,3,0,0,2,3,2,3,3,0,2,0,3,2,2,2,0, 3,3,3,3,0,3,3,3,3,2,2,2,3,2,3,2,3,0,0,0,0,0,0,2,3,0,0,0,2,0,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,3,2,0,2,2,2,3,0,2,2,3,2,2,2,0, 3,3,3,0,0,0,0,3,2,2,2,0,0,0,3,0,0,0,0,0,2,2,0,0,2,0,0,2,0,0,0,0,0, 3,3,3,0,3,3,3,3,3,3,0,2,2,0,3,0,0,0,0,0,0,2,0,0,2,0,0,2,0,0,0,0,0, 0,3,0,2,3,0,3,0,0,0,0,0,3,0,0,0,0,0,2,3,0,0,2,2,0,0,0,2,0,0,0,0,0, 3,3,3,3,3,2,3,3,3,2,2,3,2,0,3,2,2,2,0,0,0,0,0,0,3,0,2,2,2,0,2,0,0, 3,3,3,2,2,2,2,3,3,0,2,3,2,2,3,2,0,3,0,0,0,3,3,2,3,0,0,2,2,0,2,2,0, 3,3,3,3,3,3,3,3,3,2,3,2,2,2,3,0,2,3,0,0,0,2,2,0,2,0,2,2,3,2,2,2,0, 0,3,0,3,3,3,3,3,0,2,2,2,3,0,0,0,0,0,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,0,3,0,3,3,3,2,0,0,3,3,0,3,0,0,0,0,3,0,2,2,3,0,0,3,0,0,0,0, 3,3,3,2,2,2,3,3,3,0,2,2,2,0,2,0,0,2,0,0,0,2,0,0,2,0,0,2,0,0,2,0,0, 3,3,3,3,2,3,3,3,3,2,3,2,3,2,2,2,2,2,2,2,2,2,0,3,0,0,0,2,3,2,2,2,0, 3,2,3,3,3,2,3,2,3,3,3,3,3,2,0,2,0,2,0,0,0,2,2,2,0,0,2,2,0,2,2,0,0, 3,3,3,2,3,2,2,2,3,2,3,2,2,2,0,0,2,2,0,0,0,0,0,3,0,0,0,0,2,3,0,0,0, 2,3,0,3,3,2,2,0,0,2,2,2,2,0,0,2,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0, 0,3,2,2,2,2,2,0,0,2,2,2,2,2,0,2,0,2,0,0,0,2,2,0,0,0,2,2,0,0,0,0,0, 0,0,2,0,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, }; const SequenceModel Iso_8859_16RomanianModel = { Iso_8859_16_CharToOrderMap, RomanianLangModel, 33, (float)0.997762564143313, PR_TRUE, "ISO-8859-16" }; const SequenceModel Iso_8859_2RomanianModel = { Iso_8859_2_CharToOrderMap, RomanianLangModel, 33, (float)0.997762564143313, PR_TRUE, "ISO-8859-2" }; const SequenceModel Windows_1250RomanianModel = { Windows_1250_CharToOrderMap, RomanianLangModel, 33, (float)0.997762564143313, PR_TRUE, "WINDOWS-1250" }; const SequenceModel Ibm852RomanianModel = { Ibm852_CharToOrderMap, RomanianLangModel, 33, (float)0.997762564143313, PR_TRUE, "IBM852" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangRussianModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" //KOI8-R language model //Character Mapping Table: constexpr unsigned char KOI8R_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, //00 CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, //10 SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, //20 NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, //30 SYM,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, //40 155,156,157,158,159,160,161,162,163,164,165,SYM,SYM,SYM,SYM,SYM, //50 SYM, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, //60 67,179, 78, 73,180,181, 79,182,183,184,185,SYM,SYM,SYM,SYM,SYM, //70 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, //80 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, //90 223,224,225, 68,226,227,228,229,230,231,232,233,234,235,236,237, //a0 238,239,240,241,242,243,244,245,246,247,248,249,250,251,NUM,SYM, //b0 27, 3, 21, 28, 13, 2, 39, 19, 26, 4, 23, 11, 8, 12, 5, 1, //c0 15, 16, 9, 7, 6, 14, 24, 10, 17, 18, 20, 25, 30, 29, 22, 54, //d0 59, 37, 44, 58, 41, 48, 53, 46, 55, 42, 60, 36, 49, 38, 31, 34, //e0 35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70, //f0 }; constexpr unsigned char win1251_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, //00 CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, //10 SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, //20 NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, //30 SYM,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, //40 155,156,157,158,159,160,161,162,163,164,165,SYM,SYM,SYM,SYM,SYM, //50 SYM, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, //60 67,179, 78, 73,180,181, 79,182,183,184,185,SYM,SYM,SYM,SYM,SYM, //70 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,ILL,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 239,240,241,242,243,244,245,246, 68,247,248,249,250,251,NUM,SYM, 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, }; constexpr unsigned char latin5_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, //00 CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, //10 SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, //20 NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, //30 SYM,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, //40 155,156,157,158,159,160,161,162,163,164,165,SYM,SYM,SYM,SYM,SYM, //50 SYM, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, //60 67,179, 78, 73,180,181, 79,182,183,184,185,SYM,SYM,SYM,SYM,SYM, //70 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, 239, 68,240,241,242,243,244,245,246,247,248,249,250,251,NUM,CTR, }; constexpr unsigned char macCyrillic_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, //00 CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, //10 SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, //20 NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, //30 SYM,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, //40 155,156,157,158,159,160,161,162,163,164,165,SYM,SYM,SYM,SYM,SYM, //50 SYM, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, //60 67,179, 78, 73,180,181, 79,182,183,184,185,SYM,SYM,SYM,SYM,SYM, //70 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 239,240,241,242,243,244,245,246,247,248,249,250,251,NUM, 68, 16, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,CTR, }; constexpr unsigned char IBM855_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, //00 CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, //10 SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, //20 NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, //30 SYM,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, //40 155,156,157,158,159,160,161,162,163,164,165,SYM,SYM,SYM,SYM,SYM, //50 SYM, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, //60 67,179, 78, 73,180,181, 79,182,183,184,185,SYM,SYM,SYM,SYM,SYM, //70 191,192,193,194, 68,195,196,197,198,199,200,201,202,203,204,205, 206,207,208,209,210,211,212,213,214,215,216,217, 27, 59, 54, 70, 3, 37, 21, 44, 28, 58, 13, 41, 2, 48, 39, 53, 19, 46,218,219, 220,221,222,223,224, 26, 55, 4, 42,225,226,227,228, 23, 60,229, 230,231,232,233,234,235, 11, 36,236,237,238,239,240,241,242,243, 8, 49, 12, 38, 5, 31, 1, 34, 15,244,245,246,247, 35, 16,248, 43, 9, 45, 7, 32, 6, 40, 14, 52, 24, 56, 10, 33, 17, 61,249, 250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,NUM,CTR, }; constexpr unsigned char IBM866_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, //00 CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, //10 SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, //20 NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, //30 SYM,142,143,144,145,146,147,148,149,150,151,152, 74,153, 75,154, //40 155,156,157,158,159,160,161,162,163,164,165,SYM,SYM,SYM,SYM,SYM, //50 SYM, 71,172, 66,173, 65,174, 76,175, 64,176,177, 77, 72,178, 69, //60 67,179, 78, 73,180,181, 79,182,183,184,185,SYM,SYM,SYM,SYM,SYM, //70 37, 44, 33, 46, 41, 48, 56, 51, 42, 60, 36, 49, 38, 31, 34, 35, 45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43, 3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15, 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, 207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222, 223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238, 9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16, 239, 68,240,241,242,243,244,245,246,247,248,249,250,251,NUM,CTR, }; //Model Table: //total sequences: 100% //first 512 sequences: 97.6601% //first 1024 sequences: 2.3389% //rest sequences: 0.1237% //negative sequences: 0.0009% constexpr PRUint8 RussianLangModel[] = { 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,3,3,3,3,1,3,3,3,2,3,2,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2,2,2,2,0,0,2, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,2,3,2,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,2,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,2,3,3,1,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, 0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,3,3,3,3,3,3,2,1, 0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,2,2,2,3,1,3,3,1,3,3,3,3,2,2,3,0,2,2,2,3,3,2,1,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,3,3,3,2,2,3,2,3,3,3,2,1,2,2,0,1,2,2,2,2,2,2,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,0,2,2,3,3,2,1,2,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,1,2,3,2,2,3,2,3,3,3,3,2,2,3,0,3,2,2,3,1,1,1,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,2,2,3,3,3,3,3,2,3,3,3,3,2,2,2,0,3,3,3,2,2,2,2,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,2,3,2,2,0,1,3,2,1,2,2,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,1,1,3,0,1,1,1,1,2,1,1,0,2,2,2,1,2,0,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,2,2,2,2,1,3,2,3,2,3,2,1,2,2,0,1,1,2,1,2,1,2,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,3,3,3,2,2,2,2,0,2,2,2,2,3,1,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 3,2,3,2,2,3,3,3,3,3,3,3,3,3,1,3,2,0,0,3,3,3,3,2,3,3,3,3,2,3,2,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,3,3,2,2,3,3,0,2,1,0,3,2,3,2,3,0,0,1,2,0,0,1,0,1,2,1,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,0,2,3,3,3,3,2,3,3,3,3,1,2,2,0,0,2,3,2,2,2,3,2,3,2,2,3,0,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,0,2,3,2,3,0,1,2,3,3,2,0,2,3,0,0,2,3,2,2,0,1,3,1,3,2,2,1,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,1,3,0,2,3,3,3,3,3,3,3,3,2,1,3,2,0,0,2,2,3,3,3,2,3,3,0,2,2,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,2,3,3,2,2,2,3,3,0,0,1,1,1,1,1,2,0,0,1,1,1,1,0,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,2,3,3,3,3,3,3,3,0,3,2,3,3,2,3,2,0,2,1,0,1,1,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,3,3,2,2,2,2,3,1,3,2,3,1,1,2,1,0,2,2,2,2,1,3,1,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 2,2,3,3,3,3,3,1,2,2,1,3,1,0,3,0,0,3,0,0,0,1,1,0,1,2,1,0,0,0,0,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,2,1,1,3,3,3,2,2,1,2,2,3,1,1,2,0,0,2,2,1,3,0,0,2,1,1,2,1,1,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,3,3,3,1,2,2,2,1,2,1,3,3,1,1,2,1,2,1,2,2,0,2,0,0,1,1,0,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,3,3,2,1,3,2,2,3,2,0,3,2,0,3,0,1,0,1,1,0,0,1,1,1,1,0,1,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,2,3,3,3,2,2,2,3,3,1,2,1,2,1,0,1,0,1,1,0,1,0,0,2,1,1,1,0,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 3,1,1,2,1,2,3,3,2,2,1,2,2,3,0,2,1,0,0,2,2,3,2,1,2,2,2,2,2,3,1,0, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,1,1,0,1,1,2,2,1,1,3,0,0,1,3,1,1,1,0,0,0,1,0,1,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,1,3,3,3,2,0,0,0,2,1,0,1,0,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,1,0,0,2,3,2,2,2,1,2,2,2,1,2,1,0,0,1,1,1,0,2,0,1,1,1,0,0,1,1, 1,0,0,0,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,3,0,0,0,0,1,0,0,0,0,3,0,1,2,1,0,0,0,0,0,0,0,1,1,0,0,1,1, 1,0,1,0,1,2,0,0,1,1,2,1,0,1,1,1,1,0,1,1,1,1,0,1,0,0,1,0,0,1,1,0, 2,2,3,2,2,2,3,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,0,1,0,1,1,1,0,2,1, 1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,0,1,1,0, 3,3,3,2,2,2,2,3,2,2,1,1,2,2,2,2,1,1,3,1,2,1,2,0,0,1,1,0,1,0,2,1, 1,1,1,1,1,2,1,0,1,1,1,1,0,1,0,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,1,0, 2,0,0,1,0,3,2,2,2,2,1,2,1,2,1,2,0,0,0,2,1,2,2,1,1,2,2,0,1,1,0,2, 1,1,1,1,1,0,1,1,1,2,1,1,1,2,1,0,1,2,1,1,1,1,0,1,1,1,0,0,1,0,0,1, 1,3,2,2,2,1,1,1,2,3,0,0,0,0,2,0,2,2,1,0,0,0,0,0,0,1,0,0,0,0,1,1, 1,0,1,1,0,1,0,1,1,0,1,1,0,2,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0, 2,3,2,3,2,1,2,2,2,2,1,0,0,0,2,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,2,1, 1,1,2,1,0,2,0,0,1,0,1,0,0,1,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0, 3,0,0,1,0,2,2,2,3,2,2,2,2,2,2,2,0,0,0,2,1,2,1,1,1,2,2,0,0,0,1,2, 1,1,1,1,1,0,1,2,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,1, 2,3,2,3,3,2,0,1,1,1,0,0,1,0,2,0,1,1,3,1,0,0,0,0,0,0,0,1,0,0,2,1, 1,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,0,1,1,0,1,0,0,0,0,0,0,1,0, 2,3,3,3,3,1,2,2,2,2,0,1,1,0,2,1,1,1,2,1,0,1,1,0,0,1,0,1,0,0,2,0, 0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,3,3,3,2,0,0,1,1,2,2,1,0,0,2,0,1,1,3,0,0,1,0,0,0,0,0,1,0,1,2,1, 1,1,2,0,1,1,1,0,1,0,1,1,0,1,0,1,1,1,1,0,1,0,0,0,0,0,0,1,0,1,1,0, 1,3,2,3,2,1,0,0,2,2,2,0,1,0,2,0,1,1,1,0,1,0,0,0,3,0,1,1,0,0,2,1, 1,1,1,0,1,1,0,0,0,0,1,1,0,1,0,0,2,1,1,0,1,0,0,0,1,0,1,0,0,1,1,0, 3,1,2,1,1,2,2,2,2,2,2,1,2,2,1,1,0,0,0,2,2,2,0,0,0,1,2,1,0,1,0,1, 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,2,1,1,1,0,1,0,1,1,0,1,1,1,0,0,1, 3,0,0,0,0,2,0,1,1,1,1,1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,1,0,0,1,0,1, 1,1,0,0,1,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,1, 1,3,3,2,2,0,0,0,2,2,0,0,0,1,2,0,1,1,2,0,0,0,0,0,0,0,0,1,0,0,2,1, 0,1,1,0,0,1,1,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0, 2,3,2,3,2,0,0,0,0,1,1,0,0,0,2,0,2,0,2,0,0,0,0,0,1,0,0,1,0,0,1,1, 1,1,2,0,1,2,1,0,1,1,2,1,1,1,1,1,2,1,1,0,1,0,0,1,1,1,1,1,0,1,1,0, 1,3,2,2,2,1,0,0,2,2,1,0,1,2,2,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1, 0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,0,2,3,1,2,2,2,2,2,2,1,1,0,0,0,1,0,1,0,2,1,1,1,0,0,0,0,1, 1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0, 2,0,2,0,0,1,0,3,2,1,2,1,2,2,0,1,0,0,0,2,1,0,0,2,1,1,1,1,0,2,0,2, 2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,0,1,1,1,1,0,0,0,1,1,1,1,0,1,0,0,1, 1,2,2,2,2,1,0,0,1,0,0,0,0,0,2,0,1,1,1,1,0,0,0,0,1,0,1,2,0,0,2,0, 1,0,1,1,1,2,1,0,1,0,1,1,0,0,1,0,1,1,1,0,1,0,0,0,1,0,0,1,0,1,1,0, 2,1,2,2,2,0,3,0,1,1,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 0,0,0,1,1,1,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0, 1,2,2,3,2,2,0,0,1,1,2,0,1,2,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1, 0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,1,1,0, 2,2,1,1,2,1,2,2,2,2,2,1,2,2,0,1,0,0,0,1,2,2,2,1,2,1,1,1,1,1,2,1, 1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,1,1,1,0,0,0,0,1,1,1,0,1,1,0,0,1, 1,2,2,2,2,0,1,0,2,2,0,0,0,0,2,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2,0, 0,0,1,0,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,2,2,2,2,0,0,0,2,2,2,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1, 0,1,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,2,2,2,2,0,0,0,0,1,0,0,1,1,2,0,0,0,0,1,0,1,0,0,1,0,0,2,0,0,0,1, 0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0, 1,2,2,2,1,1,2,0,2,1,1,1,1,0,2,2,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1, 0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 1,0,2,1,2,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0, 0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0, 1,0,0,0,0,2,0,1,2,1,0,1,1,1,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1, 0,0,0,0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1, 2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0, 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,1,1,0,1,0,1,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0, 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 1,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0, 0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, }; const SequenceModel Koi8rRussianModel = { KOI8R_CharToOrderMap, RussianLangModel, 64, (float)0.976601, PR_FALSE, "KOI8-R" }; const SequenceModel Win1251RussianModel = { win1251_CharToOrderMap, RussianLangModel, 64, (float)0.976601, PR_FALSE, "WINDOWS-1251" }; const SequenceModel Latin5RussianModel = { latin5_CharToOrderMap, RussianLangModel, 64, (float)0.976601, PR_FALSE, "ISO-8859-5" }; const SequenceModel MacCyrillicRussianModel = { macCyrillic_CharToOrderMap, RussianLangModel, 64, (float)0.976601, PR_FALSE, "MAC-CYRILLIC" }; const SequenceModel Ibm866RussianModel = { IBM866_CharToOrderMap, RussianLangModel, 64, (float)0.976601, PR_FALSE, "IBM866" }; const SequenceModel Ibm855RussianModel = { IBM855_CharToOrderMap, RussianLangModel, 64, (float)0.976601, PR_FALSE, "IBM855" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangSlovakModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Slovak *********/ /** * Generated by BuildLangModel.py * On: 2016-09-21 13:33:10.331339 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Ibm852_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 20, 15, 11, 2, 29, 30, 17, 4, 18, 7, 10, 12, 3, 0, /* 4X */ 13, 40, 6, 8, 5, 14, 9, 37, 34, 19, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 20, 15, 11, 2, 29, 30, 17, 4, 18, 7, 10, 12, 3, 0, /* 6X */ 13, 40, 6, 8, 5, 14, 9, 37, 34, 19, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ 51, 46, 25, 62, 38, 48, 47, 51, 49, 54, 50, 50, 63, 64, 38, 47, /* 8X */ 25, 42, 42, 32, 43, 33, 33, 65, 66, 43, 46, 31, 31, 49,SYM, 24, /* 9X */ 21, 23, 35, 27, 67, 68, 26, 26, 69, 70,SYM, 71, 24, 59,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 21, 72, 41, 59,SYM,SYM,SYM,SYM, 61, 61,SYM, /* BX */ SYM,SYM,SYM,SYM,SYM,SYM, 56, 56,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* CX */ 55, 55, 39, 54, 39, 36, 23, 73, 41,SYM,SYM,SYM,SYM, 74, 48,SYM, /* DX */ 35, 58, 32, 52, 52, 36, 28, 28, 44, 27, 44, 60, 22, 22, 75,SYM, /* EX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 60, 45, 45,SYM,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_2_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 20, 15, 11, 2, 29, 30, 17, 4, 18, 7, 10, 12, 3, 0, /* 4X */ 13, 40, 6, 8, 5, 14, 9, 37, 34, 19, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 20, 15, 11, 2, 29, 30, 17, 4, 18, 7, 10, 12, 3, 0, /* 6X */ 13, 40, 6, 8, 5, 14, 9, 37, 34, 19, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 76,SYM, 49,SYM, 33, 77,SYM,SYM, 28, 59, 31, 78,SYM, 26, 61, /* AX */ SYM, 79,SYM, 49,SYM, 33, 80,SYM,SYM, 28, 59, 31, 81,SYM, 26, 61, /* BX */ 44, 21, 82, 56, 38, 42, 47, 51, 24, 25, 83, 54, 41, 23, 84, 39, /* CX */ 55, 52, 36, 35, 32, 50, 43,SYM, 45, 48, 27, 60, 46, 22, 85, 58, /* DX */ 44, 21, 86, 56, 38, 42, 47, 51, 24, 25, 87, 54, 41, 23, 88, 39, /* EX */ 55, 52, 36, 35, 32, 50, 43,SYM, 45, 48, 27, 60, 46, 22, 89,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Mac_Centraleurope_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 20, 15, 11, 2, 29, 30, 17, 4, 18, 7, 10, 12, 3, 0, /* 4X */ 13, 40, 6, 8, 5, 14, 9, 37, 34, 19, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 20, 15, 11, 2, 29, 30, 17, 4, 18, 7, 10, 12, 3, 0, /* 6X */ 13, 40, 6, 8, 5, 14, 9, 37, 34, 19, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ 38, 90, 91, 25, 92, 43, 46, 21, 93, 24, 38, 24, 47, 47, 25, 94, /* 8X */ 95, 39, 23, 39, 96, 97, 98, 35, 99, 32, 43,100, 27, 41, 41, 46, /* 9X */ SYM,SYM,101,SYM,SYM,SYM,SYM, 58,SYM,SYM,SYM,102,SYM,SYM,103,104, /* AX */ 105, 57,SYM,SYM, 57,106,SYM,SYM, 49,107,108, 33, 33, 42, 42,109, /* BX */ 110, 52,SYM,SYM, 52, 36,SYM,SYM,SYM,SYM,SYM, 36, 50,111, 50, 53, /* CX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 53, 44, 44, 45,SYM,SYM, 45,112, /* DX */ 113, 28,SYM,SYM, 28,114,115, 21, 31, 31, 23, 26, 26,116, 35, 32, /* EX */ 117, 48, 27, 48, 60, 60,118,119, 22, 22,120, 61, 49, 61,121,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1250_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 20, 15, 11, 2, 29, 30, 17, 4, 18, 7, 10, 12, 3, 0, /* 4X */ 13, 40, 6, 8, 5, 14, 9, 37, 34, 19, 16,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 20, 15, 11, 2, 29, 30, 17, 4, 18, 7, 10, 12, 3, 0, /* 6X */ 13, 40, 6, 8, 5, 14, 9, 37, 34, 19, 16,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM, 28,SYM,122, 31, 26,123, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, 28,SYM,124, 31, 26,125, /* 9X */ SYM,SYM,SYM, 49,SYM,126,SYM,SYM,SYM,SYM, 59,SYM,SYM,SYM,SYM, 61, /* AX */ SYM,SYM,SYM, 49,SYM,SYM,SYM,SYM,SYM,127, 59,SYM, 33,SYM, 33, 61, /* BX */ 44, 21,128, 56, 38, 42, 47, 51, 24, 25,129, 54, 41, 23,130, 39, /* CX */ 55, 52, 36, 35, 32, 50, 43,SYM, 45, 48, 27, 60, 46, 22,131, 58, /* DX */ 44, 21,132, 56, 38, 42, 47, 51, 24, 25,133, 54, 41, 23,134, 39, /* EX */ 55, 52, 36, 35, 32, 50, 43,SYM, 45, 48, 27, 60, 46, 22,135,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1181 * First 512 sequences: 0.9733303573968434 * Next 512 sequences (512-1024): 0.026317344239265295 * Rest: 0.0003522983638913346 * Negative sequences: TODO */ constexpr PRUint8 SlovakLangModel[] = { 2,2,2,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2, 0,0,3,2,3,1,2,3,3,1,0,3,2,0,3,2,0,1,2,0,0,0,0, 2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, 0,0,3,0,3,0,3,3,3,3,0,2,3,1,2,2,0,2,2,0,0,0,0, 3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3, 0,2,3,0,3,2,3,3,3,2,0,3,3,3,3,2,0,3,2,0,0,1,0, 3,3,3,3,3,3,2,3,3,2,2,3,2,2,3,3,2,2,2,3,2,3, 3,3,3,3,2,3,3,2,3,0,2,0,0,2,0,2,0,0,2,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3, 0,3,3,2,3,0,3,3,3,3,0,2,2,3,2,2,0,0,2,0,0,0,0, 3,3,3,3,3,2,3,3,3,3,3,1,3,2,3,2,3,3,2,3,2,3, 3,3,2,3,0,3,2,2,2,1,0,2,0,3,2,2,2,2,1,2,1,1,2, 3,3,3,3,3,3,2,3,3,3,2,3,3,2,3,3,2,2,2,3,3,3, 3,3,3,3,2,2,2,2,3,2,3,0,2,3,2,2,2,0,2,0,0,1,0, 3,3,3,2,3,3,3,2,2,3,3,3,3,1,3,3,2,2,2,3,2,3, 3,2,2,3,2,3,2,2,2,0,3,2,0,2,2,2,0,0,0,0,0,2,1, 3,3,3,3,3,3,2,3,3,3,3,2,3,3,3,3,2,2,2,3,2,3, 2,3,2,2,1,3,0,2,2,3,2,2,0,2,2,2,0,0,2,0,0,0,0, 3,3,3,3,3,2,3,2,3,0,3,3,2,3,3,2,3,2,0,3,2,3, 3,3,2,3,2,2,3,1,2,0,2,0,0,0,2,0,3,2,0,2,2,1,2, 3,3,3,3,3,3,2,3,3,2,3,2,2,2,3,2,2,2,2,3,3,3, 3,3,2,3,2,3,2,2,3,0,1,0,0,3,2,0,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,3,3,3,3,2,3,3,3,3,3,2,2,3,2,3, 3,3,2,2,2,2,2,2,2,0,3,3,2,2,2,2,0,0,0,2,2,0,0, 3,3,3,3,3,3,2,2,3,1,2,2,3,3,3,2,0,0,2,3,3,3, 2,3,0,2,2,2,0,0,2,0,3,0,1,2,1,0,3,0,2,0,0,2,2, 3,3,3,3,3,3,3,2,2,0,3,2,2,2,3,2,1,2,0,2,2,3, 2,3,1,2,0,2,2,0,1,2,3,1,0,2,2,0,2,0,0,2,2,0,0, 2,2,2,3,2,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,3, 0,3,3,1,3,1,2,2,3,2,0,2,2,0,1,2,0,2,2,0,0,0,0, 3,3,3,3,3,2,2,3,2,2,2,2,2,0,3,2,2,3,0,2,0,2, 1,3,0,2,0,3,0,1,2,2,0,0,0,2,2,0,0,0,2,0,0,0,0, 3,3,3,3,3,2,3,3,3,3,3,3,3,2,3,2,2,3,2,3,2,3, 3,2,1,2,1,2,2,0,2,2,0,2,0,2,2,2,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,2,2,2,3,2,3,1,3,2,0,2,1,3,2,3, 3,2,2,2,0,2,2,1,0,0,0,2,0,1,2,2,1,0,0,0,2,1,2, 3,3,3,3,3,3,2,2,3,3,2,2,3,2,3,2,2,2,2,0,2,2, 0,3,2,0,0,3,3,0,2,1,0,2,0,2,0,0,1,0,0,0,0,0,0, 2,2,2,3,2,3,3,3,3,3,3,2,3,3,2,3,3,3,2,0,3,0, 0,0,2,0,2,2,3,1,2,3,0,1,0,1,2,1,0,0,0,0,0,0,0, 3,3,3,3,3,1,3,2,3,2,3,3,2,0,3,2,2,2,3,3,2,3, 2,2,2,2,1,2,2,0,2,0,1,0,0,1,2,0,1,0,0,0,0,1,0, 0,0,0,3,0,3,3,3,3,3,3,3,3,3,2,3,3,2,3,0,3,0, 0,0,2,0,2,0,3,0,1,0,0,2,0,0,2,0,0,2,0,0,0,0,0, 0,0,0,2,0,2,3,2,2,3,2,2,3,2,0,3,3,2,2,0,2,0, 0,0,1,0,2,0,2,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, 0,2,0,3,0,3,3,3,3,3,3,2,3,3,0,3,2,2,2,0,2,0, 0,0,2,0,2,0,3,0,1,2,0,2,0,0,1,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,2,3,2,0,3,0,2,0,2,2,0,0,0,0,0,2, 0,3,0,1,1,1,3,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0, 1,0,0,2,0,3,3,2,2,2,2,2,3,2,0,3,3,3,0,0,1,0, 0,0,2,0,0,0,2,2,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 3,3,3,3,3,0,1,2,3,1,1,3,1,0,3,0,0,0,2,0,2,0, 0,3,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0, 1,0,0,3,0,3,3,2,3,3,3,3,2,3,0,3,3,2,0,0,2,0, 0,0,3,0,2,0,2,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,3,0,2,2,2,3,1,2,3,2,0,0,2,0,0,2,1, 0,3,2,1,0,1,2,0,0,2,0,2,0,0,1,0,0,0,0,0,0,0,0, 3,3,3,2,3,2,3,0,2,1,2,0,2,0,3,0,0,2,0,3,0,2, 0,2,0,2,0,1,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,2,3,0,2,2,3,2,2,0,3,2,0,2,0,2,0,2, 0,0,0,2,0,2,0,0,2,0,0,0,0,2,0,1,0,0,0,0,0,2,0, 3,3,0,0,1,0,2,1,0,0,0,2,0,1,2,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,3,3,3,3,3,2,1,0,0,2,3,0,0,0,2,0, 0,0,0,0,3,0,1,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0, 3,3,0,3,0,0,0,3,2,2,0,0,2,0,3,0,1,1,0,0,2,0, 0,0,1,0,0,2,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,2,3,2,0,1,0,0,2,0,2,3,2,0,0,0,0,2,0,0, 0,2,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0, 0,0,0,3,0,2,3,1,2,1,2,3,3,2,0,2,2,0,0,0,3,0, 0,0,0,0,1,0,0,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,0,0,0,0,0,0,0,0,0,1,2,0,2,0,0,2,0,0,0,2, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,2,2,1,3,2,0,1,2,0,2,0,2,1,0,0,0,2,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 0,0,0,2,0,2,1,1,0,0,0,2,0,0,0,2,2,0,0,0,2,0, 0,0,3,0,0,0,0,0,2,2,0,0,0,0,0,0,2,0,0,0,0,0,0, 2,3,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,2,0,0,1,0,0,0,0,2,0,0,0,0,0,0,2, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,2,0,2,2,2,0,0,1,0,1,0,0,1,2,0,2,0,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2,0, 0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,2,2,0,2,0,1,2,1,0,0,0,0,2,0,0,2,0, 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,0,0,0,1,0,0,0,0,2,0,0,0,0, 0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0, }; const SequenceModel Ibm852SlovakModel = { Ibm852_CharToOrderMap, SlovakLangModel, 45, (float)0.9733303573968434, PR_TRUE, "IBM852" }; const SequenceModel Iso_8859_2SlovakModel = { Iso_8859_2_CharToOrderMap, SlovakLangModel, 45, (float)0.9733303573968434, PR_TRUE, "ISO-8859-2" }; const SequenceModel Mac_CentraleuropeSlovakModel = { Mac_Centraleurope_CharToOrderMap, SlovakLangModel, 45, (float)0.9733303573968434, PR_TRUE, "MAC-CENTRALEUROPE" }; const SequenceModel Windows_1250SlovakModel = { Windows_1250_CharToOrderMap, SlovakLangModel, 45, (float)0.9733303573968434, PR_TRUE, "WINDOWS-1250" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangSloveneModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Slovene *********/ /** * Generated by BuildLangModel.py * On: 2016-09-28 22:06:46.134717 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_2_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 4X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 6X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 41,SYM, 42,SYM, 43, 44,SYM,SYM, 22, 45, 46, 47,SYM, 23, 48, /* AX */ SYM, 49,SYM, 50,SYM, 51, 52,SYM,SYM, 22, 53, 54, 55,SYM, 23, 56, /* BX */ 57, 32, 58, 59, 60, 61, 37, 34, 21, 29, 62, 36, 63, 30, 64, 65, /* CX */ 66, 67, 68, 31, 35, 69, 70,SYM, 71, 72, 39, 73, 74, 40, 75, 76, /* DX */ 77, 32, 78, 79, 80, 81, 37, 34, 21, 29, 82, 36, 83, 30, 84, 85, /* EX */ 86, 87, 88, 31, 35, 89, 90,SYM, 91, 92, 39, 93, 94, 40, 95,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_16_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 4X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 6X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 96, 97, 98,SYM,SYM, 22,SYM, 22,SYM, 99,SYM,100,SYM,101,102, /* AX */ SYM,SYM, 21,103, 23,SYM,SYM,SYM, 23, 21,104,SYM,105,106,107,108, /* BX */ 109, 32,110,111,112, 37,113, 34,114, 29, 33, 36,115, 30,116,117, /* CX */ 118,119,120, 31, 35,121,122,123,124,125, 39,126,127,128,129,130, /* DX */ 131, 32,132,133,134, 37,135, 34,136, 29, 33, 36,137, 30,138,139, /* EX */ 140,141,142, 31, 35,143,144,145,146,147, 39,148,149,150,151,152, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1250_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 4X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 6X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,ILL,SYM,SYM,SYM,SYM,ILL,SYM, 22,SYM,153,154, 23,155, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM, 22,SYM,156,157, 23,158, /* 9X */ SYM,SYM,SYM,159,SYM,160,SYM,SYM,SYM,SYM,161,SYM,SYM,SYM,SYM,162, /* AX */ SYM,SYM,SYM,163,SYM,SYM,SYM,SYM,SYM,164,165,SYM,166,SYM,167,168, /* BX */ 169, 32,170,171,172,173, 37, 34, 21, 29,174, 36,175, 30,176,177, /* CX */ 178,179,180, 31, 35,181,182,SYM,183,184, 39,185,186, 40,187,188, /* DX */ 189, 32,190,191,192,193, 37, 34, 21, 29,194, 36,195, 30,196,197, /* EX */ 198,199,200, 31, 35,201,202,SYM,203,204, 39,205,206, 40,207,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Mac_Centraleurope_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 4X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 6X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,CTR, /* 7X */ 208,209,210, 29,211,212,213, 32,214, 21,215, 21, 37, 37, 29,216, /* 8X */ 217,218, 30,219, 38, 38,220, 31,221, 35,222,223, 39,224,225,226, /* 9X */ SYM,SYM,227,SYM,SYM,SYM,SYM,228,SYM,SYM,SYM,229,SYM,SYM,230,231, /* AX */ 232,233,SYM,SYM,234,235,SYM,SYM,236,237,238,239,240,241,242,243, /* BX */ 244,245,SYM,SYM,246,247,SYM,SYM,SYM,SYM,SYM,248,249,249,249,249, /* CX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,249,249,249,249,SYM,SYM,249,249, /* DX */ 249, 22,SYM,SYM, 22,249,249, 32,249,249, 30, 23, 23,249, 31, 35, /* EX */ 249,249, 39,249,249,249,249,249, 40, 40,249,249,249,249,249,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Ibm852_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 4X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 18, 19, 13, 1, 24, 17, 20, 2, 8, 12, 9, 14, 4, 3, /* 6X */ 11, 28, 5, 6, 7, 16, 10, 27, 25, 26, 15,SYM,SYM,SYM,SYM,CTR, /* 7X */ 34,249, 29,249,249,249, 37, 34,249, 36,249,249,249,249,249, 37, /* 8X */ 29,249,249, 35,249,249,249,249,249,249,249,249,249,249,SYM, 21, /* 9X */ 32, 30, 31, 39,249,249, 23, 23,249,249,SYM,249, 21,249,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 32,249,249,249,SYM,SYM,SYM,SYM,249,249,SYM, /* BX */ SYM,SYM,SYM,SYM,SYM,SYM,249,249,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* CX */ 249,249,249, 36,249,249, 30,249,249,SYM,SYM,SYM,SYM,249,249,SYM, /* DX */ 31,249, 35,249,249,249, 22, 22,249, 39,249,249, 40, 40,249,SYM, /* EX */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,249,249,249,SYM,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 727 * First 512 sequences: 0.9983524317161332 * Next 512 sequences (512-1024): 0.0016475682838668457 * Rest: -3.859759734048396e-17 * Negative sequences: TODO */ constexpr PRUint8 SloveneLangModel[] = { 2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,2, 3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,2,3,2,3,3,3,2,0,0,3,2,3,3,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,0,0,0,3,2,3,3,0, 3,3,3,3,3,2,3,3,0,0,3,3,3,3,3,2,3,2,3,3,3,2,3,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,2,3,3,2,3,2,0, 3,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,2,3,3,3,3,2,2,2,2,0,0, 3,3,3,3,3,3,3,3,2,3,0,3,3,3,2,2,3,3,3,3,3,2,2,0,0,0,3,2,2, 3,3,3,3,3,3,3,3,3,3,3,0,2,3,3,2,3,0,2,3,3,0,3,0,2,0,3,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,2,2,3,2,0, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,0,3,2,3,3,2,2,2,0,2,2,3,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,0,2,0,0,0, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,2,0,0, 3,3,3,3,3,3,3,2,0,3,3,3,2,2,2,0,3,2,3,2,3,0,0,0,2,2,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,2,2,3,3,0,3,0,2,2,0,3,3,2,2,0,3,0,0, 3,3,3,3,3,3,3,3,0,3,2,3,3,3,2,2,3,2,2,3,3,0,0,0,2,2,3,2,2, 3,3,3,3,3,3,2,3,0,3,3,3,3,2,2,2,3,0,2,0,0,2,0,0,2,0,2,2,0, 3,3,3,3,3,3,0,0,3,3,2,2,3,2,0,0,3,0,2,2,0,0,2,0,0,0,0,0,0, 3,3,3,3,3,2,0,3,3,3,2,3,3,0,0,0,3,0,0,0,0,3,0,2,0,0,0,0,0, 3,3,3,2,3,2,0,2,3,3,2,0,3,0,0,0,3,2,3,2,0,0,0,2,0,0,0,0,0, 3,3,3,3,2,3,3,3,0,3,0,0,0,2,2,0,3,2,0,2,2,0,0,0,3,2,2,2,0, 3,3,3,3,2,2,2,3,0,0,2,3,0,2,2,0,3,2,3,3,2,0,0,0,2,2,2,2,0, 3,3,2,3,3,2,3,3,3,3,0,2,2,2,2,0,2,2,2,3,2,0,0,0,0,2,0,2,0, 3,3,3,3,3,0,3,0,0,2,0,0,0,0,2,0,2,2,2,0,2,0,0,0,2,0,2,3,0, 0,0,0,0,2,0,0,2,0,2,0,0,0,0,0,0,3,0,0,2,0,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_2SloveneModel = { Iso_8859_2_CharToOrderMap, SloveneLangModel, 29, (float)0.9983524317161332, PR_TRUE, "ISO-8859-2" }; const SequenceModel Iso_8859_16SloveneModel = { Iso_8859_16_CharToOrderMap, SloveneLangModel, 29, (float)0.9983524317161332, PR_TRUE, "ISO-8859-16" }; const SequenceModel Windows_1250SloveneModel = { Windows_1250_CharToOrderMap, SloveneLangModel, 29, (float)0.9983524317161332, PR_TRUE, "WINDOWS-1250" }; const SequenceModel Mac_CentraleuropeSloveneModel = { Mac_Centraleurope_CharToOrderMap, SloveneLangModel, 29, (float)0.9983524317161332, PR_TRUE, "MAC-CENTRALEUROPE" }; const SequenceModel Ibm852SloveneModel = { Ibm852_CharToOrderMap, SloveneLangModel, 29, (float)0.9983524317161332, PR_TRUE, "IBM852" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangSpanishModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Spanish *********/ /** * Generated by BuildLangModel.py * On: 2015-12-12 18:39:02.290370 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 14, 10, 8, 0, 16, 15, 20, 5, 23, 27, 7, 12, 3, 2, /* 4X */ 13, 21, 6, 4, 9, 11, 18, 31, 28, 17, 24,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 14, 10, 8, 0, 16, 15, 20, 5, 23, 27, 7, 12, 3, 2, /* 6X */ 13, 21, 6, 4, 9, 11, 18, 31, 28, 17, 24,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 52,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 33, 25, 39, 46, 37, 45, 47, 35, 36, 26, 48, 40, 53, 22, 41, 43, /* CX */ 49, 29, 38, 19, 50, 54, 34,SYM, 44, 51, 30, 55, 32, 42, 56, 57, /* DX */ 33, 25, 39, 46, 37, 45, 47, 35, 36, 26, 48, 40, 58, 22, 41, 43, /* EX */ 49, 29, 38, 19, 50, 59, 34,SYM, 44, 51, 30, 60, 32, 42, 61, 62, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 14, 10, 8, 0, 16, 15, 20, 5, 23, 27, 7, 12, 3, 2, /* 4X */ 13, 21, 6, 4, 9, 11, 18, 31, 28, 17, 24,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 14, 10, 8, 0, 16, 15, 20, 5, 23, 27, 7, 12, 3, 2, /* 6X */ 13, 21, 6, 4, 9, 11, 18, 31, 28, 17, 24,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM, 63,SYM, 64,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM, 65, 66,SYM,SYM, 67,SYM,SYM,SYM, 68, 69, 70,SYM, /* BX */ 33, 25, 39, 46, 37, 45, 47, 35, 36, 26, 48, 40, 71, 22, 41, 43, /* CX */ 49, 29, 38, 19, 50, 72, 34,SYM, 44, 51, 30, 73, 32, 42, 74, 75, /* DX */ 33, 25, 39, 46, 37, 45, 47, 35, 36, 26, 48, 40, 76, 22, 41, 43, /* EX */ 49, 29, 38, 19, 50, 77, 34,SYM, 44, 51, 30, 78, 32, 42, 79, 80, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 1, 14, 10, 8, 0, 16, 15, 20, 5, 23, 27, 7, 12, 3, 2, /* 4X */ 13, 21, 6, 4, 9, 11, 18, 31, 28, 17, 24,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 1, 14, 10, 8, 0, 16, 15, 20, 5, 23, 27, 7, 12, 3, 2, /* 6X */ 13, 21, 6, 4, 9, 11, 18, 31, 28, 17, 24,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM, 81,SYM,SYM,SYM,SYM,SYM,SYM, 82,SYM, 83,ILL, 84,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 85,SYM, 86,ILL, 87, 88, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 89,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 33, 25, 39, 46, 37, 45, 47, 35, 36, 26, 48, 40, 90, 22, 41, 43, /* CX */ 49, 29, 38, 19, 50, 91, 34,SYM, 44, 51, 30, 92, 32, 42, 93, 94, /* DX */ 33, 25, 39, 46, 37, 45, 47, 35, 36, 26, 48, 40, 95, 22, 41, 43, /* EX */ 49, 29, 38, 19, 50, 96, 34,SYM, 44, 51, 30, 97, 32, 42, 98, 99, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 897 * First 512 sequences: 0.9970385677528184 * Next 512 sequences (512-1024): 0.0029614322471815486 * Rest: 4.597017211338539e-17 * Negative sequences: TODO */ constexpr PRUint8 SpanishLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,0,3,3,3,2,3,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,3,3,3,3,3,3,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,2,3,3,2,2,3,3,2,2,3,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,3,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,0,2,3,3,3,0,0,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,3,3,3,2,0,3,2,2, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,2,3,3,2,2,0,2,2,0, 3,3,3,2,3,3,3,3,2,2,2,3,3,2,2,3,2,3,3,3,3,2,3,2,2,3,3,2,0,0,2,2,2, 3,3,3,3,3,3,3,3,2,3,3,3,2,2,3,2,2,3,2,3,3,0,3,2,2,3,3,0,0,0,2,2,2, 3,3,3,3,3,3,3,3,2,3,3,3,2,2,2,2,2,3,0,3,3,2,3,0,2,3,3,3,0,0,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,2,3,0,2,0, 3,3,3,3,3,3,2,2,2,2,2,3,3,3,3,2,2,3,0,3,2,0,3,2,0,3,3,2,2,0,3,2,2, 3,3,3,2,3,3,3,3,2,3,3,3,2,3,3,0,2,2,2,3,3,0,3,2,0,3,3,2,0,0,3,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,2,3,2,3,2,2,3,3,0,3,2,2,0,0,2,2,0, 3,3,3,3,3,3,3,3,3,3,0,3,3,0,2,2,2,2,2,3,3,0,3,2,2,2,3,2,0,0,3,2,3, 3,3,3,2,2,3,3,3,2,3,2,3,2,2,2,2,3,2,0,3,0,0,3,2,0,2,2,2,0,0,3,2,0, 3,3,3,3,3,3,3,3,2,2,2,3,2,2,2,2,2,2,0,3,2,0,0,2,2,2,2,2,0,0,2,2,0, 3,3,3,2,2,3,2,2,2,0,2,3,0,2,0,2,2,2,2,3,0,0,3,0,0,2,3,2,0,0,0,0,0, 0,0,0,3,3,0,3,3,3,3,3,0,3,3,2,3,2,0,3,0,0,0,0,0,0,0,0,0,2,0,0,0,0, 3,3,3,3,2,3,3,3,3,3,2,3,3,0,2,0,2,3,2,2,2,0,3,2,2,2,3,0,2,0,2,2,2, 2,3,2,0,2,2,0,2,2,2,0,3,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0, 3,3,3,3,3,0,2,2,3,3,3,2,3,2,3,3,3,0,2,0,0,2,0,2,2,0,0,0,0,0,0,0,0, 3,3,3,2,0,3,2,2,2,2,0,3,2,2,0,0,0,0,0,3,0,0,2,2,0,2,3,0,0,0,2,0,2, 3,3,3,2,0,3,2,0,2,2,2,3,2,2,2,3,0,2,0,3,2,3,2,0,3,3,2,2,0,0,2,0,0, 2,0,0,3,3,2,3,3,2,3,3,2,3,3,2,3,3,2,2,0,2,2,0,2,2,0,0,0,2,2,0,0,0, 2,3,2,3,3,2,3,3,3,3,3,2,2,3,2,3,2,2,2,0,0,0,0,2,0,0,0,0,3,0,0,0,0, 3,3,3,2,3,3,3,3,2,2,2,3,3,0,2,2,2,3,2,0,2,0,2,0,0,0,0,2,0,0,2,2,0, 3,3,3,2,2,3,2,2,2,3,3,3,2,3,2,0,2,2,3,2,2,2,0,2,0,2,2,2,3,0,0,2,0, 3,3,3,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,3,0,0,2,0,0,0,0,0,0,0, 2,3,2,3,3,0,2,3,2,3,2,0,3,2,3,0,2,0,0,0,0,0,0,2,2,0,0,0,0,2,0,0,0, 3,3,3,3,2,3,2,2,2,2,2,2,0,0,2,0,2,2,0,0,2,0,0,2,0,2,0,2,0,0,0,2,0, 3,0,0,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0, }; const SequenceModel Iso_8859_1SpanishModel = { Iso_8859_1_CharToOrderMap, SpanishLangModel, 33, (float)0.9970385677528184, PR_TRUE, "ISO-8859-1" }; const SequenceModel Iso_8859_15SpanishModel = { Iso_8859_15_CharToOrderMap, SpanishLangModel, 33, (float)0.9970385677528184, PR_TRUE, "ISO-8859-15" }; const SequenceModel Windows_1252SpanishModel = { Windows_1252_CharToOrderMap, SpanishLangModel, 33, (float)0.9970385677528184, PR_TRUE, "WINDOWS-1252" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangSwedishModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Swedish *********/ /** * Generated by BuildLangModel.py * On: 2016-09-28 22:29:21.480940 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1252_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 4X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 6X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM, 34,SYM,SYM,SYM,SYM,SYM,SYM, 48,SYM, 49,ILL, 50,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, 51,SYM, 52,ILL, 53, 54, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 55,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 56, 44, 57, 58, 17, 19, 38, 40, 32, 28, 45, 59, 60, 61, 47, 62, /* CX */ 63, 64, 65, 66, 35, 67, 21,SYM, 37, 68, 69, 70, 31, 71, 72, 73, /* DX */ 74, 44, 75, 76, 17, 19, 38, 40, 32, 28, 45, 77, 78, 79, 47, 80, /* EX */ 81, 82, 83, 84, 35, 85, 21,SYM, 37, 86, 87, 88, 31, 89, 90, 91, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_9_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 4X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 6X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 92,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 93, 44, 94, 95, 17, 19, 38, 40, 32, 28, 45, 96, 97, 98, 47, 99, /* CX */ 100,101,102,103, 35,104, 21,SYM, 37,105,106,107, 31,108,109,110, /* DX */ 111, 44,112,113, 17, 19, 38, 40, 32, 28, 45,114,115,116, 47,117, /* EX */ 118,119,120,121, 35,122, 21,SYM, 37,123,124,125, 31, 42,126,127, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_1_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 4X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 6X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,128,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 129, 44,130,131, 17, 19, 38, 40, 32, 28, 45,132,133,134, 47,135, /* CX */ 136,137,138,139, 35,140, 21,SYM, 37,141,142,143, 31,144,145,146, /* DX */ 147, 44,148,149, 17, 19, 38, 40, 32, 28, 45,150,151,152, 47,153, /* EX */ 154,155,156,157, 35,158, 21,SYM, 37,159,160,161, 31,162,163,164, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_4_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 4X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 6X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,165,166,167,SYM,168,169,SYM,SYM,170,171,172,173,SYM,174,SYM, /* AX */ SYM,175,SYM,176,SYM,177,178,SYM,SYM,179,180,181,182, 43,183, 43, /* BX */ 29, 44,184,185, 17, 19, 38,186,187, 28,188,189, 39,190, 47, 41, /* CX */ 191,192, 33,193, 35,194, 21,SYM, 37, 36,195,196, 31,197, 46,198, /* DX */ 29, 44,199,200, 17, 19, 38,201,202, 28,203,204, 39,205, 47, 41, /* EX */ 206,207, 33,208, 35,209, 21,SYM, 37, 36,210,211, 31,212, 46,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_15_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 4X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 22, 20, 9, 1, 14, 12, 18, 6, 23, 10, 7, 11, 3, 8, /* 6X */ 15, 30, 2, 5, 4, 16, 13, 26, 25, 24, 27,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,213,SYM,214,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,215,216,SYM,SYM,217,SYM,SYM,SYM,218,219,220,SYM, /* BX */ 221, 44,222,223, 17, 19, 38, 40, 32, 28, 45,224,225,226, 47,227, /* CX */ 228,229,230,231, 35,232, 21,SYM, 37,233,234,235, 31,236,237,238, /* DX */ 239, 44,240,241, 17, 19, 38, 40, 32, 28, 45,242,243,244, 47,245, /* EX */ 246,247,248,249, 35,249, 21,SYM, 37,249,249,249, 31,249,249,249, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 748 * First 512 sequences: 0.997323508584682 * Next 512 sequences (512-1024): 0.0026764914153179875 * Rest: 1.7780915628762273e-17 * Negative sequences: TODO */ constexpr PRUint8 SwedishLangModel[] = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,0,3,2,3,3,3,3,3,2,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,3,2,3,3,3,3,3,3,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,0,2,2,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,3,2,2,2,2,3,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,0,2,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,2,3,3,2,3,3,2,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,0,2,0,2,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,0,2,0,2,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,0,2,0,3,3,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,3,3,3,3,0,2,2,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,2,2,2,3,2,3,3,3,3,0,2,3,2,0,0,0,2,0,0,0, 3,3,3,2,3,2,3,3,3,2,0,2,2,2,3,2,3,3,0,3,2,3,0,3,3,0,0,0,2,0,0, 3,3,3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,3,2,2,2,2,3,2,0,2,3,2,0, 3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,2,0,2,0,3,2,3,2,0,3,0,0,0,2,0, 2,2,3,3,3,3,0,3,0,3,3,3,3,3,3,3,2,2,0,0,3,0,3,0,0,3,0,0,0,0,0, 3,3,3,3,3,2,3,2,3,2,2,2,2,0,0,0,3,3,2,3,2,3,2,3,3,0,0,3,0,2,0, 2,3,3,3,3,3,2,3,0,3,3,3,3,3,2,0,0,0,2,0,0,2,3,0,0,0,0,0,0,0,0, 3,3,3,3,3,2,3,3,3,2,3,2,2,2,2,0,3,0,3,0,3,2,2,0,3,0,0,2,2,0,2, 3,3,3,3,3,3,2,3,2,3,3,3,3,3,2,3,0,2,2,0,3,2,2,3,0,0,0,0,0,0,0, 3,3,3,3,3,3,3,3,3,2,2,2,0,2,2,2,3,3,2,3,3,3,3,3,3,0,0,2,2,0,0, 3,3,0,2,2,3,2,3,3,3,2,0,0,0,2,0,3,3,0,0,0,3,2,0,0,0,0,0,2,0,0, 3,2,3,3,3,3,2,3,3,3,3,3,3,2,3,3,2,0,2,0,3,0,3,2,0,3,0,2,0,0,0, 3,3,0,3,3,0,3,2,3,0,2,2,0,0,2,3,2,0,2,0,0,0,2,0,2,2,0,0,0,0,0, 3,3,2,2,2,3,3,2,3,2,2,0,0,0,0,0,2,0,2,0,0,0,0,0,2,0,2,2,0,0,0, 3,3,0,2,2,0,2,0,3,0,2,0,0,0,0,0,2,0,2,0,0,0,2,0,2,0,0,2,0,0,0, 0,3,2,2,0,2,0,2,2,2,0,0,0,2,0,2,0,0,2,0,0,2,2,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,2,0,3,0,2,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,2,0,0,0,0,0,0,2,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Windows_1252SwedishModel = { Windows_1252_CharToOrderMap, SwedishLangModel, 31, (float)0.997323508584682, PR_TRUE, "WINDOWS-1252" }; const SequenceModel Iso_8859_9SwedishModel = { Iso_8859_9_CharToOrderMap, SwedishLangModel, 31, (float)0.997323508584682, PR_TRUE, "ISO-8859-9" }; const SequenceModel Iso_8859_1SwedishModel = { Iso_8859_1_CharToOrderMap, SwedishLangModel, 31, (float)0.997323508584682, PR_TRUE, "ISO-8859-1" }; const SequenceModel Iso_8859_4SwedishModel = { Iso_8859_4_CharToOrderMap, SwedishLangModel, 31, (float)0.997323508584682, PR_TRUE, "ISO-8859-4" }; const SequenceModel Iso_8859_15SwedishModel = { Iso_8859_15_CharToOrderMap, SwedishLangModel, 31, (float)0.997323508584682, PR_TRUE, "ISO-8859-15" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangThaiModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Thai *********/ /** * Generated by BuildLangModel.py * On: 2015-12-04 03:05:06.182099 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Tis_620_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 66, 70, 67, 80, 78, 87, 85, 73, 79, 93, 88, 84, 68, 77, 81, /* 4X */ 75,101, 74, 61, 71, 86, 96, 90,103,100, 99,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 35, 64, 48, 52, 32, 60, 65, 54, 36, 97, 76, 46, 56, 41, 40, /* 6X */ 59,104, 43, 45, 44, 55, 72, 82, 94, 57, 92,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ ILL, 3, 23,105, 15,106, 89, 5, 21, 63, 26, 31,102, 42, 69, 58, /* AX */ 49, 91, 83, 34, 9, 17, 30, 12, 39, 1, 16, 19, 33, 62, 22, 47, /* BX */ 38, 7, 10, 2, 50, 11,107, 8, 28, 37, 13, 18, 98, 4, 53, 95, /* CX */ 14,SYM, 0, 29,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,ILL,ILL,ILL,SYM, /* DX */ 6, 20, 27, 24, 25,108, 51,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,109, /* EX */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,110,111,ILL,ILL,ILL,ILL, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_11_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 66, 70, 67, 80, 78, 87, 85, 73, 79, 93, 88, 84, 68, 77, 81, /* 4X */ 75,101, 74, 61, 71, 86, 96, 90,103,100, 99,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 35, 64, 48, 52, 32, 60, 65, 54, 36, 97, 76, 46, 56, 41, 40, /* 6X */ 59,104, 43, 45, 44, 55, 72, 82, 94, 57, 92,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 3, 23,112, 15,113, 89, 5, 21, 63, 26, 31,102, 42, 69, 58, /* AX */ 49, 91, 83, 34, 9, 17, 30, 12, 39, 1, 16, 19, 33, 62, 22, 47, /* BX */ 38, 7, 10, 2, 50, 11,114, 8, 28, 37, 13, 18, 98, 4, 53, 95, /* CX */ 14,SYM, 0, 29,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,ILL,ILL,ILL,SYM, /* DX */ 6, 20, 27, 24, 25,115, 51,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,116, /* EX */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,117,118,ILL,ILL,ILL,ILL, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 2324 * First 512 sequences: 0.8815720594354438 * Next 512 sequences (512-1024): 0.0920860122682917 * Rest: 0.026341928296264486 * Negative sequences: TODO */ constexpr PRUint8 ThaiLangModel[] = { 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,3, 0,2,3,0,0,3,2,3,0,0,2,0,0,0,0,2,0,1,1,1,0,2,0,0,0,0,1,0,0,0,1,1, 3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3, 0,3,0,0,0,1,3,3,0,0,1,0,0,0,0,2,0,2,1,2,0,1,0,0,0,0,0,0,0,0,2,1, 3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,2,3,3,3,3,3,3,2,2,2,3,1,3,2, 0,2,3,0,0,2,2,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,0,0,0,0,0,0,2,1, 3,3,3,3,3,2,3,3,3,3,2,3,3,3,2,3,2,3,3,3,3,3,3,3,3,3,2,3,2,3,2,3, 0,2,1,0,0,3,2,1,0,0,0,0,0,0,0,1,0,3,3,1,0,1,0,0,0,0,3,0,0,0,1,1, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,2,2,2,2,3,3,2,2,1,2,2,2, 0,2,0,0,0,0,2,2,0,0,1,0,0,0,0,2,0,0,1,1,0,1,0,0,0,0,0,0,0,0,1,1, 3,3,3,3,3,2,3,3,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2, 0,3,0,0,0,1,2,2,0,0,1,0,0,0,0,2,0,1,1,2,0,2,0,0,0,0,0,0,0,0,2,1, 0,3,3,3,3,2,0,3,3,3,3,3,3,3,0,3,3,3,3,3,0,3,3,3,0,0,3,0,3,0,1,3, 0,2,0,0,0,2,2,2,0,0,0,0,0,0,0,3,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,3, 3,3,3,3,3,2,3,3,3,3,2,3,3,3,2,3,3,3,3,3,3,2,3,3,3,3,2,2,1,0,2,1, 0,2,2,0,1,2,2,1,0,0,1,0,0,0,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,1,1, 3,3,3,3,3,3,3,3,2,3,3,3,3,2,2,2,3,2,2,2,3,3,3,2,2,2,2,2,2,0,2,2, 0,1,2,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,3,1,0,1,0,0,0,0,0,0,0,0,1,1, 3,3,3,3,3,3,3,2,3,2,3,3,3,3,0,3,2,3,2,2,3,2,2,3,3,3,2,2,1,3,2,1, 0,1,0,0,0,0,2,1,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,1,1, 3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,2,3,3,3,3,2,2,1,2,2, 0,2,0,0,0,0,3,1,0,0,1,0,0,0,0,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,1,1, 3,3,2,3,3,3,3,3,3,3,2,3,3,3,3,2,2,3,2,2,2,2,1,3,2,2,2,2,1,3,1,2, 0,1,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,1, 3,3,3,1,2,1,2,1,2,3,3,1,1,2,2,3,2,1,2,1,1,1,2,1,1,1,1,1,3,3,0,1, 0,0,0,0,0,1,1,3,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,3,3,3,3,3,2,3,2,2,2,2,3,3,3,2,2,1,1,1,2,2,1,2,1,3,3,2, 0,1,0,0,0,0,2,2,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 0,3,3,3,3,1,3,3,3,3,3,2,3,3,0,3,3,3,3,3,3,3,3,2,3,3,3,3,2,0,2,2, 0,2,1,0,0,0,2,2,0,0,1,0,0,0,0,1,0,1,1,0,0,2,0,0,0,0,1,0,0,0,1,1, 3,3,3,1,3,2,2,3,3,2,2,3,1,1,2,2,1,2,1,2,1,3,1,1,1,1,1,2,0,3,0,1, 0,0,2,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,1,3,2,3,3,2,3,3,3,1,3,3,3,3,3,3,2,2,2,3,3,2,2,2,2,2,2, 0,2,0,0,0,0,2,1,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,0,1,1, 3,3,3,3,3,1,2,1,2,1,3,2,2,2,3,1,2,2,1,1,2,1,1,2,2,1,1,2,1,3,3,1, 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,3,1,2,1,0,3,3,1,2,3,1,1,1,0,0,3,1,1,0,0,1,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,2,3,3,3,1,2,1,2,2,2,3,2,2,2,1,1,2,1,2,2,2,1,1,2,2,1,1,1,0,2,1, 0,1,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,3,0,0,0,0,0, 0,3,3,3,3,1,0,3,2,2,2,3,3,3,0,3,3,3,3,3,0,1,2,2,0,0,1,0,0,0,3,3, 0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0, 3,3,3,3,3,1,3,2,2,2,1,1,2,2,3,2,1,2,1,1,2,3,3,2,2,2,1,2,0,3,1,2, 0,1,1,0,0,0,1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1, 3,1,3,2,3,1,2,2,3,2,3,3,3,2,0,1,3,1,1,1,2,2,1,2,1,1,1,1,1,1,1,0, 0,1,1,0,0,0,1,1,0,0,1,0,0,0,0,1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,1,1,3,0,1,1,2,1,2,1,2,1,0,1,1,2,1,1,1,1,1,1,1,1,1,1,0,1,1,1, 0,0,3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,0,3,0,0,0,0,0,2,1,0,0,2,0,1,1,3,3,1,0,3,0,0,0,0,3,0,0,0,0,0, 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,3,2,2,0,0,3,3,3,0,2,3,1,0,2,2,2,2,3,0,1,1,3,0,0,1,0,0,0,1,2, 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0, 3,3,1,2,3,1,2,2,2,1,2,2,2,2,1,1,2,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1, 0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,3,3,2,3,0,0,2,1,3,2,3,3,1,0,3,2,3,1,2,0,2,2,1,0,0,1,0,1,0,1,2, 0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,2,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1, 3,3,2,2,2,0,2,2,2,1,2,1,2,2,0,1,1,2,1,1,2,2,1,2,2,2,1,1,1,0,1,1, 0,0,0,0,0,2,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0, 0,3,3,3,2,2,3,2,2,2,1,3,2,2,0,3,2,2,3,1,3,1,2,2,3,2,1,2,1,0,2,1, 0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,0, 3,2,1,1,2,1,2,2,2,1,1,2,2,1,1,1,2,1,1,1,2,1,1,1,2,1,1,1,1,0,1,0, 0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 3,3,1,1,3,2,2,1,1,1,1,2,1,0,1,1,1,2,0,1,1,0,0,0,0,1,1,1,0,0,0,1, 0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, 2,0,0,2,2,0,0,0,2,3,0,3,2,3,3,0,2,0,0,0,2,0,1,2,2,1,0,2,2,1,0,0, 1,2,0,1,0,1,1,1,1,1,2,3,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,1,2,2,1,1,1,1,1,1,1,1,2,2,3,1,1,1,2,1,1,1,1,1,1,1,1,1,1,0,1,1, 0,0,0,0,0,0,2,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,2,0,0,0,1,3,0,3,3,2,3,0,2,0,0,0,2,0,1,1,2,2,0,2,1,1,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,3,1,0,0,0,3,3,0,2,3,3,2,0,3,0,0,0,2,0,1,1,2,0,0,1,1,0,0,0, 3,1,1,2,1,0,1,1,1,1,2,0,2,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,1,1, 0,1,3,0,0,1,2,0,0,0,0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,1,0,0,0,1,0, 3,0,2,1,1,0,0,1,0,0,1,0,2,1,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,1,3,1,2,1,1,2,1,1,1,0,1,1,0,1,1,1,1,1,1,0,0,1,1,1,0,1,1,1,0,0, 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,1,1,0,0,0,1,3,0,3,2,2,2,0,2,0,0,0,2,0,1,2,2,1,0,2,3,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,2,2,0,0,0,2,2,0,1,3,2,1,0,2,0,0,0,3,0,1,1,1,1,0,0,1,0,0,0, 3,1,1,1,1,0,2,1,1,0,0,1,2,1,0,1,1,1,2,1,1,1,1,1,2,1,2,1,1,0,1,1, 0,0,0,0,0,0,1,0,0,0,3,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,3,3,0,0,0,2,2,0,2,2,2,1,0,2,0,0,0,2,0,1,1,1,2,0,1,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,2,3,0,0,0,2,1,0,2,2,2,1,0,1,0,0,0,1,0,3,2,1,2,0,1,1,0,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,1,2,0,0,0,2,1,0,1,3,2,1,0,2,0,0,0,1,0,2,1,1,1,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,2,2,0,0,0,2,2,0,0,1,1,2,0,1,0,0,0,1,0,1,1,1,1,0,1,1,0,0,0, 1,1,3,2,2,0,2,1,1,1,1,2,1,1,0,1,1,2,1,0,1,1,1,1,1,1,1,1,0,0,0,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,2,2,0,0,0,2,0,0,1,2,1,1,0,1,0,0,0,0,0,2,1,0,1,0,0,0,0,0,0, 3,1,1,1,2,0,1,2,1,0,0,0,1,2,0,1,2,1,1,1,1,0,0,0,1,1,0,1,1,0,0,1, 0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,3,0,0,0,0,0,2,0,0,1,0,0,1,0,2,2,0,0,1,0,0,0,0,0,0,2,0,1,0, 0,0,0,0,0,3,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,1,1,0,1,1,1,0,0,0,1,0,0,1,0,1,0,0,1,0,1,1,1,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,2,2,0,0,0,2,0,0,1,0,1,1,0,1,0,0,0,1,0,1,1,1,2,0,0,2,0,0,0, 2,1,1,0,2,0,2,1,1,1,1,2,1,1,1,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,2,2,0,0,0,2,1,0,1,1,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,1,0,0,0,0,2,0,2,2,2,2,0,2,0,0,0,2,0,1,0,1,1,0,1,1,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,2,2,0,0,0,2,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,2,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,1,0,0,0,1,1,0,0,1,2,1,0,1,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0, 1,0,1,2,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,0,0,0,1,1, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,2,1,0,0,0,2,0,0,2,1,1,2,0,0,0,0,0,0,0,2,1,1,2,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,1,2,0,0,0,2,1,0,2,1,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,2,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,1,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,0,0,1,1,1,1,0,1,1,1,0,0, 0,1,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,1,1,0,0,0,0,1,1,1,1,2,0,0,1,0,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; const SequenceModel Tis_620ThaiModel = { Tis_620_CharToOrderMap, ThaiLangModel, 64, (float)0.8815720594354438, PR_FALSE, "TIS-620" }; const SequenceModel Iso_8859_11ThaiModel = { Iso_8859_11_CharToOrderMap, ThaiLangModel, 64, (float)0.8815720594354438, PR_FALSE, "ISO-8859-11" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangTurkishModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Turkish *********/ /** * Generated by BuildLangModel.py * On: 2015-12-04 02:24:44.730727 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Iso_8859_3_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 15, 21, 7, 1, 26, 22, 19, 6, 28, 9, 5, 11, 3, 14, /* 4X */ 23, 34, 4, 10, 8, 12, 20, 29, 32, 13, 18,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 15, 21, 7, 1, 26, 22, 19, 2, 28, 9, 5, 11, 3, 14, /* 6X */ 23, 34, 4, 10, 8, 12, 20, 29, 32, 13, 18,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM, 48,SYM,SYM,SYM,ILL, 49,SYM,SYM, 2, 17, 25, 50,SYM,ILL, 51, /* AX */ SYM, 52,SYM,SYM,SYM,SYM, 53,SYM,SYM, 6, 17, 25, 54,SYM,ILL, 55, /* BX */ 41, 36, 30,ILL, 39, 56, 57, 24, 42, 33, 58, 45, 59, 37, 31, 60, /* CX */ ILL, 47, 61, 38, 62, 63, 27,SYM, 64, 65, 40, 35, 16, 66, 67, 68, /* DX */ 41, 36, 30,ILL, 39, 69, 70, 24, 42, 33, 71, 45, 72, 37, 31, 73, /* EX */ ILL, 47, 74, 38, 75, 76, 27,SYM, 77, 78, 40, 35, 16, 79, 80,SYM, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Iso_8859_9_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 0, 15, 21, 7, 1, 26, 22, 19, 6, 28, 9, 5, 11, 3, 14, /* 4X */ 23, 34, 4, 10, 8, 12, 20, 29, 32, 13, 18,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 0, 15, 21, 7, 1, 26, 22, 19, 2, 28, 9, 5, 11, 3, 14, /* 6X */ 23, 34, 4, 10, 8, 12, 20, 29, 32, 13, 18,SYM,SYM,SYM,SYM,CTR, /* 7X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 8X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM, 81,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 41, 36, 30, 44, 39, 82, 46, 24, 42, 33, 83, 45, 84, 37, 31, 85, /* CX */ 25, 47, 86, 38, 87, 88, 27,SYM, 43, 89, 40, 35, 16, 2, 17, 90, /* DX */ 41, 36, 30, 44, 39, 91, 46, 24, 42, 33, 92, 45, 93, 37, 31, 94, /* EX */ 25, 47, 95, 38, 96, 97, 27,SYM, 43, 98, 40, 35, 16, 6, 17, 99, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 935 * First 512 sequences: 0.991865243864388 * Next 512 sequences (512-1024): 0.008134756135611957 * Rest: 2.949029909160572e-17 * Negative sequences: TODO */ constexpr PRUint8 TurkishLangModel[] = { 3,2,3,3,3,3,2,3,3,3,3,3,3,3,2,3,0,3,3,3,3,3,3,3,3,3,3,0,3,3,0,2,2,2,2,0, 3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,3,2,0,3,0,2,0, 3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,0,2,2,2,0,2,0,2,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,3,2,3,0,3,2,2,2,2,2,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,3,2,3,2,2,2,2,2,2,2, 3,3,3,2,2,3,3,3,3,3,3,3,3,3,3,3,3,2,2,3,2,3,3,2,3,0,3,2,2,2,2,3,0,2,2,2, 3,2,0,3,3,3,3,3,3,3,3,3,2,3,2,3,0,3,3,2,3,3,2,3,2,3,2,0,0,0,0,0,2,0,0,0, 3,3,3,2,3,3,3,3,2,2,2,2,3,3,3,2,3,0,2,2,2,2,2,2,0,0,0,3,2,3,2,2,0,0,0,0, 3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,3,3,2,2,2,3,0,2,3,2,2,3,2,2,0,0,0, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,3,2,2,3,2,2,2,2,3,0,2,3,2,2,3,0,0,0,0,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,2,3,3,3,2,3,3,0,2,3,0,2,2,0,0,2,2,2, 3,3,3,2,3,3,3,3,2,2,3,3,3,3,3,3,3,2,3,3,0,3,2,3,2,0,2,2,0,2,3,2,2,2,2,2, 3,3,3,3,3,3,0,3,3,3,3,3,2,3,2,3,0,3,3,3,3,3,3,3,3,3,2,0,2,2,0,0,2,2,0,0, 3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,3,2,2,2,2,2,3,2,2,0,2,3,0,2,2,0,0,2,0,2, 3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,0,3,3,3,3,3,3,3,3,3,3,0,3,3,0,2,2,2,0,0, 3,3,3,3,3,3,3,3,0,2,2,3,3,3,3,3,3,0,2,2,2,2,0,2,0,0,0,3,2,2,2,0,0,2,0,0, 2,2,2,3,3,3,0,3,3,3,3,3,0,3,2,3,0,3,3,3,3,3,2,3,3,3,3,0,2,0,0,0,0,0,0,0, 3,3,3,0,2,3,3,2,3,3,2,3,3,2,2,3,3,2,0,2,2,2,2,2,3,0,2,2,0,0,2,2,0,0,0,0, 3,3,3,2,2,3,3,3,2,2,0,3,3,3,3,2,3,0,2,2,0,3,3,0,0,0,0,2,0,0,2,2,0,0,0,0, 3,3,3,3,3,3,3,2,3,2,3,3,3,3,3,3,3,2,2,2,2,2,0,2,3,0,2,0,0,2,3,2,0,2,0,2, 3,3,3,2,3,3,2,2,0,2,3,2,3,3,3,2,2,2,2,2,3,2,2,0,0,0,2,0,0,0,2,2,0,0,0,0, 3,3,3,2,3,3,3,2,3,3,2,2,3,2,3,2,3,0,2,3,0,2,0,0,0,0,0,2,0,0,2,0,0,2,2,2, 3,3,3,2,3,3,3,2,2,2,2,0,3,2,3,0,3,0,2,3,2,0,2,2,0,0,2,3,2,2,2,0,0,2,0,0, 3,3,3,0,3,3,3,2,3,2,3,3,3,2,3,2,2,0,2,3,0,2,2,3,2,0,2,0,0,2,2,0,2,2,0,0, 3,3,3,0,2,3,3,2,3,2,0,3,3,2,3,2,3,2,0,0,0,0,2,2,0,0,0,3,0,0,0,0,0,0,0,0, 3,3,3,0,3,3,3,3,0,0,0,3,3,0,0,2,3,2,2,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,3,3,2,3,3,3,2,3,2,2,0,3,3,3,2,2,0,0,2,0,2,2,0,2,0,2,2,2,0,2,2,0,0,0,0, 0,0,0,3,3,3,0,3,3,3,3,3,0,3,0,2,0,2,3,2,2,0,0,2,3,3,2,0,2,0,0,0,0,0,0,0, 3,3,3,0,0,2,2,2,0,2,0,0,3,0,3,0,2,0,0,0,0,2,2,2,0,0,0,2,0,0,2,0,0,0,0,0, 3,3,3,2,2,2,0,0,0,2,2,2,2,2,3,2,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0, 0,0,2,3,3,3,0,3,2,2,2,2,0,2,0,2,0,2,2,3,2,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0, 0,0,0,2,0,2,0,2,2,0,0,2,0,2,0,0,0,2,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, 3,2,2,0,0,0,2,0,2,0,0,0,0,2,2,0,0,0,0,0,2,0,0,2,0,0,2,0,0,2,0,0,0,0,0,0, 2,0,2,2,2,2,0,2,2,0,2,2,2,0,0,2,0,0,2,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0, 2,0,2,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,2,2,0,2,0,0,2,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0, }; const SequenceModel Iso_8859_3TurkishModel = { Iso_8859_3_CharToOrderMap, TurkishLangModel, 36, (float)0.991865243864388, PR_FALSE, "ISO-8859-3" }; const SequenceModel Iso_8859_9TurkishModel = { Iso_8859_9_CharToOrderMap, TurkishLangModel, 36, (float)0.991865243864388, PR_FALSE, "ISO-8859-9" }; ================================================ FILE: third_party/uchardet/uchardet/src/LangModels/LangVietnameseModel.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../nsSBCharSetProber.h" /********* Language model for: Vietnamese *********/ /** * Generated by BuildLangModel.py * On: 2016-02-13 03:42:06.561440 **/ /* Character Mapping Table: * ILL: illegal character. * CTR: control character specific to the charset. * RET: carriage/return. * SYM: symbol (punctuation) that does not belong to word. * NUM: 0 - 9. * * Other characters are ordered by probabilities * (0 is the most common character in the language). * * Orders are generic to a language. So the codepoint with order X in * CHARSET1 maps to the same character as the codepoint with the same * order X in CHARSET2 for the same language. * As such, it is possible to get missing order. For instance the * ligature of 'o' and 'e' exists in ISO-8859-15 but not in ISO-8859-1 * even though they are both used for French. Same for the euro sign. */ constexpr unsigned char Windows_1258_CharToOrderMap[] = { CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 6, 17, 3, 22, 21, 66, 5, 1, 4, 75, 24, 14, 8, 0, 9, /* 4X */ 16, 36, 11, 19, 2, 7, 13, 69, 54, 20, 82,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 6, 17, 3, 22, 21, 66, 5, 1, 4, 75, 24, 14, 8, 0, 9, /* 6X */ 16, 36, 11, 19, 2, 7, 13, 69, 54, 20, 82,SYM,SYM,SYM,SYM,CTR, /* 7X */ SYM,ILL,SYM,101,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,100,ILL,ILL,ILL, /* 8X */ ILL,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,ILL,SYM,100,ILL,ILL,102, /* 9X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* AX */ SYM,SYM,SYM,SYM,SYM,103,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* BX */ 12, 15, 25, 51, 97,104, 98, 91, 90, 62, 27,105,SYM, 47,106,107, /* CX */ 10,108,SYM, 33, 29, 46, 93,SYM, 94, 58, 67,109, 96, 18,SYM, 99, /* DX */ 12, 15, 25, 51, 97,110, 98, 91, 90, 62, 27,111,SYM, 47,112,113, /* EX */ 10,114,SYM, 33, 29, 46, 93,SYM, 94, 58, 67,115, 96, 18,116,117, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ constexpr unsigned char Viscii_CharToOrderMap[] = { CTR,CTR, 88,CTR,CTR, 95, 77,CTR,CTR,CTR,RET,CTR,CTR,RET,CTR,CTR, /* 0X */ CTR,CTR,CTR,CTR, 80,CTR,CTR,CTR,CTR, 79,CTR,CTR,CTR,CTR, 92,CTR, /* 1X */ SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM,SYM, /* 2X */ NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,NUM,SYM,SYM,SYM,SYM,SYM,SYM, /* 3X */ SYM, 6, 17, 3, 22, 21, 66, 5, 1, 4, 75, 24, 14, 8, 0, 9, /* 4X */ 16, 36, 11, 19, 2, 7, 13, 69, 54, 20, 82,SYM,SYM,SYM,SYM,SYM, /* 5X */ SYM, 6, 17, 3, 22, 21, 66, 5, 1, 4, 75, 24, 14, 8, 0, 9, /* 6X */ 16, 36, 11, 19, 2, 7, 13, 69, 54, 20, 82,SYM,SYM,SYM,SYM,CTR, /* 7X */ 30, 57, 71, 65, 41, 43, 78, 49, 83, 89, 23, 45, 39, 74, 28, 32, /* 8X */ 53, 60, 84, 31, 37, 40, 38, 59, 42, 81, 44, 73, 35, 72, 48, 76, /* 9X */ 86, 57, 71, 65, 41, 43, 78, 49, 83, 89, 23, 45, 39, 74, 28, 32, /* AX */ 53, 60, 84, 87, 46, 31, 38, 59, 42, 56, 52, 55, 70, 46, 40, 18, /* BX */ 12, 15, 25, 61, 34, 51, 88, 95, 90, 62, 27, 85, 50, 47, 64, 76, /* CX */ 10, 52, 63, 33, 29, 30, 80, 55, 70, 58, 67, 79, 92, 68, 87, 18, /* DX */ 12, 15, 25, 61, 34, 51, 26, 77, 90, 62, 27, 85, 50, 47, 64, 73, /* EX */ 10, 56, 63, 33, 29, 86, 81, 44, 48, 58, 67, 72, 35, 68, 37, 26, /* FX */ }; /*X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */ /* Model Table: * Total sequences: 1494 * First 512 sequences: 0.9321889118082535 * Next 512 sequences (512-1024): 0.06092051479986333 * Rest: 0.0068905733918831966 * Negative sequences: TODO */ constexpr PRUint8 VietnameseLangModel[] = { 3,3,3,3,3,3,3,2,2,3,0,2,3,1,1,1,1,2,3,3,2,3,3,3,2,1,2, 3,0,3,2,2,2,3,1,0,1,1,2,0,0,1,0,1,0,2,2,1,0,0,0,3,0,0,2, 2,1,2,0,3,0,3,3,2,3,0,2,3,0,2,3,0,0,3,1,3,3,1,3,1,3,3, 3,3,3,3,3,3,3,3,3,0,3,3,3,2,3,3,3,3,2,3,3,3,3,3,2,3,2,0, 2,3,2,2,3,1,3,3,1,3,1,3,3,2,2,3,2,0,3,2,2,3,1,3,0,3,0, 3,1,3,3,3,3,2,3,2,0,0,2,1,2,2,2,2,0,0,1,3,2,3,2,2,2,2,0, 2,3,2,2,3,0,3,3,2,3,0,2,2,1,2,3,1,1,2,2,2,3,1,0,2,2,0, 0,0,3,2,3,2,3,3,3,1,1,2,0,0,2,0,3,0,0,2,0,2,2,0,2,3,1,1, 3,1,3,3,3,3,3,2,3,3,1,3,2,2,3,3,2,2,0,3,1,3,3,3,2,0,3, 3,3,1,0,0,3,1,3,0,2,0,2,3,3,2,0,0,2,3,0,0,0,1,0,1,0,0,2, 2,3,2,2,3,1,3,3,1,3,0,3,3,0,2,2,0,1,3,2,2,3,1,1,1,2,3, 0,0,3,3,1,2,2,0,1,0,2,2,0,0,1,1,3,3,0,0,0,1,1,2,1,0,3,0, 3,2,3,3,3,2,2,3,3,3,0,3,0,2,3,0,2,3,0,3,3,2,3,0,2,0,0, 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,2, 3,1,3,2,3,2,3,1,3,2,0,3,1,2,3,2,2,2,0,3,3,3,2,2,2,3,0, 2,1,3,1,3,3,0,2,0,0,0,1,0,1,3,0,3,0,0,2,2,0,3,0,2,0,3,1, 2,1,0,2,3,0,3,3,2,3,0,0,3,0,2,3,2,2,3,2,2,3,2,0,0,1,0, 0,2,3,3,3,2,2,1,0,0,0,2,0,3,3,0,1,2,2,0,0,3,2,2,1,2,1,1, 3,2,3,2,3,2,3,3,3,2,0,3,3,2,3,3,2,3,0,3,2,2,3,0,2,0,0, 0,0,0,3,0,0,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2, 0,0,0,0,3,0,3,2,0,3,0,1,3,0,0,3,0,1,3,0,0,1,0,3,0,3,0, 2,3,3,3,3,3,3,3,2,0,1,3,3,1,3,3,3,3,3,2,2,0,1,2,2,3,3,0, 3,2,3,2,3,2,3,3,2,3,0,3,2,2,3,2,1,2,3,3,3,3,3,0,2,1,2, 3,1,2,2,3,2,0,2,0,0,2,2,1,0,3,3,2,3,0,1,2,2,2,3,3,1,2,0, 3,0,0,0,3,0,0,2,3,3,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,3,0,3,3,0,2,0,1,3,0,1,1,0,0,2,1,1,3,1,1,0,2,1, 2,1,2,1,0,1,0,0,0,0,2,1,0,3,2,3,3,1,3,0,3,2,3,3,3,0,0,0, 0,2,2,1,3,2,3,3,2,3,0,0,3,2,3,2,2,2,3,2,2,3,2,1,1,2,1, 3,2,2,3,3,2,1,0,0,0,3,2,0,3,2,3,2,1,0,1,2,2,3,0,2,0,0,1, 3,0,3,3,3,1,0,2,3,3,0,1,0,0,1,0,3,0,0,1,3,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,3,2,0,3,0,3,2,1,3,0,3,0,0,2,0,2,1,0,2,2,3,1,0,0,0,0, 2,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 2,1,0,2,3,1,3,3,0,3,0,3,3,0,3,3,0,3,1,2,2,3,1,1,1,0,0, 2,1,0,2,3,3,2,3,0,0,0,1,0,2,2,3,2,0,1,0,2,1,2,3,0,2,3,0, 3,0,1,1,2,0,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,3,3,0,3,0,0,0,0,0,3,0,0,0,0,0,0,0,0, 1,3,3,3,3,1,3,3,2,3,0,1,2,0,2,3,2,2,2,3,2,3,2,0,2,2,0, 0,0,2,1,0,3,2,2,0,1,1,1,1,1,1,0,0,0,0,2,0,1,0,0,1,2,1,0, 2,0,1,2,1,0,2,2,1,2,0,2,0,0,1,1,2,1,0,2,0,2,1,3,1,0,0, 3,2,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0, 3,2,3,2,2,2,3,2,3,3,0,3,0,2,3,1,2,2,0,3,2,3,3,0,2,0,0, 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, 1,1,1,2,3,1,3,3,0,3,0,3,3,1,2,1,0,0,3,2,2,3,2,0,1,3,1, 1,0,0,3,1,1,1,0,0,0,0,1,0,0,3,3,2,1,0,1,0,3,2,1,1,2,1,0, 3,0,3,2,0,0,0,3,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,3,1,0,3,1,3,2,0,2,0,2,0,1,2,0,0,1,0,2,2,2,0,3,1,0,0, 2,0,1,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,3,0,0,2,0,0,0,1, 3,0,1,1,0,0,0,3,3,0,0,0,0,0,1,0,1,0,0,0,3,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,2,1,0,0,0,3,3,0,1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,3,0,0,0,3,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,2,2,3,0,0,0,3,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0, 0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,3,3,0,0,0,2,3,0,0,0,0,0,0,3,0,0,0,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,3,3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,3,3,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,1,2,3,0,3,0,2,0,0,1,0,1,0,0,2,0,0,0,0,0,0,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,3,0,0,0,2,3,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,1,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,2,3,3,0,0,2,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,2,3,3,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,0,0,0,0,3,3,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,1,3,0,0,3,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,1,0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,1,3,3,0,2,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,0,0,0,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,1,1,3,0,0,2,2,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,2,3,0,0,2,1,1,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,1,3,1,0,0,0,1,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,3,1,0,0,0,2,2,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,0,0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,1,1,1,0,0,0,3,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,2,3,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 3,0,0,0,2,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 1,1,2,1,2,0,3,3,0,1,0,0,0,2,0,3,1,2,2,0,1,3,0,2,0,2,0, 2,0,2,1,1,0,1,2,0,0,0,1,0,0,1,0,0,0,0,1,2,0,0,1,1,2,0,2, }; const SequenceModel Windows_1258VietnameseModel = { Windows_1258_CharToOrderMap, VietnameseLangModel, 55, (float)0.9321889118082535, PR_FALSE, "WINDOWS-1258" }; const SequenceModel VisciiVietnameseModel = { Viscii_CharToOrderMap, VietnameseLangModel, 55, (float)0.9321889118082535, PR_FALSE, "VISCII" }; ================================================ FILE: third_party/uchardet/uchardet/src/nsBig5Prober.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsBig5Prober.h" void nsBig5Prober::Reset(void) { mCodingSM->Reset(); mState = eDetecting; mDistributionAnalyser.Reset(mIsPreferredLanguage); } nsProbingState nsBig5Prober::HandleData(const char* aBuf, PRUint32 aLen) { nsSMState codingState; for (PRUint32 i = 0; i < aLen; i++) { codingState = mCodingSM->NextState(aBuf[i]); if (codingState == eItsMe) { mState = eFoundIt; break; } if (codingState == eStart) { PRUint32 charLen = mCodingSM->GetCurrentCharLen(); if (i == 0) { mLastChar[1] = aBuf[0]; mDistributionAnalyser.HandleOneChar(mLastChar, charLen); } else mDistributionAnalyser.HandleOneChar(aBuf+i-1, charLen); } } mLastChar[0] = aBuf[aLen-1]; if (mState == eDetecting) if (mDistributionAnalyser.GotEnoughData() && GetConfidence() >= SHORTCUT_THRESHOLD) mState = eFoundIt; return mState; } float nsBig5Prober::GetConfidence(void) { float distribCf = mDistributionAnalyser.GetConfidence(); return (float)distribCf; } ================================================ FILE: third_party/uchardet/uchardet/src/nsBig5Prober.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsBig5Prober_h__ #define nsBig5Prober_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" #include "CharDistribution.h" class nsBig5Prober: public nsCharSetProber { public: nsBig5Prober(PRBool aIsPreferredLanguage) :mIsPreferredLanguage(aIsPreferredLanguage) {mCodingSM = new nsCodingStateMachine(&Big5SMModel); Reset();} virtual ~nsBig5Prober(void){delete mCodingSM;} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "BIG5";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); nsCodingStateMachine* mCodingSM; nsProbingState mState; //Big5ContextAnalysis mContextAnalyser; Big5DistributionAnalysis mDistributionAnalyser; char mLastChar[2]; PRBool mIsPreferredLanguage; }; #endif /* nsBig5Prober_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsCharSetProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsCharSetProber.h" #include "prmem.h" //This filter applies to all scripts which do not use English characters PRBool nsCharSetProber::FilterWithoutEnglishLetters(const char* aBuf, PRUint32 aLen, char** newBuf, PRUint32& newLen) { char *newptr; char *prevPtr, *curPtr; PRBool meetMSB = PR_FALSE; newptr = *newBuf = (char*)PR_Malloc(aLen); if (!newptr) return PR_FALSE; for (curPtr = prevPtr = (char*)aBuf; curPtr < aBuf+aLen; curPtr++) { if (*curPtr & 0x80) { meetMSB = PR_TRUE; } else if (*curPtr < 'A' || (*curPtr > 'Z' && *curPtr < 'a') || *curPtr > 'z') { //current char is a symbol, most likely a punctuation. we treat it as segment delimiter if (meetMSB && curPtr > prevPtr) //this segment contains more than single symbol, and it has upper ASCII, we need to keep it { while (prevPtr < curPtr) *newptr++ = *prevPtr++; prevPtr++; *newptr++ = ' '; meetMSB = PR_FALSE; } else //ignore current segment. (either because it is just a symbol or just an English word) prevPtr = curPtr+1; } } if (meetMSB && curPtr > prevPtr) while (prevPtr < curPtr) *newptr++ = *prevPtr++; newLen = static_cast(newptr - *newBuf); return PR_TRUE; } //This filter applies to all scripts which contain both English characters and upper ASCII characters. PRBool nsCharSetProber::FilterWithEnglishLetters(const char* aBuf, PRUint32 aLen, char** newBuf, PRUint32& newLen) { //do filtering to reduce load to probers char *newptr; char *prevPtr, *curPtr; PRBool isInTag = PR_FALSE; newptr = *newBuf = (char*)PR_Malloc(aLen); if (!newptr) return PR_FALSE; for (curPtr = prevPtr = (char*)aBuf; curPtr < aBuf+aLen; curPtr++) { if (*curPtr == '>') isInTag = PR_FALSE; else if (*curPtr == '<') isInTag = PR_TRUE; if (!(*curPtr & 0x80) && (*curPtr < 'A' || (*curPtr > 'Z' && *curPtr < 'a') || *curPtr > 'z') ) { if (curPtr > prevPtr && !isInTag) // Current segment contains more than just a symbol // and it is not inside a tag, keep it. { while (prevPtr < curPtr) *newptr++ = *prevPtr++; prevPtr++; *newptr++ = ' '; } else prevPtr = curPtr+1; } } // If the current segment contains more than just a symbol // and it is not inside a tag then keep it. if (!isInTag) while (prevPtr < curPtr) *newptr++ = *prevPtr++; newLen = static_cast(newptr - *newBuf); return PR_TRUE; } ================================================ FILE: third_party/uchardet/uchardet/src/nsCharSetProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsCharSetProber_h__ #define nsCharSetProber_h__ #include "nscore.h" //#define DEBUG_chardet // Uncomment this for debug dump. typedef enum { eDetecting = 0, //We are still detecting, no sure answer yet, but caller can ask for confidence. eFoundIt = 1, //That's a positive answer eNotMe = 2 //Negative answer } nsProbingState; class nsCharSetProber { public: // non copyable nsCharSetProber() = default; nsCharSetProber(const nsCharSetProber&) = delete; nsCharSetProber& operator=(const nsCharSetProber&) = delete; virtual ~nsCharSetProber() {}; virtual const char* GetCharSetName() = 0; virtual nsProbingState HandleData(const char* aBuf, PRUint32 aLen) = 0; virtual nsProbingState GetState(void) = 0; virtual void Reset(void) = 0; virtual float GetConfidence(void) = 0; virtual void SetOpion() = 0; #ifdef DEBUG_chardet virtual void DumpStatus() {}; #endif // Helper functions used in the Latin1 and Group probers. // both functions Allocate a new buffer for newBuf. This buffer should be // freed by the caller using PR_FREEIF. // Both functions return PR_FALSE in case of memory allocation failure. static PRBool FilterWithoutEnglishLetters(const char* aBuf, PRUint32 aLen, char** newBuf, PRUint32& newLen); static PRBool FilterWithEnglishLetters(const char* aBuf, PRUint32 aLen, char** newBuf, PRUint32& newLen); }; #endif /* nsCharSetProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsCodingStateMachine.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: et sw=2 ts=2 fdm=marker */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsCodingStateMachine_h__ #define nsCodingStateMachine_h__ #include "nsPkgInt.h" /* Apart from these 3 generic states, machine states are specific to * each charset prober. */ typedef enum { eStart = 0, eError = 1, eItsMe = 2 } nsSMState; #define GETCLASS(c) GETFROMPCK(((unsigned char)(c)), mModel->classTable) //state machine model typedef struct { nsPkgInt classTable; PRUint32 classFactor; nsPkgInt stateTable; const PRUint32* charLenTable; const char* name; } SMModel; class nsCodingStateMachine { public: nsCodingStateMachine(const SMModel* sm) : mModel(sm) , mCurrentState(eStart) , mCurrentBytePos(0) , mCurrentCharLen(0) { } nsSMState NextState(char c){ //for each byte we get its class , if it is first byte, we also get byte length PRUint32 byteCls = GETCLASS(c); if (mCurrentState == eStart) { mCurrentBytePos = 0; mCurrentCharLen = mModel->charLenTable[byteCls]; } //from byte's class and stateTable, we get its next state mCurrentState=(nsSMState)GETFROMPCK(mCurrentState*(mModel->classFactor)+byteCls, mModel->stateTable); mCurrentBytePos++; return mCurrentState; } PRUint32 GetCurrentCharLen(void) {return mCurrentCharLen;} void Reset(void) {mCurrentState = eStart;} const char * GetCodingStateMachine() {return mModel->name;} protected: nsSMState mCurrentState; PRUint32 mCurrentCharLen; PRUint32 mCurrentBytePos; const SMModel *mModel; }; extern const SMModel UTF8SMModel; extern const SMModel Big5SMModel; extern const SMModel EUCJPSMModel; extern const SMModel EUCKRSMModel; extern const SMModel EUCTWSMModel; extern const SMModel GB2312SMModel; extern const SMModel GB18030SMModel; extern const SMModel SJISSMModel; extern const SMModel UCS2BESMModel; extern const SMModel HZSMModel; extern const SMModel ISO2022CNSMModel; extern const SMModel ISO2022JPSMModel; extern const SMModel ISO2022KRSMModel; #endif /* nsCodingStateMachine_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsEUCJPProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // for japanese encoding, obeserve characteristic: // 1, kana character (or hankaku?) often have hight frequency of appereance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language #include "nsEUCJPProber.h" void nsEUCJPProber::Reset(void) { mCodingSM->Reset(); mState = eDetecting; mContextAnalyser.Reset(mIsPreferredLanguage); mDistributionAnalyser.Reset(mIsPreferredLanguage); } nsProbingState nsEUCJPProber::HandleData(const char* aBuf, PRUint32 aLen) { nsSMState codingState; for (PRUint32 i = 0; i < aLen; i++) { codingState = mCodingSM->NextState(aBuf[i]); if (codingState == eItsMe) { mState = eFoundIt; break; } if (codingState == eStart) { PRUint32 charLen = mCodingSM->GetCurrentCharLen(); if (i == 0) { mLastChar[1] = aBuf[0]; mContextAnalyser.HandleOneChar(mLastChar, charLen); mDistributionAnalyser.HandleOneChar(mLastChar, charLen); } else { mContextAnalyser.HandleOneChar(aBuf+i-1, charLen); mDistributionAnalyser.HandleOneChar(aBuf+i-1, charLen); } } } mLastChar[0] = aBuf[aLen-1]; if (mState == eDetecting) if (mContextAnalyser.GotEnoughData() && GetConfidence() >= SHORTCUT_THRESHOLD) mState = eFoundIt; return mState; } float nsEUCJPProber::GetConfidence(void) { float contxtCf = mContextAnalyser.GetConfidence(); float distribCf = mDistributionAnalyser.GetConfidence(); return (contxtCf > distribCf ? contxtCf : distribCf); } ================================================ FILE: third_party/uchardet/uchardet/src/nsEUCJPProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // for S-JIS encoding, obeserve characteristic: // 1, kana character (or hankaku?) often have hight frequency of appereance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language #ifndef nsEUCJPProber_h__ #define nsEUCJPProber_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" #include "JpCntx.h" #include "CharDistribution.h" class nsEUCJPProber: public nsCharSetProber { public: nsEUCJPProber(PRBool aIsPreferredLanguage) :mIsPreferredLanguage(aIsPreferredLanguage) {mCodingSM = new nsCodingStateMachine(&EUCJPSMModel); Reset();} virtual ~nsEUCJPProber(void){delete mCodingSM;} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "EUC-JP";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} protected: nsCodingStateMachine* mCodingSM; nsProbingState mState; EUCJPContextAnalysis mContextAnalyser; EUCJPDistributionAnalysis mDistributionAnalyser; char mLastChar[2]; PRBool mIsPreferredLanguage; }; #endif /* nsEUCJPProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsEUCKRProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: et sw=2 ts=2 fdm=marker */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsEUCKRProber.h" void nsEUCKRProber::Reset(void) { mCodingSM->Reset(); mState = eDetecting; mDistributionAnalyser.Reset(mIsPreferredLanguage); //mContextAnalyser.Reset(); } nsProbingState nsEUCKRProber::HandleData(const char* aBuf, PRUint32 aLen) { nsSMState codingState; for (PRUint32 i = 0; i < aLen; i++) { codingState = mCodingSM->NextState(aBuf[i]); if (codingState == eItsMe) { mState = eFoundIt; break; } if (codingState == eStart) { PRUint32 charLen = mCodingSM->GetCurrentCharLen(); if (i == 0) { mLastChar[1] = aBuf[0]; mDistributionAnalyser.HandleOneChar(mLastChar, charLen); } else mDistributionAnalyser.HandleOneChar(aBuf+i-1, charLen); } } mLastChar[0] = aBuf[aLen-1]; if (mState == eDetecting) if (mDistributionAnalyser.GotEnoughData() && GetConfidence() >= SHORTCUT_THRESHOLD) mState = eFoundIt; // else // mDistributionAnalyser.HandleData(aBuf, aLen); return mState; } float nsEUCKRProber::GetConfidence(void) { float distribCf = mDistributionAnalyser.GetConfidence(); return (float)distribCf; } ================================================ FILE: third_party/uchardet/uchardet/src/nsEUCKRProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsEUCKRProber_h__ #define nsEUCKRProber_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" #include "CharDistribution.h" class nsEUCKRProber: public nsCharSetProber { public: nsEUCKRProber(PRBool aIsPreferredLanguage) :mIsPreferredLanguage(aIsPreferredLanguage) {mCodingSM = new nsCodingStateMachine(&EUCKRSMModel); Reset(); } virtual ~nsEUCKRProber(void){delete mCodingSM;} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); /* "Unified Hangul Code", also called "CP949" or "Windows-949" is a * superset of EUC-KR. Though not fully ok to return UHC here (a * separate prober would be better), it is acceptable, since many * Korean documents are actually created with this character set. */ const char* GetCharSetName() {return "UHC";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); nsCodingStateMachine* mCodingSM; nsProbingState mState; //EUCKRContextAnalysis mContextAnalyser; EUCKRDistributionAnalysis mDistributionAnalyser; char mLastChar[2]; PRBool mIsPreferredLanguage; }; #endif /* nsEUCKRProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsEUCTWProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsEUCTWProber.h" void nsEUCTWProber::Reset(void) { mCodingSM->Reset(); mState = eDetecting; mDistributionAnalyser.Reset(mIsPreferredLanguage); //mContextAnalyser.Reset(); } nsProbingState nsEUCTWProber::HandleData(const char* aBuf, PRUint32 aLen) { nsSMState codingState; for (PRUint32 i = 0; i < aLen; i++) { codingState = mCodingSM->NextState(aBuf[i]); if (codingState == eItsMe) { mState = eFoundIt; break; } if (codingState == eStart) { PRUint32 charLen = mCodingSM->GetCurrentCharLen(); if (i == 0) { mLastChar[1] = aBuf[0]; mDistributionAnalyser.HandleOneChar(mLastChar, charLen); } else mDistributionAnalyser.HandleOneChar(aBuf+i-1, charLen); } } mLastChar[0] = aBuf[aLen-1]; if (mState == eDetecting) if (mDistributionAnalyser.GotEnoughData() && GetConfidence() >= SHORTCUT_THRESHOLD) mState = eFoundIt; // else // mDistributionAnalyser.HandleData(aBuf, aLen); return mState; } float nsEUCTWProber::GetConfidence(void) { float distribCf = mDistributionAnalyser.GetConfidence(); return (float)distribCf; } ================================================ FILE: third_party/uchardet/uchardet/src/nsEUCTWProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsEUCTWProber_h__ #define nsEUCTWProber_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" #include "CharDistribution.h" class nsEUCTWProber: public nsCharSetProber { public: nsEUCTWProber(PRBool aIsPreferredLanguage) :mIsPreferredLanguage(aIsPreferredLanguage) {mCodingSM = new nsCodingStateMachine(&EUCTWSMModel); Reset();} virtual ~nsEUCTWProber(void){delete mCodingSM;} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "EUC-TW";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); nsCodingStateMachine* mCodingSM; nsProbingState mState; //EUCTWContextAnalysis mContextAnalyser; EUCTWDistributionAnalysis mDistributionAnalyser; char mLastChar[2]; PRBool mIsPreferredLanguage; }; #endif /* nsEUCTWProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsEscCharsetProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsEscCharsetProber.h" #include "nsUniversalDetector.h" nsEscCharSetProber::nsEscCharSetProber(PRUint32 aLanguageFilter) { for (PRUint32 i = 0; i < NUM_OF_ESC_CHARSETS; i++) mCodingSM[i] = nsnull; if (aLanguageFilter & NS_FILTER_CHINESE_SIMPLIFIED) { mCodingSM[0] = new nsCodingStateMachine(&HZSMModel); mCodingSM[1] = new nsCodingStateMachine(&ISO2022CNSMModel); } if (aLanguageFilter & NS_FILTER_JAPANESE) mCodingSM[2] = new nsCodingStateMachine(&ISO2022JPSMModel); if (aLanguageFilter & NS_FILTER_KOREAN) mCodingSM[3] = new nsCodingStateMachine(&ISO2022KRSMModel); mActiveSM = NUM_OF_ESC_CHARSETS; mState = eDetecting; mDetectedCharset = nsnull; } nsEscCharSetProber::~nsEscCharSetProber(void) { for (PRUint32 i = 0; i < NUM_OF_ESC_CHARSETS; i++) delete mCodingSM[i]; } void nsEscCharSetProber::Reset(void) { mState = eDetecting; for (PRUint32 i = 0; i < NUM_OF_ESC_CHARSETS; i++) if (mCodingSM[i]) mCodingSM[i]->Reset(); mActiveSM = NUM_OF_ESC_CHARSETS; mDetectedCharset = nsnull; } nsProbingState nsEscCharSetProber::HandleData(const char* aBuf, PRUint32 aLen) { for (PRUint32 i = 0; i < aLen && mState == eDetecting; i++) { for (PRInt32 j = mActiveSM - 1; j >= 0; j--) { if (mCodingSM[j]) { nsSMState const codingState = mCodingSM[j]->NextState(aBuf[i]); if (codingState == eItsMe) { mState = eFoundIt; mDetectedCharset = mCodingSM[j]->GetCodingStateMachine(); return mState; } } } } return mState; } ================================================ FILE: third_party/uchardet/uchardet/src/nsEscCharsetProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsEscCharSetProber_h__ #define nsEscCharSetProber_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" #define NUM_OF_ESC_CHARSETS 4 class nsEscCharSetProber: public nsCharSetProber { public: nsEscCharSetProber(PRUint32 aLanguageFilter); virtual ~nsEscCharSetProber(void); nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return mDetectedCharset;} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void) { return NO_DOUBT; } void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); nsCodingStateMachine* mCodingSM[NUM_OF_ESC_CHARSETS] ; PRUint32 mActiveSM; nsProbingState mState; const char * mDetectedCharset; }; #endif /* nsEscCharSetProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsEscSM.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsCodingStateMachine.h" constexpr PRUint32 HZ_cls[ 256 / 8 ] = { PCK4BITS(1,0,0,0,0,0,0,0), // 00 - 07 PCK4BITS(0,0,0,0,0,0,0,0), // 08 - 0f PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 PCK4BITS(0,0,0,1,0,0,0,0), // 18 - 1f PCK4BITS(0,0,0,0,0,0,0,0), // 20 - 27 PCK4BITS(0,0,0,0,0,0,0,0), // 28 - 2f PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f PCK4BITS(0,0,0,0,0,0,0,0), // 40 - 47 PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 PCK4BITS(0,0,0,4,0,5,2,0), // 78 - 7f PCK4BITS(1,1,1,1,1,1,1,1), // 80 - 87 PCK4BITS(1,1,1,1,1,1,1,1), // 88 - 8f PCK4BITS(1,1,1,1,1,1,1,1), // 90 - 97 PCK4BITS(1,1,1,1,1,1,1,1), // 98 - 9f PCK4BITS(1,1,1,1,1,1,1,1), // a0 - a7 PCK4BITS(1,1,1,1,1,1,1,1), // a8 - af PCK4BITS(1,1,1,1,1,1,1,1), // b0 - b7 PCK4BITS(1,1,1,1,1,1,1,1), // b8 - bf PCK4BITS(1,1,1,1,1,1,1,1), // c0 - c7 PCK4BITS(1,1,1,1,1,1,1,1), // c8 - cf PCK4BITS(1,1,1,1,1,1,1,1), // d0 - d7 PCK4BITS(1,1,1,1,1,1,1,1), // d8 - df PCK4BITS(1,1,1,1,1,1,1,1), // e0 - e7 PCK4BITS(1,1,1,1,1,1,1,1), // e8 - ef PCK4BITS(1,1,1,1,1,1,1,1), // f0 - f7 PCK4BITS(1,1,1,1,1,1,1,1) // f8 - ff }; constexpr PRUint32 HZ_st [ 6] = { PCK4BITS(eStart,eError, 3,eStart,eStart,eStart,eError,eError),//00-07 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart, 4,eError),//10-17 PCK4BITS( 5,eError, 6,eError, 5, 5, 4,eError),//18-1f PCK4BITS( 4,eError, 4, 4, 4,eError, 4,eError),//20-27 PCK4BITS( 4,eItsMe,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f }; static const PRUint32 HZCharLenTable[] = {0, 0, 0, 0, 0, 0}; const SMModel HZSMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_cls }, 6, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_st }, HZCharLenTable, "HZ-GB-2312", }; constexpr PRUint32 ISO2022CN_cls [ 256 / 8 ] = { PCK4BITS(2,0,0,0,0,0,0,0), // 00 - 07 PCK4BITS(0,0,0,0,0,0,0,0), // 08 - 0f PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 PCK4BITS(0,0,0,1,0,0,0,0), // 18 - 1f PCK4BITS(0,0,0,0,0,0,0,0), // 20 - 27 PCK4BITS(0,3,0,0,0,0,0,0), // 28 - 2f PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f PCK4BITS(0,0,0,4,0,0,0,0), // 40 - 47 PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f PCK4BITS(2,2,2,2,2,2,2,2), // 80 - 87 PCK4BITS(2,2,2,2,2,2,2,2), // 88 - 8f PCK4BITS(2,2,2,2,2,2,2,2), // 90 - 97 PCK4BITS(2,2,2,2,2,2,2,2), // 98 - 9f PCK4BITS(2,2,2,2,2,2,2,2), // a0 - a7 PCK4BITS(2,2,2,2,2,2,2,2), // a8 - af PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 PCK4BITS(2,2,2,2,2,2,2,2), // c8 - cf PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df PCK4BITS(2,2,2,2,2,2,2,2), // e0 - e7 PCK4BITS(2,2,2,2,2,2,2,2), // e8 - ef PCK4BITS(2,2,2,2,2,2,2,2), // f0 - f7 PCK4BITS(2,2,2,2,2,2,2,2) // f8 - ff }; constexpr PRUint32 ISO2022CN_st [ 8] = { PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eStart,eStart),//00-07 PCK4BITS(eStart,eError,eError,eError,eError,eError,eError,eError),//08-0f PCK4BITS(eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe),//10-17 PCK4BITS(eItsMe,eItsMe,eItsMe,eError,eError,eError, 4,eError),//18-1f PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//20-27 PCK4BITS( 5, 6,eError,eError,eError,eError,eError,eError),//28-2f PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//30-37 PCK4BITS(eError,eError,eError,eError,eError,eItsMe,eError,eStart) //38-3f }; static const PRUint32 ISO2022CNCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; const SMModel ISO2022CNSMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_cls }, 9, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_st }, ISO2022CNCharLenTable, "ISO-2022-CN", }; constexpr PRUint32 ISO2022JP_cls [ 256 / 8 ] = { PCK4BITS(2,0,0,0,0,0,0,0), // 00 - 07 PCK4BITS(0,0,0,0,0,0,2,2), // 08 - 0f PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 PCK4BITS(0,0,0,1,0,0,0,0), // 18 - 1f PCK4BITS(0,0,0,0,7,0,0,0), // 20 - 27 PCK4BITS(3,0,0,0,0,0,0,0), // 28 - 2f PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f PCK4BITS(6,0,4,0,8,0,0,0), // 40 - 47 PCK4BITS(0,9,5,0,0,0,0,0), // 48 - 4f PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f PCK4BITS(2,2,2,2,2,2,2,2), // 80 - 87 PCK4BITS(2,2,2,2,2,2,2,2), // 88 - 8f PCK4BITS(2,2,2,2,2,2,2,2), // 90 - 97 PCK4BITS(2,2,2,2,2,2,2,2), // 98 - 9f PCK4BITS(2,2,2,2,2,2,2,2), // a0 - a7 PCK4BITS(2,2,2,2,2,2,2,2), // a8 - af PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 PCK4BITS(2,2,2,2,2,2,2,2), // c8 - cf PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df PCK4BITS(2,2,2,2,2,2,2,2), // e0 - e7 PCK4BITS(2,2,2,2,2,2,2,2), // e8 - ef PCK4BITS(2,2,2,2,2,2,2,2), // f0 - f7 PCK4BITS(2,2,2,2,2,2,2,2) // f8 - ff }; constexpr PRUint32 ISO2022JP_st [ 9] = { PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eStart,eStart),//00-07 PCK4BITS(eStart,eStart,eError,eError,eError,eError,eError,eError),//08-0f PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//10-17 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eError),//18-1f PCK4BITS(eError, 5,eError,eError,eError, 4,eError,eError),//20-27 PCK4BITS(eError,eError,eError, 6,eItsMe,eError,eItsMe,eError),//28-2f PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),//30-37 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//38-3f PCK4BITS(eError,eError,eError,eError,eItsMe,eError,eStart,eStart) //40-47 }; /* XXX: I needed to complete the 2 last classes for this CharLenTable * but I did it a bit randomly. Cf. bug 101030. * Let's check this piece of code again later when I understand it * better. */ constexpr PRUint32 ISO2022JPCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; const SMModel ISO2022JPSMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_cls }, 10, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_st }, ISO2022JPCharLenTable, "ISO-2022-JP", }; constexpr PRUint32 ISO2022KR_cls [ 256 / 8 ] = { PCK4BITS(2,0,0,0,0,0,0,0), // 00 - 07 PCK4BITS(0,0,0,0,0,0,0,0), // 08 - 0f PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 PCK4BITS(0,0,0,1,0,0,0,0), // 18 - 1f PCK4BITS(0,0,0,0,3,0,0,0), // 20 - 27 PCK4BITS(0,4,0,0,0,0,0,0), // 28 - 2f PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f PCK4BITS(0,0,0,5,0,0,0,0), // 40 - 47 PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f PCK4BITS(2,2,2,2,2,2,2,2), // 80 - 87 PCK4BITS(2,2,2,2,2,2,2,2), // 88 - 8f PCK4BITS(2,2,2,2,2,2,2,2), // 90 - 97 PCK4BITS(2,2,2,2,2,2,2,2), // 98 - 9f PCK4BITS(2,2,2,2,2,2,2,2), // a0 - a7 PCK4BITS(2,2,2,2,2,2,2,2), // a8 - af PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 PCK4BITS(2,2,2,2,2,2,2,2), // c8 - cf PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df PCK4BITS(2,2,2,2,2,2,2,2), // e0 - e7 PCK4BITS(2,2,2,2,2,2,2,2), // e8 - ef PCK4BITS(2,2,2,2,2,2,2,2), // f0 - f7 PCK4BITS(2,2,2,2,2,2,2,2) // f8 - ff }; constexpr PRUint32 ISO2022KR_st [ 5] = { PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eError,eError),//00-07 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f PCK4BITS(eItsMe,eItsMe,eError,eError,eError, 4,eError,eError),//10-17 PCK4BITS(eError,eError,eError,eError, 5,eError,eError,eError),//18-1f PCK4BITS(eError,eError,eError,eItsMe,eStart,eStart,eStart,eStart) //20-27 }; constexpr PRUint32 ISO2022KRCharLenTable[] = { 0, 0, 0, 0, 0, 0 }; const SMModel ISO2022KRSMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_cls }, 6, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_st }, ISO2022KRCharLenTable, "ISO-2022-KR", }; ================================================ FILE: third_party/uchardet/uchardet/src/nsGB18030Prober.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // for S-JIS encoding, obeserve characteristic: // 1, kana character (or hankaku?) often have hight frequency of appereance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language #include "nsGB18030Prober.h" void nsGB18030Prober::Reset(void) { mCodingSM->Reset(); mState = eDetecting; mDistributionAnalyser.Reset(mIsPreferredLanguage); //mContextAnalyser.Reset(); } nsProbingState nsGB18030Prober::HandleData(const char* aBuf, PRUint32 aLen) { nsSMState codingState; for (PRUint32 i = 0; i < aLen; i++) { codingState = mCodingSM->NextState(aBuf[i]); if (codingState == eItsMe) { mState = eFoundIt; break; } if (codingState == eStart) { PRUint32 charLen = mCodingSM->GetCurrentCharLen(); if (i == 0) { mLastChar[1] = aBuf[0]; mDistributionAnalyser.HandleOneChar(mLastChar, charLen); } else mDistributionAnalyser.HandleOneChar(aBuf+i-1, charLen); } } mLastChar[0] = aBuf[aLen-1]; if (mState == eDetecting) if (mDistributionAnalyser.GotEnoughData() && GetConfidence() >= SHORTCUT_THRESHOLD) mState = eFoundIt; // else // mDistributionAnalyser.HandleData(aBuf, aLen); return mState; } float nsGB18030Prober::GetConfidence(void) { return mDistributionAnalyser.GetConfidence(); } ================================================ FILE: third_party/uchardet/uchardet/src/nsGB18030Prober.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsGB18030Prober_h__ #define nsGB18030Prober_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" #include "CharDistribution.h" // NOT VALID: We use GB18030 to replace GB2312, because 18030 is a superset. // it superseded GB2312, but it is NOT a superset class nsGB18030Prober : public nsCharSetProber { public: nsGB18030Prober(PRBool aIsPreferredLanguage) :mIsPreferredLanguage(aIsPreferredLanguage) {mCodingSM = new nsCodingStateMachine(&GB18030SMModel); Reset();} virtual ~nsGB18030Prober(void){delete mCodingSM;} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "GB18030";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); nsCodingStateMachine* mCodingSM; nsProbingState mState; //GB18030ContextAnalysis mContextAnalyser; GB18030DistributionAnalysis mDistributionAnalyser; char mLastChar[2]; PRBool mIsPreferredLanguage; }; #endif /* nsGB18030Prober_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsGB2312Prober.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // for S-JIS encoding, obeserve characteristic: // 1, kana character (or hankaku?) often have hight frequency of appereance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language #include "nsGB2312Prober.h" void nsGB2312Prober::Reset(void) { mCodingSM->Reset(); mState = eDetecting; mDistributionAnalyser.Reset(mIsPreferredLanguage); //mContextAnalyser.Reset(); } nsProbingState nsGB2312Prober::HandleData(const char* aBuf, PRUint32 aLen) { nsSMState codingState; for (PRUint32 i = 0; i < aLen; i++) { codingState = mCodingSM->NextState(aBuf[i]); if (codingState == eItsMe) { mState = eFoundIt; break; } if (codingState == eStart) { PRUint32 charLen = mCodingSM->GetCurrentCharLen(); if (i == 0) { mLastChar[1] = aBuf[0]; mDistributionAnalyser.HandleOneChar(mLastChar, charLen); } else mDistributionAnalyser.HandleOneChar(aBuf+i-1, charLen); } } mLastChar[0] = aBuf[aLen-1]; if (mState == eDetecting) if (mDistributionAnalyser.GotEnoughData() && GetConfidence() >= SHORTCUT_THRESHOLD) mState = eFoundIt; // else // mDistributionAnalyser.HandleData(aBuf, aLen); return mState; } float nsGB2312Prober::GetConfidence(void) { float distribCf = mDistributionAnalyser.GetConfidence(); return (float)distribCf; } ================================================ FILE: third_party/uchardet/uchardet/src/nsGB2312Prober.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsGB2312Prober_h__ #define nsGB2312Prober_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" #include "CharDistribution.h" // NOT VALID: We use GB18030 to replace GB2312, because 18030 is a superset. // it superseded GB2312, but it is NOT a superset class nsGB2312Prober : public nsCharSetProber { public: nsGB2312Prober(PRBool aIsPreferredLanguage) :mIsPreferredLanguage(aIsPreferredLanguage) {mCodingSM = new nsCodingStateMachine(&GB2312SMModel); Reset();} virtual ~nsGB2312Prober(void){delete mCodingSM;} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "GB2312";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} protected: void GetDistribution(PRUint32 aCharLen, const char* aStr); nsCodingStateMachine* mCodingSM; nsProbingState mState; //GB2312ContextAnalysis mContextAnalyser; GB2312DistributionAnalysis mDistributionAnalyser; char mLastChar[2]; PRBool mIsPreferredLanguage; }; #endif /* nsGB2312Prober_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsHebrewProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Shy Shalom * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsHebrewProber.h" #include // Windows-1255 / ISO-8859-8 code points of interest #define FINAL_KAF ('\xea') #define NORMAL_KAF ('\xeb') #define FINAL_MEM ('\xed') #define NORMAL_MEM ('\xee') #define FINAL_NUN ('\xef') #define NORMAL_NUN ('\xf0') #define FINAL_PE ('\xf3') #define NORMAL_PE ('\xf4') #define FINAL_TSADI ('\xf5') #define NORMAL_TSADI ('\xf6') // Minimum Visual vs Logical final letter score difference. // If the difference is below this, don't rely solely on the final letter score distance. #define MIN_FINAL_CHAR_DISTANCE (5) // Minimum Visual vs Logical model score difference. // If the difference is below this, don't rely at all on the model score distance. #define MIN_MODEL_DISTANCE (0.01f) #define VISUAL_HEBREW_NAME ("ISO-8859-8") #define LOGICAL_HEBREW_NAME ("WINDOWS-1255") PRBool nsHebrewProber::isFinal(char c) { return ((c == FINAL_KAF) || (c == FINAL_MEM) || (c == FINAL_NUN) || (c == FINAL_PE) || (c == FINAL_TSADI)); } PRBool nsHebrewProber::isNonFinal(char c) { return ((c == NORMAL_KAF) || (c == NORMAL_MEM) || (c == NORMAL_NUN) || (c == NORMAL_PE)); // The normal Tsadi is not a good Non-Final letter due to words like // 'lechotet' (to chat) containing an apostrophe after the tsadi. This // apostrophe is converted to a space in FilterWithoutEnglishLetters causing // the Non-Final tsadi to appear at an end of a word even though this is not // the case in the original text. // The letters Pe and Kaf rarely display a related behavior of not being a // good Non-Final letter. Words like 'Pop', 'Winamp' and 'Mubarak' for // example legally end with a Non-Final Pe or Kaf. However, the benefit of // these letters as Non-Final letters outweighs the damage since these words // are quite rare. } /** HandleData * Final letter analysis for logical-visual decision. * Look for evidence that the received buffer is either logical Hebrew or * visual Hebrew. * The following cases are checked: * 1) A word longer than 1 letter, ending with a final letter. This is an * indication that the text is laid out "naturally" since the final letter * really appears at the end. +1 for logical score. * 2) A word longer than 1 letter, ending with a Non-Final letter. In normal * Hebrew, words ending with Kaf, Mem, Nun, Pe or Tsadi, should not end with * the Non-Final form of that letter. Exceptions to this rule are mentioned * above in isNonFinal(). This is an indication that the text is laid out * backwards. +1 for visual score * 3) A word longer than 1 letter, starting with a final letter. Final letters * should not appear at the beginning of a word. This is an indication that * the text is laid out backwards. +1 for visual score. * * The visual score and logical score are accumulated throughout the text and * are finally checked against each other in GetCharSetName(). * No checking for final letters in the middle of words is done since that case * is not an indication for either Logical or Visual text. * * The input buffer should not contain any white spaces that are not (' ') * or any low-ascii punctuation marks. */ nsProbingState nsHebrewProber::HandleData(const char* aBuf, PRUint32 aLen) { // Both model probers say it's not them. No reason to continue. if (GetState() == eNotMe) return eNotMe; const char *curPtr, *endPtr = aBuf+aLen; char cur; for (curPtr = (char*)aBuf; curPtr < endPtr; ++curPtr) { cur = *curPtr; if (cur == ' ') // We stand on a space - a word just ended { if (mBeforePrev != ' ') // *(curPtr-2) was not a space so prev is not a 1 letter word { if (isFinal(mPrev)) // case (1) [-2:not space][-1:final letter][cur:space] ++mFinalCharLogicalScore; else if (isNonFinal(mPrev)) // case (2) [-2:not space][-1:Non-Final letter][cur:space] ++mFinalCharVisualScore; } } else // Not standing on a space { if ((mBeforePrev == ' ') && (isFinal(mPrev)) && (cur != ' ')) // case (3) [-2:space][-1:final letter][cur:not space] ++mFinalCharVisualScore; } mBeforePrev = mPrev; mPrev = cur; } // Forever detecting, till the end or until both model probers return eNotMe (handled above). return eDetecting; } // Make the decision: is it Logical or Visual? const char* nsHebrewProber::GetCharSetName() { // If the final letter score distance is dominant enough, rely on it. PRInt32 finalsub = mFinalCharLogicalScore - mFinalCharVisualScore; if (finalsub >= MIN_FINAL_CHAR_DISTANCE) return LOGICAL_HEBREW_NAME; if (finalsub <= -(MIN_FINAL_CHAR_DISTANCE)) return VISUAL_HEBREW_NAME; // It's not dominant enough, try to rely on the model scores instead. float modelsub = mLogicalProb->GetConfidence() - mVisualProb->GetConfidence(); if (modelsub > MIN_MODEL_DISTANCE) return LOGICAL_HEBREW_NAME; if (modelsub < -(MIN_MODEL_DISTANCE)) return VISUAL_HEBREW_NAME; // Still no good, back to final letter distance, maybe it'll save the day. if (finalsub < 0) return VISUAL_HEBREW_NAME; // (finalsub > 0 - Logical) or (don't know what to do) default to Logical. return LOGICAL_HEBREW_NAME; } void nsHebrewProber::Reset(void) { mFinalCharLogicalScore = 0; mFinalCharVisualScore = 0; // mPrev and mBeforePrev are initialized to space in order to simulate a word // delimiter at the beginning of the data mPrev = ' '; mBeforePrev = ' '; } nsProbingState nsHebrewProber::GetState(void) { // Remain active as long as any of the model probers are active. if ((mLogicalProb->GetState() == eNotMe) && (mVisualProb->GetState() == eNotMe)) return eNotMe; return eDetecting; } #ifdef DEBUG_chardet void nsHebrewProber::DumpStatus() { printf(" HEB: %d - %d [Logical-Visual score]\r\n", mFinalCharLogicalScore, mFinalCharVisualScore); } #endif ================================================ FILE: third_party/uchardet/uchardet/src/nsHebrewProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Shy Shalom * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer: All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsHebrewProber_h__ #define nsHebrewProber_h__ #include "nsSBCharSetProber.h" // This prober doesn't actually recognize a language or a charset. // It is a helper prober for the use of the Hebrew model probers class nsHebrewProber: public nsCharSetProber { public: nsHebrewProber(void) :mLogicalProb(0), mVisualProb(0) { Reset(); } virtual ~nsHebrewProber(void) {} virtual nsProbingState HandleData(const char* aBuf, PRUint32 aLen); virtual const char* GetCharSetName(); virtual void Reset(void); virtual nsProbingState GetState(void); virtual float GetConfidence(void) { return (float)0.0; } virtual void SetOpion() {} void SetModelProbers(nsCharSetProber *logicalPrb, nsCharSetProber *visualPrb) { mLogicalProb = logicalPrb; mVisualProb = visualPrb; } #ifdef DEBUG_chardet virtual void DumpStatus(); #endif protected: static PRBool isFinal(char c); static PRBool isNonFinal(char c); PRInt32 mFinalCharLogicalScore, mFinalCharVisualScore; // The two last characters seen in the previous buffer. char mPrev, mBeforePrev; // These probers are owned by the group prober. nsCharSetProber *mLogicalProb, *mVisualProb; }; /** * ** General ideas of the Hebrew charset recognition ** * * Four main charsets exist in Hebrew: * "ISO-8859-8" - Visual Hebrew * "Windows-1255" - Logical Hebrew * "ISO-8859-8-I" - Logical Hebrew * "x-mac-hebrew" - ?? Logical Hebrew ?? * * Both "ISO" charsets use a completely identical set of code points, whereas * "Windows-1255" and "x-mac-hebrew" are two different proper supersets of * these code points. Windows-1255 defines additional characters in the range * 0x80-0x9F as some misc punctuation marks as well as some Hebrew-specific * diacritics and additional 'Yiddish' ligature letters in the range 0xc0-0xd6. * x-mac-hebrew defines similar additional code points but with a different * mapping. * * As far as an average Hebrew text with no diacritics is concerned, all four * charsets are identical with respect to code points. Meaning that for the * main Hebrew alphabet, all four map the same values to all 27 Hebrew letters * (including final letters). * * The dominant difference between these charsets is their directionality. * "Visual" directionality means that the text is ordered as if the renderer is * not aware of a BIDI rendering algorithm. The renderer sees the text and * draws it from left to right. The text itself when ordered naturally is read * backwards. A buffer of Visual Hebrew generally looks like so: * "[last word of first line spelled backwards] [whole line ordered backwards * and spelled backwards] [first word of first line spelled backwards] * [end of line] [last word of second line] ... etc' " * adding punctuation marks, numbers and English text to visual text is * naturally also "visual" and from left to right. * * "Logical" directionality means the text is ordered "naturally" according to * the order it is read. It is the responsibility of the renderer to display * the text from right to left. A BIDI algorithm is used to place general * punctuation marks, numbers and English text in the text. * * Texts in x-mac-hebrew are almost impossible to find on the Internet. From * what little evidence I could find, it seems that its general directionality * is Logical. * * To sum up all of the above, the Hebrew probing mechanism knows about two * charsets: * Visual Hebrew - "ISO-8859-8" - backwards text - Words and sentences are * backwards while line order is natural. For charset recognition purposes * the line order is unimportant (In fact, for this implementation, even * word order is unimportant). * Logical Hebrew - "Windows-1255" - normal, naturally ordered text. * * "ISO-8859-8-I" is a subset of Windows-1255 and doesn't need to be * specifically identified. * "x-mac-hebrew" is also identified as Windows-1255. A text in x-mac-hebrew * that contain special punctuation marks or diacritics is displayed with * some unconverted characters showing as question marks. This problem might * be corrected using another model prober for x-mac-hebrew. Due to the fact * that x-mac-hebrew texts are so rare, writing another model prober isn't * worth the effort and performance hit. * * *** The Prober *** * * The prober is divided between two nsSBCharSetProbers and an nsHebrewProber, * all of which are managed, created, fed data, inquired and deleted by the * nsSBCSGroupProber. The two nsSBCharSetProbers identify that the text is in * fact some kind of Hebrew, Logical or Visual. The final decision about which * one is it is made by the nsHebrewProber by combining final-letter scores * with the scores of the two nsSBCharSetProbers to produce a final answer. * * The nsSBCSGroupProber is responsible for stripping the original text of HTML * tags, English characters, numbers, low-ASCII punctuation characters, spaces * and new lines. It reduces any sequence of such characters to a single space. * The buffer fed to each prober in the SBCS group prober is pure text in * high-ASCII. * The two nsSBCharSetProbers (model probers) share the same language model: * Win1255Model. * The first nsSBCharSetProber uses the model normally as any other * nsSBCharSetProber does, to recognize Windows-1255, upon which this model was * built. The second nsSBCharSetProber is told to make the pair-of-letter * lookup in the language model backwards. This in practice exactly simulates * a visual Hebrew model using the Windows-1255 logical Hebrew model. * * The nsHebrewProber is not using any language model. All it does is look for * final-letter evidence suggesting the text is either logical Hebrew or visual * Hebrew. Disjointed from the model probers, the results of the nsHebrewProber * alone are meaningless. nsHebrewProber always returns 0.00 as confidence * since it never identifies a charset by itself. Instead, the pointer to the * nsHebrewProber is passed to the model probers as a helper "Name Prober". * When the Group prober receives a positive identification from any prober, * it asks for the name of the charset identified. If the prober queried is a * Hebrew model prober, the model prober forwards the call to the * nsHebrewProber to make the final decision. In the nsHebrewProber, the * decision is made according to the final-letters scores maintained and Both * model probers scores. The answer is returned in the form of the name of the * charset identified, either "Windows-1255" or "ISO-8859-8". * */ #endif /* nsHebrewProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsLatin1Prober.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsLatin1Prober.h" #include "prmem.h" #include #define UDF 0 // undefined #define OTH 1 //other #define ASC 2 // ascii capital letter #define ASS 3 // ascii small letter #define ACV 4 // accent capital vowel #define ACO 5 // accent capital other #define ASV 6 // accent small vowel #define ASO 7 // accent small other #define CLASS_NUM 8 // total classes constexpr unsigned char Latin1_CharToClass[] = { OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 00 - 07 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 08 - 0F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 10 - 17 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 18 - 1F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 20 - 27 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 28 - 2F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 30 - 37 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 38 - 3F OTH, ASC, ASC, ASC, ASC, ASC, ASC, ASC, // 40 - 47 ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, // 48 - 4F ASC, ASC, ASC, ASC, ASC, ASC, ASC, ASC, // 50 - 57 ASC, ASC, ASC, OTH, OTH, OTH, OTH, OTH, // 58 - 5F OTH, ASS, ASS, ASS, ASS, ASS, ASS, ASS, // 60 - 67 ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, // 68 - 6F ASS, ASS, ASS, ASS, ASS, ASS, ASS, ASS, // 70 - 77 ASS, ASS, ASS, OTH, OTH, OTH, OTH, OTH, // 78 - 7F OTH, UDF, OTH, ASO, OTH, OTH, OTH, OTH, // 80 - 87 OTH, OTH, ACO, OTH, ACO, UDF, ACO, UDF, // 88 - 8F UDF, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // 90 - 97 OTH, OTH, ASO, OTH, ASO, UDF, ASO, ACO, // 98 - 9F OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // A0 - A7 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // A8 - AF OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // B0 - B7 OTH, OTH, OTH, OTH, OTH, OTH, OTH, OTH, // B8 - BF ACV, ACV, ACV, ACV, ACV, ACV, ACO, ACO, // C0 - C7 ACV, ACV, ACV, ACV, ACV, ACV, ACV, ACV, // C8 - CF ACO, ACO, ACV, ACV, ACV, ACV, ACV, OTH, // D0 - D7 ACV, ACV, ACV, ACV, ACV, ACO, ACO, ACO, // D8 - DF ASV, ASV, ASV, ASV, ASV, ASV, ASO, ASO, // E0 - E7 ASV, ASV, ASV, ASV, ASV, ASV, ASV, ASV, // E8 - EF ASO, ASO, ASV, ASV, ASV, ASV, ASV, OTH, // F0 - F7 ASV, ASV, ASV, ASV, ASV, ASO, ASO, ASO, // F8 - FF }; /* 0 : illegal 1 : very unlikely 2 : normal 3 : very likely */ constexpr unsigned char Latin1ClassModel[] = { /* UDF OTH ASC ASS ACV ACO ASV ASO */ /*UDF*/ 0, 0, 0, 0, 0, 0, 0, 0, /*OTH*/ 0, 3, 3, 3, 3, 3, 3, 3, /*ASC*/ 0, 3, 3, 3, 3, 3, 3, 3, /*ASS*/ 0, 3, 3, 3, 1, 1, 3, 3, /*ACV*/ 0, 3, 3, 3, 1, 2, 1, 2, /*ACO*/ 0, 3, 3, 3, 3, 3, 3, 3, /*ASV*/ 0, 3, 1, 3, 1, 1, 1, 3, /*ASO*/ 0, 3, 1, 3, 1, 1, 3, 3, }; void nsLatin1Prober::Reset(void) { mState = eDetecting; mLastCharClass = OTH; for (int i = 0; i < FREQ_CAT_NUM; i++) mFreqCounter[i] = 0; } nsProbingState nsLatin1Prober::HandleData(const char* aBuf, PRUint32 aLen) { char *newBuf1 = 0; PRUint32 newLen1 = 0; if (!FilterWithEnglishLetters(aBuf, aLen, &newBuf1, newLen1)) { newBuf1 = (char*)aBuf; newLen1 = aLen; } unsigned char charClass; unsigned char freq; for (PRUint32 i = 0; i < newLen1; i++) { charClass = Latin1_CharToClass[(unsigned char)newBuf1[i]]; freq = Latin1ClassModel[mLastCharClass*CLASS_NUM + charClass]; if (freq == 0) { mState = eNotMe; break; } mFreqCounter[freq]++; mLastCharClass = charClass; } if (newBuf1 != aBuf) PR_FREEIF(newBuf1); return mState; } float nsLatin1Prober::GetConfidence(void) { if (mState == eNotMe) return SURE_NO; PRUint32 total = 0; for (PRInt32 i = 0; i < FREQ_CAT_NUM; i++) { total += mFreqCounter[i]; } float confidence = 0.0f; if (total) { confidence = (float)mFreqCounter[3] / (float)total; confidence -= (float)mFreqCounter[1] * 20.0f / (float)total; } if (confidence < 0.0f) { confidence = 0.0f; } // lower the confidence of latin1 so that other more accurate detector // can take priority. confidence *= 0.50f; return confidence; } #ifdef DEBUG_chardet void nsLatin1Prober::DumpStatus() { printf(" Latin1Prober: %1.3f [%s]\r\n", GetConfidence(), GetCharSetName()); } #endif ================================================ FILE: third_party/uchardet/uchardet/src/nsLatin1Prober.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: et sw=2 ts=2 fdm=marker */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsLatin1Prober_h__ #define nsLatin1Prober_h__ #include "nsCharSetProber.h" #define FREQ_CAT_NUM 4 class nsLatin1Prober: public nsCharSetProber { public: nsLatin1Prober(void){Reset();} virtual ~nsLatin1Prober(void){} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "Windows-1252";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} #ifdef DEBUG_chardet virtual void DumpStatus(); #endif protected: nsProbingState mState; char mLastCharClass; PRUint32 mFreqCounter[FREQ_CAT_NUM]; }; #endif /* nsLatin1Prober_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsMBCSGroupProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * Proofpoint, Inc. * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include #include "nsMBCSGroupProber.h" #include "nsUniversalDetector.h" #if defined(DEBUG_chardet) || defined(DEBUG_jgmyers) const char *ProberName[] = { "UTF-8", "SJIS", "EUC-JP", //"GB2312", "GB18030", "EUC-KR", "BIG5", "EUC-TW", }; #endif nsMBCSGroupProber::nsMBCSGroupProber(PRUint32 aLanguageFilter) : mNumOfProbers(MAX_NUM_OF_MBCS_PROBERS), mBestGuess(-1), mActiveNum(0) { PRUint32 i = 0; mProbers[i++] = new nsUTF8Prober(); if (aLanguageFilter & NS_FILTER_JAPANESE) { mProbers[i++] = new nsSJISProber(aLanguageFilter == NS_FILTER_JAPANESE); mProbers[i++] = new nsEUCJPProber(aLanguageFilter == NS_FILTER_JAPANESE); } if (aLanguageFilter & NS_FILTER_CHINESE_SIMPLIFIED) { //mProbers[i++] = new nsGB2312Prober(aLanguageFilter == NS_FILTER_CHINESE_SIMPLIFIED); mProbers[i++] = new nsGB18030Prober(aLanguageFilter == NS_FILTER_CHINESE_SIMPLIFIED); } if (aLanguageFilter & NS_FILTER_KOREAN) { mProbers[i++] = new nsEUCKRProber(aLanguageFilter == NS_FILTER_KOREAN); } if (aLanguageFilter & NS_FILTER_CHINESE_TRADITIONAL) { mProbers[i++] = new nsBig5Prober(aLanguageFilter == NS_FILTER_CHINESE_TRADITIONAL); mProbers[i++] = new nsEUCTWProber(aLanguageFilter == NS_FILTER_CHINESE_TRADITIONAL); } mNumOfProbers = i; for (; i < MAX_NUM_OF_MBCS_PROBERS; ++i) { mProbers[i] = nsnull; } Reset(); } nsMBCSGroupProber::~nsMBCSGroupProber() { for (PRUint32 i = 0; i < MAX_NUM_OF_MBCS_PROBERS; ++i) { if (mProbers[i]) { delete mProbers[i]; } } } const char* nsMBCSGroupProber::GetCharSetName() { if (mBestGuess == -1) { GetConfidence(); if (mBestGuess == -1) { mBestGuess = 0; } } return mProbers[mBestGuess]->GetCharSetName(); } void nsMBCSGroupProber::Reset(void) { mActiveNum = 0; for (PRUint32 i = 0; i < MAX_NUM_OF_MBCS_PROBERS; i++) { if (mProbers[i]) { mProbers[i]->Reset(); mIsActive[i] = PR_TRUE; ++mActiveNum; } else mIsActive[i] = PR_FALSE; } mBestGuess = -1; mState = eDetecting; mKeepNext = 0; } nsProbingState nsMBCSGroupProber::HandleData(const char* aBuf, PRUint32 aLen) { nsProbingState st; PRUint32 start = 0; PRUint32 keepNext = mKeepNext; //do filtering to reduce load to probers for (PRUint32 pos = 0; pos < aLen; ++pos) { if (aBuf[pos] & 0x80) { if (!keepNext) start = pos; keepNext = 2; } else if (keepNext) { if (--keepNext == 0) { for (PRUint32 i = 0; i < mNumOfProbers; i++) { if (!mIsActive[i]) continue; st = mProbers[i]->HandleData(aBuf + start, pos + 1 - start); if (st == eFoundIt) { mBestGuess = i; mState = eFoundIt; return mState; } } } } } if (keepNext) { for (PRUint32 i = 0; i < mNumOfProbers; i++) { if (!mIsActive[i]) continue; //@@@st = mProbers[i]->HandleData(aBuf + start, aLen + 1 - start); st = mProbers[i]->HandleData(aBuf + start, aLen - start); if (st == eFoundIt) { mBestGuess = i; mState = eFoundIt; return mState; } } } mKeepNext = keepNext; return mState; } float nsMBCSGroupProber::GetConfidence() { float bestConf = 0.0f; switch (mState) { case eFoundIt: return SURE_YES; case eNotMe: return SURE_NO; default: for (PRUint32 i = 0; i < mNumOfProbers; i++) { if (!mIsActive[i]) continue; float const cf = mProbers[i]->GetConfidence(); if (bestConf < cf) { bestConf = cf; mBestGuess = i; } } } return bestConf; } #ifdef DEBUG_chardet void nsMBCSGroupProber::DumpStatus() { GetConfidence(); for (PRUint32 i = 0; i < mNumOfProbers; i++) { if (!mIsActive[i]) printf(" MBCS inactive: [%s] (confidence is too low).\r\n", ProberName[i]); else { float const cf = mProbers[i]->GetConfidence(); printf(" MBCS %1.3f: [%s]\r\n", cf, ProberName[i]); } } } #endif #ifdef DEBUG_jgmyers void nsMBCSGroupProber::GetDetectorState(nsUniversalDetector::DetectorState (&states)[nsUniversalDetector::NumDetectors], PRUint32 &offset) { for (PRUint32 i = 0; i < mNumOfProbers; ++i) { states[offset].name = ProberName[i]; states[offset].isActive = mIsActive[i]; states[offset].confidence = mIsActive[i] ? mProbers[i]->GetConfidence() : 0.0; ++offset; } } #endif /* DEBUG_jgmyers */ ================================================ FILE: third_party/uchardet/uchardet/src/nsMBCSGroupProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Proofpoint, Inc. * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsMBCSGroupProber_h__ #define nsMBCSGroupProber_h__ #include "nsSJISProber.h" #include "nsUTF8Prober.h" #include "nsEUCJPProber.h" //#include "nsGB2312Prober.h" #include "nsGB18030Prober.h" #include "nsEUCKRProber.h" #include "nsBig5Prober.h" #include "nsEUCTWProber.h" #define MAX_NUM_OF_MBCS_PROBERS 10 class nsMBCSGroupProber: public nsCharSetProber { public: nsMBCSGroupProber(); nsMBCSGroupProber(PRUint32 aLanguageFilter); virtual ~nsMBCSGroupProber(); nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName(); nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} #ifdef DEBUG_chardet void DumpStatus(); #endif #ifdef DEBUG_jgmyers void GetDetectorState(nsUniversalDetector::DetectorState (&states)[nsUniversalDetector::NumDetectors], PRUint32 &offset); #endif protected: nsProbingState mState; nsCharSetProber* mProbers[MAX_NUM_OF_MBCS_PROBERS]; PRBool mIsActive[MAX_NUM_OF_MBCS_PROBERS]; PRUint32 mNumOfProbers; PRInt32 mBestGuess; PRUint32 mActiveNum; PRUint32 mKeepNext; }; #endif /* nsMBCSGroupProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsMBCSSM.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsCodingStateMachine.h" /* Modification from frank tang's original work: . 0x00 is allowed as a legal character. Since some web pages contains this char in text stream. */ // BIG5 constexpr PRUint32 BIG5_cls [ 256 / 8 ] = { //PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07 PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07 //allow 0x00 as legal value PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f PCK4BITS(1,1,1,1,1,1,1,1), // 10 - 17 PCK4BITS(1,1,1,0,1,1,1,1), // 18 - 1f PCK4BITS(1,1,1,1,1,1,1,1), // 20 - 27 PCK4BITS(1,1,1,1,1,1,1,1), // 28 - 2f PCK4BITS(1,1,1,1,1,1,1,1), // 30 - 37 PCK4BITS(1,1,1,1,1,1,1,1), // 38 - 3f PCK4BITS(2,2,2,2,2,2,2,2), // 40 - 47 PCK4BITS(2,2,2,2,2,2,2,2), // 48 - 4f PCK4BITS(2,2,2,2,2,2,2,2), // 50 - 57 PCK4BITS(2,2,2,2,2,2,2,2), // 58 - 5f PCK4BITS(2,2,2,2,2,2,2,2), // 60 - 67 PCK4BITS(2,2,2,2,2,2,2,2), // 68 - 6f PCK4BITS(2,2,2,2,2,2,2,2), // 70 - 77 PCK4BITS(2,2,2,2,2,2,2,1), // 78 - 7f PCK4BITS(4,4,4,4,4,4,4,4), // 80 - 87 PCK4BITS(4,4,4,4,4,4,4,4), // 88 - 8f PCK4BITS(4,4,4,4,4,4,4,4), // 90 - 97 PCK4BITS(4,4,4,4,4,4,4,4), // 98 - 9f PCK4BITS(4,3,3,3,3,3,3,3), // a0 - a7 PCK4BITS(3,3,3,3,3,3,3,3), // a8 - af PCK4BITS(3,3,3,3,3,3,3,3), // b0 - b7 PCK4BITS(3,3,3,3,3,3,3,3), // b8 - bf PCK4BITS(3,3,3,3,3,3,3,3), // c0 - c7 PCK4BITS(3,3,3,3,3,3,3,3), // c8 - cf PCK4BITS(3,3,3,3,3,3,3,3), // d0 - d7 PCK4BITS(3,3,3,3,3,3,3,3), // d8 - df PCK4BITS(3,3,3,3,3,3,3,3), // e0 - e7 PCK4BITS(3,3,3,3,3,3,3,3), // e8 - ef PCK4BITS(3,3,3,3,3,3,3,3), // f0 - f7 PCK4BITS(3,3,3,3,3,3,3,0) // f8 - ff }; constexpr PRUint32 BIG5_st [ 3] = { PCK4BITS(eError,eStart,eStart, 3,eError,eError,eError,eError),//00-07 PCK4BITS(eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError),//08-0f PCK4BITS(eError,eStart,eStart,eStart,eStart,eStart,eStart,eStart) //10-17 }; constexpr PRUint32 Big5CharLenTable[] = { 0, 1, 1, 2, 0 }; SMModel const Big5SMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_cls }, 5, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_st }, Big5CharLenTable, "BIG5", }; constexpr PRUint32 EUCJP_cls [ 256 / 8 ] = { //PCK4BITS(5,4,4,4,4,4,4,4), // 00 - 07 PCK4BITS(4,4,4,4,4,4,4,4), // 00 - 07 PCK4BITS(4,4,4,4,4,4,5,5), // 08 - 0f PCK4BITS(4,4,4,4,4,4,4,4), // 10 - 17 PCK4BITS(4,4,4,5,4,4,4,4), // 18 - 1f PCK4BITS(4,4,4,4,4,4,4,4), // 20 - 27 PCK4BITS(4,4,4,4,4,4,4,4), // 28 - 2f PCK4BITS(4,4,4,4,4,4,4,4), // 30 - 37 PCK4BITS(4,4,4,4,4,4,4,4), // 38 - 3f PCK4BITS(4,4,4,4,4,4,4,4), // 40 - 47 PCK4BITS(4,4,4,4,4,4,4,4), // 48 - 4f PCK4BITS(4,4,4,4,4,4,4,4), // 50 - 57 PCK4BITS(4,4,4,4,4,4,4,4), // 58 - 5f PCK4BITS(4,4,4,4,4,4,4,4), // 60 - 67 PCK4BITS(4,4,4,4,4,4,4,4), // 68 - 6f PCK4BITS(4,4,4,4,4,4,4,4), // 70 - 77 PCK4BITS(4,4,4,4,4,4,4,4), // 78 - 7f PCK4BITS(5,5,5,5,5,5,5,5), // 80 - 87 PCK4BITS(5,5,5,5,5,5,1,3), // 88 - 8f PCK4BITS(5,5,5,5,5,5,5,5), // 90 - 97 PCK4BITS(5,5,5,5,5,5,5,5), // 98 - 9f PCK4BITS(5,2,2,2,2,2,2,2), // a0 - a7 PCK4BITS(2,2,2,2,2,2,2,2), // a8 - af PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 PCK4BITS(2,2,2,2,2,2,2,2), // c8 - cf PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df PCK4BITS(0,0,0,0,0,0,0,0), // e0 - e7 PCK4BITS(0,0,0,0,0,0,0,0), // e8 - ef PCK4BITS(0,0,0,0,0,0,0,0), // f0 - f7 PCK4BITS(0,0,0,0,0,0,0,5) // f8 - ff }; constexpr PRUint32 EUCJP_st [ 5] = { PCK4BITS( 3, 4, 3, 5,eStart,eError,eError,eError),//00-07 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f PCK4BITS(eItsMe,eItsMe,eStart,eError,eStart,eError,eError,eError),//10-17 PCK4BITS(eError,eError,eStart,eError,eError,eError, 3,eError),//18-1f PCK4BITS( 3,eError,eError,eError,eStart,eStart,eStart,eStart) //20-27 }; constexpr PRUint32 EUCJPCharLenTable[] = { 2, 2, 2, 3, 1, 0 }; const SMModel EUCJPSMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCJP_cls }, 6, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCJP_st }, EUCJPCharLenTable, "EUC-JP", }; constexpr PRUint32 EUCKR_cls [ 256 / 8 ] = { //PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07 PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07 PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f PCK4BITS(1,1,1,1,1,1,1,1), // 10 - 17 PCK4BITS(1,1,1,0,1,1,1,1), // 18 - 1f PCK4BITS(1,1,1,1,1,1,1,1), // 20 - 27 PCK4BITS(1,1,1,1,1,1,1,1), // 28 - 2f PCK4BITS(1,1,1,1,1,1,1,1), // 30 - 37 PCK4BITS(1,1,1,1,1,1,1,1), // 38 - 3f PCK4BITS(1,1,1,1,1,1,1,1), // 40 - 47 PCK4BITS(1,1,1,1,1,1,1,1), // 48 - 4f PCK4BITS(1,1,1,1,1,1,1,1), // 50 - 57 PCK4BITS(1,1,1,1,1,1,1,1), // 58 - 5f PCK4BITS(1,1,1,1,1,1,1,1), // 60 - 67 PCK4BITS(1,1,1,1,1,1,1,1), // 68 - 6f PCK4BITS(1,1,1,1,1,1,1,1), // 70 - 77 PCK4BITS(1,1,1,1,1,1,1,1), // 78 - 7f PCK4BITS(0,0,0,0,0,0,0,0), // 80 - 87 PCK4BITS(0,0,0,0,0,0,0,0), // 88 - 8f PCK4BITS(0,0,0,0,0,0,0,0), // 90 - 97 PCK4BITS(0,0,0,0,0,0,0,0), // 98 - 9f PCK4BITS(0,2,2,2,2,2,2,2), // a0 - a7 PCK4BITS(2,2,2,2,2,3,3,3), // a8 - af PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 PCK4BITS(2,3,2,2,2,2,2,2), // c8 - cf PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df PCK4BITS(2,2,2,2,2,2,2,2), // e0 - e7 PCK4BITS(2,2,2,2,2,2,2,2), // e8 - ef PCK4BITS(2,2,2,2,2,2,2,2), // f0 - f7 PCK4BITS(2,2,2,2,2,2,2,0) // f8 - ff }; constexpr PRUint32 EUCKR_st [ 2] = { PCK4BITS(eError,eStart, 3,eError,eError,eError,eError,eError),//00-07 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart,eStart) //08-0f }; constexpr PRUint32 EUCKRCharLenTable[] = { 0, 1, 2, 0 }; const SMModel EUCKRSMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCKR_cls }, 4, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCKR_st }, EUCKRCharLenTable, "EUC-KR", }; constexpr PRUint32 EUCTW_cls [ 256 / 8 ] = { //PCK4BITS(0,2,2,2,2,2,2,2), // 00 - 07 PCK4BITS(2,2,2,2,2,2,2,2), // 00 - 07 PCK4BITS(2,2,2,2,2,2,0,0), // 08 - 0f PCK4BITS(2,2,2,2,2,2,2,2), // 10 - 17 PCK4BITS(2,2,2,0,2,2,2,2), // 18 - 1f PCK4BITS(2,2,2,2,2,2,2,2), // 20 - 27 PCK4BITS(2,2,2,2,2,2,2,2), // 28 - 2f PCK4BITS(2,2,2,2,2,2,2,2), // 30 - 37 PCK4BITS(2,2,2,2,2,2,2,2), // 38 - 3f PCK4BITS(2,2,2,2,2,2,2,2), // 40 - 47 PCK4BITS(2,2,2,2,2,2,2,2), // 48 - 4f PCK4BITS(2,2,2,2,2,2,2,2), // 50 - 57 PCK4BITS(2,2,2,2,2,2,2,2), // 58 - 5f PCK4BITS(2,2,2,2,2,2,2,2), // 60 - 67 PCK4BITS(2,2,2,2,2,2,2,2), // 68 - 6f PCK4BITS(2,2,2,2,2,2,2,2), // 70 - 77 PCK4BITS(2,2,2,2,2,2,2,2), // 78 - 7f PCK4BITS(0,0,0,0,0,0,0,0), // 80 - 87 PCK4BITS(0,0,0,0,0,0,6,0), // 88 - 8f PCK4BITS(0,0,0,0,0,0,0,0), // 90 - 97 PCK4BITS(0,0,0,0,0,0,0,0), // 98 - 9f PCK4BITS(0,3,4,4,4,4,4,4), // a0 - a7 PCK4BITS(5,5,1,1,1,1,1,1), // a8 - af PCK4BITS(1,1,1,1,1,1,1,1), // b0 - b7 PCK4BITS(1,1,1,1,1,1,1,1), // b8 - bf PCK4BITS(1,1,3,1,3,3,3,3), // c0 - c7 PCK4BITS(3,3,3,3,3,3,3,3), // c8 - cf PCK4BITS(3,3,3,3,3,3,3,3), // d0 - d7 PCK4BITS(3,3,3,3,3,3,3,3), // d8 - df PCK4BITS(3,3,3,3,3,3,3,3), // e0 - e7 PCK4BITS(3,3,3,3,3,3,3,3), // e8 - ef PCK4BITS(3,3,3,3,3,3,3,3), // f0 - f7 PCK4BITS(3,3,3,3,3,3,3,0) // f8 - ff }; constexpr PRUint32 EUCTW_st [ 6] = { PCK4BITS(eError,eError,eStart, 3, 3, 3, 4,eError),//00-07 PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),//08-0f PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eStart,eError),//10-17 PCK4BITS(eStart,eStart,eStart,eError,eError,eError,eError,eError),//18-1f PCK4BITS( 5,eError,eError,eError,eStart,eError,eStart,eStart),//20-27 PCK4BITS(eStart,eError,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f }; constexpr PRUint32 EUCTWCharLenTable[] = {0, 0, 1, 2, 2, 2, 3}; const SMModel EUCTWSMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCTW_cls }, 7, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCTW_st }, EUCTWCharLenTable, "EUC-TW", }; // GB-2312 #if 0 // obsolete GB2312 by gb18030 static PRUint32 GB2312_cls [ 256 / 8 ] = { //PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07 PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07 PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f PCK4BITS(1,1,1,1,1,1,1,1), // 10 - 17 PCK4BITS(1,1,1,0,1,1,1,1), // 18 - 1f PCK4BITS(1,1,1,1,1,1,1,1), // 20 - 27 PCK4BITS(1,1,1,1,1,1,1,1), // 28 - 2f PCK4BITS(1,1,1,1,1,1,1,1), // 30 - 37 PCK4BITS(1,1,1,1,1,1,1,1), // 38 - 3f PCK4BITS(1,1,1,1,1,1,1,1), // 40 - 47 PCK4BITS(1,1,1,1,1,1,1,1), // 48 - 4f PCK4BITS(1,1,1,1,1,1,1,1), // 50 - 57 PCK4BITS(1,1,1,1,1,1,1,1), // 58 - 5f PCK4BITS(1,1,1,1,1,1,1,1), // 60 - 67 PCK4BITS(1,1,1,1,1,1,1,1), // 68 - 6f PCK4BITS(1,1,1,1,1,1,1,1), // 70 - 77 PCK4BITS(1,1,1,1,1,1,1,1), // 78 - 7f PCK4BITS(1,0,0,0,0,0,0,0), // 80 - 87 PCK4BITS(0,0,0,0,0,0,0,0), // 88 - 8f PCK4BITS(0,0,0,0,0,0,0,0), // 90 - 97 PCK4BITS(0,0,0,0,0,0,0,0), // 98 - 9f PCK4BITS(0,2,2,2,2,2,2,2), // a0 - a7 PCK4BITS(2,2,3,3,3,3,3,3), // a8 - af PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 PCK4BITS(2,2,2,2,2,2,2,2), // c8 - cf PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df PCK4BITS(2,2,2,2,2,2,2,2), // e0 - e7 PCK4BITS(2,2,2,2,2,2,2,2), // e8 - ef PCK4BITS(2,2,2,2,2,2,2,2), // f0 - f7 PCK4BITS(2,2,2,2,2,2,2,0) // f8 - ff }; constexpr PRUint32 GB2312_st [ 2] = { PCK4BITS(eError,eStart, 3,eError,eError,eError,eError,eError),//00-07 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart,eStart) //08-0f }; constexpr PRUint32 GB2312CharLenTable[] = {0, 1, 2, 0}; const SMModel GB2312SMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB2312_cls }, 4, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB2312_st }, GB2312CharLenTable, "GB2312", }; #endif // GB-18030 // the following state machine data was created by perl script in // intl/chardet/tools. It should be the same as in PSM detector. constexpr PRUint32 GB18030_cls [ 256 / 8 ] = { PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07 PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f PCK4BITS(1,1,1,1,1,1,1,1), // 10 - 17 PCK4BITS(1,1,1,0,1,1,1,1), // 18 - 1f PCK4BITS(1,1,1,1,1,1,1,1), // 20 - 27 PCK4BITS(1,1,1,1,1,1,1,1), // 28 - 2f PCK4BITS(3,3,3,3,3,3,3,3), // 30 - 37 PCK4BITS(3,3,1,1,1,1,1,1), // 38 - 3f PCK4BITS(2,2,2,2,2,2,2,2), // 40 - 47 PCK4BITS(2,2,2,2,2,2,2,2), // 48 - 4f PCK4BITS(2,2,2,2,2,2,2,2), // 50 - 57 PCK4BITS(2,2,2,2,2,2,2,2), // 58 - 5f PCK4BITS(2,2,2,2,2,2,2,2), // 60 - 67 PCK4BITS(2,2,2,2,2,2,2,2), // 68 - 6f PCK4BITS(2,2,2,2,2,2,2,2), // 70 - 77 PCK4BITS(2,2,2,2,2,2,2,4), // 78 - 7f PCK4BITS(5,6,6,6,6,6,6,6), // 80 - 87 PCK4BITS(6,6,6,6,6,6,6,6), // 88 - 8f PCK4BITS(6,6,6,6,6,6,6,6), // 90 - 97 PCK4BITS(6,6,6,6,6,6,6,6), // 98 - 9f PCK4BITS(6,6,6,6,6,6,6,6), // a0 - a7 PCK4BITS(6,6,6,6,6,6,6,6), // a8 - af PCK4BITS(6,6,6,6,6,6,6,6), // b0 - b7 PCK4BITS(6,6,6,6,6,6,6,6), // b8 - bf PCK4BITS(6,6,6,6,6,6,6,6), // c0 - c7 PCK4BITS(6,6,6,6,6,6,6,6), // c8 - cf PCK4BITS(6,6,6,6,6,6,6,6), // d0 - d7 PCK4BITS(6,6,6,6,6,6,6,6), // d8 - df PCK4BITS(6,6,6,6,6,6,6,6), // e0 - e7 PCK4BITS(6,6,6,6,6,6,6,6), // e8 - ef PCK4BITS(6,6,6,6,6,6,6,6), // f0 - f7 PCK4BITS(6,6,6,6,6,6,6,0) // f8 - ff }; constexpr PRUint32 GB18030_st [6] = { PCK4BITS(eError,eStart,eStart,eStart,eStart,eStart, 3,eError),//00-07 PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),//08-0f PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart),//10-17 PCK4BITS( 4,eError,eStart,eStart,eError,eError,eError,eError),//18-1f PCK4BITS(eError,eError, 5,eError,eError,eError,eItsMe,eError),//20-27 PCK4BITS(eError,eError,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f }; // To be accurate, the length of class 6 can be either 2 or 4. // But it is not necessary to discriminate between the two since // it is used for frequency analysis only, and we are validing // each code range there as well. So it is safe to set it to be // 2 here. constexpr PRUint32 GB18030CharLenTable[] = {0, 1, 1, 1, 1, 1, 2}; const SMModel GB18030SMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB18030_cls }, 7, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB18030_st }, GB18030CharLenTable, "GB18030", }; // sjis constexpr PRUint32 SJIS_cls [ 256 / 8 ] = { //PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07 PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07 PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f PCK4BITS(1,1,1,1,1,1,1,1), // 10 - 17 PCK4BITS(1,1,1,0,1,1,1,1), // 18 - 1f PCK4BITS(1,1,1,1,1,1,1,1), // 20 - 27 PCK4BITS(1,1,1,1,1,1,1,1), // 28 - 2f PCK4BITS(1,1,1,1,1,1,1,1), // 30 - 37 PCK4BITS(1,1,1,1,1,1,1,1), // 38 - 3f PCK4BITS(2,2,2,2,2,2,2,2), // 40 - 47 PCK4BITS(2,2,2,2,2,2,2,2), // 48 - 4f PCK4BITS(2,2,2,2,2,2,2,2), // 50 - 57 PCK4BITS(2,2,2,2,2,2,2,2), // 58 - 5f PCK4BITS(2,2,2,2,2,2,2,2), // 60 - 67 PCK4BITS(2,2,2,2,2,2,2,2), // 68 - 6f PCK4BITS(2,2,2,2,2,2,2,2), // 70 - 77 PCK4BITS(2,2,2,2,2,2,2,1), // 78 - 7f PCK4BITS(3,3,3,3,3,3,3,3), // 80 - 87 PCK4BITS(3,3,3,3,3,3,3,3), // 88 - 8f PCK4BITS(3,3,3,3,3,3,3,3), // 90 - 97 PCK4BITS(3,3,3,3,3,3,3,3), // 98 - 9f //0xa0 is illegal in sjis encoding, but some pages does //contain such byte. We need to be more error forgiven. PCK4BITS(2,2,2,2,2,2,2,2), // a0 - a7 PCK4BITS(2,2,2,2,2,2,2,2), // a8 - af PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 PCK4BITS(2,2,2,2,2,2,2,2), // c8 - cf PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df PCK4BITS(3,3,3,3,3,3,3,3), // e0 - e7 PCK4BITS(3,3,3,3,3,4,4,4), // e8 - ef PCK4BITS(4,4,4,4,4,4,4,4), // f0 - f7 PCK4BITS(4,4,4,4,4,0,0,0) // f8 - ff }; constexpr PRUint32 SJIS_st [ 3] = { PCK4BITS(eError,eStart,eStart, 3,eError,eError,eError,eError),//00-07 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart,eStart,eStart) //10-17 }; constexpr PRUint32 SJISCharLenTable[] = {0, 1, 1, 2, 0, 0}; const SMModel SJISSMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, SJIS_cls }, 6, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, SJIS_st }, SJISCharLenTable, "SHIFT_JIS", }; static PRUint32 UCS2BE_cls [ 256 / 8 ] = { PCK4BITS(0,0,0,0,0,0,0,0), // 00 - 07 PCK4BITS(0,0,1,0,0,2,0,0), // 08 - 0f PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 PCK4BITS(0,0,0,3,0,0,0,0), // 18 - 1f PCK4BITS(0,0,0,0,0,0,0,0), // 20 - 27 PCK4BITS(0,3,3,3,3,3,0,0), // 28 - 2f PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f PCK4BITS(0,0,0,0,0,0,0,0), // 40 - 47 PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f PCK4BITS(0,0,0,0,0,0,0,0), // 80 - 87 PCK4BITS(0,0,0,0,0,0,0,0), // 88 - 8f PCK4BITS(0,0,0,0,0,0,0,0), // 90 - 97 PCK4BITS(0,0,0,0,0,0,0,0), // 98 - 9f PCK4BITS(0,0,0,0,0,0,0,0), // a0 - a7 PCK4BITS(0,0,0,0,0,0,0,0), // a8 - af PCK4BITS(0,0,0,0,0,0,0,0), // b0 - b7 PCK4BITS(0,0,0,0,0,0,0,0), // b8 - bf PCK4BITS(0,0,0,0,0,0,0,0), // c0 - c7 PCK4BITS(0,0,0,0,0,0,0,0), // c8 - cf PCK4BITS(0,0,0,0,0,0,0,0), // d0 - d7 PCK4BITS(0,0,0,0,0,0,0,0), // d8 - df PCK4BITS(0,0,0,0,0,0,0,0), // e0 - e7 PCK4BITS(0,0,0,0,0,0,0,0), // e8 - ef PCK4BITS(0,0,0,0,0,0,0,0), // f0 - f7 PCK4BITS(0,0,0,0,0,0,4,5) // f8 - ff }; static PRUint32 UCS2BE_st [ 7] = { PCK4BITS( 5, 7, 7,eError, 4, 3,eError,eError),//00-07 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f PCK4BITS(eItsMe,eItsMe, 6, 6, 6, 6,eError,eError),//10-17 PCK4BITS( 6, 6, 6, 6, 6,eItsMe, 6, 6),//18-1f PCK4BITS( 6, 6, 6, 6, 5, 7, 7,eError),//20-27 PCK4BITS( 5, 8, 6, 6,eError, 6, 6, 6),//28-2f PCK4BITS( 6, 6, 6, 6,eError,eError,eStart,eStart) //30-37 }; constexpr PRUint32 UCS2BECharLenTable[] = {2, 2, 2, 0, 2, 2}; SMModel const UCS2BESMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2BE_cls }, 6, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2BE_st }, UCS2BECharLenTable, "UTF-16BE", }; static PRUint32 UCS2LE_cls [ 256 / 8 ] = { PCK4BITS(0,0,0,0,0,0,0,0), // 00 - 07 PCK4BITS(0,0,1,0,0,2,0,0), // 08 - 0f PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 PCK4BITS(0,0,0,3,0,0,0,0), // 18 - 1f PCK4BITS(0,0,0,0,0,0,0,0), // 20 - 27 PCK4BITS(0,3,3,3,3,3,0,0), // 28 - 2f PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f PCK4BITS(0,0,0,0,0,0,0,0), // 40 - 47 PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f PCK4BITS(0,0,0,0,0,0,0,0), // 80 - 87 PCK4BITS(0,0,0,0,0,0,0,0), // 88 - 8f PCK4BITS(0,0,0,0,0,0,0,0), // 90 - 97 PCK4BITS(0,0,0,0,0,0,0,0), // 98 - 9f PCK4BITS(0,0,0,0,0,0,0,0), // a0 - a7 PCK4BITS(0,0,0,0,0,0,0,0), // a8 - af PCK4BITS(0,0,0,0,0,0,0,0), // b0 - b7 PCK4BITS(0,0,0,0,0,0,0,0), // b8 - bf PCK4BITS(0,0,0,0,0,0,0,0), // c0 - c7 PCK4BITS(0,0,0,0,0,0,0,0), // c8 - cf PCK4BITS(0,0,0,0,0,0,0,0), // d0 - d7 PCK4BITS(0,0,0,0,0,0,0,0), // d8 - df PCK4BITS(0,0,0,0,0,0,0,0), // e0 - e7 PCK4BITS(0,0,0,0,0,0,0,0), // e8 - ef PCK4BITS(0,0,0,0,0,0,0,0), // f0 - f7 PCK4BITS(0,0,0,0,0,0,4,5) // f8 - ff }; constexpr PRUint32 UCS2LE_st [ 7] = { PCK4BITS( 6, 6, 7, 6, 4, 3,eError,eError),//00-07 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f PCK4BITS(eItsMe,eItsMe, 5, 5, 5,eError,eItsMe,eError),//10-17 PCK4BITS( 5, 5, 5,eError, 5,eError, 6, 6),//18-1f PCK4BITS( 7, 6, 8, 8, 5, 5, 5,eError),//20-27 PCK4BITS( 5, 5, 5,eError,eError,eError, 5, 5),//28-2f PCK4BITS( 5, 5, 5,eError, 5,eError,eStart,eStart) //30-37 }; constexpr PRUint32 UCS2LECharLenTable[] = {2, 2, 2, 2, 2, 2}; SMModel UCS2LESMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2LE_cls }, 6, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2LE_st }, UCS2LECharLenTable, "UTF-16LE", }; constexpr PRUint32 UTF8_cls [ 256 / 8 ] = { //PCK4BITS(0,1,1,1,1,1,1,1), // 00 - 07 PCK4BITS(1,1,1,1,1,1,1,1), // 00 - 07 //allow 0x00 as a legal value PCK4BITS(1,1,1,1,1,1,0,0), // 08 - 0f PCK4BITS(1,1,1,1,1,1,1,1), // 10 - 17 PCK4BITS(1,1,1,0,1,1,1,1), // 18 - 1f PCK4BITS(1,1,1,1,1,1,1,1), // 20 - 27 PCK4BITS(1,1,1,1,1,1,1,1), // 28 - 2f PCK4BITS(1,1,1,1,1,1,1,1), // 30 - 37 PCK4BITS(1,1,1,1,1,1,1,1), // 38 - 3f PCK4BITS(1,1,1,1,1,1,1,1), // 40 - 47 PCK4BITS(1,1,1,1,1,1,1,1), // 48 - 4f PCK4BITS(1,1,1,1,1,1,1,1), // 50 - 57 PCK4BITS(1,1,1,1,1,1,1,1), // 58 - 5f PCK4BITS(1,1,1,1,1,1,1,1), // 60 - 67 PCK4BITS(1,1,1,1,1,1,1,1), // 68 - 6f PCK4BITS(1,1,1,1,1,1,1,1), // 70 - 77 PCK4BITS(1,1,1,1,1,1,1,1), // 78 - 7f PCK4BITS(2,2,2,2,3,3,3,3), // 80 - 87 PCK4BITS(4,4,4,4,4,4,4,4), // 88 - 8f PCK4BITS(4,4,4,4,4,4,4,4), // 90 - 97 PCK4BITS(4,4,4,4,4,4,4,4), // 98 - 9f PCK4BITS(5,5,5,5,5,5,5,5), // a0 - a7 PCK4BITS(5,5,5,5,5,5,5,5), // a8 - af PCK4BITS(5,5,5,5,5,5,5,5), // b0 - b7 PCK4BITS(5,5,5,5,5,5,5,5), // b8 - bf PCK4BITS(0,0,6,6,6,6,6,6), // c0 - c7 PCK4BITS(6,6,6,6,6,6,6,6), // c8 - cf PCK4BITS(6,6,6,6,6,6,6,6), // d0 - d7 PCK4BITS(6,6,6,6,6,6,6,6), // d8 - df PCK4BITS(7,8,8,8,8,8,8,8), // e0 - e7 PCK4BITS(8,8,8,8,8,9,8,8), // e8 - ef PCK4BITS(10,11,11,11,11,11,11,11), // f0 - f7 PCK4BITS(12,13,13,13,14,15,0,0) // f8 - ff }; constexpr PRUint32 UTF8_st [ 26] = { PCK4BITS(eError,eStart,eError,eError,eError,eError, 12, 10),//00-07 PCK4BITS( 9, 11, 8, 7, 6, 5, 4, 3),//08-0f PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//10-17 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//18-1f PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe),//20-27 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe),//28-2f PCK4BITS(eError,eError, 5, 5, 5, 5,eError,eError),//30-37 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//38-3f PCK4BITS(eError,eError,eError, 5, 5, 5,eError,eError),//40-47 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//48-4f PCK4BITS(eError,eError, 7, 7, 7, 7,eError,eError),//50-57 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//58-5f PCK4BITS(eError,eError,eError,eError, 7, 7,eError,eError),//60-67 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//68-6f PCK4BITS(eError,eError, 9, 9, 9, 9,eError,eError),//70-77 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//78-7f PCK4BITS(eError,eError,eError,eError,eError, 9,eError,eError),//80-87 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//88-8f PCK4BITS(eError,eError, 12, 12, 12, 12,eError,eError),//90-97 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//98-9f PCK4BITS(eError,eError,eError,eError,eError, 12,eError,eError),//a0-a7 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//a8-af PCK4BITS(eError,eError, 12, 12, 12,eError,eError,eError),//b0-b7 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),//b8-bf PCK4BITS(eError,eError,eStart,eStart,eStart,eStart,eError,eError),//c0-c7 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError) //c8-cf }; constexpr PRUint32 UTF8CharLenTable[] = {0, 1, 0, 0, 0, 0, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6 }; const SMModel UTF8SMModel = { {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UTF8_cls }, 16, {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UTF8_st }, UTF8CharLenTable, "UTF-8", }; ================================================ FILE: third_party/uchardet/uchardet/src/nsPkgInt.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsPkgInt_h__ #define nsPkgInt_h__ #include "nscore.h" typedef enum { eIdxSft4bits = 3, eIdxSft8bits = 2, eIdxSft16bits = 1 } nsIdxSft; typedef enum { eSftMsk4bits = 7, eSftMsk8bits = 3, eSftMsk16bits = 1 } nsSftMsk; typedef enum { eBitSft4bits = 2, eBitSft8bits = 3, eBitSft16bits = 4 } nsBitSft; typedef enum { eUnitMsk4bits = 0x0000000FL, eUnitMsk8bits = 0x000000FFL, eUnitMsk16bits = 0x0000FFFFL } nsUnitMsk; typedef struct nsPkgInt { nsIdxSft idxsft; nsSftMsk sftmsk; nsBitSft bitsft; nsUnitMsk unitmsk; const PRUint32* const data; } nsPkgInt; #define PCK16BITS(a,b) ((PRUint32)(((b) << 16) | (a))) #define PCK8BITS(a,b,c,d) PCK16BITS( ((PRUint32)(((b) << 8) | (a))), \ ((PRUint32)(((d) << 8) | (c)))) #define PCK4BITS(a,b,c,d,e,f,g,h) PCK8BITS( ((PRUint32)(((b) << 4) | (a))), \ ((PRUint32)(((d) << 4) | (c))), \ ((PRUint32)(((f) << 4) | (e))), \ ((PRUint32)(((h) << 4) | (g))) ) #define GETFROMPCK(i, c) \ (((((c).data)[(i)>>(c).idxsft])>>(((i)&(c).sftmsk)<<(c).bitsft))&(c).unitmsk) #endif /* nsPkgInt_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsSBCSGroupProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include #include "prmem.h" #include "nsSBCharSetProber.h" #include "nsSBCSGroupProber.h" #include "nsHebrewProber.h" nsSBCSGroupProber::nsSBCSGroupProber() : mNumOfProbers(MAX_NUM_OF_SBCS_PROBERS), mBestGuess(-1), mActiveNum(0) { PRUint32 i = 0; mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252GermanModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1GermanModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252FrenchModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1FrenchModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15FrenchModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252SpanishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1SpanishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15SpanishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252PortugueseModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1PortugueseModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_9PortugueseModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15PortugueseModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1250HungarianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_2HungarianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_3EsperantoModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252AfricaansModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1AfricaansModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_9AfricaansModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15AfricaansModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252NederlandsModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1NederlandsModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_9NederlandsModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15NederlandsModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252DanishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15DanishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1DanishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_13LithuanianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_10LithuanianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_4LithuanianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_13LatvianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_10LatvianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_4LatvianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_3MalteseModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1250CzechModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_2CzechModel); mProbers[i++] = new nsSingleByteCharSetProber(&Mac_CentraleuropeCzechModel); mProbers[i++] = new nsSingleByteCharSetProber(&Ibm852CzechModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1250SlovakModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_2SlovakModel); mProbers[i++] = new nsSingleByteCharSetProber(&Mac_CentraleuropeSlovakModel); mProbers[i++] = new nsSingleByteCharSetProber(&Ibm852SlovakModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1250PolishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_2PolishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_13PolishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_16PolishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Mac_CentraleuropePolishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Ibm852PolishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252FinnishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1FinnishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_4FinnishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_9FinnishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_13FinnishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15FinnishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252ItalianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1ItalianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_3ItalianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_9ItalianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15ItalianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1250CroatianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_2CroatianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_13CroatianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_16CroatianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Mac_CentraleuropeCroatianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Ibm852CroatianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252EstonianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1257EstonianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_4EstonianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_13EstonianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15EstonianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252IrishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1IrishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_9IrishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15IrishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1250RomanianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_2RomanianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_16RomanianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Ibm852RomanianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1250SloveneModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_2SloveneModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_16SloveneModel); mProbers[i++] = new nsSingleByteCharSetProber(&Mac_CentraleuropeSloveneModel); mProbers[i++] = new nsSingleByteCharSetProber(&Ibm852SloveneModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1252SwedishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_1SwedishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_4SwedishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_9SwedishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_15SwedishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1251BelarusianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Win1251RussianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Koi8rRussianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Latin5RussianModel); mProbers[i++] = new nsSingleByteCharSetProber(&MacCyrillicRussianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Ibm866RussianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Ibm855RussianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_7GreekModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1253GreekModel); mProbers[i++] = new nsSingleByteCharSetProber(&Latin5BulgarianModel); mProbers[i++] = new nsSingleByteCharSetProber(&Win1251BulgarianModel); nsHebrewProber* hebprober = new nsHebrewProber(); // Notice: Any change in these indexes - 10,11,12 must be reflected // in the code below as well. PRUint32 const heb = i; mProbers[i++] = hebprober; mProbers[i++] = new nsSingleByteCharSetProber(&Win1255Model, PR_FALSE, hebprober); // Logical Hebrew mProbers[i++] = new nsSingleByteCharSetProber(&Win1255Model, PR_TRUE, hebprober); // Visual Hebrew // Tell the Hebrew prober about the logical and visual probers if (mProbers[heb] && mProbers[heb + 1] && mProbers[heb + 2]) // all are not null { hebprober->SetModelProbers(mProbers[heb + 1], mProbers[heb + 2]); } else // One or more is null. avoid any Hebrew probing, null them all { for (PRUint32 j = heb + 2; j >= heb; --j) { delete mProbers[j]; mProbers[j] = nsnull; } } mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_3TurkishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_9TurkishModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1256ArabicModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_6ArabicModel); mProbers[i++] = new nsSingleByteCharSetProber(&Windows_1258VietnameseModel); mProbers[i++] = new nsSingleByteCharSetProber(&VisciiVietnameseModel); mProbers[i++] = new nsSingleByteCharSetProber(&Tis_620ThaiModel); mProbers[i++] = new nsSingleByteCharSetProber(&Iso_8859_11ThaiModel); mNumOfProbers = i; for (; i < MAX_NUM_OF_SBCS_PROBERS; ++i) { mProbers[i] = nsnull; } Reset(); } nsSBCSGroupProber::~nsSBCSGroupProber() { for (PRUint32 i = 0; i < MAX_NUM_OF_SBCS_PROBERS; i++) { if (mProbers[i]) { delete mProbers[i]; } } } const char* nsSBCSGroupProber::GetCharSetName() { //if we have no answer yet if (mBestGuess == -1) { GetConfidence(); //no charset seems positive if (mBestGuess == -1) //we will use default. mBestGuess = 0; } return mProbers[mBestGuess]->GetCharSetName(); } void nsSBCSGroupProber::Reset(void) { mActiveNum = 0; for (PRUint32 i = 0; i < MAX_NUM_OF_SBCS_PROBERS; ++i) { if (mProbers[i]) // not null { mProbers[i]->Reset(); mIsActive[i] = PR_TRUE; ++mActiveNum; } else { mIsActive[i] = PR_FALSE; } } mBestGuess = -1; mState = eDetecting; } nsProbingState nsSBCSGroupProber::HandleData(const char* aBuf, PRUint32 aLen) { nsProbingState st; PRUint32 i; char *newBuf1 = 0; PRUint32 newLen1 = 0; //apply filter to original buffer, and we got new buffer back //depend on what script it is, we will feed them the new buffer //we got after applying proper filter //this is done without any consideration to KeepEnglishLetters //of each prober since as of now, there are no probers here which //recognize languages with English characters. if (!FilterWithoutEnglishLetters(aBuf, aLen, &newBuf1, newLen1)) goto done; if (newLen1 == 0) goto done; // Nothing to see here, move on. for (i = 0; i < mNumOfProbers; i++) { if (!mIsActive[i]) continue; st = mProbers[i]->HandleData(newBuf1, newLen1); if (st == eFoundIt) { mBestGuess = i; mState = eFoundIt; break; } else if (st == eNotMe) { mIsActive[i] = PR_FALSE; mActiveNum--; if (mActiveNum <= 0) { mState = eNotMe; break; } } } done: PR_FREEIF(newBuf1); return mState; } float nsSBCSGroupProber::GetConfidence(void) { float bestConf = 0.0f; switch (mState) { case eFoundIt: return SURE_YES; case eNotMe: return SURE_NO; default: for (PRUint32 i = 0; i < mNumOfProbers; i++) { if (!mIsActive[i]) continue; float const cf = mProbers[i]->GetConfidence(); if (bestConf < cf) { bestConf = cf; mBestGuess = i; } } } return bestConf; } #ifdef DEBUG_chardet void nsSBCSGroupProber::DumpStatus() { PRUint32 i; float cf; cf = GetConfidence(); printf(" SBCS Group Prober --------begin status \r\n"); for (i = 0; i < mNumOfProbers; i++) { if (!mIsActive[i]) printf(" inactive: [%s] (i.e. confidence is too low).\r\n", mProbers[i]->GetCharSetName()); else mProbers[i]->DumpStatus(); } printf(" SBCS Group found best match [%s] confidence %f.\r\n", mProbers[mBestGuess]->GetCharSetName(), cf); } #endif ================================================ FILE: third_party/uchardet/uchardet/src/nsSBCSGroupProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: et sw=2 ts=2 fdm=marker */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsSBCSGroupProber_h__ #define nsSBCSGroupProber_h__ #define MAX_NUM_OF_SBCS_PROBERS 160 class nsCharSetProber; class nsSBCSGroupProber : public nsCharSetProber { public: nsSBCSGroupProber(); virtual ~nsSBCSGroupProber(); nsProbingState HandleData(const char* aBuf, PRUint32 aLen) override; const char* GetCharSetName() override; nsProbingState GetState(void) override { return mState; } void Reset(void) override; float GetConfidence(void) override; void SetOpion() override {} #ifdef DEBUG_chardet void DumpStatus(); #endif protected: nsProbingState mState; nsCharSetProber* mProbers[MAX_NUM_OF_SBCS_PROBERS]; PRBool mIsActive[MAX_NUM_OF_SBCS_PROBERS]; PRUint32 mNumOfProbers; PRInt32 mBestGuess; PRUint32 mActiveNum; }; #endif /* nsSBCSGroupProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsSBCharSetProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include #include "nsSBCharSetProber.h" nsProbingState nsSingleByteCharSetProber::HandleData(const char* aBuf, PRUint32 aLen) { for (PRUint32 i = 0; i < aLen; i++) { unsigned char const order = mModel->charToOrderMap[(unsigned char)aBuf[i]]; if (order < SYMBOL_CAT_ORDER) { mTotalChar++; } else if (order == ILL) { /* When encountering an illegal codepoint, no need * to continue analyzing data. */ mState = eNotMe; break; } else if (order == CTR) { mCtrlChar++; } if (order < mModel->freqCharCount) { ++mFreqChar; if (mLastOrder < mModel->freqCharCount) { ++mTotalSeqs; if (!mReversed) ++(mSeqCounters[(int)mModel->precedenceMatrix[mLastOrder*mModel->freqCharCount+order]]); else // reverse the order of the letters in the lookup ++(mSeqCounters[(int)mModel->precedenceMatrix[order*mModel->freqCharCount+mLastOrder]]); } } mLastOrder = order; } if (mState == eDetecting) if (mTotalSeqs > SB_ENOUGH_REL_THRESHOLD) { float const cf = GetConfidence(); if (cf >= POSITIVE_SHORTCUT_THRESHOLD) mState = eFoundIt; else if (cf <= NEGATIVE_SHORTCUT_THRESHOLD) mState = eNotMe; } return mState; } void nsSingleByteCharSetProber::Reset(void) { mState = eDetecting; mLastOrder = 255; for (PRUint32 i = 0; i < NUMBER_OF_SEQ_CAT; i++) mSeqCounters[i] = 0; mTotalSeqs = 0; mTotalChar = 0; mCtrlChar = 0; mFreqChar = 0; } constexpr float rfactor(PRUint32 m, PRUint32 d) { return ((d >= 1) ? (static_cast(m) / static_cast(d)) : static_cast(m)); } float nsSingleByteCharSetProber::GetConfidence() { PRUint32 const neutralChar = mSeqCounters[NEUTRAL_CAT] + mCtrlChar; PRUint32 const netChars = (mTotalChar > neutralChar) ? (mTotalChar - neutralChar) : mTotalSeqs; if ((mTotalChar > 0) && (mTotalSeqs > 0)) { // weighted good sequence count //PRUint32 const probableSeqs = mSeqCounters[POSITIVE_CAT] + (mSeqCounters[PROBABLE_CAT] >> 2); PRUint32 const validSeqs = mTotalSeqs - mSeqCounters[NEGATIVE_CAT]; float r = rfactor(mSeqCounters[POSITIVE_CAT], mTotalSeqs) / mModel->mTypicalPositiveRatio; // negative sequence correction factor r *= rfactor(validSeqs, (mTotalSeqs + (netChars * mSeqCounters[NEGATIVE_CAT]))); /* Multiply by a ratio of positive sequences per characters. * This would help in particular to distinguish close winners. * Indeed if you add a letter, you'd expect the positive sequence count * to increase as well. If it doesn't, it may mean that this new codepoint * may not have been a letter, but instead a symbol (or some other * character). This could make the difference between very closely related * charsets used for the same language. */ r *= rfactor(validSeqs, netChars); /* The more control characters (proportionally to the size of the text), the * less confident we become in the current charset. */ r *= rfactor(netChars, mTotalChar); // normalizing r *= rfactor(mFreqChar, mTotalChar); if (r > NO_DOUBT) { r = NO_DOUBT; } return r; } return SURE_NO; } const char* nsSingleByteCharSetProber::GetCharSetName() { if (!mNameProber) return mModel->charsetName; return mNameProber->GetCharSetName(); } #ifdef DEBUG_chardet void nsSingleByteCharSetProber::DumpStatus() { printf(" SBCS: %1.3f [%s]\r\n", GetConfidence(), GetCharSetName()); } #endif ================================================ FILE: third_party/uchardet/uchardet/src/nsSBCharSetProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsSingleByteCharSetProber_h__ #define nsSingleByteCharSetProber_h__ #include "nsCharSetProber.h" /** Codepoints **/ /* Illegal codepoints.*/ #define ILL 255 /* Control character. */ #define CTR 254 /* Symbols and punctuation that does not belong to words. */ #define SYM 253 /* Return/Line feeds. */ #define RET 252 /* Numbers 0-9. */ #define NUM 251 #define SB_ENOUGH_REL_THRESHOLD (ENOUGH_DATA_THRESHOLD >> 1) #define POSITIVE_SHORTCUT_THRESHOLD SHORTCUT_THRESHOLD #define NEGATIVE_SHORTCUT_THRESHOLD (0.05f) #define SYMBOL_CAT_ORDER 250 #define NUMBER_OF_SEQ_CAT 4 #define POSITIVE_CAT (NUMBER_OF_SEQ_CAT-1) #define PROBABLE_CAT (NUMBER_OF_SEQ_CAT-2) #define NEUTRAL_CAT (NUMBER_OF_SEQ_CAT-3) #define NEGATIVE_CAT 0 typedef struct { /* [256] table mapping codepoints to chararacter orders. */ const unsigned char* const charToOrderMap; /* freqCharCount x freqCharCount table of 2-char sequence's frequencies. */ const PRUint8* const precedenceMatrix; /* The count of frequent characters. */ int freqCharCount; float mTypicalPositiveRatio; // = freqSeqs / totalSeqs PRBool keepEnglishLetter; // says if this script contains English characters (not implemented) const char* const charsetName; } SequenceModel; class nsSingleByteCharSetProber : public nsCharSetProber{ public: nsSingleByteCharSetProber(const SequenceModel *model) :mModel(model), mReversed(PR_FALSE), mNameProber(0) { Reset(); } nsSingleByteCharSetProber(const SequenceModel *model, PRBool reversed, nsCharSetProber* nameProber) :mModel(model), mReversed(reversed), mNameProber(nameProber) { Reset(); } virtual const char* GetCharSetName(); virtual nsProbingState HandleData(const char* aBuf, PRUint32 aLen); virtual nsProbingState GetState(void) {return mState;} virtual void Reset(void); virtual float GetConfidence(void); virtual void SetOpion() {} // This feature is not implemented yet. any current language model // contain this parameter as PR_FALSE. No one is looking at this // parameter or calling this method. // Moreover, the nsSBCSGroupProber which calls the HandleData of this // prober has a hard-coded call to FilterWithoutEnglishLetters which gets rid // of the English letters. PRBool KeepEnglishLetters() {return mModel->keepEnglishLetter;} // (not implemented) #ifdef DEBUG_chardet virtual void DumpStatus(); #endif protected: nsProbingState mState; const SequenceModel* const mModel; const PRBool mReversed; // PR_TRUE if we need to reverse every pair in the model lookup //char order of last character unsigned char mLastOrder; PRUint32 mTotalSeqs; PRUint32 mSeqCounters[NUMBER_OF_SEQ_CAT]; PRUint32 mTotalChar; PRUint32 mCtrlChar; //characters that fall in our sampling range PRUint32 mFreqChar; // Optional auxiliary prober for name decision. created and destroyed by the GroupProber nsCharSetProber* mNameProber; }; extern const SequenceModel Windows_1256ArabicModel; extern const SequenceModel Iso_8859_6ArabicModel; extern const SequenceModel Koi8rRussianModel; extern const SequenceModel Win1251RussianModel; extern const SequenceModel Latin5RussianModel; extern const SequenceModel MacCyrillicRussianModel; extern const SequenceModel Ibm866RussianModel; extern const SequenceModel Ibm855RussianModel; extern const SequenceModel Iso_8859_7GreekModel; extern const SequenceModel Windows_1253GreekModel; extern const SequenceModel Latin5BulgarianModel; extern const SequenceModel Win1251BulgarianModel; extern const SequenceModel Iso_8859_2HungarianModel; extern const SequenceModel Windows_1250HungarianModel; extern const SequenceModel Win1255Model; extern const SequenceModel Tis_620ThaiModel; extern const SequenceModel Iso_8859_11ThaiModel; extern const SequenceModel Iso_8859_15FrenchModel; extern const SequenceModel Iso_8859_1FrenchModel; extern const SequenceModel Windows_1252FrenchModel; extern const SequenceModel Iso_8859_15SpanishModel; extern const SequenceModel Iso_8859_1SpanishModel; extern const SequenceModel Windows_1252SpanishModel; extern const SequenceModel Iso_8859_1GermanModel; extern const SequenceModel Windows_1252GermanModel; extern const SequenceModel Iso_8859_3EsperantoModel; extern const SequenceModel Iso_8859_3TurkishModel; extern const SequenceModel Iso_8859_9TurkishModel; extern const SequenceModel VisciiVietnameseModel; extern const SequenceModel Windows_1258VietnameseModel; extern const SequenceModel Iso_8859_15DanishModel; extern const SequenceModel Iso_8859_1DanishModel; extern const SequenceModel Windows_1252DanishModel; extern const SequenceModel Iso_8859_13LithuanianModel; extern const SequenceModel Iso_8859_10LithuanianModel; extern const SequenceModel Iso_8859_4LithuanianModel; extern const SequenceModel Iso_8859_13LatvianModel; extern const SequenceModel Iso_8859_10LatvianModel; extern const SequenceModel Iso_8859_4LatvianModel; extern const SequenceModel Iso_8859_1PortugueseModel; extern const SequenceModel Iso_8859_9PortugueseModel; extern const SequenceModel Iso_8859_15PortugueseModel; extern const SequenceModel Windows_1252PortugueseModel; extern const SequenceModel Iso_8859_3MalteseModel; extern const SequenceModel Windows_1250CzechModel; extern const SequenceModel Iso_8859_2CzechModel; extern const SequenceModel Ibm852CzechModel; extern const SequenceModel Mac_CentraleuropeCzechModel; extern const SequenceModel Windows_1250SlovakModel; extern const SequenceModel Iso_8859_2SlovakModel; extern const SequenceModel Ibm852SlovakModel; extern const SequenceModel Mac_CentraleuropeSlovakModel; extern const SequenceModel Windows_1250PolishModel; extern const SequenceModel Iso_8859_2PolishModel; extern const SequenceModel Iso_8859_13PolishModel; extern const SequenceModel Iso_8859_16PolishModel; extern const SequenceModel Ibm852PolishModel; extern const SequenceModel Mac_CentraleuropePolishModel; extern const SequenceModel Iso_8859_1FinnishModel; extern const SequenceModel Iso_8859_4FinnishModel; extern const SequenceModel Iso_8859_9FinnishModel; extern const SequenceModel Iso_8859_13FinnishModel; extern const SequenceModel Iso_8859_15FinnishModel; extern const SequenceModel Windows_1252FinnishModel; extern const SequenceModel Iso_8859_1ItalianModel; extern const SequenceModel Iso_8859_3ItalianModel; extern const SequenceModel Iso_8859_9ItalianModel; extern const SequenceModel Iso_8859_15ItalianModel; extern const SequenceModel Windows_1252ItalianModel; extern const SequenceModel Windows_1250CroatianModel; extern const SequenceModel Iso_8859_2CroatianModel; extern const SequenceModel Iso_8859_13CroatianModel; extern const SequenceModel Iso_8859_16CroatianModel; extern const SequenceModel Ibm852CroatianModel; extern const SequenceModel Mac_CentraleuropeCroatianModel; extern const SequenceModel Windows_1252EstonianModel; extern const SequenceModel Windows_1257EstonianModel; extern const SequenceModel Iso_8859_4EstonianModel; extern const SequenceModel Iso_8859_13EstonianModel; extern const SequenceModel Iso_8859_15EstonianModel; extern const SequenceModel Iso_8859_15IrishModel; extern const SequenceModel Iso_8859_9IrishModel; extern const SequenceModel Iso_8859_1IrishModel; extern const SequenceModel Windows_1252IrishModel; extern const SequenceModel Windows_1250RomanianModel; extern const SequenceModel Iso_8859_2RomanianModel; extern const SequenceModel Iso_8859_16RomanianModel; extern const SequenceModel Ibm852RomanianModel; extern const SequenceModel Windows_1250SloveneModel; extern const SequenceModel Iso_8859_2SloveneModel; extern const SequenceModel Iso_8859_16SloveneModel; extern const SequenceModel Ibm852SloveneModel; extern const SequenceModel Mac_CentraleuropeSloveneModel; extern const SequenceModel Windows_1252SwedishModel; extern const SequenceModel Iso_8859_1SwedishModel; extern const SequenceModel Iso_8859_4SwedishModel; extern const SequenceModel Iso_8859_9SwedishModel; extern const SequenceModel Iso_8859_15SwedishModel; extern const SequenceModel Windows_1252AfricaansModel; extern const SequenceModel Iso_8859_15AfricaansModel; extern const SequenceModel Iso_8859_1AfricaansModel; extern const SequenceModel Iso_8859_9AfricaansModel; extern const SequenceModel Windows_1251BelarusianModel; extern const SequenceModel Windows_1252NederlandsModel; extern const SequenceModel Iso_8859_1NederlandsModel; extern const SequenceModel Iso_8859_9NederlandsModel; extern const SequenceModel Iso_8859_15NederlandsModel; #endif /* nsSingleByteCharSetProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsSJISProber.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // for S-JIS encoding, obeserve characteristic: // 1, kana character (or hankaku?) often have hight frequency of appereance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language #include "nsSJISProber.h" void nsSJISProber::Reset(void) { mCodingSM->Reset(); mState = eDetecting; mContextAnalyser.Reset(mIsPreferredLanguage); mDistributionAnalyser.Reset(mIsPreferredLanguage); } nsProbingState nsSJISProber::HandleData(const char* aBuf, PRUint32 aLen) { nsSMState codingState; for (PRUint32 i = 0; i < aLen; i++) { codingState = mCodingSM->NextState(aBuf[i]); if (codingState == eItsMe) { mState = eFoundIt; break; } if (codingState == eStart) { PRUint32 charLen = mCodingSM->GetCurrentCharLen(); if (i == 0) { mLastChar[1] = aBuf[0]; mContextAnalyser.HandleOneChar(mLastChar+2-charLen, charLen); mDistributionAnalyser.HandleOneChar(mLastChar, charLen); } else { mContextAnalyser.HandleOneChar(aBuf+i+1-charLen, charLen); mDistributionAnalyser.HandleOneChar(aBuf+i-1, charLen); } } } mLastChar[0] = aBuf[aLen-1]; if (mState == eDetecting) if (mContextAnalyser.GotEnoughData() && GetConfidence() >= SHORTCUT_THRESHOLD) mState = eFoundIt; return mState; } float nsSJISProber::GetConfidence(void) { float contxtCf = mContextAnalyser.GetConfidence(); float distribCf = mDistributionAnalyser.GetConfidence(); return (contxtCf > distribCf ? contxtCf : distribCf); } ================================================ FILE: third_party/uchardet/uchardet/src/nsSJISProber.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // for S-JIS encoding, obeserve characteristic: // 1, kana character (or hankaku?) often have hight frequency of appereance // 2, kana character often exist in group // 3, certain combination of kana is never used in japanese language #ifndef nsSJISProber_h__ #define nsSJISProber_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" #include "JpCntx.h" #include "CharDistribution.h" class nsSJISProber: public nsCharSetProber { public: nsSJISProber(PRBool aIsPreferredLanguage) :mIsPreferredLanguage(aIsPreferredLanguage) {mCodingSM = new nsCodingStateMachine(&SJISSMModel); Reset();} virtual ~nsSJISProber(void){delete mCodingSM;} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "Shift_JIS";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} protected: nsCodingStateMachine* mCodingSM; nsProbingState mState; SJISContextAnalysis mContextAnalyser; SJISDistributionAnalysis mDistributionAnalyser; char mLastChar[2]; PRBool mIsPreferredLanguage; }; #endif /* nsSJISProber_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsUTF8Prober.cpp ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nsUTF8Prober.h" void nsUTF8Prober::Reset(void) { mCodingSM->Reset(); mNumOfMBChar = 0; mState = eDetecting; } nsProbingState nsUTF8Prober::HandleData(const char* aBuf, PRUint32 aLen) { nsSMState codingState; for (PRUint32 i = 0; i < aLen; i++) { codingState = mCodingSM->NextState(aBuf[i]); if (codingState == eItsMe) { mState = eFoundIt; break; } if (codingState == eStart) { if (mCodingSM->GetCurrentCharLen() >= 2) mNumOfMBChar++; } } if (mState == eDetecting) if (GetConfidence() >= SHORTCUT_THRESHOLD) mState = eFoundIt; return mState; } #define ONE_CHAR_PROB (0.50f) float nsUTF8Prober::GetConfidence(void) { if (mNumOfMBChar < 6) { float unlike = SURE_YES; for (PRUint32 i = 0; i < mNumOfMBChar; ++i) unlike *= ONE_CHAR_PROB; return (NO_DOUBT - unlike); } else return SURE_YES + (NO_DOUBT - SURE_YES)/2.0f; } ================================================ FILE: third_party/uchardet/uchardet/src/nsUTF8Prober.h ================================================ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsUTF8Prober_h__ #define nsUTF8Prober_h__ #include "nsCharSetProber.h" #include "nsCodingStateMachine.h" class nsUTF8Prober: public nsCharSetProber { public: nsUTF8Prober(){mNumOfMBChar = 0; mCodingSM = new nsCodingStateMachine(&UTF8SMModel); Reset(); } virtual ~nsUTF8Prober(){delete mCodingSM;} nsProbingState HandleData(const char* aBuf, PRUint32 aLen); const char* GetCharSetName() {return "UTF-8";} nsProbingState GetState(void) {return mState;} void Reset(void); float GetConfidence(void); void SetOpion() {} protected: nsCodingStateMachine* mCodingSM; nsProbingState mState; PRUint32 mNumOfMBChar; }; #endif /* nsUTF8Prober_h__ */ ================================================ FILE: third_party/uchardet/uchardet/src/nsUniversalDetector.cpp ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Shy Shalom * JoungKyun.Kim * - Add mDetectedConfidence * - Add mDetectedIsBOM * * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "nscore.h" #include "nsUniversalDetector.h" #include "nsMBCSGroupProber.h" #include "nsSBCSGroupProber.h" #include "nsEscCharsetProber.h" #include "nsLatin1Prober.h" nsUniversalDetector::nsUniversalDetector(PRUint32 aLanguageFilter) { mNbspFound = PR_FALSE; mDone = PR_FALSE; mInTag = PR_FALSE; mEscCharSetProber = nsnull; mStart = PR_TRUE; mDetectedCharset = nsnull; mDetectedConfidence = 0.0; mDetectedIsBOM = 0; mGotData = PR_FALSE; mInputState = ePureAscii; mLastChar = '\0'; mLanguageFilter = aLanguageFilter; PRUint32 i; for (i = 0; i < NUM_OF_CHARSET_PROBERS; i++) mCharSetProbers[i] = nsnull; } nsUniversalDetector::~nsUniversalDetector() { for (PRInt32 i = 0; i < NUM_OF_CHARSET_PROBERS; i++) delete mCharSetProbers[i]; delete mEscCharSetProber; } void nsUniversalDetector::Reset() { mNbspFound = PR_FALSE; mDone = PR_FALSE; mInTag = PR_FALSE; mStart = PR_TRUE; mDetectedCharset = nsnull; mDetectedConfidence = 0.0; mDetectedIsBOM = 0; mGotData = PR_FALSE; mInputState = ePureAscii; mLastChar = '\0'; if (mEscCharSetProber) mEscCharSetProber->Reset(); PRUint32 i; for (i = 0; i < NUM_OF_CHARSET_PROBERS; i++) if (mCharSetProbers[i]) mCharSetProbers[i]->Reset(); } //--------------------------------------------------------------------- nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen) { if(mDone) return NS_OK; if (aLen > 0) mGotData = PR_TRUE; //If the data starts with BOM, we know it is UTF if (mStart) { mStart = PR_FALSE; if (aLen > 3) switch (aBuf[0]) { case '\xEF': if (('\xBB' == aBuf[1]) && ('\xBF' == aBuf[2])) { // EF BB BF UTF-8 encoded BOM mDetectedCharset = "UTF-8"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } break; case '\xFE': if (('\xFF' == aBuf[1]) && ('\x00' == aBuf[2]) && ('\x00' == aBuf[3])) { // FE FF 00 00 UCS-4, unusual octet order BOM (3412) mDetectedCharset = "X-ISO-10646-UCS-4-3412"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } else if ('\xFF' == aBuf[1]) { // FE FF UTF-16, big endian BOM mDetectedCharset = "UTF-16BE"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } break; case '\x00': if (('\x00' == aBuf[1]) && ('\xFE' == aBuf[2]) && ('\xFF' == aBuf[3])) { // 00 00 FE FF UTF-32, big-endian BOM mDetectedCharset = "UTF-32BE"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } else if (('\x00' == aBuf[1]) && ('\xFF' == aBuf[2]) && ('\xFE' == aBuf[3])) { // 00 00 FF FE UCS-4, unusual octet order BOM (2143) mDetectedCharset = "X-ISO-10646-UCS-4-2143"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } break; case '\xFF': if (('\xFE' == aBuf[1]) && ('\x00' == aBuf[2]) && ('\x00' == aBuf[3])) { // FF FE 00 00 UTF-32, little-endian BOM mDetectedCharset = "UTF-32LE"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } else if ('\xFE' == aBuf[1]) { // FF FE UTF-16, little endian BOM mDetectedCharset = "UTF-16LE"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } break; case '\x2B': if (('\x2F' == aBuf[1]) && ('\x76' == aBuf[2])) { switch (aBuf[3]) { case '\x38': case '\x39': case '\x2B': case '\x2F': // https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding // 2B 2F 76 38 UTF-7 // 2B 2F 76 39 UTF-7 // 2B 2F 76 2B UTF-7 // 2B 2F 76 2F UTF-7 mDetectedCharset = "UTF-7"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; break; } } break; case '\xE7': if (('\x64' == aBuf[1]) && ('\x4C' == aBuf[2])) { // E7 64 4c UTF-1 encoded BOM mDetectedCharset = "UTF-1"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } break; case '\xDD': if (('\x73' == aBuf[1]) && ('\x66' == aBuf[2]) && ('\x73' == aBuf[3])) { // DD 73 66 73 UTF-EBCDIC encoded BOM mDetectedCharset = "UTF-EBCDIC"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } break; case '\x0E': if (('\xFE' == aBuf[1]) && ('\xFF' == aBuf[2])) { // 0E FE FF SCSU encoded BOM mDetectedCharset = "SCSU"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } break; case '\xFB': if (('\xEE' == aBuf[1]) && ('\x28' == aBuf[2])) { // FB EE 28 BOCU-1 encoded BOM mDetectedCharset = "BOCU-1"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } break; case '\x84': if (('\x31' == aBuf[1]) && ('\x95' == aBuf[2]) && ('\x33' == aBuf[3])) { // 84 31 95 33 GB18030 encoded BOM mDetectedCharset = "GB18030"; mDetectedConfidence = 1.0; mDetectedIsBOM = 1; } break; } // switch if (mDetectedCharset) { mDone = PR_TRUE; return NS_OK; } } PRUint32 i; for (i = 0; i < aLen; i++) { //other than 0xa0, if every othe character is ascii, the page is ascii if (aBuf[i] & '\x80' && aBuf[i] != '\xA0') //Since many Ascii only page contains NBSP { //we got a non-ascii byte (high-byte) if (mInputState != eHighbyte) { //adjust state mInputState = eHighbyte; //kill mEscCharSetProber if it is active if (mEscCharSetProber) { delete mEscCharSetProber; mEscCharSetProber = nsnull; } //start multibyte and singlebyte charset prober if (nsnull == mCharSetProbers[0]) { mCharSetProbers[0] = new nsMBCSGroupProber(mLanguageFilter); if (nsnull == mCharSetProbers[0]) return NS_ERROR_OUT_OF_MEMORY; } if (nsnull == mCharSetProbers[1] && (mLanguageFilter & NS_FILTER_NON_CJK)) { mCharSetProbers[1] = new nsSBCSGroupProber; if (nsnull == mCharSetProbers[1]) return NS_ERROR_OUT_OF_MEMORY; } if (nsnull == mCharSetProbers[2]) { mCharSetProbers[2] = new nsLatin1Prober; if (nsnull == mCharSetProbers[2]) return NS_ERROR_OUT_OF_MEMORY; } } } else { if (aBuf[i] == '\xA0') { mNbspFound = PR_TRUE; } //ok, just pure ascii so far else if ( ePureAscii == mInputState && (aBuf[i] == '\033' || (aBuf[i] == '{' && mLastChar == '~')) ) { //found escape character or HZ "~{" mInputState = eEscAscii; } mLastChar = aBuf[i]; } } nsProbingState st; switch (mInputState) { case eEscAscii: if (nsnull == mEscCharSetProber) { mEscCharSetProber = new nsEscCharSetProber(mLanguageFilter); if (nsnull == mEscCharSetProber) return NS_ERROR_OUT_OF_MEMORY; } st = mEscCharSetProber->HandleData(aBuf, aLen); mDone = PR_TRUE; if (st == eFoundIt) { mDetectedCharset = mEscCharSetProber->GetCharSetName(); mDetectedConfidence = mEscCharSetProber->GetConfidence(); } else { mDetectedCharset = mNbspFound ? "ISO-8859-1" : "ASCII"; mDetectedConfidence = 1.0; } break; case eHighbyte: for (i = 0; i < NUM_OF_CHARSET_PROBERS; i++) { if (mCharSetProbers[i]) { st = mCharSetProbers[i]->HandleData(aBuf, aLen); if (st == eFoundIt) { mDone = PR_TRUE; mDetectedCharset = mCharSetProbers[i]->GetCharSetName(); mDetectedConfidence = mCharSetProbers[i]->GetConfidence(); return NS_OK; } } } break; default: //pure ascii mDone = PR_TRUE; mDetectedCharset = mNbspFound ? "ISO-8859-1" : "ASCII"; mDetectedConfidence = 1.0; mDetectedIsBOM = 0; } return NS_OK; } //--------------------------------------------------------------------- void nsUniversalDetector::DataEnd() { if (!mGotData) { // we haven't got any data yet, return immediately // caller program sometimes call DataEnd before anything has been sent to detector return; } if (mDetectedCharset) { mDone = PR_TRUE; Report(mDetectedCharset, mDetectedConfidence); return; } switch (mInputState) { case eHighbyte: { float maxProberConfidence = (float)0.0; PRInt32 maxProber = 0; for (PRInt32 i = 0; i < NUM_OF_CHARSET_PROBERS; ++i) { if (mCharSetProbers[i]) { float const proberConfidence = mCharSetProbers[i]->GetConfidence(); if (proberConfidence > maxProberConfidence) { maxProberConfidence = proberConfidence; maxProber = i; } } } mDetectedConfidence = maxProberConfidence; //do not report anything because we are not confident of it, that's in fact a negative answer if (maxProberConfidence > MINIMUM_THRESHOLD) { Report(mCharSetProbers[maxProber]->GetCharSetName(), maxProberConfidence); mDetectedConfidence = mCharSetProbers[maxProber]->GetConfidence(); } } break; case eEscAscii: break; default: break; } return; } ================================================ FILE: third_party/uchardet/uchardet/src/nsUniversalDetector.h ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * JoungKyun.Kim * - Add mDetectedConfidence * - Add mDetectedIsBOM * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsUniversalDetector_h__ #define nsUniversalDetector_h__ class nsCharSetProber; #define NUM_OF_CHARSET_PROBERS 3 typedef enum { ePureAscii = 0, eEscAscii = 1, eHighbyte = 2 } nsInputState; #define NS_FILTER_CHINESE_SIMPLIFIED 0x01 #define NS_FILTER_CHINESE_TRADITIONAL 0x02 #define NS_FILTER_JAPANESE 0x04 #define NS_FILTER_KOREAN 0x08 #define NS_FILTER_NON_CJK 0x10 #define NS_FILTER_ALL 0x1F #define NS_FILTER_CHINESE (NS_FILTER_CHINESE_SIMPLIFIED | \ NS_FILTER_CHINESE_TRADITIONAL) #define NS_FILTER_CJK (NS_FILTER_CHINESE_SIMPLIFIED | \ NS_FILTER_CHINESE_TRADITIONAL | \ NS_FILTER_JAPANESE | \ NS_FILTER_KOREAN) class nsUniversalDetector { public: nsUniversalDetector(PRUint32 aLanguageFilter); virtual ~nsUniversalDetector(); virtual nsresult HandleData(const char* aBuf, PRUint32 aLen); virtual void DataEnd(void); protected: virtual void Report(const char* aCharset, float aConfidence) = 0; virtual void Reset(); nsInputState mInputState; PRBool mNbspFound; PRBool mDone; PRBool mInTag; PRBool mStart; PRBool mGotData; char mLastChar; const char * mDetectedCharset; float mDetectedConfidence; short mDetectedIsBOM; PRUint32 mLanguageFilter; nsCharSetProber *mCharSetProbers[NUM_OF_CHARSET_PROBERS]; nsCharSetProber *mEscCharSetProber; }; #endif ================================================ FILE: third_party/uchardet/uchardet/src/nscore.h ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Kohei TAKETA * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsDummyCore_h__ #define nsDummyCore_h__ typedef bool PRBool; typedef int PRInt32; typedef unsigned int PRUint32; typedef short PRInt16; typedef unsigned short PRUint16; typedef signed char PRInt8; typedef unsigned char PRUint8; #define nsnull nullptr #define PR_FALSE false #define PR_TRUE true #define MINIMUM_DATA_THRESHOLD 4 #define ENOUGH_DATA_THRESHOLD 1024 #define SURE_YES (0.95f) #define NO_DOUBT (1.00f) #define SURE_NO (NO_DOUBT - SURE_YES) #define SHORTCUT_THRESHOLD (SURE_YES - 0.02f) #define MINIMUM_THRESHOLD (0.20f) #ifndef min #define min(x,y) (((x) < (y)) ? (x) : (y)) #endif #ifdef _MSC_VER #ifdef strdup #undef strdup #endif #define strdup _strdup #endif enum nsresult { NS_OK, NS_ERROR_OUT_OF_MEMORY }; #endif ================================================ FILE: third_party/uchardet/uchardet/src/prmem.h ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Kohei TAKETA * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef nsDummyPrmem_h__ #define nsDummyPrmem_h__ #include inline void* PR_Malloc(size_t len) { return malloc(len); } #define PR_FREEIF(p) if (p) free(p) #endif ================================================ FILE: third_party/uchardet/uchardet/src/symbols.cmake ================================================ set( UCHARDET_SYMBOLS uchardet_new uchardet_delete uchardet_handle_data uchardet_data_end uchardet_reset uchardet_get_charset uchardet_get_confidence ) set (LINK_FLAGS "") if (APPLE) # Create a symbols_list file for the Darwin linker. string(REPLACE ";" "\n_" _symbols "${UCHARDET_SYMBOLS}") set(_symbols_list "${CMAKE_CURRENT_BINARY_DIR}/symbols.list") file(WRITE ${_symbols_list} "_${_symbols}\n") set(LINK_FLAGS "${LINK_FLAGS} -Wl,-exported_symbols_list,'${_symbols_list}'") elseif (CMAKE_CXX_COMPILER_ID STREQUAL GNU) # Create a version script for the GNU ld. set(_symbols "{ global: ${UCHARDET_SYMBOLS}; local: *; };") set(_version_script "${CMAKE_CURRENT_BINARY_DIR}/version.script") file(WRITE ${_version_script} "${_symbols}\n") set(LINK_FLAGS "${LINK_FLAGS} -Wl,--version-script,\"${_version_script}\"") endif (APPLE) set_target_properties( ${UCHARDET_LIBRARY} PROPERTIES LINK_FLAGS "${LINK_FLAGS}" ) ================================================ FILE: third_party/uchardet/uchardet/src/tables/Big5Freq.tab ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // Big5 frequency table // by Taiwan's Mandarin Promotion Council // /****************************************************************************** * 128 --> 0.42261 * 256 --> 0.57851 * 512 --> 0.74851 * 1024 --> 0.89384 * 2048 --> 0.97583 * * Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98 * Random Distribution Ration = 512/(5401-512)=0.105 * * Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR *****************************************************************************/ #define BIG5_TYPICAL_DISTRIBUTION_RATIO (float)0.75 //Char to FreqOrder table , #define BIG5_TABLE_SIZE 5376 static const PRInt16 Big5CharToFreqOrder[] = { 1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, // 16 3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, // 32 1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, // 48 63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, // 64 3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, // 80 4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, // 96 5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, // 112 630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, // 128 179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, // 144 995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, // 160 2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, // 176 1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, // 192 3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, // 208 706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, // 224 1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, // 240 3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, // 256 2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, // 272 437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, // 288 3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, // 304 1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, // 320 5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, // 336 266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, // 352 5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, // 368 1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, // 384 32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, // 400 188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, // 416 3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, // 432 3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, // 448 324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, // 464 2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, // 480 2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, // 496 314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, // 512 287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, // 528 3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, // 544 1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, // 560 1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, // 576 1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, // 592 2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, // 608 265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, // 624 4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, // 640 1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, // 656 5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, // 672 2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, // 688 383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, // 704 98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, // 720 523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, // 736 710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, // 752 5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, // 768 379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, // 784 1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, // 800 585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, // 816 690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, // 832 5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, // 848 1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, // 864 544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, // 880 3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, // 896 4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, // 912 3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, // 928 279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, // 944 610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, // 960 1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, // 976 4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, // 992 3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, // 1008 3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, // 1024 2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, // 1040 5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, // 1056 3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, // 1072 5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, // 1088 1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, // 1104 2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, // 1120 1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, // 1136 78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, // 1152 1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, // 1168 4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, // 1184 3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, // 1200 534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, // 1216 165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, // 1232 626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, // 1248 2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, // 1264 5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, // 1280 1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, // 1296 2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, // 1312 1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, // 1328 1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, // 1344 5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, // 1360 5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, // 1376 5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, // 1392 3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, // 1408 4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, // 1424 4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, // 1440 2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, // 1456 5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, // 1472 3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, // 1488 598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, // 1504 5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, // 1520 5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, // 1536 1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, // 1552 2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, // 1568 3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, // 1584 4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, // 1600 5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, // 1616 3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, // 1632 4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, // 1648 1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, // 1664 1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, // 1680 4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, // 1696 1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, // 1712 240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, // 1728 1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, // 1744 1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, // 1760 3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, // 1776 619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, // 1792 5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, // 1808 2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, // 1824 1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, // 1840 1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, // 1856 5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, // 1872 829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, // 1888 4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, // 1904 375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, // 1920 2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, // 1936 444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, // 1952 1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, // 1968 1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, // 1984 730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, // 2000 4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, // 2016 4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, // 2032 1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, // 2048 3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, // 2064 5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, // 2080 5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, // 2096 1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, // 2112 2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, // 2128 1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, // 2144 3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, // 2160 2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, // 2176 3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, // 2192 2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, // 2208 4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, // 2224 4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, // 2240 3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, // 2256 97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, // 2272 3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, // 2288 424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, // 2304 3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, // 2320 4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, // 2336 3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, // 2352 1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, // 2368 5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, // 2384 199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, // 2400 5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, // 2416 1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, // 2432 391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, // 2448 4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, // 2464 4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, // 2480 397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, // 2496 2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, // 2512 2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, // 2528 3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, // 2544 1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, // 2560 4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, // 2576 2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, // 2592 1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, // 2608 1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, // 2624 2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, // 2640 3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, // 2656 1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, // 2672 5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, // 2688 1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, // 2704 4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, // 2720 1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, // 2736 135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, // 2752 1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, // 2768 4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, // 2784 4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, // 2800 2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, // 2816 1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, // 2832 4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, // 2848 660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, // 2864 5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, // 2880 2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, // 2896 3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, // 2912 4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, // 2928 790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, // 2944 5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, // 2960 5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, // 2976 1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, // 2992 4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, // 3008 4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, // 3024 2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, // 3040 3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, // 3056 3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, // 3072 2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, // 3088 1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, // 3104 4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, // 3120 3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, // 3136 3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, // 3152 2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, // 3168 4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, // 3184 5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, // 3200 3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, // 3216 2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, // 3232 3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, // 3248 1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, // 3264 2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, // 3280 3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, // 3296 4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, // 3312 2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, // 3328 2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, // 3344 5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, // 3360 1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, // 3376 2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, // 3392 1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, // 3408 3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, // 3424 4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, // 3440 2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, // 3456 3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, // 3472 3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, // 3488 2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, // 3504 4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, // 3520 2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, // 3536 3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, // 3552 4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, // 3568 5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, // 3584 3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, // 3600 194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, // 3616 1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, // 3632 4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, // 3648 1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, // 3664 4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, // 3680 5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, // 3696 510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, // 3712 5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, // 3728 5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, // 3744 2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, // 3760 3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, // 3776 2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, // 3792 2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, // 3808 681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, // 3824 1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, // 3840 4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, // 3856 3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, // 3872 3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, // 3888 838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, // 3904 2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, // 3920 625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, // 3936 2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, // 3952 4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, // 3968 1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, // 3984 4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, // 4000 1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, // 4016 3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, // 4032 574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, // 4048 3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, // 4064 5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, // 4080 5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, // 4096 3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, // 4112 3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, // 4128 1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, // 4144 2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, // 4160 5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, // 4176 1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, // 4192 1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, // 4208 3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, // 4224 919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, // 4240 1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, // 4256 4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, // 4272 5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, // 4288 2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, // 4304 3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, // 4320 516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, // 4336 1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, // 4352 2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, // 4368 2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, // 4384 5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, // 4400 5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, // 4416 5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, // 4432 2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, // 4448 2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, // 4464 1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, // 4480 4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, // 4496 3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, // 4512 3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, // 4528 4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, // 4544 4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, // 4560 2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, // 4576 2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, // 4592 5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, // 4608 4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, // 4624 5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, // 4640 4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, // 4656 502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, // 4672 121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, // 4688 1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, // 4704 3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, // 4720 4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, // 4736 1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, // 4752 5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, // 4768 2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, // 4784 2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, // 4800 3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, // 4816 5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, // 4832 1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, // 4848 3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, // 4864 5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, // 4880 1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, // 4896 5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, // 4912 2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, // 4928 3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, // 4944 2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, // 4960 3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, // 4976 3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, // 4992 3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, // 5008 4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, // 5024 803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, // 5040 2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, // 5056 4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, // 5072 3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, // 5088 5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, // 5104 1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, // 5120 5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, // 5136 425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, // 5152 1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, // 5168 479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, // 5184 4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, // 5200 1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, // 5216 4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, // 5232 1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, // 5248 433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, // 5264 3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, // 5280 4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, // 5296 5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, // 5312 938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, // 5328 3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, // 5344 890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, // 5360 2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, // 5376 //last 512 /*************************************************************************************** *Everything below is of no interest for detection purpose * *************************************************************************************** 2522,1613,4812,5799,3345,3945,2523,5800,4162,5801,1637,4163,2471,4813,3946,5802, // 5392 2500,3034,3800,5803,5804,2195,4814,5805,2163,5806,5807,5808,5809,5810,5811,5812, // 5408 5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828, // 5424 5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844, // 5440 5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856,5857,5858,5859,5860, // 5456 5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872,5873,5874,5875,5876, // 5472 5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888,5889,5890,5891,5892, // 5488 5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905,5906,5907,5908, // 5504 5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920,5921,5922,5923,5924, // 5520 5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936,5937,5938,5939,5940, // 5536 5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952,5953,5954,5955,5956, // 5552 5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968,5969,5970,5971,5972, // 5568 5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984,5985,5986,5987,5988, // 5584 5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004, // 5600 6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020, // 5616 6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032,6033,6034,6035,6036, // 5632 6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052, // 5648 6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068, // 5664 6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084, // 5680 6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100, // 5696 6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116, // 5712 6117,6118,6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,6132, // 5728 6133,6134,6135,6136,6137,6138,6139,6140,6141,6142,6143,6144,6145,6146,6147,6148, // 5744 6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163,6164, // 5760 6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179,6180, // 5776 6181,6182,6183,6184,6185,6186,6187,6188,6189,6190,6191,6192,6193,6194,6195,6196, // 5792 6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210,6211,6212, // 5808 6213,6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,3670,6224,6225,6226,6227, // 5824 6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241,6242,6243, // 5840 6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,6254,6255,6256,6257,6258,6259, // 5856 6260,6261,6262,6263,6264,6265,6266,6267,6268,6269,6270,6271,6272,6273,6274,6275, // 5872 6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,4815,6286,6287,6288,6289,6290, // 5888 6291,6292,4816,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,6303,6304,6305, // 5904 6306,6307,6308,6309,6310,6311,4817,4818,6312,6313,6314,6315,6316,6317,6318,4819, // 5920 6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333,6334, // 5936 6335,6336,6337,4820,6338,6339,6340,6341,6342,6343,6344,6345,6346,6347,6348,6349, // 5952 6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363,6364,6365, // 5968 6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379,6380,6381, // 5984 6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395,6396,6397, // 6000 6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,3441,6411,6412, // 6016 6413,6414,6415,6416,6417,6418,6419,6420,6421,6422,6423,6424,6425,4440,6426,6427, // 6032 6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,6439,6440,6441,6442,6443, // 6048 6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,4821,6455,6456,6457,6458, // 6064 6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472,6473,6474, // 6080 6475,6476,6477,3947,3948,6478,6479,6480,6481,3272,4441,6482,6483,6484,6485,4442, // 6096 6486,6487,6488,6489,6490,6491,6492,6493,6494,6495,6496,4822,6497,6498,6499,6500, // 6112 6501,6502,6503,6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516, // 6128 6517,6518,6519,6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532, // 6144 6533,6534,6535,6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548, // 6160 6549,6550,6551,6552,6553,6554,6555,6556,2784,6557,4823,6558,6559,6560,6561,6562, // 6176 6563,6564,6565,6566,6567,6568,6569,3949,6570,6571,6572,4824,6573,6574,6575,6576, // 6192 6577,6578,6579,6580,6581,6582,6583,4825,6584,6585,6586,3950,2785,6587,6588,6589, // 6208 6590,6591,6592,6593,6594,6595,6596,6597,6598,6599,6600,6601,6602,6603,6604,6605, // 6224 6606,6607,6608,6609,6610,6611,6612,4826,6613,6614,6615,4827,6616,6617,6618,6619, // 6240 6620,6621,6622,6623,6624,6625,4164,6626,6627,6628,6629,6630,6631,6632,6633,6634, // 6256 3547,6635,4828,6636,6637,6638,6639,6640,6641,6642,3951,2984,6643,6644,6645,6646, // 6272 6647,6648,6649,4165,6650,4829,6651,6652,4830,6653,6654,6655,6656,6657,6658,6659, // 6288 6660,6661,6662,4831,6663,6664,6665,6666,6667,6668,6669,6670,6671,4166,6672,4832, // 6304 3952,6673,6674,6675,6676,4833,6677,6678,6679,4167,6680,6681,6682,3198,6683,6684, // 6320 6685,6686,6687,6688,6689,6690,6691,6692,6693,6694,6695,6696,6697,4834,6698,6699, // 6336 6700,6701,6702,6703,6704,6705,6706,6707,6708,6709,6710,6711,6712,6713,6714,6715, // 6352 6716,6717,6718,6719,6720,6721,6722,6723,6724,6725,6726,6727,6728,6729,6730,6731, // 6368 6732,6733,6734,4443,6735,6736,6737,6738,6739,6740,6741,6742,6743,6744,6745,4444, // 6384 6746,6747,6748,6749,6750,6751,6752,6753,6754,6755,6756,6757,6758,6759,6760,6761, // 6400 6762,6763,6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777, // 6416 6778,6779,6780,6781,4168,6782,6783,3442,6784,6785,6786,6787,6788,6789,6790,6791, // 6432 4169,6792,6793,6794,6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806, // 6448 6807,6808,6809,6810,6811,4835,6812,6813,6814,4445,6815,6816,4446,6817,6818,6819, // 6464 6820,6821,6822,6823,6824,6825,6826,6827,6828,6829,6830,6831,6832,6833,6834,6835, // 6480 3548,6836,6837,6838,6839,6840,6841,6842,6843,6844,6845,6846,4836,6847,6848,6849, // 6496 6850,6851,6852,6853,6854,3953,6855,6856,6857,6858,6859,6860,6861,6862,6863,6864, // 6512 6865,6866,6867,6868,6869,6870,6871,6872,6873,6874,6875,6876,6877,3199,6878,6879, // 6528 6880,6881,6882,4447,6883,6884,6885,6886,6887,6888,6889,6890,6891,6892,6893,6894, // 6544 6895,6896,6897,6898,6899,6900,6901,6902,6903,6904,4170,6905,6906,6907,6908,6909, // 6560 6910,6911,6912,6913,6914,6915,6916,6917,6918,6919,6920,6921,6922,6923,6924,6925, // 6576 6926,6927,4837,6928,6929,6930,6931,6932,6933,6934,6935,6936,3346,6937,6938,4838, // 6592 6939,6940,6941,4448,6942,6943,6944,6945,6946,4449,6947,6948,6949,6950,6951,6952, // 6608 6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966,6967,6968, // 6624 6969,6970,6971,6972,6973,6974,6975,6976,6977,6978,6979,6980,6981,6982,6983,6984, // 6640 6985,6986,6987,6988,6989,6990,6991,6992,6993,6994,3671,6995,6996,6997,6998,4839, // 6656 6999,7000,7001,7002,3549,7003,7004,7005,7006,7007,7008,7009,7010,7011,7012,7013, // 6672 7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027,7028,7029, // 6688 7030,4840,7031,7032,7033,7034,7035,7036,7037,7038,4841,7039,7040,7041,7042,7043, // 6704 7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058,7059, // 6720 7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,2985,7071,7072,7073,7074, // 6736 7075,7076,7077,7078,7079,7080,4842,7081,7082,7083,7084,7085,7086,7087,7088,7089, // 6752 7090,7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105, // 6768 7106,7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,4450,7119,7120, // 6784 7121,7122,7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136, // 6800 7137,7138,7139,7140,7141,7142,7143,4843,7144,7145,7146,7147,7148,7149,7150,7151, // 6816 7152,7153,7154,7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167, // 6832 7168,7169,7170,7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183, // 6848 7184,7185,7186,7187,7188,4171,4172,7189,7190,7191,7192,7193,7194,7195,7196,7197, // 6864 7198,7199,7200,7201,7202,7203,7204,7205,7206,7207,7208,7209,7210,7211,7212,7213, // 6880 7214,7215,7216,7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229, // 6896 7230,7231,7232,7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245, // 6912 7246,7247,7248,7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261, // 6928 7262,7263,7264,7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277, // 6944 7278,7279,7280,7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293, // 6960 7294,7295,7296,4844,7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308, // 6976 7309,7310,7311,7312,7313,7314,7315,7316,4451,7317,7318,7319,7320,7321,7322,7323, // 6992 7324,7325,7326,7327,7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339, // 7008 7340,7341,7342,7343,7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,4173,7354, // 7024 7355,4845,7356,7357,7358,7359,7360,7361,7362,7363,7364,7365,7366,7367,7368,7369, // 7040 7370,7371,7372,7373,7374,7375,7376,7377,7378,7379,7380,7381,7382,7383,7384,7385, // 7056 7386,7387,7388,4846,7389,7390,7391,7392,7393,7394,7395,7396,7397,7398,7399,7400, // 7072 7401,7402,7403,7404,7405,3672,7406,7407,7408,7409,7410,7411,7412,7413,7414,7415, // 7088 7416,7417,7418,7419,7420,7421,7422,7423,7424,7425,7426,7427,7428,7429,7430,7431, // 7104 7432,7433,7434,7435,7436,7437,7438,7439,7440,7441,7442,7443,7444,7445,7446,7447, // 7120 7448,7449,7450,7451,7452,7453,4452,7454,3200,7455,7456,7457,7458,7459,7460,7461, // 7136 7462,7463,7464,7465,7466,7467,7468,7469,7470,7471,7472,7473,7474,4847,7475,7476, // 7152 7477,3133,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487,7488,7489,7490,7491, // 7168 7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,3347,7503,7504,7505,7506, // 7184 7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519,7520,7521,4848, // 7200 7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537, // 7216 7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,3801,4849,7550,7551, // 7232 7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567, // 7248 7568,7569,3035,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582, // 7264 7583,7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598, // 7280 7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614, // 7296 7615,7616,4850,7617,7618,3802,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628, // 7312 7629,7630,7631,7632,4851,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643, // 7328 7644,7645,7646,7647,7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659, // 7344 7660,7661,7662,7663,7664,7665,7666,7667,7668,7669,7670,4453,7671,7672,7673,7674, // 7360 7675,7676,7677,7678,7679,7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690, // 7376 7691,7692,7693,7694,7695,7696,7697,3443,7698,7699,7700,7701,7702,4454,7703,7704, // 7392 7705,7706,7707,7708,7709,7710,7711,7712,7713,2472,7714,7715,7716,7717,7718,7719, // 7408 7720,7721,7722,7723,7724,7725,7726,7727,7728,7729,7730,7731,3954,7732,7733,7734, // 7424 7735,7736,7737,7738,7739,7740,7741,7742,7743,7744,7745,7746,7747,7748,7749,7750, // 7440 3134,7751,7752,4852,7753,7754,7755,4853,7756,7757,7758,7759,7760,4174,7761,7762, // 7456 7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,7777,7778, // 7472 7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791,7792,7793,7794, // 7488 7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,4854,7806,7807,7808,7809, // 7504 7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824,7825, // 7520 4855,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840, // 7536 7841,7842,7843,7844,7845,7846,7847,3955,7848,7849,7850,7851,7852,7853,7854,7855, // 7552 7856,7857,7858,7859,7860,3444,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870, // 7568 7871,7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886, // 7584 7887,7888,7889,7890,7891,4175,7892,7893,7894,7895,7896,4856,4857,7897,7898,7899, // 7600 7900,2598,7901,7902,7903,7904,7905,7906,7907,7908,4455,7909,7910,7911,7912,7913, // 7616 7914,3201,7915,7916,7917,7918,7919,7920,7921,4858,7922,7923,7924,7925,7926,7927, // 7632 7928,7929,7930,7931,7932,7933,7934,7935,7936,7937,7938,7939,7940,7941,7942,7943, // 7648 7944,7945,7946,7947,7948,7949,7950,7951,7952,7953,7954,7955,7956,7957,7958,7959, // 7664 7960,7961,7962,7963,7964,7965,7966,7967,7968,7969,7970,7971,7972,7973,7974,7975, // 7680 7976,7977,7978,7979,7980,7981,4859,7982,7983,7984,7985,7986,7987,7988,7989,7990, // 7696 7991,7992,7993,7994,7995,7996,4860,7997,7998,7999,8000,8001,8002,8003,8004,8005, // 7712 8006,8007,8008,8009,8010,8011,8012,8013,8014,8015,8016,4176,8017,8018,8019,8020, // 7728 8021,8022,8023,4861,8024,8025,8026,8027,8028,8029,8030,8031,8032,8033,8034,8035, // 7744 8036,4862,4456,8037,8038,8039,8040,4863,8041,8042,8043,8044,8045,8046,8047,8048, // 7760 8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063,8064, // 7776 8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079,8080, // 7792 8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095,8096, // 7808 8097,8098,8099,4864,4177,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110, // 7824 8111,8112,8113,8114,8115,8116,8117,8118,8119,8120,4178,8121,8122,8123,8124,8125, // 7840 8126,8127,8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141, // 7856 8142,8143,8144,8145,4865,4866,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155, // 7872 8156,8157,8158,8159,8160,8161,8162,8163,8164,8165,4179,8166,8167,8168,8169,8170, // 7888 8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181,4457,8182,8183,8184,8185, // 7904 8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201, // 7920 8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213,8214,8215,8216,8217, // 7936 8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229,8230,8231,8232,8233, // 7952 8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245,8246,8247,8248,8249, // 7968 8250,8251,8252,8253,8254,8255,8256,3445,8257,8258,8259,8260,8261,8262,4458,8263, // 7984 8264,8265,8266,8267,8268,8269,8270,8271,8272,4459,8273,8274,8275,8276,3550,8277, // 8000 8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,4460,8290,8291,8292, // 8016 8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,4867, // 8032 8308,8309,8310,8311,8312,3551,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322, // 8048 8323,8324,8325,8326,4868,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337, // 8064 8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353, // 8080 8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,4869,4461,8364,8365,8366,8367, // 8096 8368,8369,8370,4870,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382, // 8112 8383,8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398, // 8128 8399,8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,4871,8411,8412,8413, // 8144 8414,8415,8416,8417,8418,8419,8420,8421,8422,4462,8423,8424,8425,8426,8427,8428, // 8160 8429,8430,8431,8432,8433,2986,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443, // 8176 8444,8445,8446,8447,8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459, // 8192 8460,8461,8462,8463,8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475, // 8208 8476,8477,8478,4180,8479,8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490, // 8224 8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506, // 8240 8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522, // 8256 8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538, // 8272 8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554, // 8288 8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,4872,8565,8566,8567,8568,8569, // 8304 8570,8571,8572,8573,4873,8574,8575,8576,8577,8578,8579,8580,8581,8582,8583,8584, // 8320 8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597,8598,8599,8600, // 8336 8601,8602,8603,8604,8605,3803,8606,8607,8608,8609,8610,8611,8612,8613,4874,3804, // 8352 8614,8615,8616,8617,8618,8619,8620,8621,3956,8622,8623,8624,8625,8626,8627,8628, // 8368 8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,2865,8639,8640,8641,8642,8643, // 8384 8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,4463,8657,8658, // 8400 8659,4875,4876,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672, // 8416 8673,8674,8675,8676,8677,8678,8679,8680,8681,4464,8682,8683,8684,8685,8686,8687, // 8432 8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703, // 8448 8704,8705,8706,8707,8708,8709,2261,8710,8711,8712,8713,8714,8715,8716,8717,8718, // 8464 8719,8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,4181, // 8480 8734,8735,8736,8737,8738,8739,8740,8741,8742,8743,8744,8745,8746,8747,8748,8749, // 8496 8750,8751,8752,8753,8754,8755,8756,8757,8758,8759,8760,8761,8762,8763,4877,8764, // 8512 8765,8766,8767,8768,8769,8770,8771,8772,8773,8774,8775,8776,8777,8778,8779,8780, // 8528 8781,8782,8783,8784,8785,8786,8787,8788,4878,8789,4879,8790,8791,8792,4880,8793, // 8544 8794,8795,8796,8797,8798,8799,8800,8801,4881,8802,8803,8804,8805,8806,8807,8808, // 8560 8809,8810,8811,8812,8813,8814,8815,3957,8816,8817,8818,8819,8820,8821,8822,8823, // 8576 8824,8825,8826,8827,8828,8829,8830,8831,8832,8833,8834,8835,8836,8837,8838,8839, // 8592 8840,8841,8842,8843,8844,8845,8846,8847,4882,8848,8849,8850,8851,8852,8853,8854, // 8608 8855,8856,8857,8858,8859,8860,8861,8862,8863,8864,8865,8866,8867,8868,8869,8870, // 8624 8871,8872,8873,8874,8875,8876,8877,8878,8879,8880,8881,8882,8883,8884,3202,8885, // 8640 8886,8887,8888,8889,8890,8891,8892,8893,8894,8895,8896,8897,8898,8899,8900,8901, // 8656 8902,8903,8904,8905,8906,8907,8908,8909,8910,8911,8912,8913,8914,8915,8916,8917, // 8672 8918,8919,8920,8921,8922,8923,8924,4465,8925,8926,8927,8928,8929,8930,8931,8932, // 8688 4883,8933,8934,8935,8936,8937,8938,8939,8940,8941,8942,8943,2214,8944,8945,8946, // 8704 8947,8948,8949,8950,8951,8952,8953,8954,8955,8956,8957,8958,8959,8960,8961,8962, // 8720 8963,8964,8965,4884,8966,8967,8968,8969,8970,8971,8972,8973,8974,8975,8976,8977, // 8736 8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,4885, // 8752 8993,8994,8995,8996,8997,8998,8999,9000,9001,9002,9003,9004,9005,9006,9007,9008, // 8768 9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020,9021,4182,9022,9023, // 8784 9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037,9038,9039, // 8800 9040,9041,9042,9043,9044,9045,9046,9047,9048,9049,9050,9051,9052,9053,9054,9055, // 8816 9056,9057,9058,9059,9060,9061,9062,9063,4886,9064,9065,9066,9067,9068,9069,4887, // 8832 9070,9071,9072,9073,9074,9075,9076,9077,9078,9079,9080,9081,9082,9083,9084,9085, // 8848 9086,9087,9088,9089,9090,9091,9092,9093,9094,9095,9096,9097,9098,9099,9100,9101, // 8864 9102,9103,9104,9105,9106,9107,9108,9109,9110,9111,9112,9113,9114,9115,9116,9117, // 8880 9118,9119,9120,9121,9122,9123,9124,9125,9126,9127,9128,9129,9130,9131,9132,9133, // 8896 9134,9135,9136,9137,9138,9139,9140,9141,3958,9142,9143,9144,9145,9146,9147,9148, // 8912 9149,9150,9151,4888,9152,9153,9154,9155,9156,9157,9158,9159,9160,9161,9162,9163, // 8928 9164,9165,9166,9167,9168,9169,9170,9171,9172,9173,9174,9175,4889,9176,9177,9178, // 8944 9179,9180,9181,9182,9183,9184,9185,9186,9187,9188,9189,9190,9191,9192,9193,9194, // 8960 9195,9196,9197,9198,9199,9200,9201,9202,9203,4890,9204,9205,9206,9207,9208,9209, // 8976 9210,9211,9212,9213,9214,9215,9216,9217,9218,9219,9220,9221,9222,4466,9223,9224, // 8992 9225,9226,9227,9228,9229,9230,9231,9232,9233,9234,9235,9236,9237,9238,9239,9240, // 9008 9241,9242,9243,9244,9245,4891,9246,9247,9248,9249,9250,9251,9252,9253,9254,9255, // 9024 9256,9257,4892,9258,9259,9260,9261,4893,4894,9262,9263,9264,9265,9266,9267,9268, // 9040 9269,9270,9271,9272,9273,4467,9274,9275,9276,9277,9278,9279,9280,9281,9282,9283, // 9056 9284,9285,3673,9286,9287,9288,9289,9290,9291,9292,9293,9294,9295,9296,9297,9298, // 9072 9299,9300,9301,9302,9303,9304,9305,9306,9307,9308,9309,9310,9311,9312,9313,9314, // 9088 9315,9316,9317,9318,9319,9320,9321,9322,4895,9323,9324,9325,9326,9327,9328,9329, // 9104 9330,9331,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345, // 9120 9346,9347,4468,9348,9349,9350,9351,9352,9353,9354,9355,9356,9357,9358,9359,9360, // 9136 9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9372,9373,4896,9374,4469, // 9152 9375,9376,9377,9378,9379,4897,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389, // 9168 9390,9391,9392,9393,9394,9395,9396,9397,9398,9399,9400,9401,9402,9403,9404,9405, // 9184 9406,4470,9407,2751,9408,9409,3674,3552,9410,9411,9412,9413,9414,9415,9416,9417, // 9200 9418,9419,9420,9421,4898,9422,9423,9424,9425,9426,9427,9428,9429,3959,9430,9431, // 9216 9432,9433,9434,9435,9436,4471,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446, // 9232 9447,9448,9449,9450,3348,9451,9452,9453,9454,9455,9456,9457,9458,9459,9460,9461, // 9248 9462,9463,9464,9465,9466,9467,9468,9469,9470,9471,9472,4899,9473,9474,9475,9476, // 9264 9477,4900,9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,3349,9489,9490, // 9280 9491,9492,9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506, // 9296 9507,9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,4901,9521, // 9312 9522,9523,9524,9525,9526,4902,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536, // 9328 9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,9548,9549,9550,9551,9552, // 9344 9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568, // 9360 9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584, // 9376 3805,9585,9586,9587,9588,9589,9590,9591,9592,9593,9594,9595,9596,9597,9598,9599, // 9392 9600,9601,9602,4903,9603,9604,9605,9606,9607,4904,9608,9609,9610,9611,9612,9613, // 9408 9614,4905,9615,9616,9617,9618,9619,9620,9621,9622,9623,9624,9625,9626,9627,9628, // 9424 9629,9630,9631,9632,4906,9633,9634,9635,9636,9637,9638,9639,9640,9641,9642,9643, // 9440 4907,9644,9645,9646,9647,9648,9649,9650,9651,9652,9653,9654,9655,9656,9657,9658, // 9456 9659,9660,9661,9662,9663,9664,9665,9666,9667,9668,9669,9670,9671,9672,4183,9673, // 9472 9674,9675,9676,9677,4908,9678,9679,9680,9681,4909,9682,9683,9684,9685,9686,9687, // 9488 9688,9689,9690,4910,9691,9692,9693,3675,9694,9695,9696,2945,9697,9698,9699,9700, // 9504 9701,9702,9703,9704,9705,4911,9706,9707,9708,9709,9710,9711,9712,9713,9714,9715, // 9520 9716,9717,9718,9719,9720,9721,9722,9723,9724,9725,9726,9727,9728,9729,9730,9731, // 9536 9732,9733,9734,9735,4912,9736,9737,9738,9739,9740,4913,9741,9742,9743,9744,9745, // 9552 9746,9747,9748,9749,9750,9751,9752,9753,9754,9755,9756,9757,9758,4914,9759,9760, // 9568 9761,9762,9763,9764,9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776, // 9584 9777,9778,9779,9780,9781,9782,4915,9783,9784,9785,9786,9787,9788,9789,9790,9791, // 9600 9792,9793,4916,9794,9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806, // 9616 9807,9808,9809,9810,9811,9812,9813,9814,9815,9816,9817,9818,9819,9820,9821,9822, // 9632 9823,9824,9825,9826,9827,9828,9829,9830,9831,9832,9833,9834,9835,9836,9837,9838, // 9648 9839,9840,9841,9842,9843,9844,9845,9846,9847,9848,9849,9850,9851,9852,9853,9854, // 9664 9855,9856,9857,9858,9859,9860,9861,9862,9863,9864,9865,9866,9867,9868,4917,9869, // 9680 9870,9871,9872,9873,9874,9875,9876,9877,9878,9879,9880,9881,9882,9883,9884,9885, // 9696 9886,9887,9888,9889,9890,9891,9892,4472,9893,9894,9895,9896,9897,3806,9898,9899, // 9712 9900,9901,9902,9903,9904,9905,9906,9907,9908,9909,9910,9911,9912,9913,9914,4918, // 9728 9915,9916,9917,4919,9918,9919,9920,9921,4184,9922,9923,9924,9925,9926,9927,9928, // 9744 9929,9930,9931,9932,9933,9934,9935,9936,9937,9938,9939,9940,9941,9942,9943,9944, // 9760 9945,9946,4920,9947,9948,9949,9950,9951,9952,9953,9954,9955,4185,9956,9957,9958, // 9776 9959,9960,9961,9962,9963,9964,9965,4921,9966,9967,9968,4473,9969,9970,9971,9972, // 9792 9973,9974,9975,9976,9977,4474,9978,9979,9980,9981,9982,9983,9984,9985,9986,9987, // 9808 9988,9989,9990,9991,9992,9993,9994,9995,9996,9997,9998,9999,10000,10001,10002,10003, // 9824 10004,10005,10006,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10017,10018,10019, // 9840 10020,10021,4922,10022,4923,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033, // 9856 10034,10035,10036,10037,10038,10039,10040,10041,10042,10043,10044,10045,10046,10047,10048,4924, // 9872 10049,10050,10051,10052,10053,10054,10055,10056,10057,10058,10059,10060,10061,10062,10063,10064, // 9888 10065,10066,10067,10068,10069,10070,10071,10072,10073,10074,10075,10076,10077,10078,10079,10080, // 9904 10081,10082,10083,10084,10085,10086,10087,4475,10088,10089,10090,10091,10092,10093,10094,10095, // 9920 10096,10097,4476,10098,10099,10100,10101,10102,10103,10104,10105,10106,10107,10108,10109,10110, // 9936 10111,2174,10112,10113,10114,10115,10116,10117,10118,10119,10120,10121,10122,10123,10124,10125, // 9952 10126,10127,10128,10129,10130,10131,10132,10133,10134,10135,10136,10137,10138,10139,10140,3807, // 9968 4186,4925,10141,10142,10143,10144,10145,10146,10147,4477,4187,10148,10149,10150,10151,10152, // 9984 10153,4188,10154,10155,10156,10157,10158,10159,10160,10161,4926,10162,10163,10164,10165,10166, //10000 10167,10168,10169,10170,10171,10172,10173,10174,10175,10176,10177,10178,10179,10180,10181,10182, //10016 10183,10184,10185,10186,10187,10188,10189,10190,10191,10192,3203,10193,10194,10195,10196,10197, //10032 10198,10199,10200,4478,10201,10202,10203,10204,4479,10205,10206,10207,10208,10209,10210,10211, //10048 10212,10213,10214,10215,10216,10217,10218,10219,10220,10221,10222,10223,10224,10225,10226,10227, //10064 10228,10229,10230,10231,10232,10233,10234,4927,10235,10236,10237,10238,10239,10240,10241,10242, //10080 10243,10244,10245,10246,10247,10248,10249,10250,10251,10252,10253,10254,10255,10256,10257,10258, //10096 10259,10260,10261,10262,10263,10264,10265,10266,10267,10268,10269,10270,10271,10272,10273,4480, //10112 4928,4929,10274,10275,10276,10277,10278,10279,10280,10281,10282,10283,10284,10285,10286,10287, //10128 10288,10289,10290,10291,10292,10293,10294,10295,10296,10297,10298,10299,10300,10301,10302,10303, //10144 10304,10305,10306,10307,10308,10309,10310,10311,10312,10313,10314,10315,10316,10317,10318,10319, //10160 10320,10321,10322,10323,10324,10325,10326,10327,10328,10329,10330,10331,10332,10333,10334,4930, //10176 10335,10336,10337,10338,10339,10340,10341,10342,4931,10343,10344,10345,10346,10347,10348,10349, //10192 10350,10351,10352,10353,10354,10355,3088,10356,2786,10357,10358,10359,10360,4189,10361,10362, //10208 10363,10364,10365,10366,10367,10368,10369,10370,10371,10372,10373,10374,10375,4932,10376,10377, //10224 10378,10379,10380,10381,10382,10383,10384,10385,10386,10387,10388,10389,10390,10391,10392,4933, //10240 10393,10394,10395,4934,10396,10397,10398,10399,10400,10401,10402,10403,10404,10405,10406,10407, //10256 10408,10409,10410,10411,10412,3446,10413,10414,10415,10416,10417,10418,10419,10420,10421,10422, //10272 10423,4935,10424,10425,10426,10427,10428,10429,10430,4936,10431,10432,10433,10434,10435,10436, //10288 10437,10438,10439,10440,10441,10442,10443,4937,10444,10445,10446,10447,4481,10448,10449,10450, //10304 10451,10452,10453,10454,10455,10456,10457,10458,10459,10460,10461,10462,10463,10464,10465,10466, //10320 10467,10468,10469,10470,10471,10472,10473,10474,10475,10476,10477,10478,10479,10480,10481,10482, //10336 10483,10484,10485,10486,10487,10488,10489,10490,10491,10492,10493,10494,10495,10496,10497,10498, //10352 10499,10500,10501,10502,10503,10504,10505,4938,10506,10507,10508,10509,10510,2552,10511,10512, //10368 10513,10514,10515,10516,3447,10517,10518,10519,10520,10521,10522,10523,10524,10525,10526,10527, //10384 10528,10529,10530,10531,10532,10533,10534,10535,10536,10537,10538,10539,10540,10541,10542,10543, //10400 4482,10544,4939,10545,10546,10547,10548,10549,10550,10551,10552,10553,10554,10555,10556,10557, //10416 10558,10559,10560,10561,10562,10563,10564,10565,10566,10567,3676,4483,10568,10569,10570,10571, //10432 10572,3448,10573,10574,10575,10576,10577,10578,10579,10580,10581,10582,10583,10584,10585,10586, //10448 10587,10588,10589,10590,10591,10592,10593,10594,10595,10596,10597,10598,10599,10600,10601,10602, //10464 10603,10604,10605,10606,10607,10608,10609,10610,10611,10612,10613,10614,10615,10616,10617,10618, //10480 10619,10620,10621,10622,10623,10624,10625,10626,10627,4484,10628,10629,10630,10631,10632,4940, //10496 10633,10634,10635,10636,10637,10638,10639,10640,10641,10642,10643,10644,10645,10646,10647,10648, //10512 10649,10650,10651,10652,10653,10654,10655,10656,4941,10657,10658,10659,2599,10660,10661,10662, //10528 10663,10664,10665,10666,3089,10667,10668,10669,10670,10671,10672,10673,10674,10675,10676,10677, //10544 10678,10679,10680,4942,10681,10682,10683,10684,10685,10686,10687,10688,10689,10690,10691,10692, //10560 10693,10694,10695,10696,10697,4485,10698,10699,10700,10701,10702,10703,10704,4943,10705,3677, //10576 10706,10707,10708,10709,10710,10711,10712,4944,10713,10714,10715,10716,10717,10718,10719,10720, //10592 10721,10722,10723,10724,10725,10726,10727,10728,4945,10729,10730,10731,10732,10733,10734,10735, //10608 10736,10737,10738,10739,10740,10741,10742,10743,10744,10745,10746,10747,10748,10749,10750,10751, //10624 10752,10753,10754,10755,10756,10757,10758,10759,10760,10761,4946,10762,10763,10764,10765,10766, //10640 10767,4947,4948,10768,10769,10770,10771,10772,10773,10774,10775,10776,10777,10778,10779,10780, //10656 10781,10782,10783,10784,10785,10786,10787,10788,10789,10790,10791,10792,10793,10794,10795,10796, //10672 10797,10798,10799,10800,10801,10802,10803,10804,10805,10806,10807,10808,10809,10810,10811,10812, //10688 10813,10814,10815,10816,10817,10818,10819,10820,10821,10822,10823,10824,10825,10826,10827,10828, //10704 10829,10830,10831,10832,10833,10834,10835,10836,10837,10838,10839,10840,10841,10842,10843,10844, //10720 10845,10846,10847,10848,10849,10850,10851,10852,10853,10854,10855,10856,10857,10858,10859,10860, //10736 10861,10862,10863,10864,10865,10866,10867,10868,10869,10870,10871,10872,10873,10874,10875,10876, //10752 10877,10878,4486,10879,10880,10881,10882,10883,10884,10885,4949,10886,10887,10888,10889,10890, //10768 10891,10892,10893,10894,10895,10896,10897,10898,10899,10900,10901,10902,10903,10904,10905,10906, //10784 10907,10908,10909,10910,10911,10912,10913,10914,10915,10916,10917,10918,10919,4487,10920,10921, //10800 10922,10923,10924,10925,10926,10927,10928,10929,10930,10931,10932,4950,10933,10934,10935,10936, //10816 10937,10938,10939,10940,10941,10942,10943,10944,10945,10946,10947,10948,10949,4488,10950,10951, //10832 10952,10953,10954,10955,10956,10957,10958,10959,4190,10960,10961,10962,10963,10964,10965,10966, //10848 10967,10968,10969,10970,10971,10972,10973,10974,10975,10976,10977,10978,10979,10980,10981,10982, //10864 10983,10984,10985,10986,10987,10988,10989,10990,10991,10992,10993,10994,10995,10996,10997,10998, //10880 10999,11000,11001,11002,11003,11004,11005,11006,3960,11007,11008,11009,11010,11011,11012,11013, //10896 11014,11015,11016,11017,11018,11019,11020,11021,11022,11023,11024,11025,11026,11027,11028,11029, //10912 11030,11031,11032,4951,11033,11034,11035,11036,11037,11038,11039,11040,11041,11042,11043,11044, //10928 11045,11046,11047,4489,11048,11049,11050,11051,4952,11052,11053,11054,11055,11056,11057,11058, //10944 4953,11059,11060,11061,11062,11063,11064,11065,11066,11067,11068,11069,11070,11071,4954,11072, //10960 11073,11074,11075,11076,11077,11078,11079,11080,11081,11082,11083,11084,11085,11086,11087,11088, //10976 11089,11090,11091,11092,11093,11094,11095,11096,11097,11098,11099,11100,11101,11102,11103,11104, //10992 11105,11106,11107,11108,11109,11110,11111,11112,11113,11114,11115,3808,11116,11117,11118,11119, //11008 11120,11121,11122,11123,11124,11125,11126,11127,11128,11129,11130,11131,11132,11133,11134,4955, //11024 11135,11136,11137,11138,11139,11140,11141,11142,11143,11144,11145,11146,11147,11148,11149,11150, //11040 11151,11152,11153,11154,11155,11156,11157,11158,11159,11160,11161,4956,11162,11163,11164,11165, //11056 11166,11167,11168,11169,11170,11171,11172,11173,11174,11175,11176,11177,11178,11179,11180,4957, //11072 11181,11182,11183,11184,11185,11186,4958,11187,11188,11189,11190,11191,11192,11193,11194,11195, //11088 11196,11197,11198,11199,11200,3678,11201,11202,11203,11204,11205,11206,4191,11207,11208,11209, //11104 11210,11211,11212,11213,11214,11215,11216,11217,11218,11219,11220,11221,11222,11223,11224,11225, //11120 11226,11227,11228,11229,11230,11231,11232,11233,11234,11235,11236,11237,11238,11239,11240,11241, //11136 11242,11243,11244,11245,11246,11247,11248,11249,11250,11251,4959,11252,11253,11254,11255,11256, //11152 11257,11258,11259,11260,11261,11262,11263,11264,11265,11266,11267,11268,11269,11270,11271,11272, //11168 11273,11274,11275,11276,11277,11278,11279,11280,11281,11282,11283,11284,11285,11286,11287,11288, //11184 11289,11290,11291,11292,11293,11294,11295,11296,11297,11298,11299,11300,11301,11302,11303,11304, //11200 11305,11306,11307,11308,11309,11310,11311,11312,11313,11314,3679,11315,11316,11317,11318,4490, //11216 11319,11320,11321,11322,11323,11324,11325,11326,11327,11328,11329,11330,11331,11332,11333,11334, //11232 11335,11336,11337,11338,11339,11340,11341,11342,11343,11344,11345,11346,11347,4960,11348,11349, //11248 11350,11351,11352,11353,11354,11355,11356,11357,11358,11359,11360,11361,11362,11363,11364,11365, //11264 11366,11367,11368,11369,11370,11371,11372,11373,11374,11375,11376,11377,3961,4961,11378,11379, //11280 11380,11381,11382,11383,11384,11385,11386,11387,11388,11389,11390,11391,11392,11393,11394,11395, //11296 11396,11397,4192,11398,11399,11400,11401,11402,11403,11404,11405,11406,11407,11408,11409,11410, //11312 11411,4962,11412,11413,11414,11415,11416,11417,11418,11419,11420,11421,11422,11423,11424,11425, //11328 11426,11427,11428,11429,11430,11431,11432,11433,11434,11435,11436,11437,11438,11439,11440,11441, //11344 11442,11443,11444,11445,11446,11447,11448,11449,11450,11451,11452,11453,11454,11455,11456,11457, //11360 11458,11459,11460,11461,11462,11463,11464,11465,11466,11467,11468,11469,4963,11470,11471,4491, //11376 11472,11473,11474,11475,4964,11476,11477,11478,11479,11480,11481,11482,11483,11484,11485,11486, //11392 11487,11488,11489,11490,11491,11492,4965,11493,11494,11495,11496,11497,11498,11499,11500,11501, //11408 11502,11503,11504,11505,11506,11507,11508,11509,11510,11511,11512,11513,11514,11515,11516,11517, //11424 11518,11519,11520,11521,11522,11523,11524,11525,11526,11527,11528,11529,3962,11530,11531,11532, //11440 11533,11534,11535,11536,11537,11538,11539,11540,11541,11542,11543,11544,11545,11546,11547,11548, //11456 11549,11550,11551,11552,11553,11554,11555,11556,11557,11558,11559,11560,11561,11562,11563,11564, //11472 4193,4194,11565,11566,11567,11568,11569,11570,11571,11572,11573,11574,11575,11576,11577,11578, //11488 11579,11580,11581,11582,11583,11584,11585,11586,11587,11588,11589,11590,11591,4966,4195,11592, //11504 11593,11594,11595,11596,11597,11598,11599,11600,11601,11602,11603,11604,3090,11605,11606,11607, //11520 11608,11609,11610,4967,11611,11612,11613,11614,11615,11616,11617,11618,11619,11620,11621,11622, //11536 11623,11624,11625,11626,11627,11628,11629,11630,11631,11632,11633,11634,11635,11636,11637,11638, //11552 11639,11640,11641,11642,11643,11644,11645,11646,11647,11648,11649,11650,11651,11652,11653,11654, //11568 11655,11656,11657,11658,11659,11660,11661,11662,11663,11664,11665,11666,11667,11668,11669,11670, //11584 11671,11672,11673,11674,4968,11675,11676,11677,11678,11679,11680,11681,11682,11683,11684,11685, //11600 11686,11687,11688,11689,11690,11691,11692,11693,3809,11694,11695,11696,11697,11698,11699,11700, //11616 11701,11702,11703,11704,11705,11706,11707,11708,11709,11710,11711,11712,11713,11714,11715,11716, //11632 11717,11718,3553,11719,11720,11721,11722,11723,11724,11725,11726,11727,11728,11729,11730,4969, //11648 11731,11732,11733,11734,11735,11736,11737,11738,11739,11740,4492,11741,11742,11743,11744,11745, //11664 11746,11747,11748,11749,11750,11751,11752,4970,11753,11754,11755,11756,11757,11758,11759,11760, //11680 11761,11762,11763,11764,11765,11766,11767,11768,11769,11770,11771,11772,11773,11774,11775,11776, //11696 11777,11778,11779,11780,11781,11782,11783,11784,11785,11786,11787,11788,11789,11790,4971,11791, //11712 11792,11793,11794,11795,11796,11797,4972,11798,11799,11800,11801,11802,11803,11804,11805,11806, //11728 11807,11808,11809,11810,4973,11811,11812,11813,11814,11815,11816,11817,11818,11819,11820,11821, //11744 11822,11823,11824,11825,11826,11827,11828,11829,11830,11831,11832,11833,11834,3680,3810,11835, //11760 11836,4974,11837,11838,11839,11840,11841,11842,11843,11844,11845,11846,11847,11848,11849,11850, //11776 11851,11852,11853,11854,11855,11856,11857,11858,11859,11860,11861,11862,11863,11864,11865,11866, //11792 11867,11868,11869,11870,11871,11872,11873,11874,11875,11876,11877,11878,11879,11880,11881,11882, //11808 11883,11884,4493,11885,11886,11887,11888,11889,11890,11891,11892,11893,11894,11895,11896,11897, //11824 11898,11899,11900,11901,11902,11903,11904,11905,11906,11907,11908,11909,11910,11911,11912,11913, //11840 11914,11915,4975,11916,11917,11918,11919,11920,11921,11922,11923,11924,11925,11926,11927,11928, //11856 11929,11930,11931,11932,11933,11934,11935,11936,11937,11938,11939,11940,11941,11942,11943,11944, //11872 11945,11946,11947,11948,11949,4976,11950,11951,11952,11953,11954,11955,11956,11957,11958,11959, //11888 11960,11961,11962,11963,11964,11965,11966,11967,11968,11969,11970,11971,11972,11973,11974,11975, //11904 11976,11977,11978,11979,11980,11981,11982,11983,11984,11985,11986,11987,4196,11988,11989,11990, //11920 11991,11992,4977,11993,11994,11995,11996,11997,11998,11999,12000,12001,12002,12003,12004,12005, //11936 12006,12007,12008,12009,12010,12011,12012,12013,12014,12015,12016,12017,12018,12019,12020,12021, //11952 12022,12023,12024,12025,12026,12027,12028,12029,12030,12031,12032,12033,12034,12035,12036,12037, //11968 12038,12039,12040,12041,12042,12043,12044,12045,12046,12047,12048,12049,12050,12051,12052,12053, //11984 12054,12055,12056,12057,12058,12059,12060,12061,4978,12062,12063,12064,12065,12066,12067,12068, //12000 12069,12070,12071,12072,12073,12074,12075,12076,12077,12078,12079,12080,12081,12082,12083,12084, //12016 12085,12086,12087,12088,12089,12090,12091,12092,12093,12094,12095,12096,12097,12098,12099,12100, //12032 12101,12102,12103,12104,12105,12106,12107,12108,12109,12110,12111,12112,12113,12114,12115,12116, //12048 12117,12118,12119,12120,12121,12122,12123,4979,12124,12125,12126,12127,12128,4197,12129,12130, //12064 12131,12132,12133,12134,12135,12136,12137,12138,12139,12140,12141,12142,12143,12144,12145,12146, //12080 12147,12148,12149,12150,12151,12152,12153,12154,4980,12155,12156,12157,12158,12159,12160,4494, //12096 12161,12162,12163,12164,3811,12165,12166,12167,12168,12169,4495,12170,12171,4496,12172,12173, //12112 12174,12175,12176,3812,12177,12178,12179,12180,12181,12182,12183,12184,12185,12186,12187,12188, //12128 12189,12190,12191,12192,12193,12194,12195,12196,12197,12198,12199,12200,12201,12202,12203,12204, //12144 12205,12206,12207,12208,12209,12210,12211,12212,12213,12214,12215,12216,12217,12218,12219,12220, //12160 12221,4981,12222,12223,12224,12225,12226,12227,12228,12229,12230,12231,12232,12233,12234,12235, //12176 4982,12236,12237,12238,12239,12240,12241,12242,12243,12244,12245,4983,12246,12247,12248,12249, //12192 4984,12250,12251,12252,12253,12254,12255,12256,12257,12258,12259,12260,12261,12262,12263,12264, //12208 4985,12265,4497,12266,12267,12268,12269,12270,12271,12272,12273,12274,12275,12276,12277,12278, //12224 12279,12280,12281,12282,12283,12284,12285,12286,12287,4986,12288,12289,12290,12291,12292,12293, //12240 12294,12295,12296,2473,12297,12298,12299,12300,12301,12302,12303,12304,12305,12306,12307,12308, //12256 12309,12310,12311,12312,12313,12314,12315,12316,12317,12318,12319,3963,12320,12321,12322,12323, //12272 12324,12325,12326,12327,12328,12329,12330,12331,12332,4987,12333,12334,12335,12336,12337,12338, //12288 12339,12340,12341,12342,12343,12344,12345,12346,12347,12348,12349,12350,12351,12352,12353,12354, //12304 12355,12356,12357,12358,12359,3964,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369, //12320 12370,3965,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384, //12336 12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400, //12352 12401,12402,12403,12404,12405,12406,12407,12408,4988,12409,12410,12411,12412,12413,12414,12415, //12368 12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431, //12384 12432,12433,12434,12435,12436,12437,12438,3554,12439,12440,12441,12442,12443,12444,12445,12446, //12400 12447,12448,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462, //12416 12463,12464,4989,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475,12476,12477, //12432 12478,12479,12480,4990,12481,12482,12483,12484,12485,12486,12487,12488,12489,4498,12490,12491, //12448 12492,12493,12494,12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507, //12464 12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523, //12480 12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,12535,12536,12537,12538,12539, //12496 12540,12541,12542,12543,12544,12545,12546,12547,12548,12549,12550,12551,4991,12552,12553,12554, //12512 12555,12556,12557,12558,12559,12560,12561,12562,12563,12564,12565,12566,12567,12568,12569,12570, //12528 12571,12572,12573,12574,12575,12576,12577,12578,3036,12579,12580,12581,12582,12583,3966,12584, //12544 12585,12586,12587,12588,12589,12590,12591,12592,12593,12594,12595,12596,12597,12598,12599,12600, //12560 12601,12602,12603,12604,12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615,12616, //12576 12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628,12629,12630,12631,12632, //12592 12633,12634,12635,12636,12637,12638,12639,12640,12641,12642,12643,12644,12645,12646,4499,12647, //12608 12648,12649,12650,12651,12652,12653,12654,12655,12656,12657,12658,12659,12660,12661,12662,12663, //12624 12664,12665,12666,12667,12668,12669,12670,12671,12672,12673,12674,12675,12676,12677,12678,12679, //12640 12680,12681,12682,12683,12684,12685,12686,12687,12688,12689,12690,12691,12692,12693,12694,12695, //12656 12696,12697,12698,4992,12699,12700,12701,12702,12703,12704,12705,12706,12707,12708,12709,12710, //12672 12711,12712,12713,12714,12715,12716,12717,12718,12719,12720,12721,12722,12723,12724,12725,12726, //12688 12727,12728,12729,12730,12731,12732,12733,12734,12735,12736,12737,12738,12739,12740,12741,12742, //12704 12743,12744,12745,12746,12747,12748,12749,12750,12751,12752,12753,12754,12755,12756,12757,12758, //12720 12759,12760,12761,12762,12763,12764,12765,12766,12767,12768,12769,12770,12771,12772,12773,12774, //12736 12775,12776,12777,12778,4993,2175,12779,12780,12781,12782,12783,12784,12785,12786,4500,12787, //12752 12788,12789,12790,12791,12792,12793,12794,12795,12796,12797,12798,12799,12800,12801,12802,12803, //12768 12804,12805,12806,12807,12808,12809,12810,12811,12812,12813,12814,12815,12816,12817,12818,12819, //12784 12820,12821,12822,12823,12824,12825,12826,4198,3967,12827,12828,12829,12830,12831,12832,12833, //12800 12834,12835,12836,12837,12838,12839,12840,12841,12842,12843,12844,12845,12846,12847,12848,12849, //12816 12850,12851,12852,12853,12854,12855,12856,12857,12858,12859,12860,12861,4199,12862,12863,12864, //12832 12865,12866,12867,12868,12869,12870,12871,12872,12873,12874,12875,12876,12877,12878,12879,12880, //12848 12881,12882,12883,12884,12885,12886,12887,4501,12888,12889,12890,12891,12892,12893,12894,12895, //12864 12896,12897,12898,12899,12900,12901,12902,12903,12904,12905,12906,12907,12908,12909,12910,12911, //12880 12912,4994,12913,12914,12915,12916,12917,12918,12919,12920,12921,12922,12923,12924,12925,12926, //12896 12927,12928,12929,12930,12931,12932,12933,12934,12935,12936,12937,12938,12939,12940,12941,12942, //12912 12943,12944,12945,12946,12947,12948,12949,12950,12951,12952,12953,12954,12955,12956,1772,12957, //12928 12958,12959,12960,12961,12962,12963,12964,12965,12966,12967,12968,12969,12970,12971,12972,12973, //12944 12974,12975,12976,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988,12989, //12960 12990,12991,12992,12993,12994,12995,12996,12997,4502,12998,4503,12999,13000,13001,13002,13003, //12976 4504,13004,13005,13006,13007,13008,13009,13010,13011,13012,13013,13014,13015,13016,13017,13018, //12992 13019,13020,13021,13022,13023,13024,13025,13026,13027,13028,13029,3449,13030,13031,13032,13033, //13008 13034,13035,13036,13037,13038,13039,13040,13041,13042,13043,13044,13045,13046,13047,13048,13049, //13024 13050,13051,13052,13053,13054,13055,13056,13057,13058,13059,13060,13061,13062,13063,13064,13065, //13040 13066,13067,13068,13069,13070,13071,13072,13073,13074,13075,13076,13077,13078,13079,13080,13081, //13056 13082,13083,13084,13085,13086,13087,13088,13089,13090,13091,13092,13093,13094,13095,13096,13097, //13072 13098,13099,13100,13101,13102,13103,13104,13105,13106,13107,13108,13109,13110,13111,13112,13113, //13088 13114,13115,13116,13117,13118,3968,13119,4995,13120,13121,13122,13123,13124,13125,13126,13127, //13104 4505,13128,13129,13130,13131,13132,13133,13134,4996,4506,13135,13136,13137,13138,13139,4997, //13120 13140,13141,13142,13143,13144,13145,13146,13147,13148,13149,13150,13151,13152,13153,13154,13155, //13136 13156,13157,13158,13159,4998,13160,13161,13162,13163,13164,13165,13166,13167,13168,13169,13170, //13152 13171,13172,13173,13174,13175,13176,4999,13177,13178,13179,13180,13181,13182,13183,13184,13185, //13168 13186,13187,13188,13189,13190,13191,13192,13193,13194,13195,13196,13197,13198,13199,13200,13201, //13184 13202,13203,13204,13205,13206,5000,13207,13208,13209,13210,13211,13212,13213,13214,13215,13216, //13200 13217,13218,13219,13220,13221,13222,13223,13224,13225,13226,13227,4200,5001,13228,13229,13230, //13216 13231,13232,13233,13234,13235,13236,13237,13238,13239,13240,3969,13241,13242,13243,13244,3970, //13232 13245,13246,13247,13248,13249,13250,13251,13252,13253,13254,13255,13256,13257,13258,13259,13260, //13248 13261,13262,13263,13264,13265,13266,13267,13268,3450,13269,13270,13271,13272,13273,13274,13275, //13264 13276,5002,13277,13278,13279,13280,13281,13282,13283,13284,13285,13286,13287,13288,13289,13290, //13280 13291,13292,13293,13294,13295,13296,13297,13298,13299,13300,13301,13302,3813,13303,13304,13305, //13296 13306,13307,13308,13309,13310,13311,13312,13313,13314,13315,13316,13317,13318,13319,13320,13321, //13312 13322,13323,13324,13325,13326,13327,13328,4507,13329,13330,13331,13332,13333,13334,13335,13336, //13328 13337,13338,13339,13340,13341,5003,13342,13343,13344,13345,13346,13347,13348,13349,13350,13351, //13344 13352,13353,13354,13355,13356,13357,13358,13359,13360,13361,13362,13363,13364,13365,13366,13367, //13360 5004,13368,13369,13370,13371,13372,13373,13374,13375,13376,13377,13378,13379,13380,13381,13382, //13376 13383,13384,13385,13386,13387,13388,13389,13390,13391,13392,13393,13394,13395,13396,13397,13398, //13392 13399,13400,13401,13402,13403,13404,13405,13406,13407,13408,13409,13410,13411,13412,13413,13414, //13408 13415,13416,13417,13418,13419,13420,13421,13422,13423,13424,13425,13426,13427,13428,13429,13430, //13424 13431,13432,4508,13433,13434,13435,4201,13436,13437,13438,13439,13440,13441,13442,13443,13444, //13440 13445,13446,13447,13448,13449,13450,13451,13452,13453,13454,13455,13456,13457,5005,13458,13459, //13456 13460,13461,13462,13463,13464,13465,13466,13467,13468,13469,13470,4509,13471,13472,13473,13474, //13472 13475,13476,13477,13478,13479,13480,13481,13482,13483,13484,13485,13486,13487,13488,13489,13490, //13488 13491,13492,13493,13494,13495,13496,13497,13498,13499,13500,13501,13502,13503,13504,13505,13506, //13504 13507,13508,13509,13510,13511,13512,13513,13514,13515,13516,13517,13518,13519,13520,13521,13522, //13520 13523,13524,13525,13526,13527,13528,13529,13530,13531,13532,13533,13534,13535,13536,13537,13538, //13536 13539,13540,13541,13542,13543,13544,13545,13546,13547,13548,13549,13550,13551,13552,13553,13554, //13552 13555,13556,13557,13558,13559,13560,13561,13562,13563,13564,13565,13566,13567,13568,13569,13570, //13568 13571,13572,13573,13574,13575,13576,13577,13578,13579,13580,13581,13582,13583,13584,13585,13586, //13584 13587,13588,13589,13590,13591,13592,13593,13594,13595,13596,13597,13598,13599,13600,13601,13602, //13600 13603,13604,13605,13606,13607,13608,13609,13610,13611,13612,13613,13614,13615,13616,13617,13618, //13616 13619,13620,13621,13622,13623,13624,13625,13626,13627,13628,13629,13630,13631,13632,13633,13634, //13632 13635,13636,13637,13638,13639,13640,13641,13642,5006,13643,13644,13645,13646,13647,13648,13649, //13648 13650,13651,5007,13652,13653,13654,13655,13656,13657,13658,13659,13660,13661,13662,13663,13664, //13664 13665,13666,13667,13668,13669,13670,13671,13672,13673,13674,13675,13676,13677,13678,13679,13680, //13680 13681,13682,13683,13684,13685,13686,13687,13688,13689,13690,13691,13692,13693,13694,13695,13696, //13696 13697,13698,13699,13700,13701,13702,13703,13704,13705,13706,13707,13708,13709,13710,13711,13712, //13712 13713,13714,13715,13716,13717,13718,13719,13720,13721,13722,13723,13724,13725,13726,13727,13728, //13728 13729,13730,13731,13732,13733,13734,13735,13736,13737,13738,13739,13740,13741,13742,13743,13744, //13744 13745,13746,13747,13748,13749,13750,13751,13752,13753,13754,13755,13756,13757,13758,13759,13760, //13760 13761,13762,13763,13764,13765,13766,13767,13768,13769,13770,13771,13772,13773,13774,3273,13775, //13776 13776,13777,13778,13779,13780,13781,13782,13783,13784,13785,13786,13787,13788,13789,13790,13791, //13792 13792,13793,13794,13795,13796,13797,13798,13799,13800,13801,13802,13803,13804,13805,13806,13807, //13808 13808,13809,13810,13811,13812,13813,13814,13815,13816,13817,13818,13819,13820,13821,13822,13823, //13824 13824,13825,13826,13827,13828,13829,13830,13831,13832,13833,13834,13835,13836,13837,13838,13839, //13840 13840,13841,13842,13843,13844,13845,13846,13847,13848,13849,13850,13851,13852,13853,13854,13855, //13856 13856,13857,13858,13859,13860,13861,13862,13863,13864,13865,13866,13867,13868,13869,13870,13871, //13872 13872,13873,13874,13875,13876,13877,13878,13879,13880,13881,13882,13883,13884,13885,13886,13887, //13888 13888,13889,13890,13891,13892,13893,13894,13895,13896,13897,13898,13899,13900,13901,13902,13903, //13904 13904,13905,13906,13907,13908,13909,13910,13911,13912,13913,13914,13915,13916,13917,13918,13919, //13920 13920,13921,13922,13923,13924,13925,13926,13927,13928,13929,13930,13931,13932,13933,13934,13935, //13936 13936,13937,13938,13939,13940,13941,13942,13943,13944,13945,13946,13947,13948,13949,13950,13951, //13952 13952,13953,13954,13955,13956,13957,13958,13959,13960,13961,13962,13963,13964,13965,13966,13967, //13968 13968,13969,13970,13971,13972, //13973 ****************************************************************************************/ }; ================================================ FILE: third_party/uchardet/uchardet/src/tables/EUCKRFreq.tab ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //Sampling from about 20M text materials include literature and computer technology /****************************************************************************** * 128 --> 0.79 * 256 --> 0.92 * 512 --> 0.986 * 1024 --> 0.99944 * 2048 --> 0.99999 * * Idea Distribution Ratio = 0.98653 / (1-0.98653) = 73.24 * Random Distribution Ration = 512 / (2350-512) = 0.279. * * Typical Distribution Ratio *****************************************************************************/ #define EUCKR_TYPICAL_DISTRIBUTION_RATIO (float)0.99 #define EUCKR_TABLE_SIZE 2352 //Char to FreqOrder table , constexpr PRInt16 EUCKRCharToFreqOrder[] = { 13, 130, 120,1396, 481,1719,1720, 328, 609, 212,1721, 707, 400, 299,1722, 87, 1397,1723, 104, 536,1117,1203,1724,1267, 685,1268, 508,1725,1726,1727,1728,1398, 1399,1729,1730,1731, 141, 621, 326,1057, 368,1732, 267, 488, 20,1733,1269,1734, 945,1400,1735, 47, 904,1270,1736,1737, 773, 248,1738, 409, 313, 786, 429,1739, 116, 987, 813,1401, 683, 75,1204, 145,1740,1741,1742,1743, 16, 847, 667, 622, 708,1744,1745,1746, 966, 787, 304, 129,1747, 60, 820, 123, 676,1748,1749,1750, 1751, 617,1752, 626,1753,1754,1755,1756, 653,1757,1758,1759,1760,1761,1762, 856, 344,1763,1764,1765,1766, 89, 401, 418, 806, 905, 848,1767,1768,1769, 946,1205, 709,1770,1118,1771, 241,1772,1773,1774,1271,1775, 569,1776, 999,1777,1778,1779, 1780, 337, 751,1058, 28, 628, 254,1781, 177, 906, 270, 349, 891,1079,1782, 19, 1783, 379,1784, 315,1785, 629, 754,1402, 559,1786, 636, 203,1206,1787, 710, 567, 1788, 935, 814,1789,1790,1207, 766, 528,1791,1792,1208,1793,1794,1795,1796,1797, 1403,1798,1799, 533,1059,1404,1405,1156,1406, 936, 884,1080,1800, 351,1801,1802, 1803,1804,1805, 801,1806,1807,1808,1119,1809,1157, 714, 474,1407,1810, 298, 899, 885,1811,1120, 802,1158,1812, 892,1813,1814,1408, 659,1815,1816,1121,1817,1818, 1819,1820,1821,1822, 319,1823, 594, 545,1824, 815, 937,1209,1825,1826, 573,1409, 1022,1827,1210,1828,1829,1830,1831,1832,1833, 556, 722, 807,1122,1060,1834, 697, 1835, 900, 557, 715,1836,1410, 540,1411, 752,1159, 294, 597,1211, 976, 803, 770, 1412,1837,1838, 39, 794,1413, 358,1839, 371, 925,1840, 453, 661, 788, 531, 723, 544,1023,1081, 869, 91,1841, 392, 430, 790, 602,1414, 677,1082, 457,1415,1416, 1842,1843, 475, 327,1024,1417, 795, 121,1844, 733, 403,1418,1845,1846,1847, 300, 119, 711,1212, 627,1848,1272, 207,1849,1850, 796,1213, 382,1851, 519,1852,1083, 893,1853,1854,1855, 367, 809, 487, 671,1856, 663,1857,1858, 956, 471, 306, 857, 1859,1860,1160,1084,1861,1862,1863,1864,1865,1061,1866,1867,1868,1869,1870,1871, 282, 96, 574,1872, 502,1085,1873,1214,1874, 907,1875,1876, 827, 977,1419,1420, 1421, 268,1877,1422,1878,1879,1880, 308,1881, 2, 537,1882,1883,1215,1884,1885, 127, 791,1886,1273,1423,1887, 34, 336, 404, 643,1888, 571, 654, 894, 840,1889, 0, 886,1274, 122, 575, 260, 908, 938,1890,1275, 410, 316,1891,1892, 100,1893, 1894,1123, 48,1161,1124,1025,1895, 633, 901,1276,1896,1897, 115, 816,1898, 317, 1899, 694,1900, 909, 734,1424, 572, 866,1425, 691, 85, 524,1010, 543, 394, 841, 1901,1902,1903,1026,1904,1905,1906,1907,1908,1909, 30, 451, 651, 988, 310,1910, 1911,1426, 810,1216, 93,1912,1913,1277,1217,1914, 858, 759, 45, 58, 181, 610, 269,1915,1916, 131,1062, 551, 443,1000, 821,1427, 957, 895,1086,1917,1918, 375, 1919, 359,1920, 687,1921, 822,1922, 293,1923,1924, 40, 662, 118, 692, 29, 939, 887, 640, 482, 174,1925, 69,1162, 728,1428, 910,1926,1278,1218,1279, 386, 870, 217, 854,1163, 823,1927,1928,1929,1930, 834,1931, 78,1932, 859,1933,1063,1934, 1935,1936,1937, 438,1164, 208, 595,1938,1939,1940,1941,1219,1125,1942, 280, 888, 1429,1430,1220,1431,1943,1944,1945,1946,1947,1280, 150, 510,1432,1948,1949,1950, 1951,1952,1953,1954,1011,1087,1955,1433,1043,1956, 881,1957, 614, 958,1064,1065, 1221,1958, 638,1001, 860, 967, 896,1434, 989, 492, 553,1281,1165,1959,1282,1002, 1283,1222,1960,1961,1962,1963, 36, 383, 228, 753, 247, 454,1964, 876, 678,1965, 1966,1284, 126, 464, 490, 835, 136, 672, 529, 940,1088,1435, 473,1967,1968, 467, 50, 390, 227, 587, 279, 378, 598, 792, 968, 240, 151, 160, 849, 882,1126,1285, 639,1044, 133, 140, 288, 360, 811, 563,1027, 561, 142, 523,1969,1970,1971, 7, 103, 296, 439, 407, 506, 634, 990,1972,1973,1974,1975, 645,1976,1977,1978,1979, 1980,1981, 236,1982,1436,1983,1984,1089, 192, 828, 618, 518,1166, 333,1127,1985, 818,1223,1986,1987,1988,1989,1990,1991,1992,1993, 342,1128,1286, 746, 842,1994, 1995, 560, 223,1287, 98, 8, 189, 650, 978,1288,1996,1437,1997, 17, 345, 250, 423, 277, 234, 512, 226, 97, 289, 42, 167,1998, 201,1999,2000, 843, 836, 824, 532, 338, 783,1090, 182, 576, 436,1438,1439, 527, 500,2001, 947, 889,2002,2003, 2004,2005, 262, 600, 314, 447,2006, 547,2007, 693, 738,1129,2008, 71,1440, 745, 619, 688,2009, 829,2010,2011, 147,2012, 33, 948,2013,2014, 74, 224,2015, 61, 191, 918, 399, 637,2016,1028,1130, 257, 902,2017,2018,2019,2020,2021,2022,2023, 2024,2025,2026, 837,2027,2028,2029,2030, 179, 874, 591, 52, 724, 246,2031,2032, 2033,2034,1167, 969,2035,1289, 630, 605, 911,1091,1168,2036,2037,2038,1441, 912, 2039, 623,2040,2041, 253,1169,1290,2042,1442, 146, 620, 611, 577, 433,2043,1224, 719,1170, 959, 440, 437, 534, 84, 388, 480,1131, 159, 220, 198, 679,2044,1012, 819,1066,1443, 113,1225, 194, 318,1003,1029,2045,2046,2047,2048,1067,2049,2050, 2051,2052,2053, 59, 913, 112,2054, 632,2055, 455, 144, 739,1291,2056, 273, 681, 499,2057, 448,2058,2059, 760,2060,2061, 970, 384, 169, 245,1132,2062,2063, 414, 1444,2064,2065, 41, 235,2066, 157, 252, 877, 568, 919, 789, 580,2067, 725,2068, 2069,1292,2070,2071,1445,2072,1446,2073,2074, 55, 588, 66,1447, 271,1092,2075, 1226,2076, 960,1013, 372,2077,2078,2079,2080,2081,1293,2082,2083,2084,2085, 850, 2086,2087,2088,2089,2090, 186,2091,1068, 180,2092,2093,2094, 109,1227, 522, 606, 2095, 867,1448,1093, 991,1171, 926, 353,1133,2096, 581,2097,2098,2099,1294,1449, 1450,2100, 596,1172,1014,1228,2101,1451,1295,1173,1229,2102,2103,1296,1134,1452, 949,1135,2104,2105,1094,1453,1454,1455,2106,1095,2107,2108,2109,2110,2111,2112, 2113,2114,2115,2116,2117, 804,2118,2119,1230,1231, 805,1456, 405,1136,2120,2121, 2122,2123,2124, 720, 701,1297, 992,1457, 927,1004,2125,2126,2127,2128,2129,2130, 22, 417,2131, 303,2132, 385,2133, 971, 520, 513,2134,1174, 73,1096, 231, 274, 962,1458, 673,2135,1459,2136, 152,1137,2137,2138,2139,2140,1005,1138,1460,1139, 2141,2142,2143,2144, 11, 374, 844,2145, 154,1232, 46,1461,2146, 838, 830, 721, 1233, 106,2147, 90, 428, 462, 578, 566,1175, 352,2148,2149, 538,1234, 124,1298, 2150,1462, 761, 565,2151, 686,2152, 649,2153, 72, 173,2154, 460, 415,2155,1463, 2156,1235, 305,2157,2158,2159,2160,2161,2162, 579,2163,2164,2165,2166,2167, 747, 2168,2169,2170,2171,1464, 669,2172,2173,2174,2175,2176,1465,2177, 23, 530, 285, 2178, 335, 729,2179, 397,2180,2181,2182,1030,2183,2184, 698,2185,2186, 325,2187, 2188, 369,2189, 799,1097,1015, 348,2190,1069, 680,2191, 851,1466,2192,2193, 10, 2194, 613, 424,2195, 979, 108, 449, 589, 27, 172, 81,1031, 80, 774, 281, 350, 1032, 525, 301, 582,1176,2196, 674,1045,2197,2198,1467, 730, 762,2199,2200,2201, 2202,1468,2203, 993,2204,2205, 266,1070, 963,1140,2206,2207,2208, 664,1098, 972, 2209,2210,2211,1177,1469,1470, 871,2212,2213,2214,2215,2216,1471,2217,2218,2219, 2220,2221,2222,2223,2224,2225,2226,2227,1472,1236,2228,2229,2230,2231,2232,2233, 2234,2235,1299,2236,2237, 200,2238, 477, 373,2239,2240, 731, 825, 777,2241,2242, 2243, 521, 486, 548,2244,2245,2246,1473,1300, 53, 549, 137, 875, 76, 158,2247, 1301,1474, 469, 396,1016, 278, 712,2248, 321, 442, 503, 767, 744, 941,1237,1178, 1475,2249, 82, 178,1141,1179, 973,2250,1302,2251, 297,2252,2253, 570,2254,2255, 2256, 18, 450, 206,2257, 290, 292,1142,2258, 511, 162, 99, 346, 164, 735,2259, 1476,1477, 4, 554, 343, 798,1099,2260,1100,2261, 43, 171,1303, 139, 215,2262, 2263, 717, 775,2264,1033, 322, 216,2265, 831,2266, 149,2267,1304,2268,2269, 702, 1238, 135, 845, 347, 309,2270, 484,2271, 878, 655, 238,1006,1478,2272, 67,2273, 295,2274,2275, 461,2276, 478, 942, 412,2277,1034,2278,2279,2280, 265,2281, 541, 2282,2283,2284,2285,2286, 70, 852,1071,2287,2288,2289,2290, 21, 56, 509, 117, 432,2291,2292, 331, 980, 552,1101, 148, 284, 105, 393,1180,1239, 755,2293, 187, 2294,1046,1479,2295, 340,2296, 63,1047, 230,2297,2298,1305, 763,1306, 101, 800, 808, 494,2299,2300,2301, 903,2302, 37,1072, 14, 5,2303, 79, 675,2304, 312, 2305,2306,2307,2308,2309,1480, 6,1307,2310,2311,2312, 1, 470, 35, 24, 229, 2313, 695, 210, 86, 778, 15, 784, 592, 779, 32, 77, 855, 964,2314, 259,2315, 501, 380,2316,2317, 83, 981, 153, 689,1308,1481,1482,1483,2318,2319, 716,1484, 2320,2321,2322,2323,2324,2325,1485,2326,2327, 128, 57, 68, 261,1048, 211, 170, 1240, 31,2328, 51, 435, 742,2329,2330,2331, 635,2332, 264, 456,2333,2334,2335, 425,2336,1486, 143, 507, 263, 943,2337, 363, 920,1487, 256,1488,1102, 243, 601, 1489,2338,2339,2340,2341,2342,2343,2344, 861,2345,2346,2347,2348,2349,2350, 395, 2351,1490,1491, 62, 535, 166, 225,2352,2353, 668, 419,1241, 138, 604, 928,2354, 1181,2355,1492,1493,2356,2357,2358,1143,2359, 696,2360, 387, 307,1309, 682, 476, 2361,2362, 332, 12, 222, 156,2363, 232,2364, 641, 276, 656, 517,1494,1495,1035, 416, 736,1496,2365,1017, 586,2366,2367,2368,1497,2369, 242,2370,2371,2372,1498, 2373, 965, 713,2374,2375,2376,2377, 740, 982,1499, 944,1500,1007,2378,2379,1310, 1501,2380,2381,2382, 785, 329,2383,2384,1502,2385,2386,2387, 932,2388,1503,2389, 2390,2391,2392,1242,2393,2394,2395,2396,2397, 994, 950,2398,2399,2400,2401,1504, 1311,2402,2403,2404,2405,1049, 749,2406,2407, 853, 718,1144,1312,2408,1182,1505, 2409,2410, 255, 516, 479, 564, 550, 214,1506,1507,1313, 413, 239, 444, 339,1145, 1036,1508,1509,1314,1037,1510,1315,2411,1511,2412,2413,2414, 176, 703, 497, 624, 593, 921, 302,2415, 341, 165,1103,1512,2416,1513,2417,2418,2419, 376,2420, 700, 2421,2422,2423, 258, 768,1316,2424,1183,2425, 995, 608,2426,2427,2428,2429, 221, 2430,2431,2432,2433,2434,2435,2436,2437, 195, 323, 726, 188, 897, 983,1317, 377, 644,1050, 879,2438, 452,2439,2440,2441,2442,2443,2444, 914,2445,2446,2447,2448, 915, 489,2449,1514,1184,2450,2451, 515, 64, 427, 495,2452, 583,2453, 483, 485, 1038, 562, 213,1515, 748, 666,2454,2455,2456,2457, 334,2458, 780, 996,1008, 705, 1243,2459,2460,2461,2462,2463, 114,2464, 493,1146, 366, 163,1516, 961,1104,2465, 291,2466,1318,1105,2467,1517, 365,2468, 355, 951,1244,2469,1319,2470, 631,2471, 2472, 218,1320, 364, 320, 756,1518,1519,1321,1520,1322,2473,2474,2475,2476, 997, 2477,2478,2479,2480, 665,1185,2481, 916,1521,2482,2483,2484, 584, 684,2485,2486, 797,2487,1051,1186,2488,2489,2490,1522,2491,2492, 370,2493,1039,1187, 65,2494, 434, 205, 463,1188,2495, 125, 812, 391, 402, 826, 699, 286, 398, 155, 781, 771, 585,2496, 590, 505,1073,2497, 599, 244, 219, 917,1018, 952, 646,1523,2498,1323, 2499,2500, 49, 984, 354, 741,2501, 625,2502,1324,2503,1019, 190, 357, 757, 491, 95, 782, 868,2504,2505,2506,2507,2508,2509, 134,1524,1074, 422,1525, 898,2510, 161,2511,2512,2513,2514, 769,2515,1526,2516,2517, 411,1325,2518, 472,1527,2519, 2520,2521,2522,2523,2524, 985,2525,2526,2527,2528,2529,2530, 764,2531,1245,2532, 2533, 25, 204, 311,2534, 496,2535,1052,2536,2537,2538,2539,2540,2541,2542, 199, 704, 504, 468, 758, 657,1528, 196, 44, 839,1246, 272, 750,2543, 765, 862,2544, 2545,1326,2546, 132, 615, 933,2547, 732,2548,2549,2550,1189,1529,2551, 283,1247, 1053, 607, 929,2552,2553,2554, 930, 183, 872, 616,1040,1147,2555,1148,1020, 441, 249,1075,2556,2557,2558, 466, 743,2559,2560,2561, 92, 514, 426, 420, 526,2562, 2563,2564,2565,2566,2567,2568, 185,2569,2570,2571,2572, 776,1530, 658,2573, 362, 2574, 361, 922,1076, 793,2575,2576,2577,2578,2579,2580,1531, 251,2581,2582,2583, 2584,1532, 54, 612, 237,1327,2585,2586, 275, 408, 647, 111,2587,1533,1106, 465, 3, 458, 9, 38,2588, 107, 110, 890, 209, 26, 737, 498,2589,1534,2590, 431, 202, 88,1535, 356, 287,1107, 660,1149,2591, 381,1536, 986,1150, 445,1248,1151, 974,2592,2593, 846,2594, 446, 953, 184,1249,1250, 727,2595, 923, 193, 883,2596, 2597,2598, 102, 324, 539, 817,2599, 421,1041,2600, 832,2601, 94, 175, 197, 406, 2602, 459,2603,2604,2605,2606,2607, 330, 555,2608,2609,2610, 706,1108, 389,2611, 2612,2613,2614, 233,2615, 833, 558, 931, 954,1251,2616,2617,1537, 546,2618,2619, 1009,2620,2621,2622,1538, 690,1328,2623, 955,2624,1539,2625,2626, 772,2627,2628, 2629,2630,2631, 924, 648, 863, 603,2632,2633, 934,1540, 864, 865,2634, 642,1042, 670,1190,2635,2636,2637,2638, 168,2639, 652, 873, 542,1054,1541,2640,2641,2642, //512, 256 /*************************************************************************************** *Everything below is of no interest for detection purpose * *************************************************************************************** 2643,2644,2645,2646,2647,2648,2649,2650,2651,2652,2653,2654,2655,2656,2657,2658, 2659,2660,2661,2662,2663,2664,2665,2666,2667,2668,2669,2670,2671,2672,2673,2674, 2675,2676,2677,2678,2679,2680,2681,2682,2683,2684,2685,2686,2687,2688,2689,2690, 2691,2692,2693,2694,2695,2696,2697,2698,2699,1542, 880,2700,2701,2702,2703,2704, 2705,2706,2707,2708,2709,2710,2711,2712,2713,2714,2715,2716,2717,2718,2719,2720, 2721,2722,2723,2724,2725,1543,2726,2727,2728,2729,2730,2731,2732,1544,2733,2734, 2735,2736,2737,2738,2739,2740,2741,2742,2743,2744,2745,2746,2747,2748,2749,2750, 2751,2752,2753,2754,1545,2755,2756,2757,2758,2759,2760,2761,2762,2763,2764,2765, 2766,1546,2767,1547,2768,2769,2770,2771,2772,2773,2774,2775,2776,2777,2778,2779, 2780,2781,2782,2783,2784,2785,2786,1548,2787,2788,2789,1109,2790,2791,2792,2793, 2794,2795,2796,2797,2798,2799,2800,2801,2802,2803,2804,2805,2806,2807,2808,2809, 2810,2811,2812,1329,2813,2814,2815,2816,2817,2818,2819,2820,2821,2822,2823,2824, 2825,2826,2827,2828,2829,2830,2831,2832,2833,2834,2835,2836,2837,2838,2839,2840, 2841,2842,2843,2844,2845,2846,2847,2848,2849,2850,2851,2852,2853,2854,2855,2856, 1549,2857,2858,2859,2860,1550,2861,2862,1551,2863,2864,2865,2866,2867,2868,2869, 2870,2871,2872,2873,2874,1110,1330,2875,2876,2877,2878,2879,2880,2881,2882,2883, 2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899, 2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2913,2914,2915, 2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927,2928,2929,2930,1331, 2931,2932,2933,2934,2935,2936,2937,2938,2939,2940,2941,2942,2943,1552,2944,2945, 2946,2947,2948,2949,2950,2951,2952,2953,2954,2955,2956,2957,2958,2959,2960,2961, 2962,2963,2964,1252,2965,2966,2967,2968,2969,2970,2971,2972,2973,2974,2975,2976, 2977,2978,2979,2980,2981,2982,2983,2984,2985,2986,2987,2988,2989,2990,2991,2992, 2993,2994,2995,2996,2997,2998,2999,3000,3001,3002,3003,3004,3005,3006,3007,3008, 3009,3010,3011,3012,1553,3013,3014,3015,3016,3017,1554,3018,1332,3019,3020,3021, 3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037, 3038,3039,3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050,1555,3051,3052, 3053,1556,1557,3054,3055,3056,3057,3058,3059,3060,3061,3062,3063,3064,3065,3066, 3067,1558,3068,3069,3070,3071,3072,3073,3074,3075,3076,1559,3077,3078,3079,3080, 3081,3082,3083,1253,3084,3085,3086,3087,3088,3089,3090,3091,3092,3093,3094,3095, 3096,3097,3098,3099,3100,3101,3102,3103,3104,3105,3106,3107,3108,1152,3109,3110, 3111,3112,3113,1560,3114,3115,3116,3117,1111,3118,3119,3120,3121,3122,3123,3124, 3125,3126,3127,3128,3129,3130,3131,3132,3133,3134,3135,3136,3137,3138,3139,3140, 3141,3142,3143,3144,3145,3146,3147,3148,3149,3150,3151,3152,3153,3154,3155,3156, 3157,3158,3159,3160,3161,3162,3163,3164,3165,3166,3167,3168,3169,3170,3171,3172, 3173,3174,3175,3176,1333,3177,3178,3179,3180,3181,3182,3183,3184,3185,3186,3187, 3188,3189,1561,3190,3191,1334,3192,3193,3194,3195,3196,3197,3198,3199,3200,3201, 3202,3203,3204,3205,3206,3207,3208,3209,3210,3211,3212,3213,3214,3215,3216,3217, 3218,3219,3220,3221,3222,3223,3224,3225,3226,3227,3228,3229,3230,3231,3232,3233, 3234,1562,3235,3236,3237,3238,3239,3240,3241,3242,3243,3244,3245,3246,3247,3248, 3249,3250,3251,3252,3253,3254,3255,3256,3257,3258,3259,3260,3261,3262,3263,3264, 3265,3266,3267,3268,3269,3270,3271,3272,3273,3274,3275,3276,3277,1563,3278,3279, 3280,3281,3282,3283,3284,3285,3286,3287,3288,3289,3290,3291,3292,3293,3294,3295, 3296,3297,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3310,3311, 3312,3313,3314,3315,3316,3317,3318,3319,3320,3321,3322,3323,3324,3325,3326,3327, 3328,3329,3330,3331,3332,3333,3334,3335,3336,3337,3338,3339,3340,3341,3342,3343, 3344,3345,3346,3347,3348,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358,3359, 3360,3361,3362,3363,3364,1335,3365,3366,3367,3368,3369,3370,3371,3372,3373,3374, 3375,3376,3377,3378,3379,3380,3381,3382,3383,3384,3385,3386,3387,1336,3388,3389, 3390,3391,3392,3393,3394,3395,3396,3397,3398,3399,3400,3401,3402,3403,3404,3405, 3406,3407,3408,3409,3410,3411,3412,3413,3414,1337,3415,3416,3417,3418,3419,1338, 3420,3421,3422,1564,1565,3423,3424,3425,3426,3427,3428,3429,3430,3431,1254,3432, 3433,3434,1339,3435,3436,3437,3438,3439,1566,3440,3441,3442,3443,3444,3445,3446, 3447,3448,3449,3450,3451,3452,3453,3454,1255,3455,3456,3457,3458,3459,1567,1191, 3460,1568,1569,3461,3462,3463,1570,3464,3465,3466,3467,3468,1571,3469,3470,3471, 3472,3473,1572,3474,3475,3476,3477,3478,3479,3480,3481,3482,3483,3484,3485,3486, 1340,3487,3488,3489,3490,3491,3492,1021,3493,3494,3495,3496,3497,3498,1573,3499, 1341,3500,3501,3502,3503,3504,3505,3506,3507,3508,3509,3510,3511,1342,3512,3513, 3514,3515,3516,1574,1343,3517,3518,3519,1575,3520,1576,3521,3522,3523,3524,3525, 3526,3527,3528,3529,3530,3531,3532,3533,3534,3535,3536,3537,3538,3539,3540,3541, 3542,3543,3544,3545,3546,3547,3548,3549,3550,3551,3552,3553,3554,3555,3556,3557, 3558,3559,3560,3561,3562,3563,3564,3565,3566,3567,3568,3569,3570,3571,3572,3573, 3574,3575,3576,3577,3578,3579,3580,1577,3581,3582,1578,3583,3584,3585,3586,3587, 3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603, 3604,1579,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618, 3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,1580,3630,3631,1581,3632, 3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,3643,3644,3645,3646,3647,3648, 3649,3650,3651,3652,3653,3654,3655,3656,1582,3657,3658,3659,3660,3661,3662,3663, 3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,3676,3677,3678,3679, 3680,3681,3682,3683,3684,3685,3686,3687,3688,3689,3690,3691,3692,3693,3694,3695, 3696,3697,3698,3699,3700,1192,3701,3702,3703,3704,1256,3705,3706,3707,3708,1583, 1257,3709,3710,3711,3712,3713,3714,3715,3716,1584,3717,3718,3719,3720,3721,3722, 3723,3724,3725,3726,3727,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738, 3739,3740,3741,3742,3743,3744,3745,1344,3746,3747,3748,3749,3750,3751,3752,3753, 3754,3755,3756,1585,3757,3758,3759,3760,3761,3762,3763,3764,3765,3766,1586,3767, 3768,3769,3770,3771,3772,3773,3774,3775,3776,3777,3778,1345,3779,3780,3781,3782, 3783,3784,3785,3786,3787,3788,3789,3790,3791,3792,3793,3794,3795,1346,1587,3796, 3797,1588,3798,3799,3800,3801,3802,3803,3804,3805,3806,1347,3807,3808,3809,3810, 3811,1589,3812,3813,3814,3815,3816,3817,3818,3819,3820,3821,1590,3822,3823,1591, 1348,3824,3825,3826,3827,3828,3829,3830,1592,3831,3832,1593,3833,3834,3835,3836, 3837,3838,3839,3840,3841,3842,3843,3844,1349,3845,3846,3847,3848,3849,3850,3851, 3852,3853,3854,3855,3856,3857,3858,1594,3859,3860,3861,3862,3863,3864,3865,3866, 3867,3868,3869,1595,3870,3871,3872,3873,1596,3874,3875,3876,3877,3878,3879,3880, 3881,3882,3883,3884,3885,3886,1597,3887,3888,3889,3890,3891,3892,3893,3894,3895, 1598,3896,3897,3898,1599,1600,3899,1350,3900,1351,3901,3902,1352,3903,3904,3905, 3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921, 3922,3923,3924,1258,3925,3926,3927,3928,3929,3930,3931,1193,3932,1601,3933,3934, 3935,3936,3937,3938,3939,3940,3941,3942,3943,1602,3944,3945,3946,3947,3948,1603, 3949,3950,3951,3952,3953,3954,3955,3956,3957,3958,3959,3960,3961,3962,3963,3964, 3965,1604,3966,3967,3968,3969,3970,3971,3972,3973,3974,3975,3976,3977,1353,3978, 3979,3980,3981,3982,3983,3984,3985,3986,3987,3988,3989,3990,3991,1354,3992,3993, 3994,3995,3996,3997,3998,3999,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009, 4010,4011,4012,4013,4014,4015,4016,4017,4018,4019,4020,4021,4022,4023,1355,4024, 4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039,4040, 1605,4041,4042,4043,4044,4045,4046,4047,4048,4049,4050,4051,4052,4053,4054,4055, 4056,4057,4058,4059,4060,1606,4061,4062,4063,4064,1607,4065,4066,4067,4068,4069, 4070,4071,4072,4073,4074,4075,4076,1194,4077,4078,1608,4079,4080,4081,4082,4083, 4084,4085,4086,4087,1609,4088,4089,4090,4091,4092,4093,4094,4095,4096,4097,4098, 4099,4100,4101,4102,4103,4104,4105,4106,4107,4108,1259,4109,4110,4111,4112,4113, 4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,1195,4125,4126,4127,1610, 4128,4129,4130,4131,4132,4133,4134,4135,4136,4137,1356,4138,4139,4140,4141,4142, 4143,4144,1611,4145,4146,4147,4148,4149,4150,4151,4152,4153,4154,4155,4156,4157, 4158,4159,4160,4161,4162,4163,4164,4165,4166,4167,4168,4169,4170,4171,4172,4173, 4174,4175,4176,4177,4178,4179,4180,4181,4182,4183,4184,4185,4186,4187,4188,4189, 4190,4191,4192,4193,4194,4195,4196,4197,4198,4199,4200,4201,4202,4203,4204,4205, 4206,4207,4208,4209,4210,4211,4212,4213,4214,4215,4216,4217,4218,4219,1612,4220, 4221,4222,4223,4224,4225,4226,4227,1357,4228,1613,4229,4230,4231,4232,4233,4234, 4235,4236,4237,4238,4239,4240,4241,4242,4243,1614,4244,4245,4246,4247,4248,4249, 4250,4251,4252,4253,4254,4255,4256,4257,4258,4259,4260,4261,4262,4263,4264,4265, 4266,4267,4268,4269,4270,1196,1358,4271,4272,4273,4274,4275,4276,4277,4278,4279, 4280,4281,4282,4283,4284,4285,4286,4287,1615,4288,4289,4290,4291,4292,4293,4294, 4295,4296,4297,4298,4299,4300,4301,4302,4303,4304,4305,4306,4307,4308,4309,4310, 4311,4312,4313,4314,4315,4316,4317,4318,4319,4320,4321,4322,4323,4324,4325,4326, 4327,4328,4329,4330,4331,4332,4333,4334,1616,4335,4336,4337,4338,4339,4340,4341, 4342,4343,4344,4345,4346,4347,4348,4349,4350,4351,4352,4353,4354,4355,4356,4357, 4358,4359,4360,1617,4361,4362,4363,4364,4365,1618,4366,4367,4368,4369,4370,4371, 4372,4373,4374,4375,4376,4377,4378,4379,4380,4381,4382,4383,4384,4385,4386,4387, 4388,4389,4390,4391,4392,4393,4394,4395,4396,4397,4398,4399,4400,4401,4402,4403, 4404,4405,4406,4407,4408,4409,4410,4411,4412,4413,4414,4415,4416,1619,4417,4418, 4419,4420,4421,4422,4423,4424,4425,1112,4426,4427,4428,4429,4430,1620,4431,4432, 4433,4434,4435,4436,4437,4438,4439,4440,4441,4442,1260,1261,4443,4444,4445,4446, 4447,4448,4449,4450,4451,4452,4453,4454,4455,1359,4456,4457,4458,4459,4460,4461, 4462,4463,4464,4465,1621,4466,4467,4468,4469,4470,4471,4472,4473,4474,4475,4476, 4477,4478,4479,4480,4481,4482,4483,4484,4485,4486,4487,4488,4489,1055,4490,4491, 4492,4493,4494,4495,4496,4497,4498,4499,4500,4501,4502,4503,4504,4505,4506,4507, 4508,4509,4510,4511,4512,4513,4514,4515,4516,4517,4518,1622,4519,4520,4521,1623, 4522,4523,4524,4525,4526,4527,4528,4529,4530,4531,4532,4533,4534,4535,1360,4536, 4537,4538,4539,4540,4541,4542,4543, 975,4544,4545,4546,4547,4548,4549,4550,4551, 4552,4553,4554,4555,4556,4557,4558,4559,4560,4561,4562,4563,4564,4565,4566,4567, 4568,4569,4570,4571,1624,4572,4573,4574,4575,4576,1625,4577,4578,4579,4580,4581, 4582,4583,4584,1626,4585,4586,4587,4588,4589,4590,4591,4592,4593,4594,4595,1627, 4596,4597,4598,4599,4600,4601,4602,4603,4604,4605,4606,4607,4608,4609,4610,4611, 4612,4613,4614,4615,1628,4616,4617,4618,4619,4620,4621,4622,4623,4624,4625,4626, 4627,4628,4629,4630,4631,4632,4633,4634,4635,4636,4637,4638,4639,4640,4641,4642, 4643,4644,4645,4646,4647,4648,4649,1361,4650,4651,4652,4653,4654,4655,4656,4657, 4658,4659,4660,4661,1362,4662,4663,4664,4665,4666,4667,4668,4669,4670,4671,4672, 4673,4674,4675,4676,4677,4678,4679,4680,4681,4682,1629,4683,4684,4685,4686,4687, 1630,4688,4689,4690,4691,1153,4692,4693,4694,1113,4695,4696,4697,4698,4699,4700, 4701,4702,4703,4704,4705,4706,4707,4708,4709,4710,4711,1197,4712,4713,4714,4715, 4716,4717,4718,4719,4720,4721,4722,4723,4724,4725,4726,4727,4728,4729,4730,4731, 4732,4733,4734,4735,1631,4736,1632,4737,4738,4739,4740,4741,4742,4743,4744,1633, 4745,4746,4747,4748,4749,1262,4750,4751,4752,4753,4754,1363,4755,4756,4757,4758, 4759,4760,4761,4762,4763,4764,4765,4766,4767,4768,1634,4769,4770,4771,4772,4773, 4774,4775,4776,4777,4778,1635,4779,4780,4781,4782,4783,4784,4785,4786,4787,4788, 4789,1636,4790,4791,4792,4793,4794,4795,4796,4797,4798,4799,4800,4801,4802,4803, 4804,4805,4806,1637,4807,4808,4809,1638,4810,4811,4812,4813,4814,4815,4816,4817, 4818,1639,4819,4820,4821,4822,4823,4824,4825,4826,4827,4828,4829,4830,4831,4832, 4833,1077,4834,4835,4836,4837,4838,4839,4840,4841,4842,4843,4844,4845,4846,4847, 4848,4849,4850,4851,4852,4853,4854,4855,4856,4857,4858,4859,4860,4861,4862,4863, 4864,4865,4866,4867,4868,4869,4870,4871,4872,4873,4874,4875,4876,4877,4878,4879, 4880,4881,4882,4883,1640,4884,4885,1641,4886,4887,4888,4889,4890,4891,4892,4893, 4894,4895,4896,4897,4898,4899,4900,4901,4902,4903,4904,4905,4906,4907,4908,4909, 4910,4911,1642,4912,4913,4914,1364,4915,4916,4917,4918,4919,4920,4921,4922,4923, 4924,4925,4926,4927,4928,4929,4930,4931,1643,4932,4933,4934,4935,4936,4937,4938, 4939,4940,4941,4942,4943,4944,4945,4946,4947,4948,4949,4950,4951,4952,4953,4954, 4955,4956,4957,4958,4959,4960,4961,4962,4963,4964,4965,4966,4967,4968,4969,4970, 4971,4972,4973,4974,4975,4976,4977,4978,4979,4980,1644,4981,4982,4983,4984,1645, 4985,4986,1646,4987,4988,4989,4990,4991,4992,4993,4994,4995,4996,4997,4998,4999, 5000,5001,5002,5003,5004,5005,1647,5006,1648,5007,5008,5009,5010,5011,5012,1078, 5013,5014,5015,5016,5017,5018,5019,5020,5021,5022,5023,5024,5025,5026,5027,5028, 1365,5029,5030,5031,5032,5033,5034,5035,5036,5037,5038,5039,1649,5040,5041,5042, 5043,5044,5045,1366,5046,5047,5048,5049,5050,5051,5052,5053,5054,5055,1650,5056, 5057,5058,5059,5060,5061,5062,5063,5064,5065,5066,5067,5068,5069,5070,5071,5072, 5073,5074,5075,5076,5077,1651,5078,5079,5080,5081,5082,5083,5084,5085,5086,5087, 5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102,5103, 5104,5105,5106,5107,5108,5109,5110,1652,5111,5112,5113,5114,5115,5116,5117,5118, 1367,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,1653,5130,5131,5132, 5133,5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148, 5149,1368,5150,1654,5151,1369,5152,5153,5154,5155,5156,5157,5158,5159,5160,5161, 5162,5163,5164,5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,5176,5177, 5178,1370,5179,5180,5181,5182,5183,5184,5185,5186,5187,5188,5189,5190,5191,5192, 5193,5194,5195,5196,5197,5198,1655,5199,5200,5201,5202,1656,5203,5204,5205,5206, 1371,5207,1372,5208,5209,5210,5211,1373,5212,5213,1374,5214,5215,5216,5217,5218, 5219,5220,5221,5222,5223,5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234, 5235,5236,5237,5238,5239,5240,5241,5242,5243,5244,5245,5246,5247,1657,5248,5249, 5250,5251,1658,1263,5252,5253,5254,5255,5256,1375,5257,5258,5259,5260,5261,5262, 5263,5264,5265,5266,5267,5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278, 5279,5280,5281,5282,5283,1659,5284,5285,5286,5287,5288,5289,5290,5291,5292,5293, 5294,5295,5296,5297,5298,5299,5300,1660,5301,5302,5303,5304,5305,5306,5307,5308, 5309,5310,5311,5312,5313,5314,5315,5316,5317,5318,5319,5320,5321,1376,5322,5323, 5324,5325,5326,5327,5328,5329,5330,5331,5332,5333,1198,5334,5335,5336,5337,5338, 5339,5340,5341,5342,5343,1661,5344,5345,5346,5347,5348,5349,5350,5351,5352,5353, 5354,5355,5356,5357,5358,5359,5360,5361,5362,5363,5364,5365,5366,5367,5368,5369, 5370,5371,5372,5373,5374,5375,5376,5377,5378,5379,5380,5381,5382,5383,5384,5385, 5386,5387,5388,5389,5390,5391,5392,5393,5394,5395,5396,5397,5398,1264,5399,5400, 5401,5402,5403,5404,5405,5406,5407,5408,5409,5410,5411,5412,1662,5413,5414,5415, 5416,1663,5417,5418,5419,5420,5421,5422,5423,5424,5425,5426,5427,5428,5429,5430, 5431,5432,5433,5434,5435,5436,5437,5438,1664,5439,5440,5441,5442,5443,5444,5445, 5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456,5457,5458,5459,5460,5461, 5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472,5473,5474,5475,5476,5477, 5478,1154,5479,5480,5481,5482,5483,5484,5485,1665,5486,5487,5488,5489,5490,5491, 5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504,5505,5506,5507, 5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520,5521,5522,5523, 5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536,5537,5538,5539, 5540,5541,5542,5543,5544,5545,5546,5547,5548,1377,5549,5550,5551,5552,5553,5554, 5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568,5569,5570, 1114,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584,5585, 5586,5587,5588,5589,5590,5591,5592,1378,5593,5594,5595,5596,5597,5598,5599,5600, 5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,1379,5615, 5616,5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631, 5632,5633,5634,1380,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646, 5647,5648,5649,1381,1056,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660, 1666,5661,5662,5663,5664,5665,5666,5667,5668,1667,5669,1668,5670,5671,5672,5673, 5674,5675,5676,5677,5678,1155,5679,5680,5681,5682,5683,5684,5685,5686,5687,5688, 5689,5690,5691,5692,5693,5694,5695,5696,5697,5698,1669,5699,5700,5701,5702,5703, 5704,5705,1670,5706,5707,5708,5709,5710,1671,5711,5712,5713,5714,1382,5715,5716, 5717,5718,5719,5720,5721,5722,5723,5724,5725,1672,5726,5727,1673,1674,5728,5729, 5730,5731,5732,5733,5734,5735,5736,1675,5737,5738,5739,5740,5741,5742,5743,5744, 1676,5745,5746,5747,5748,5749,5750,5751,1383,5752,5753,5754,5755,5756,5757,5758, 5759,5760,5761,5762,5763,5764,5765,5766,5767,5768,1677,5769,5770,5771,5772,5773, 1678,5774,5775,5776, 998,5777,5778,5779,5780,5781,5782,5783,5784,5785,1384,5786, 5787,5788,5789,5790,5791,5792,5793,5794,5795,5796,5797,5798,5799,5800,1679,5801, 5802,5803,1115,1116,5804,5805,5806,5807,5808,5809,5810,5811,5812,5813,5814,5815, 5816,5817,5818,5819,5820,5821,5822,5823,5824,5825,5826,5827,5828,5829,5830,5831, 5832,5833,5834,5835,5836,5837,5838,5839,5840,5841,5842,5843,5844,5845,5846,5847, 5848,5849,5850,5851,5852,5853,5854,5855,1680,5856,5857,5858,5859,5860,5861,5862, 5863,5864,1681,5865,5866,5867,1682,5868,5869,5870,5871,5872,5873,5874,5875,5876, 5877,5878,5879,1683,5880,1684,5881,5882,5883,5884,1685,5885,5886,5887,5888,5889, 5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904,5905, 5906,5907,1686,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920, 5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,1687, 5936,5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951, 5952,1688,1689,5953,1199,5954,5955,5956,5957,5958,5959,5960,5961,1690,5962,5963, 5964,5965,5966,5967,5968,5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979, 5980,5981,1385,5982,1386,5983,5984,5985,5986,5987,5988,5989,5990,5991,5992,5993, 5994,5995,5996,5997,5998,5999,6000,6001,6002,6003,6004,6005,6006,6007,6008,6009, 6010,6011,6012,6013,6014,6015,6016,6017,6018,6019,6020,6021,6022,6023,6024,6025, 6026,6027,1265,6028,6029,1691,6030,6031,6032,6033,6034,6035,6036,6037,6038,6039, 6040,6041,6042,6043,6044,6045,6046,6047,6048,6049,6050,6051,6052,6053,6054,6055, 6056,6057,6058,6059,6060,6061,6062,6063,6064,6065,6066,6067,6068,6069,6070,6071, 6072,6073,6074,6075,6076,6077,6078,6079,6080,6081,6082,6083,6084,1692,6085,6086, 6087,6088,6089,6090,6091,6092,6093,6094,6095,6096,6097,6098,6099,6100,6101,6102, 6103,6104,6105,6106,6107,6108,6109,6110,6111,6112,6113,6114,6115,6116,6117,6118, 6119,6120,6121,6122,6123,6124,6125,6126,6127,6128,6129,6130,6131,1693,6132,6133, 6134,6135,6136,1694,6137,6138,6139,6140,6141,1695,6142,6143,6144,6145,6146,6147, 6148,6149,6150,6151,6152,6153,6154,6155,6156,6157,6158,6159,6160,6161,6162,6163, 6164,6165,6166,6167,6168,6169,6170,6171,6172,6173,6174,6175,6176,6177,6178,6179, 6180,6181,6182,6183,6184,6185,1696,6186,6187,6188,6189,6190,6191,6192,6193,6194, 6195,6196,6197,6198,6199,6200,6201,6202,6203,6204,6205,6206,6207,6208,6209,6210, 6211,6212,6213,6214,6215,6216,6217,6218,6219,1697,6220,6221,6222,6223,6224,6225, 6226,6227,6228,6229,6230,6231,6232,6233,6234,6235,6236,6237,6238,6239,6240,6241, 6242,6243,6244,6245,6246,6247,6248,6249,6250,6251,6252,6253,1698,6254,6255,6256, 6257,6258,6259,6260,6261,6262,6263,1200,6264,6265,6266,6267,6268,6269,6270,6271, //1024 6272,6273,6274,6275,6276,6277,6278,6279,6280,6281,6282,6283,6284,6285,6286,6287, 6288,6289,6290,6291,6292,6293,6294,6295,6296,6297,6298,6299,6300,6301,6302,1699, 6303,6304,1700,6305,6306,6307,6308,6309,6310,6311,6312,6313,6314,6315,6316,6317, 6318,6319,6320,6321,6322,6323,6324,6325,6326,6327,6328,6329,6330,6331,6332,6333, 6334,6335,6336,6337,6338,6339,1701,6340,6341,6342,6343,6344,1387,6345,6346,6347, 6348,6349,6350,6351,6352,6353,6354,6355,6356,6357,6358,6359,6360,6361,6362,6363, 6364,6365,6366,6367,6368,6369,6370,6371,6372,6373,6374,6375,6376,6377,6378,6379, 6380,6381,6382,6383,6384,6385,6386,6387,6388,6389,6390,6391,6392,6393,6394,6395, 6396,6397,6398,6399,6400,6401,6402,6403,6404,6405,6406,6407,6408,6409,6410,6411, 6412,6413,1702,6414,6415,6416,6417,6418,6419,6420,6421,6422,1703,6423,6424,6425, 6426,6427,6428,6429,6430,6431,6432,6433,6434,6435,6436,6437,6438,1704,6439,6440, 6441,6442,6443,6444,6445,6446,6447,6448,6449,6450,6451,6452,6453,6454,6455,6456, 6457,6458,6459,6460,6461,6462,6463,6464,6465,6466,6467,6468,6469,6470,6471,6472, 6473,6474,6475,6476,6477,6478,6479,6480,6481,6482,6483,6484,6485,6486,6487,6488, 6489,6490,6491,6492,6493,6494,6495,6496,6497,6498,6499,6500,6501,6502,6503,1266, 6504,6505,6506,6507,6508,6509,6510,6511,6512,6513,6514,6515,6516,6517,6518,6519, 6520,6521,6522,6523,6524,6525,6526,6527,6528,6529,6530,6531,6532,6533,6534,6535, 6536,6537,6538,6539,6540,6541,6542,6543,6544,6545,6546,6547,6548,6549,6550,6551, 1705,1706,6552,6553,6554,6555,6556,6557,6558,6559,6560,6561,6562,6563,6564,6565, 6566,6567,6568,6569,6570,6571,6572,6573,6574,6575,6576,6577,6578,6579,6580,6581, 6582,6583,6584,6585,6586,6587,6588,6589,6590,6591,6592,6593,6594,6595,6596,6597, 6598,6599,6600,6601,6602,6603,6604,6605,6606,6607,6608,6609,6610,6611,6612,6613, 6614,6615,6616,6617,6618,6619,6620,6621,6622,6623,6624,6625,6626,6627,6628,6629, 6630,6631,6632,6633,6634,6635,6636,6637,1388,6638,6639,6640,6641,6642,6643,6644, 1707,6645,6646,6647,6648,6649,6650,6651,6652,6653,6654,6655,6656,6657,6658,6659, 6660,6661,6662,6663,1708,6664,6665,6666,6667,6668,6669,6670,6671,6672,6673,6674, 1201,6675,6676,6677,6678,6679,6680,6681,6682,6683,6684,6685,6686,6687,6688,6689, 6690,6691,6692,6693,6694,6695,6696,6697,6698,6699,6700,6701,6702,6703,6704,6705, 6706,6707,6708,6709,6710,6711,6712,6713,6714,6715,6716,6717,6718,6719,6720,6721, 6722,6723,6724,6725,1389,6726,6727,6728,6729,6730,6731,6732,6733,6734,6735,6736, 1390,1709,6737,6738,6739,6740,6741,6742,1710,6743,6744,6745,6746,1391,6747,6748, 6749,6750,6751,6752,6753,6754,6755,6756,6757,1392,6758,6759,6760,6761,6762,6763, 6764,6765,6766,6767,6768,6769,6770,6771,6772,6773,6774,6775,6776,6777,6778,6779, 6780,1202,6781,6782,6783,6784,6785,6786,6787,6788,6789,6790,6791,6792,6793,6794, 6795,6796,6797,6798,6799,6800,6801,6802,6803,6804,6805,6806,6807,6808,6809,1711, 6810,6811,6812,6813,6814,6815,6816,6817,6818,6819,6820,6821,6822,6823,6824,6825, 6826,6827,6828,6829,6830,6831,6832,6833,6834,6835,6836,1393,6837,6838,6839,6840, 6841,6842,6843,6844,6845,6846,6847,6848,6849,6850,6851,6852,6853,6854,6855,6856, 6857,6858,6859,6860,6861,6862,6863,6864,6865,6866,6867,6868,6869,6870,6871,6872, 6873,6874,6875,6876,6877,6878,6879,6880,6881,6882,6883,6884,6885,6886,6887,6888, 6889,6890,6891,6892,6893,6894,6895,6896,6897,6898,6899,6900,6901,6902,1712,6903, 6904,6905,6906,6907,6908,6909,6910,1713,6911,6912,6913,6914,6915,6916,6917,6918, 6919,6920,6921,6922,6923,6924,6925,6926,6927,6928,6929,6930,6931,6932,6933,6934, 6935,6936,6937,6938,6939,6940,6941,6942,6943,6944,6945,6946,6947,6948,6949,6950, 6951,6952,6953,6954,6955,6956,6957,6958,6959,6960,6961,6962,6963,6964,6965,6966, 6967,6968,6969,6970,6971,6972,6973,6974,1714,6975,6976,6977,6978,6979,6980,6981, 6982,6983,6984,6985,6986,6987,6988,1394,6989,6990,6991,6992,6993,6994,6995,6996, 6997,6998,6999,7000,1715,7001,7002,7003,7004,7005,7006,7007,7008,7009,7010,7011, 7012,7013,7014,7015,7016,7017,7018,7019,7020,7021,7022,7023,7024,7025,7026,7027, 7028,1716,7029,7030,7031,7032,7033,7034,7035,7036,7037,7038,7039,7040,7041,7042, 7043,7044,7045,7046,7047,7048,7049,7050,7051,7052,7053,7054,7055,7056,7057,7058, 7059,7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,7071,7072,7073,7074, 7075,7076,7077,7078,7079,7080,7081,7082,7083,7084,7085,7086,7087,7088,7089,7090, 7091,7092,7093,7094,7095,7096,7097,7098,7099,7100,7101,7102,7103,7104,7105,7106, 7107,7108,7109,7110,7111,7112,7113,7114,7115,7116,7117,7118,7119,7120,7121,7122, 7123,7124,7125,7126,7127,7128,7129,7130,7131,7132,7133,7134,7135,7136,7137,7138, 7139,7140,7141,7142,7143,7144,7145,7146,7147,7148,7149,7150,7151,7152,7153,7154, 7155,7156,7157,7158,7159,7160,7161,7162,7163,7164,7165,7166,7167,7168,7169,7170, 7171,7172,7173,7174,7175,7176,7177,7178,7179,7180,7181,7182,7183,7184,7185,7186, 7187,7188,7189,7190,7191,7192,7193,7194,7195,7196,7197,7198,7199,7200,7201,7202, 7203,7204,7205,7206,7207,1395,7208,7209,7210,7211,7212,7213,1717,7214,7215,7216, 7217,7218,7219,7220,7221,7222,7223,7224,7225,7226,7227,7228,7229,7230,7231,7232, 7233,7234,7235,7236,7237,7238,7239,7240,7241,7242,7243,7244,7245,7246,7247,7248, 7249,7250,7251,7252,7253,7254,7255,7256,7257,7258,7259,7260,7261,7262,7263,7264, 7265,7266,7267,7268,7269,7270,7271,7272,7273,7274,7275,7276,7277,7278,7279,7280, 7281,7282,7283,7284,7285,7286,7287,7288,7289,7290,7291,7292,7293,7294,7295,7296, 7297,7298,7299,7300,7301,7302,7303,7304,7305,7306,7307,7308,7309,7310,7311,7312, 7313,1718,7314,7315,7316,7317,7318,7319,7320,7321,7322,7323,7324,7325,7326,7327, 7328,7329,7330,7331,7332,7333,7334,7335,7336,7337,7338,7339,7340,7341,7342,7343, 7344,7345,7346,7347,7348,7349,7350,7351,7352,7353,7354,7355,7356,7357,7358,7359, 7360,7361,7362,7363,7364,7365,7366,7367,7368,7369,7370,7371,7372,7373,7374,7375, 7376,7377,7378,7379,7380,7381,7382,7383,7384,7385,7386,7387,7388,7389,7390,7391, 7392,7393,7394,7395,7396,7397,7398,7399,7400,7401,7402,7403,7404,7405,7406,7407, 7408,7409,7410,7411,7412,7413,7414,7415,7416,7417,7418,7419,7420,7421,7422,7423, 7424,7425,7426,7427,7428,7429,7430,7431,7432,7433,7434,7435,7436,7437,7438,7439, 7440,7441,7442,7443,7444,7445,7446,7447,7448,7449,7450,7451,7452,7453,7454,7455, 7456,7457,7458,7459,7460,7461,7462,7463,7464,7465,7466,7467,7468,7469,7470,7471, 7472,7473,7474,7475,7476,7477,7478,7479,7480,7481,7482,7483,7484,7485,7486,7487, 7488,7489,7490,7491,7492,7493,7494,7495,7496,7497,7498,7499,7500,7501,7502,7503, 7504,7505,7506,7507,7508,7509,7510,7511,7512,7513,7514,7515,7516,7517,7518,7519, 7520,7521,7522,7523,7524,7525,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535, 7536,7537,7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,7550,7551, 7552,7553,7554,7555,7556,7557,7558,7559,7560,7561,7562,7563,7564,7565,7566,7567, 7568,7569,7570,7571,7572,7573,7574,7575,7576,7577,7578,7579,7580,7581,7582,7583, 7584,7585,7586,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598,7599, 7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614,7615, 7616,7617,7618,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628,7629,7630,7631, 7632,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,7646,7647, 7648,7649,7650,7651,7652,7653,7654,7655,7656,7657,7658,7659,7660,7661,7662,7663, 7664,7665,7666,7667,7668,7669,7670,7671,7672,7673,7674,7675,7676,7677,7678,7679, 7680,7681,7682,7683,7684,7685,7686,7687,7688,7689,7690,7691,7692,7693,7694,7695, 7696,7697,7698,7699,7700,7701,7702,7703,7704,7705,7706,7707,7708,7709,7710,7711, 7712,7713,7714,7715,7716,7717,7718,7719,7720,7721,7722,7723,7724,7725,7726,7727, 7728,7729,7730,7731,7732,7733,7734,7735,7736,7737,7738,7739,7740,7741,7742,7743, 7744,7745,7746,7747,7748,7749,7750,7751,7752,7753,7754,7755,7756,7757,7758,7759, 7760,7761,7762,7763,7764,7765,7766,7767,7768,7769,7770,7771,7772,7773,7774,7775, 7776,7777,7778,7779,7780,7781,7782,7783,7784,7785,7786,7787,7788,7789,7790,7791, 7792,7793,7794,7795,7796,7797,7798,7799,7800,7801,7802,7803,7804,7805,7806,7807, 7808,7809,7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823, 7824,7825,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839, 7840,7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7851,7852,7853,7854,7855, 7856,7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871, 7872,7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,7887, 7888,7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903, 7904,7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919, 7920,7921,7922,7923,7924,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935, 7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951, 7952,7953,7954,7955,7956,7957,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967, 7968,7969,7970,7971,7972,7973,7974,7975,7976,7977,7978,7979,7980,7981,7982,7983, 7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999, 8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015, 8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031, 8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047, 8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063, 8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079, 8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095, 8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111, 8112,8113,8114,8115,8116,8117,8118,8119,8120,8121,8122,8123,8124,8125,8126,8127, 8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143, 8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159, 8160,8161,8162,8163,8164,8165,8166,8167,8168,8169,8170,8171,8172,8173,8174,8175, 8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191, 8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207, 8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223, 8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239, 8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255, 8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271, 8272,8273,8274,8275,8276,8277,8278,8279,8280,8281,8282,8283,8284,8285,8286,8287, 8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303, 8304,8305,8306,8307,8308,8309,8310,8311,8312,8313,8314,8315,8316,8317,8318,8319, 8320,8321,8322,8323,8324,8325,8326,8327,8328,8329,8330,8331,8332,8333,8334,8335, 8336,8337,8338,8339,8340,8341,8342,8343,8344,8345,8346,8347,8348,8349,8350,8351, 8352,8353,8354,8355,8356,8357,8358,8359,8360,8361,8362,8363,8364,8365,8366,8367, 8368,8369,8370,8371,8372,8373,8374,8375,8376,8377,8378,8379,8380,8381,8382,8383, 8384,8385,8386,8387,8388,8389,8390,8391,8392,8393,8394,8395,8396,8397,8398,8399, 8400,8401,8402,8403,8404,8405,8406,8407,8408,8409,8410,8411,8412,8413,8414,8415, 8416,8417,8418,8419,8420,8421,8422,8423,8424,8425,8426,8427,8428,8429,8430,8431, 8432,8433,8434,8435,8436,8437,8438,8439,8440,8441,8442,8443,8444,8445,8446,8447, 8448,8449,8450,8451,8452,8453,8454,8455,8456,8457,8458,8459,8460,8461,8462,8463, 8464,8465,8466,8467,8468,8469,8470,8471,8472,8473,8474,8475,8476,8477,8478,8479, 8480,8481,8482,8483,8484,8485,8486,8487,8488,8489,8490,8491,8492,8493,8494,8495, 8496,8497,8498,8499,8500,8501,8502,8503,8504,8505,8506,8507,8508,8509,8510,8511, 8512,8513,8514,8515,8516,8517,8518,8519,8520,8521,8522,8523,8524,8525,8526,8527, 8528,8529,8530,8531,8532,8533,8534,8535,8536,8537,8538,8539,8540,8541,8542,8543, 8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,8555,8556,8557,8558,8559, 8560,8561,8562,8563,8564,8565,8566,8567,8568,8569,8570,8571,8572,8573,8574,8575, 8576,8577,8578,8579,8580,8581,8582,8583,8584,8585,8586,8587,8588,8589,8590,8591, 8592,8593,8594,8595,8596,8597,8598,8599,8600,8601,8602,8603,8604,8605,8606,8607, 8608,8609,8610,8611,8612,8613,8614,8615,8616,8617,8618,8619,8620,8621,8622,8623, 8624,8625,8626,8627,8628,8629,8630,8631,8632,8633,8634,8635,8636,8637,8638,8639, 8640,8641,8642,8643,8644,8645,8646,8647,8648,8649,8650,8651,8652,8653,8654,8655, 8656,8657,8658,8659,8660,8661,8662,8663,8664,8665,8666,8667,8668,8669,8670,8671, 8672,8673,8674,8675,8676,8677,8678,8679,8680,8681,8682,8683,8684,8685,8686,8687, 8688,8689,8690,8691,8692,8693,8694,8695,8696,8697,8698,8699,8700,8701,8702,8703, 8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719, 8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8735, 8736,8737,8738,8739,8740,8741 ****************************************************************************************/ }; ================================================ FILE: third_party/uchardet/uchardet/src/tables/EUCTWFreq.tab ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // EUCTW frequency table // Converted from big5 work // by Taiwan's Mandarin Promotion Council // /****************************************************************************** * 128 --> 0.42261 * 256 --> 0.57851 * 512 --> 0.74851 * 1024 --> 0.89384 * 2048 --> 0.97583 * * Idea Distribution Ratio = 0.74851/(1-0.74851) =2.98 * Random Distribution Ration = 512/(5401-512)=0.105 * * Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR *****************************************************************************/ #define EUCTW_TYPICAL_DISTRIBUTION_RATIO (float)0.75 //Char to FreqOrder table , //#define EUCTW_TABLE_SIZE 8102 #define EUCTW_TABLE_SIZE 5376 constexpr PRInt16 EUCTWCharToFreqOrder[] = { 1,1800,1506, 255,1431, 198, 9, 82, 6,7310, 177, 202,3615,1256,2808, 110, // 2742 3735, 33,3241, 261, 76, 44,2113, 16,2931,2184,1176, 659,3868, 26,3404,2643, // 2758 1198,3869,3313,4060, 410,2211, 302, 590, 361,1963, 8, 204, 58,4296,7311,1931, // 2774 63,7312,7313, 317,1614, 75, 222, 159,4061,2412,1480,7314,3500,3068, 224,2809, // 2790 3616, 3, 10,3870,1471, 29,2774,1135,2852,1939, 873, 130,3242,1123, 312,7315, // 2806 4297,2051, 507, 252, 682,7316, 142,1914, 124, 206,2932, 34,3501,3173, 64, 604, // 2822 7317,2494,1976,1977, 155,1990, 645, 641,1606,7318,3405, 337, 72, 406,7319, 80, // 2838 630, 238,3174,1509, 263, 939,1092,2644, 756,1440,1094,3406, 449, 69,2969, 591, // 2854 179,2095, 471, 115,2034,1843, 60, 50,2970, 134, 806,1868, 734,2035,3407, 180, // 2870 995,1607, 156, 537,2893, 688,7320, 319,1305, 779,2144, 514,2374, 298,4298, 359, // 2886 2495, 90,2707,1338, 663, 11, 906,1099,2545, 20,2436, 182, 532,1716,7321, 732, // 2902 1376,4062,1311,1420,3175, 25,2312,1056, 113, 399, 382,1949, 242,3408,2467, 529, // 2918 3243, 475,1447,3617,7322, 117, 21, 656, 810,1297,2295,2329,3502,7323, 126,4063, // 2934 706, 456, 150, 613,4299, 71,1118,2036,4064, 145,3069, 85, 835, 486,2114,1246, // 2950 1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,7324,2127,2354, 347,3736, 221, // 2966 3503,3110,7325,1955,1153,4065, 83, 296,1199,3070, 192, 624, 93,7326, 822,1897, // 2982 2810,3111, 795,2064, 991,1554,1542,1592, 27, 43,2853, 859, 139,1456, 860,4300, // 2998 437, 712,3871, 164,2392,3112, 695, 211,3017,2096, 195,3872,1608,3504,3505,3618, // 3014 3873, 234, 811,2971,2097,3874,2229,1441,3506,1615,2375, 668,2076,1638, 305, 228, // 3030 1664,4301, 467, 415,7327, 262,2098,1593, 239, 108, 300, 200,1033, 512,1247,2077, // 3046 7328,7329,2173,3176,3619,2673, 593, 845,1062,3244, 88,1723,2037,3875,1950, 212, // 3062 266, 152, 149, 468,1898,4066,4302, 77, 187,7330,3018, 37, 5,2972,7331,3876, // 3078 7332,7333, 39,2517,4303,2894,3177,2078, 55, 148, 74,4304, 545, 483,1474,1029, // 3094 1665, 217,1869,1531,3113,1104,2645,4067, 24, 172,3507, 900,3877,3508,3509,4305, // 3110 32,1408,2811,1312, 329, 487,2355,2247,2708, 784,2674, 4,3019,3314,1427,1788, // 3126 188, 109, 499,7334,3620,1717,1789, 888,1217,3020,4306,7335,3510,7336,3315,1520, // 3142 3621,3878, 196,1034, 775,7337,7338, 929,1815, 249, 439, 38,7339,1063,7340, 794, // 3158 3879,1435,2296, 46, 178,3245,2065,7341,2376,7342, 214,1709,4307, 804, 35, 707, // 3174 324,3622,1601,2546, 140, 459,4068,7343,7344,1365, 839, 272, 978,2257,2572,3409, // 3190 2128,1363,3623,1423, 697, 100,3071, 48, 70,1231, 495,3114,2193,7345,1294,7346, // 3206 2079, 462, 586,1042,3246, 853, 256, 988, 185,2377,3410,1698, 434,1084,7347,3411, // 3222 314,2615,2775,4308,2330,2331, 569,2280, 637,1816,2518, 757,1162,1878,1616,3412, // 3238 287,1577,2115, 768,4309,1671,2854,3511,2519,1321,3737, 909,2413,7348,4069, 933, // 3254 3738,7349,2052,2356,1222,4310, 765,2414,1322, 786,4311,7350,1919,1462,1677,2895, // 3270 1699,7351,4312,1424,2437,3115,3624,2590,3316,1774,1940,3413,3880,4070, 309,1369, // 3286 1130,2812, 364,2230,1653,1299,3881,3512,3882,3883,2646, 525,1085,3021, 902,2000, // 3302 1475, 964,4313, 421,1844,1415,1057,2281, 940,1364,3116, 376,4314,4315,1381, 7, // 3318 2520, 983,2378, 336,1710,2675,1845, 321,3414, 559,1131,3022,2742,1808,1132,1313, // 3334 265,1481,1857,7352, 352,1203,2813,3247, 167,1089, 420,2814, 776, 792,1724,3513, // 3350 4071,2438,3248,7353,4072,7354, 446, 229, 333,2743, 901,3739,1200,1557,4316,2647, // 3366 1920, 395,2744,2676,3740,4073,1835, 125, 916,3178,2616,4317,7355,7356,3741,7357, // 3382 7358,7359,4318,3117,3625,1133,2547,1757,3415,1510,2313,1409,3514,7360,2145, 438, // 3398 2591,2896,2379,3317,1068, 958,3023, 461, 311,2855,2677,4074,1915,3179,4075,1978, // 3414 383, 750,2745,2617,4076, 274, 539, 385,1278,1442,7361,1154,1964, 384, 561, 210, // 3430 98,1295,2548,3515,7362,1711,2415,1482,3416,3884,2897,1257, 129,7363,3742, 642, // 3446 523,2776,2777,2648,7364, 141,2231,1333, 68, 176, 441, 876, 907,4077, 603,2592, // 3462 710, 171,3417, 404, 549, 18,3118,2393,1410,3626,1666,7365,3516,4319,2898,4320, // 3478 7366,2973, 368,7367, 146, 366, 99, 871,3627,1543, 748, 807,1586,1185, 22,2258, // 3494 379,3743,3180,7368,3181, 505,1941,2618,1991,1382,2314,7369, 380,2357, 218, 702, // 3510 1817,1248,3418,3024,3517,3318,3249,7370,2974,3628, 930,3250,3744,7371, 59,7372, // 3526 585, 601,4078, 497,3419,1112,1314,4321,1801,7373,1223,1472,2174,7374, 749,1836, // 3542 690,1899,3745,1772,3885,1476, 429,1043,1790,2232,2116, 917,4079, 447,1086,1629, // 3558 7375, 556,7376,7377,2020,1654, 844,1090, 105, 550, 966,1758,2815,1008,1782, 686, // 3574 1095,7378,2282, 793,1602,7379,3518,2593,4322,4080,2933,2297,4323,3746, 980,2496, // 3590 544, 353, 527,4324, 908,2678,2899,7380, 381,2619,1942,1348,7381,1341,1252, 560, // 3606 3072,7382,3420,2856,7383,2053, 973, 886,2080, 143,4325,7384,7385, 157,3886, 496, // 3622 4081, 57, 840, 540,2038,4326,4327,3421,2117,1445, 970,2259,1748,1965,2081,4082, // 3638 3119,1234,1775,3251,2816,3629, 773,1206,2129,1066,2039,1326,3887,1738,1725,4083, // 3654 279,3120, 51,1544,2594, 423,1578,2130,2066, 173,4328,1879,7386,7387,1583, 264, // 3670 610,3630,4329,2439, 280, 154,7388,7389,7390,1739, 338,1282,3073, 693,2857,1411, // 3686 1074,3747,2440,7391,4330,7392,7393,1240, 952,2394,7394,2900,1538,2679, 685,1483, // 3702 4084,2468,1436, 953,4085,2054,4331, 671,2395, 79,4086,2441,3252, 608, 567,2680, // 3718 3422,4087,4088,1691, 393,1261,1791,2396,7395,4332,7396,7397,7398,7399,1383,1672, // 3734 3748,3182,1464, 522,1119, 661,1150, 216, 675,4333,3888,1432,3519, 609,4334,2681, // 3750 2397,7400,7401,7402,4089,3025, 0,7403,2469, 315, 231,2442, 301,3319,4335,2380, // 3766 7404, 233,4090,3631,1818,4336,4337,7405, 96,1776,1315,2082,7406, 257,7407,1809, // 3782 3632,2709,1139,1819,4091,2021,1124,2163,2778,1777,2649,7408,3074, 363,1655,3183, // 3798 7409,2975,7410,7411,7412,3889,1567,3890, 718, 103,3184, 849,1443, 341,3320,2934, // 3814 1484,7413,1712, 127, 67, 339,4092,2398, 679,1412, 821,7414,7415, 834, 738, 351, // 3830 2976,2146, 846, 235,1497,1880, 418,1992,3749,2710, 186,1100,2147,2746,3520,1545, // 3846 1355,2935,2858,1377, 583,3891,4093,2573,2977,7416,1298,3633,1078,2549,3634,2358, // 3862 78,3750,3751, 267,1289,2099,2001,1594,4094, 348, 369,1274,2194,2175,1837,4338, // 3878 1820,2817,3635,2747,2283,2002,4339,2936,2748, 144,3321, 882,4340,3892,2749,3423, // 3894 4341,2901,7417,4095,1726, 320,7418,3893,3026, 788,2978,7419,2818,1773,1327,2859, // 3910 3894,2819,7420,1306,4342,2003,1700,3752,3521,2359,2650, 787,2022, 506, 824,3636, // 3926 534, 323,4343,1044,3322,2023,1900, 946,3424,7421,1778,1500,1678,7422,1881,4344, // 3942 165, 243,4345,3637,2521, 123, 683,4096, 764,4346, 36,3895,1792, 589,2902, 816, // 3958 626,1667,3027,2233,1639,1555,1622,3753,3896,7423,3897,2860,1370,1228,1932, 891, // 3974 2083,2903, 304,4097,7424, 292,2979,2711,3522, 691,2100,4098,1115,4347, 118, 662, // 3990 7425, 611,1156, 854,2381,1316,2861, 2, 386, 515,2904,7426,7427,3253, 868,2234, // 4006 1486, 855,2651, 785,2212,3028,7428,1040,3185,3523,7429,3121, 448,7430,1525,7431, // 4022 2164,4348,7432,3754,7433,4099,2820,3524,3122, 503, 818,3898,3123,1568, 814, 676, // 4038 1444, 306,1749,7434,3755,1416,1030, 197,1428, 805,2821,1501,4349,7435,7436,7437, // 4054 1993,7438,4350,7439,7440,2195, 13,2779,3638,2980,3124,1229,1916,7441,3756,2131, // 4070 7442,4100,4351,2399,3525,7443,2213,1511,1727,1120,7444,7445, 646,3757,2443, 307, // 4086 7446,7447,1595,3186,7448,7449,7450,3639,1113,1356,3899,1465,2522,2523,7451, 519, // 4102 7452, 128,2132, 92,2284,1979,7453,3900,1512, 342,3125,2196,7454,2780,2214,1980, // 4118 3323,7455, 290,1656,1317, 789, 827,2360,7456,3758,4352, 562, 581,3901,7457, 401, // 4134 4353,2248, 94,4354,1399,2781,7458,1463,2024,4355,3187,1943,7459, 828,1105,4101, // 4150 1262,1394,7460,4102, 605,4356,7461,1783,2862,7462,2822, 819,2101, 578,2197,2937, // 4166 7463,1502, 436,3254,4103,3255,2823,3902,2905,3425,3426,7464,2712,2315,7465,7466, // 4182 2332,2067, 23,4357, 193, 826,3759,2102, 699,1630,4104,3075, 390,1793,1064,3526, // 4198 7467,1579,3076,3077,1400,7468,4105,1838,1640,2863,7469,4358,4359, 137,4106, 598, // 4214 3078,1966, 780, 104, 974,2938,7470, 278, 899, 253, 402, 572, 504, 493,1339,7471, // 4230 3903,1275,4360,2574,2550,7472,3640,3029,3079,2249, 565,1334,2713, 863, 41,7473, // 4246 7474,4361,7475,1657,2333, 19, 463,2750,4107, 606,7476,2981,3256,1087,2084,1323, // 4262 2652,2982,7477,1631,1623,1750,4108,2682,7478,2864, 791,2714,2653,2334, 232,2416, // 4278 7479,2983,1498,7480,2654,2620, 755,1366,3641,3257,3126,2025,1609, 119,1917,3427, // 4294 862,1026,4109,7481,3904,3760,4362,3905,4363,2260,1951,2470,7482,1125, 817,4110, // 4310 4111,3906,1513,1766,2040,1487,4112,3030,3258,2824,3761,3127,7483,7484,1507,7485, // 4326 2683, 733, 40,1632,1106,2865, 345,4113, 841,2524, 230,4364,2984,1846,3259,3428, // 4342 7486,1263, 986,3429,7487, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562,3907, // 4358 3908,2939, 967,2751,2655,1349, 592,2133,1692,3324,2985,1994,4114,1679,3909,1901, // 4374 2185,7488, 739,3642,2715,1296,1290,7489,4115,2198,2199,1921,1563,2595,2551,1870, // 4390 2752,2986,7490, 435,7491, 343,1108, 596, 17,1751,4365,2235,3430,3643,7492,4366, // 4406 294,3527,2940,1693, 477, 979, 281,2041,3528, 643,2042,3644,2621,2782,2261,1031, // 4422 2335,2134,2298,3529,4367, 367,1249,2552,7493,3530,7494,4368,1283,3325,2004, 240, // 4438 1762,3326,4369,4370, 836,1069,3128, 474,7495,2148,2525, 268,3531,7496,3188,1521, // 4454 1284,7497,1658,1546,4116,7498,3532,3533,7499,4117,3327,2684,1685,4118, 961,1673, // 4470 2622, 190,2005,2200,3762,4371,4372,7500, 570,2497,3645,1490,7501,4373,2623,3260, // 4486 1956,4374, 584,1514, 396,1045,1944,7502,4375,1967,2444,7503,7504,4376,3910, 619, // 4502 7505,3129,3261, 215,2006,2783,2553,3189,4377,3190,4378, 763,4119,3763,4379,7506, // 4518 7507,1957,1767,2941,3328,3646,1174, 452,1477,4380,3329,3130,7508,2825,1253,2382, // 4534 2186,1091,2285,4120, 492,7509, 638,1169,1824,2135,1752,3911, 648, 926,1021,1324, // 4550 4381, 520,4382, 997, 847,1007, 892,4383,3764,2262,1871,3647,7510,2400,1784,4384, // 4566 1952,2942,3080,3191,1728,4121,2043,3648,4385,2007,1701,3131,1551, 30,2263,4122, // 4582 7511,2026,4386,3534,7512, 501,7513,4123, 594,3431,2165,1821,3535,3432,3536,3192, // 4598 829,2826,4124,7514,1680,3132,1225,4125,7515,3262,4387,4126,3133,2336,7516,4388, // 4614 4127,7517,3912,3913,7518,1847,2383,2596,3330,7519,4389, 374,3914, 652,4128,4129, // 4630 375,1140, 798,7520,7521,7522,2361,4390,2264, 546,1659, 138,3031,2445,4391,7523, // 4646 2250, 612,1848, 910, 796,3765,1740,1371, 825,3766,3767,7524,2906,2554,7525, 692, // 4662 444,3032,2624, 801,4392,4130,7526,1491, 244,1053,3033,4131,4132, 340,7527,3915, // 4678 1041,2987, 293,1168, 87,1357,7528,1539, 959,7529,2236, 721, 694,4133,3768, 219, // 4694 1478, 644,1417,3331,2656,1413,1401,1335,1389,3916,7530,7531,2988,2362,3134,1825, // 4710 730,1515, 184,2827, 66,4393,7532,1660,2943, 246,3332, 378,1457, 226,3433, 975, // 4726 3917,2944,1264,3537, 674, 696,7533, 163,7534,1141,2417,2166, 713,3538,3333,4394, // 4742 3918,7535,7536,1186, 15,7537,1079,1070,7538,1522,3193,3539, 276,1050,2716, 758, // 4758 1126, 653,2945,3263,7539,2337, 889,3540,3919,3081,2989, 903,1250,4395,3920,3434, // 4774 3541,1342,1681,1718, 766,3264, 286, 89,2946,3649,7540,1713,7541,2597,3334,2990, // 4790 7542,2947,2215,3194,2866,7543,4396,2498,2526, 181, 387,1075,3921, 731,2187,3335, // 4806 7544,3265, 310, 313,3435,2299, 770,4134, 54,3034, 189,4397,3082,3769,3922,7545, // 4822 1230,1617,1849, 355,3542,4135,4398,3336, 111,4136,3650,1350,3135,3436,3035,4137, // 4838 2149,3266,3543,7546,2784,3923,3924,2991, 722,2008,7547,1071, 247,1207,2338,2471, // 4854 1378,4399,2009, 864,1437,1214,4400, 373,3770,1142,2216, 667,4401, 442,2753,2555, // 4870 3771,3925,1968,4138,3267,1839, 837, 170,1107, 934,1336,1882,7548,7549,2118,4139, // 4886 2828, 743,1569,7550,4402,4140, 582,2384,1418,3437,7551,1802,7552, 357,1395,1729, // 4902 3651,3268,2418,1564,2237,7553,3083,3772,1633,4403,1114,2085,4141,1532,7554, 482, // 4918 2446,4404,7555,7556,1492, 833,1466,7557,2717,3544,1641,2829,7558,1526,1272,3652, // 4934 4142,1686,1794, 416,2556,1902,1953,1803,7559,3773,2785,3774,1159,2316,7560,2867, // 4950 4405,1610,1584,3036,2419,2754, 443,3269,1163,3136,7561,7562,3926,7563,4143,2499, // 4966 3037,4406,3927,3137,2103,1647,3545,2010,1872,4144,7564,4145, 431,3438,7565, 250, // 4982 97, 81,4146,7566,1648,1850,1558, 160, 848,7567, 866, 740,1694,7568,2201,2830, // 4998 3195,4147,4407,3653,1687, 950,2472, 426, 469,3196,3654,3655,3928,7569,7570,1188, // 5014 424,1995, 861,3546,4148,3775,2202,2685, 168,1235,3547,4149,7571,2086,1674,4408, // 5030 3337,3270, 220,2557,1009,7572,3776, 670,2992, 332,1208, 717,7573,7574,3548,2447, // 5046 3929,3338,7575, 513,7576,1209,2868,3339,3138,4409,1080,7577,7578,7579,7580,2527, // 5062 3656,3549, 815,1587,3930,3931,7581,3550,3439,3777,1254,4410,1328,3038,1390,3932, // 5078 1741,3933,3778,3934,7582, 236,3779,2448,3271,7583,7584,3657,3780,1273,3781,4411, // 5094 7585, 308,7586,4412, 245,4413,1851,2473,1307,2575, 430, 715,2136,2449,7587, 270, // 5110 199,2869,3935,7588,3551,2718,1753, 761,1754, 725,1661,1840,4414,3440,3658,7589, // 5126 7590, 587, 14,3272, 227,2598, 326, 480,2265, 943,2755,3552, 291, 650,1883,7591, // 5142 1702,1226, 102,1547, 62,3441, 904,4415,3442,1164,4150,7592,7593,1224,1548,2756, // 5158 391, 498,1493,7594,1386,1419,7595,2055,1177,4416, 813, 880,1081,2363, 566,1145, // 5174 4417,2286,1001,1035,2558,2599,2238, 394,1286,7596,7597,2068,7598, 86,1494,1730, // 5190 3936, 491,1588, 745, 897,2948, 843,3340,3937,2757,2870,3273,1768, 998,2217,2069, // 5206 397,1826,1195,1969,3659,2993,3341, 284,7599,3782,2500,2137,2119,1903,7600,3938, // 5222 2150,3939,4151,1036,3443,1904, 114,2559,4152, 209,1527,7601,7602,2949,2831,2625, // 5238 2385,2719,3139, 812,2560,7603,3274,7604,1559, 737,1884,3660,1210, 885, 28,2686, // 5254 3553,3783,7605,4153,1004,1779,4418,7606, 346,1981,2218,2687,4419,3784,1742, 797, // 5270 1642,3940,1933,1072,1384,2151, 896,3941,3275,3661,3197,2871,3554,7607,2561,1958, // 5286 4420,2450,1785,7608,7609,7610,3942,4154,1005,1308,3662,4155,2720,4421,4422,1528, // 5302 2600, 161,1178,4156,1982, 987,4423,1101,4157, 631,3943,1157,3198,2420,1343,1241, // 5318 1016,2239,2562, 372, 877,2339,2501,1160, 555,1934, 911,3944,7611, 466,1170, 169, // 5334 1051,2907,2688,3663,2474,2994,1182,2011,2563,1251,2626,7612, 992,2340,3444,1540, // 5350 2721,1201,2070,2401,1996,2475,7613,4424, 528,1922,2188,1503,1873,1570,2364,3342, // 5366 3276,7614, 557,1073,7615,1827,3445,2087,2266,3140,3039,3084, 767,3085,2786,4425, // 5382 1006,4158,4426,2341,1267,2176,3664,3199, 778,3945,3200,2722,1597,2657,7616,4427, // 5398 7617,3446,7618,7619,7620,3277,2689,1433,3278, 131, 95,1504,3946, 723,4159,3141, // 5414 1841,3555,2758,2189,3947,2027,2104,3665,7621,2995,3948,1218,7622,3343,3201,3949, // 5430 4160,2576, 248,1634,3785, 912,7623,2832,3666,3040,3786, 654, 53,7624,2996,7625, // 5446 1688,4428, 777,3447,1032,3950,1425,7626, 191, 820,2120,2833, 971,4429, 931,3202, // 5462 135, 664, 783,3787,1997, 772,2908,1935,3951,3788,4430,2909,3203, 282,2723, 640, // 5478 1372,3448,1127, 922, 325,3344,7627,7628, 711,2044,7629,7630,3952,2219,2787,1936, // 5494 3953,3345,2220,2251,3789,2300,7631,4431,3790,1258,3279,3954,3204,2138,2950,3955, // 5510 3956,7632,2221, 258,3205,4432, 101,1227,7633,3280,1755,7634,1391,3281,7635,2910, // 5526 2056, 893,7636,7637,7638,1402,4161,2342,7639,7640,3206,3556,7641,7642, 878,1325, // 5542 1780,2788,4433, 259,1385,2577, 744,1183,2267,4434,7643,3957,2502,7644, 684,1024, // 5558 4162,7645, 472,3557,3449,1165,3282,3958,3959, 322,2152, 881, 455,1695,1152,1340, // 5574 660, 554,2153,4435,1058,4436,4163, 830,1065,3346,3960,4437,1923,7646,1703,1918, // 5590 7647, 932,2268, 122,7648,4438, 947, 677,7649,3791,2627, 297,1905,1924,2269,4439, // 5606 2317,3283,7650,7651,4164,7652,4165, 84,4166, 112, 989,7653, 547,1059,3961, 701, // 5622 3558,1019,7654,4167,7655,3450, 942, 639, 457,2301,2451, 993,2951, 407, 851, 494, // 5638 4440,3347, 927,7656,1237,7657,2421,3348, 573,4168, 680, 921,2911,1279,1874, 285, // 5654 790,1448,1983, 719,2167,7658,7659,4441,3962,3963,1649,7660,1541, 563,7661,1077, // 5670 7662,3349,3041,3451, 511,2997,3964,3965,3667,3966,1268,2564,3350,3207,4442,4443, // 5686 7663, 535,1048,1276,1189,2912,2028,3142,1438,1373,2834,2952,1134,2012,7664,4169, // 5702 1238,2578,3086,1259,7665, 700,7666,2953,3143,3668,4170,7667,4171,1146,1875,1906, // 5718 4444,2601,3967, 781,2422, 132,1589, 203, 147, 273,2789,2402, 898,1786,2154,3968, // 5734 3969,7668,3792,2790,7669,7670,4445,4446,7671,3208,7672,1635,3793, 965,7673,1804, // 5750 2690,1516,3559,1121,1082,1329,3284,3970,1449,3794, 65,1128,2835,2913,2759,1590, // 5766 3795,7674,7675, 12,2658, 45, 976,2579,3144,4447, 517,2528,1013,1037,3209,7676, // 5782 3796,2836,7677,3797,7678,3452,7679,2602, 614,1998,2318,3798,3087,2724,2628,7680, // 5798 2580,4172, 599,1269,7681,1810,3669,7682,2691,3088, 759,1060, 489,1805,3351,3285, // 5814 1358,7683,7684,2386,1387,1215,2629,2252, 490,7685,7686,4173,1759,2387,2343,7687, // 5830 4448,3799,1907,3971,2630,1806,3210,4449,3453,3286,2760,2344, 874,7688,7689,3454, // 5846 3670,1858, 91,2914,3671,3042,3800,4450,7690,3145,3972,2659,7691,3455,1202,1403, // 5862 3801,2954,2529,1517,2503,4451,3456,2504,7692,4452,7693,2692,1885,1495,1731,3973, // 5878 2365,4453,7694,2029,7695,7696,3974,2693,1216, 237,2581,4174,2319,3975,3802,4454, // 5894 4455,2694,3560,3457, 445,4456,7697,7698,7699,7700,2761, 61,3976,3672,1822,3977, // 5910 7701, 687,2045, 935, 925, 405,2660, 703,1096,1859,2725,4457,3978,1876,1367,2695, // 5926 3352, 918,2105,1781,2476, 334,3287,1611,1093,4458, 564,3146,3458,3673,3353, 945, // 5942 2631,2057,4459,7702,1925, 872,4175,7703,3459,2696,3089, 349,4176,3674,3979,4460, // 5958 3803,4177,3675,2155,3980,4461,4462,4178,4463,2403,2046, 782,3981, 400, 251,4179, // 5974 1624,7704,7705, 277,3676, 299,1265, 476,1191,3804,2121,4180,4181,1109, 205,7706, // 5990 2582,1000,2156,3561,1860,7707,7708,7709,4464,7710,4465,2565, 107,2477,2157,3982, // 6006 3460,3147,7711,1533, 541,1301, 158, 753,4182,2872,3562,7712,1696, 370,1088,4183, // 6022 4466,3563, 579, 327, 440, 162,2240, 269,1937,1374,3461, 968,3043, 56,1396,3090, // 6038 2106,3288,3354,7713,1926,2158,4467,2998,7714,3564,7715,7716,3677,4468,2478,7717, // 6054 2791,7718,1650,4469,7719,2603,7720,7721,3983,2661,3355,1149,3356,3984,3805,3985, // 6070 7722,1076, 49,7723, 951,3211,3289,3290, 450,2837, 920,7724,1811,2792,2366,4184, // 6086 1908,1138,2367,3806,3462,7725,3212,4470,1909,1147,1518,2423,4471,3807,7726,4472, // 6102 2388,2604, 260,1795,3213,7727,7728,3808,3291, 708,7729,3565,1704,7730,3566,1351, // 6118 1618,3357,2999,1886, 944,4185,3358,4186,3044,3359,4187,7731,3678, 422, 413,1714, // 6134 3292, 500,2058,2345,4188,2479,7732,1344,1910, 954,7733,1668,7734,7735,3986,2404, // 6150 4189,3567,3809,4190,7736,2302,1318,2505,3091, 133,3092,2873,4473, 629, 31,2838, // 6166 2697,3810,4474, 850, 949,4475,3987,2955,1732,2088,4191,1496,1852,7737,3988, 620, // 6182 3214, 981,1242,3679,3360,1619,3680,1643,3293,2139,2452,1970,1719,3463,2168,7738, // 6198 3215,7739,7740,3361,1828,7741,1277,4476,1565,2047,7742,1636,3568,3093,7743, 869, // 6214 2839, 655,3811,3812,3094,3989,3000,3813,1310,3569,4477,7744,7745,7746,1733, 558, // 6230 4478,3681, 335,1549,3045,1756,4192,3682,1945,3464,1829,1291,1192, 470,2726,2107, // 6246 2793, 913,1054,3990,7747,1027,7748,3046,3991,4479, 982,2662,3362,3148,3465,3216, // 6262 3217,1946,2794,7749, 571,4480,7750,1830,7751,3570,2583,1523,2424,7752,2089, 984, // 6278 4481,3683,1959,7753,3684, 852, 923,2795,3466,3685, 969,1519, 999,2048,2320,1705, // 6294 7754,3095, 615,1662, 151, 597,3992,2405,2321,1049, 275,4482,3686,4193, 568,3687, // 6310 3571,2480,4194,3688,7755,2425,2270, 409,3218,7756,1566,2874,3467,1002, 769,2840, // 6326 194,2090,3149,3689,2222,3294,4195, 628,1505,7757,7758,1763,2177,3001,3993, 521, // 6342 1161,2584,1787,2203,2406,4483,3994,1625,4196,4197, 412, 42,3096, 464,7759,2632, // 6358 4484,3363,1760,1571,2875,3468,2530,1219,2204,3814,2633,2140,2368,4485,4486,3295, // 6374 1651,3364,3572,7760,7761,3573,2481,3469,7762,3690,7763,7764,2271,2091, 460,7765, // 6390 4487,7766,3002, 962, 588,3574, 289,3219,2634,1116, 52,7767,3047,1796,7768,7769, // 6406 7770,1467,7771,1598,1143,3691,4198,1984,1734,1067,4488,1280,3365, 465,4489,1572, // 6422 510,7772,1927,2241,1812,1644,3575,7773,4490,3692,7774,7775,2663,1573,1534,7776, // 6438 7777,4199, 536,1807,1761,3470,3815,3150,2635,7778,7779,7780,4491,3471,2915,1911, // 6454 2796,7781,3296,1122, 377,3220,7782, 360,7783,7784,4200,1529, 551,7785,2059,3693, // 6470 1769,2426,7786,2916,4201,3297,3097,2322,2108,2030,4492,1404, 136,1468,1479, 672, // 6486 1171,3221,2303, 271,3151,7787,2762,7788,2049, 678,2727, 865,1947,4493,7789,2013, // 6502 3995,2956,7790,2728,2223,1397,3048,3694,4494,4495,1735,2917,3366,3576,7791,3816, // 6518 509,2841,2453,2876,3817,7792,7793,3152,3153,4496,4202,2531,4497,2304,1166,1010, // 6534 552, 681,1887,7794,7795,2957,2958,3996,1287,1596,1861,3154, 358, 453, 736, 175, // 6550 478,1117, 905,1167,1097,7796,1853,1530,7797,1706,7798,2178,3472,2287,3695,3473, // 6566 3577,4203,2092,4204,7799,3367,1193,2482,4205,1458,2190,2205,1862,1888,1421,3298, // 6582 2918,3049,2179,3474, 595,2122,7800,3997,7801,7802,4206,1707,2636, 223,3696,1359, // 6598 751,3098, 183,3475,7803,2797,3003, 419,2369, 633, 704,3818,2389, 241,7804,7805, // 6614 7806, 838,3004,3697,2272,2763,2454,3819,1938,2050,3998,1309,3099,2242,1181,7807, // 6630 1136,2206,3820,2370,1446,4207,2305,4498,7808,7809,4208,1055,2605, 484,3698,7810, // 6646 3999, 625,4209,2273,3368,1499,4210,4000,7811,4001,4211,3222,2274,2275,3476,7812, // 6662 7813,2764, 808,2606,3699,3369,4002,4212,3100,2532, 526,3370,3821,4213, 955,7814, // 6678 1620,4214,2637,2427,7815,1429,3700,1669,1831, 994, 928,7816,3578,1260,7817,7818, // 6694 7819,1948,2288, 741,2919,1626,4215,2729,2455, 867,1184, 362,3371,1392,7820,7821, // 6710 4003,4216,1770,1736,3223,2920,4499,4500,1928,2698,1459,1158,7822,3050,3372,2877, // 6726 1292,1929,2506,2842,3701,1985,1187,2071,2014,2607,4217,7823,2566,2507,2169,3702, // 6742 2483,3299,7824,3703,4501,7825,7826, 666,1003,3005,1022,3579,4218,7827,4502,1813, // 6758 2253, 574,3822,1603, 295,1535, 705,3823,4219, 283, 858, 417,7828,7829,3224,4503, // 6774 4504,3051,1220,1889,1046,2276,2456,4004,1393,1599, 689,2567, 388,4220,7830,2484, // 6790 802,7831,2798,3824,2060,1405,2254,7832,4505,3825,2109,1052,1345,3225,1585,7833, // 6806 809,7834,7835,7836, 575,2730,3477, 956,1552,1469,1144,2323,7837,2324,1560,2457, // 6822 3580,3226,4005, 616,2207,3155,2180,2289,7838,1832,7839,3478,4506,7840,1319,3704, // 6838 3705,1211,3581,1023,3227,1293,2799,7841,7842,7843,3826, 607,2306,3827, 762,2878, // 6854 1439,4221,1360,7844,1485,3052,7845,4507,1038,4222,1450,2061,2638,4223,1379,4508, // 6870 2585,7846,7847,4224,1352,1414,2325,2921,1172,7848,7849,3828,3829,7850,1797,1451, // 6886 7851,7852,7853,7854,2922,4006,4007,2485,2346, 411,4008,4009,3582,3300,3101,4509, // 6902 1561,2664,1452,4010,1375,7855,7856, 47,2959, 316,7857,1406,1591,2923,3156,7858, // 6918 1025,2141,3102,3157, 354,2731, 884,2224,4225,2407, 508,3706, 726,3583, 996,2428, // 6934 3584, 729,7859, 392,2191,1453,4011,4510,3707,7860,7861,2458,3585,2608,1675,2800, // 6950 919,2347,2960,2348,1270,4511,4012, 73,7862,7863, 647,7864,3228,2843,2255,1550, // 6966 1346,3006,7865,1332, 883,3479,7866,7867,7868,7869,3301,2765,7870,1212, 831,1347, // 6982 4226,4512,2326,3830,1863,3053, 720,3831,4513,4514,3832,7871,4227,7872,7873,4515, // 6998 7874,7875,1798,4516,3708,2609,4517,3586,1645,2371,7876,7877,2924, 669,2208,2665, // 7014 2429,7878,2879,7879,7880,1028,3229,7881,4228,2408,7882,2256,1353,7883,7884,4518, // 7030 3158, 518,7885,4013,7886,4229,1960,7887,2142,4230,7888,7889,3007,2349,2350,3833, // 7046 516,1833,1454,4014,2699,4231,4519,2225,2610,1971,1129,3587,7890,2766,7891,2961, // 7062 1422, 577,1470,3008,1524,3373,7892,7893, 432,4232,3054,3480,7894,2586,1455,2508, // 7078 2226,1972,1175,7895,1020,2732,4015,3481,4520,7896,2733,7897,1743,1361,3055,3482, // 7094 2639,4016,4233,4521,2290, 895, 924,4234,2170, 331,2243,3056, 166,1627,3057,1098, // 7110 7898,1232,2880,2227,3374,4522, 657, 403,1196,2372, 542,3709,3375,1600,4235,3483, // 7126 7899,4523,2767,3230, 576, 530,1362,7900,4524,2533,2666,3710,4017,7901, 842,3834, // 7142 7902,2801,2031,1014,4018, 213,2700,3376, 665, 621,4236,7903,3711,2925,2430,7904, // 7158 2431,3302,3588,3377,7905,4237,2534,4238,4525,3589,1682,4239,3484,1380,7906, 724, // 7174 2277, 600,1670,7907,1337,1233,4526,3103,2244,7908,1621,4527,7909, 651,4240,7910, // 7190 1612,4241,2611,7911,2844,7912,2734,2307,3058,7913, 716,2459,3059, 174,1255,2701, // 7206 4019,3590, 548,1320,1398, 728,4020,1574,7914,1890,1197,3060,4021,7915,3061,3062, // 7222 3712,3591,3713, 747,7916, 635,4242,4528,7917,7918,7919,4243,7920,7921,4529,7922, // 7238 3378,4530,2432, 451,7923,3714,2535,2072,4244,2735,4245,4022,7924,1764,4531,7925, // 7254 4246, 350,7926,2278,2390,2486,7927,4247,4023,2245,1434,4024, 488,4532, 458,4248, // 7270 4025,3715, 771,1330,2391,3835,2568,3159,2159,2409,1553,2667,3160,4249,7928,2487, // 7286 2881,2612,1720,2702,4250,3379,4533,7929,2536,4251,7930,3231,4252,2768,7931,2015, // 7302 2736,7932,1155,1017,3716,3836,7933,3303,2308, 201,1864,4253,1430,7934,4026,7935, // 7318 7936,7937,7938,7939,4254,1604,7940, 414,1865, 371,2587,4534,4535,3485,2016,3104, // 7334 4536,1708, 960,4255, 887, 389,2171,1536,1663,1721,7941,2228,4027,2351,2926,1580, // 7350 7942,7943,7944,1744,7945,2537,4537,4538,7946,4539,7947,2073,7948,7949,3592,3380, // 7366 2882,4256,7950,4257,2640,3381,2802, 673,2703,2460, 709,3486,4028,3593,4258,7951, // 7382 1148, 502, 634,7952,7953,1204,4540,3594,1575,4541,2613,3717,7954,3718,3105, 948, // 7398 3232, 121,1745,3837,1110,7955,4259,3063,2509,3009,4029,3719,1151,1771,3838,1488, // 7414 4030,1986,7956,2433,3487,7957,7958,2093,7959,4260,3839,1213,1407,2803, 531,2737, // 7430 2538,3233,1011,1537,7960,2769,4261,3106,1061,7961,3720,3721,1866,2883,7962,2017, // 7446 120,4262,4263,2062,3595,3234,2309,3840,2668,3382,1954,4542,7963,7964,3488,1047, // 7462 2704,1266,7965,1368,4543,2845, 649,3383,3841,2539,2738,1102,2846,2669,7966,7967, // 7478 1999,7968,1111,3596,2962,7969,2488,3842,3597,2804,1854,3384,3722,7970,7971,3385, // 7494 2410,2884,3304,3235,3598,7972,2569,7973,3599,2805,4031,1460, 856,7974,3600,7975, // 7510 2885,2963,7976,2886,3843,7977,4264, 632,2510, 875,3844,1697,3845,2291,7978,7979, // 7526 4544,3010,1239, 580,4545,4265,7980, 914, 936,2074,1190,4032,1039,2123,7981,7982, // 7542 7983,3386,1473,7984,1354,4266,3846,7985,2172,3064,4033, 915,3305,4267,4268,3306, // 7558 1605,1834,7986,2739, 398,3601,4269,3847,4034, 328,1912,2847,4035,3848,1331,4270, // 7574 3011, 937,4271,7987,3602,4036,4037,3387,2160,4546,3388, 524, 742, 538,3065,1012, // 7590 7988,7989,3849,2461,7990, 658,1103, 225,3850,7991,7992,4547,7993,4548,7994,3236, // 7606 1243,7995,4038, 963,2246,4549,7996,2705,3603,3161,7997,7998,2588,2327,7999,4550, // 7622 8000,8001,8002,3489,3307, 957,3389,2540,2032,1930,2927,2462, 870,2018,3604,1746, // 7638 2770,2771,2434,2463,8003,3851,8004,3723,3107,3724,3490,3390,3725,8005,1179,3066, // 7654 8006,3162,2373,4272,3726,2541,3163,3108,2740,4039,8007,3391,1556,2542,2292, 977, // 7670 2887,2033,4040,1205,3392,8008,1765,3393,3164,2124,1271,1689, 714,4551,3491,8009, // 7686 2328,3852, 533,4273,3605,2181, 617,8010,2464,3308,3492,2310,8011,8012,3165,8013, // 7702 8014,3853,1987, 618, 427,2641,3493,3394,8015,8016,1244,1690,8017,2806,4274,4552, // 7718 8018,3494,8019,8020,2279,1576, 473,3606,4275,3395, 972,8021,3607,8022,3067,8023, // 7734 8024,4553,4554,8025,3727,4041,4042,8026, 153,4555, 356,8027,1891,2888,4276,2143, // 7750 408, 803,2352,8028,3854,8029,4277,1646,2570,2511,4556,4557,3855,8030,3856,4278, // 7766 8031,2411,3396, 752,8032,8033,1961,2964,8034, 746,3012,2465,8035,4279,3728, 698, // 7782 4558,1892,4280,3608,2543,4559,3609,3857,8036,3166,3397,8037,1823,1302,4043,2706, // 7798 3858,1973,4281,8038,4282,3167, 823,1303,1288,1236,2848,3495,4044,3398, 774,3859, // 7814 8039,1581,4560,1304,2849,3860,4561,8040,2435,2161,1083,3237,4283,4045,4284, 344, // 7830 1173, 288,2311, 454,1683,8041,8042,1461,4562,4046,2589,8043,8044,4563, 985, 894, // 7846 8045,3399,3168,8046,1913,2928,3729,1988,8047,2110,1974,8048,4047,8049,2571,1194, // 7862 425,8050,4564,3169,1245,3730,4285,8051,8052,2850,8053, 636,4565,1855,3861, 760, // 7878 1799,8054,4286,2209,1508,4566,4048,1893,1684,2293,8055,8056,8057,4287,4288,2210, // 7894 479,8058,8059, 832,8060,4049,2489,8061,2965,2490,3731, 990,3109, 627,1814,2642, // 7910 4289,1582,4290,2125,2111,3496,4567,8062, 799,4291,3170,8063,4568,2112,1737,3013, // 7926 1018, 543, 754,4292,3309,1676,4569,4570,4050,8064,1489,8065,3497,8066,2614,2889, // 7942 4051,8067,8068,2966,8069,8070,8071,8072,3171,4571,4572,2182,1722,8073,3238,3239, // 7958 1842,3610,1715, 481, 365,1975,1856,8074,8075,1962,2491,4573,8076,2126,3611,3240, // 7974 433,1894,2063,2075,8077, 602,2741,8078,8079,8080,8081,8082,3014,1628,3400,8083, // 7990 3172,4574,4052,2890,4575,2512,8084,2544,2772,8085,8086,8087,3310,4576,2891,8088, // 8006 4577,8089,2851,4578,4579,1221,2967,4053,2513,8090,8091,8092,1867,1989,8093,8094, // 8022 8095,1895,8096,8097,4580,1896,4054, 318,8098,2094,4055,4293,8099,8100, 485,8101, // 8038 938,3862, 553,2670, 116,8102,3863,3612,8103,3498,2671,2773,3401,3311,2807,8104, // 8054 3613,2929,4056,1747,2930,2968,8105,8106, 207,8107,8108,2672,4581,2514,8109,3015, // 8070 890,3614,3864,8110,1877,3732,3402,8111,2183,2353,3403,1652,8112,8113,8114, 941, // 8086 2294, 208,3499,4057,2019, 330,4294,3865,2892,2492,3733,4295,8115,8116,8117,8118, // 8102 /*************************************************************************************** *Everything below is of no interest for detection purpose * *************************************************************************************** 2515,1613,4582,8119,3312,3866,2516,8120,4058,8121,1637,4059,2466,4583,3867,8122, // 8118 2493,3016,3734,8123,8124,2192,8125,8126,2162,8127,8128,8129,8130,8131,8132,8133, // 8134 8134,8135,8136,8137,8138,8139,8140,8141,8142,8143,8144,8145,8146,8147,8148,8149, // 8150 8150,8151,8152,8153,8154,8155,8156,8157,8158,8159,8160,8161,8162,8163,8164,8165, // 8166 8166,8167,8168,8169,8170,8171,8172,8173,8174,8175,8176,8177,8178,8179,8180,8181, // 8182 8182,8183,8184,8185,8186,8187,8188,8189,8190,8191,8192,8193,8194,8195,8196,8197, // 8198 8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8208,8209,8210,8211,8212,8213, // 8214 8214,8215,8216,8217,8218,8219,8220,8221,8222,8223,8224,8225,8226,8227,8228,8229, // 8230 8230,8231,8232,8233,8234,8235,8236,8237,8238,8239,8240,8241,8242,8243,8244,8245, // 8246 8246,8247,8248,8249,8250,8251,8252,8253,8254,8255,8256,8257,8258,8259,8260,8261, // 8262 8262,8263,8264,8265,8266,8267,8268,8269,8270,8271,8272,8273,8274,8275,8276,8277, // 8278 8278,8279,8280,8281,8282,8283,8284,8285,8286,8287,8288,8289,8290,8291,8292,8293, // 8294 8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,8304,8305,8306,8307,8308,8309, // 8310 8310,8311,8312,8313,8314,8315,8316,8317,8318,8319,8320,8321,8322,8323,8324,8325, // 8326 8326,8327,8328,8329,8330,8331,8332,8333,8334,8335,8336,8337,8338,8339,8340,8341, // 8342 8342,8343,8344,8345,8346,8347,8348,8349,8350,8351,8352,8353,8354,8355,8356,8357, // 8358 8358,8359,8360,8361,8362,8363,8364,8365,8366,8367,8368,8369,8370,8371,8372,8373, // 8374 8374,8375,8376,8377,8378,8379,8380,8381,8382,8383,8384,8385,8386,8387,8388,8389, // 8390 8390,8391,8392,8393,8394,8395,8396,8397,8398,8399,8400,8401,8402,8403,8404,8405, // 8406 8406,8407,8408,8409,8410,8411,8412,8413,8414,8415,8416,8417,8418,8419,8420,8421, // 8422 8422,8423,8424,8425,8426,8427,8428,8429,8430,8431,8432,8433,8434,8435,8436,8437, // 8438 8438,8439,8440,8441,8442,8443,8444,8445,8446,8447,8448,8449,8450,8451,8452,8453, // 8454 8454,8455,8456,8457,8458,8459,8460,8461,8462,8463,8464,8465,8466,8467,8468,8469, // 8470 8470,8471,8472,8473,8474,8475,8476,8477,8478,8479,8480,8481,8482,8483,8484,8485, // 8486 8486,8487,8488,8489,8490,8491,8492,8493,8494,8495,8496,8497,8498,8499,8500,8501, // 8502 8502,8503,8504,8505,8506,8507,8508,8509,8510,8511,8512,8513,8514,8515,8516,8517, // 8518 8518,8519,8520,8521,8522,8523,8524,8525,8526,8527,8528,8529,8530,8531,8532,8533, // 8534 8534,8535,8536,8537,8538,8539,8540,8541,8542,8543,8544,8545,8546,8547,8548,8549, // 8550 8550,8551,8552,8553,8554,8555,8556,8557,8558,8559,8560,8561,8562,8563,8564,8565, // 8566 8566,8567,8568,8569,8570,8571,8572,8573,8574,8575,8576,8577,8578,8579,8580,8581, // 8582 8582,8583,8584,8585,8586,8587,8588,8589,8590,8591,8592,8593,8594,8595,8596,8597, // 8598 8598,8599,8600,8601,8602,8603,8604,8605,8606,8607,8608,8609,8610,8611,8612,8613, // 8614 8614,8615,8616,8617,8618,8619,8620,8621,8622,8623,8624,8625,8626,8627,8628,8629, // 8630 8630,8631,8632,8633,8634,8635,8636,8637,8638,8639,8640,8641,8642,8643,8644,8645, // 8646 8646,8647,8648,8649,8650,8651,8652,8653,8654,8655,8656,8657,8658,8659,8660,8661, // 8662 8662,8663,8664,8665,8666,8667,8668,8669,8670,8671,8672,8673,8674,8675,8676,8677, // 8678 8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693, // 8694 8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709, // 8710 8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725, // 8726 8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741, // 8742 //13973 ****************************************************************************************/ }; ================================================ FILE: third_party/uchardet/uchardet/src/tables/GB18030Freq.tab ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //GB18030 most frequently used character table //Char to FreqOrder table , from hz6763 /****************************************************************************** * 512 --> 0.79 -- 0.79 * 1024 --> 0.92 -- 0.13 * 2048 --> 0.98 -- 0.06 * 6768 --> 1.00 -- 0.02 * * Idea Distribution Ratio = 0.79135/(1-0.79135) = 3.79 * Random Distribution Ration = 512 / (3755 - 512) = 0.157 * * Typical Distribution Ratio about 25% of Ideal one, still much higher that RDR *****************************************************************************/ #define GB18030_TYPICAL_DISTRIBUTION_RATIO (float)0.79 #define GB18030_TABLE_SIZE 3760 constexpr PRInt16 GB18030CharToFreqOrder[] = { 1671, 749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515, 572,3191,2205, 2361, 224,2558, 479,1711, 963,3162, 440,4060,1905,2966,2947,3580,2647,3961,3842, 2204, 869,4207, 970,2678,5626,2944,2956,1479,4048, 514,3595, 588,1346,2820,3409, 249,4088,1746,1873,2047,1774, 581,1813, 358,1174,3590,1014,1561,4844,2245, 670, 1636,3112, 889,1286, 953, 556,2327,3060,1290,3141, 613, 185,3477,1367, 850,3820, 1715,2428,2642,2303,2732,3041,2562,2648,3566,3946,1349, 388,3098,2091,1360,3585, 152,1687,1539, 738,1559, 59,1232,2925,2267,1388,1249,1741,1679,2960, 151,1566, 1125,1352,4271, 924,4296, 385,3166,4459, 310,1245,2850, 70,3285,2729,3534,3575, 2398,3298,3466,1960,2265, 217,3647, 864,1909,2084,4401,2773,1010,3269,5152, 853, 3051,3121,1244,4251,1895, 364,1499,1540,2313,1180,3655,2268, 562, 715,2417,3061, 544, 336,3768,2380,1752,4075, 950, 280,2425,4382, 183,2759,3272, 333,4297,2155, 1688,2356,1444,1039,4540, 736,1177,3349,2443,2368,2144,2225, 565, 196,1482,3406, 927,1335,4147, 692, 878,1311,1653,3911,3622,1378,4200,1840,2969,3149,2126,1816, 2534,1546,2393,2760, 737,2494, 13, 447, 245,2747, 38,2765,2129,2589,1079, 606, 360, 471,3755,2890, 404, 848, 699,1785,1236, 370,2221,1023,3746,2074,2026,2023, 2388,1581,2119, 812,1141,3091,2536,1519, 804,2053, 406,1596,1090, 784, 548,4414, 1806,2264,2936,1100, 343,4114,5096, 622,3358, 743,3668,1510,1626,5020,3567,2513, 3195,4115,5627,2489,2991, 24,2065,2697,1087,2719, 48,1634, 315, 68, 985,2052, 198,2239,1347,1107,1439, 597,2366,2172, 871,3307, 919,2487,2790,1867, 236,2570, 1413,3794, 906,3365,3381,1701,1982,1818,1524,2924,1205, 616,2586,2072,2004, 575, 253,3099, 32,1365,1182, 197,1714,2454,1201, 554,3388,3224,2748, 756,2587, 250, 2567,1507,1517,3529,1922,2761,2337,3416,1961,1677,2452,2238,3153, 615, 911,1506, 1474,2495,1265,1906,2749,3756,3280,2161, 898,2714,1759,3450,2243,2444, 563, 26, 3286,2266,3769,3344,2707,3677, 611,1402, 531,1028,2871,4548,1375, 261,2948, 835, 1190,4134, 353, 840,2684,1900,3082,1435,2109,1207,1674, 329,1872,2781,4055,2686, 2104, 608,3318,2423,2957,2768,1108,3739,3512,3271,3985,2203,1771,3520,1418,2054, 1681,1153, 225,1627,2929, 162,2050,2511,3687,1954, 124,1859,2431,1684,3032,2894, 585,4805,3969,2869,2704,2088,2032,2095,3656,2635,4362,2209, 256, 518,2042,2105, 3777,3657, 643,2298,1148,1779, 190, 989,3544, 414, 11,2135,2063,2979,1471, 403, 3678, 126, 770,1563, 671,2499,3216,2877, 600,1179, 307,2805,4937,1268,1297,2694, 252,4032,1448,1494,1331,1394, 127,2256, 222,1647,1035,1481,3056,1915,1048, 873, 3651, 210, 33,1608,2516, 200,1520, 415, 102, 0,3389,1287, 817, 91,3299,2940, 836,1814, 549,2197,1396,1669,2987,3582,2297,2848,4528,1070, 687, 20,1819, 121, 1552,1364,1461,1968,2617,3540,2824,2083, 177, 948,4938,2291, 110,4549,2066, 648, 3359,1755,2110,2114,4642,4845,1693,3937,3308,1257,1869,2123, 208,1804,3159,2992, 2531,2549,3361,2418,1350,2347,2800,2568,1291,2036,2680, 72, 842,1990, 212,1233, 1154,1586, 75,2027,3410,4900,1823,1337,2710,2676, 728,2810,1522,3026,4995, 157, 755,1050,4022, 710, 785,1936,2194,2085,1406,2777,2400, 150,1250,4049,1206, 807, 1910, 534, 529,3309,1721,1660, 274, 39,2827, 661,2670,1578, 925,3248,3815,1094, 4278,4901,4252, 41,1150,3747,2572,2227,4501,3658,4902,3813,3357,3617,2884,2258, 887, 538,4187,3199,1294,2439,3042,2329,2343,2497,1255, 107, 543,1527, 521,3478, 3568, 194,5062, 15, 961,3870,1241,1192,2664, 66,5215,3260,2111,1295,1127,2152, 3805,4135, 901,1164,1976, 398,1278, 530,1460, 748, 904,1054,1966,1426, 53,2909, 509, 523,2279,1534, 536,1019, 239,1685, 460,2353, 673,1065,2401,3600,4298,2272, 1272,2363, 284,1753,3679,4064,1695, 81, 815,2677,2757,2731,1386, 859, 500,4221, 2190,2566, 757,1006,2519,2068,1166,1455, 337,2654,3203,1863,1682,1914,3025,1252, 1409,1366, 847, 714,2834,2038,3209, 964,2970,1901, 885,2553,1078,1756,3049, 301, 1572,3326, 688,2130,1996,2429,1805,1648,2930,3421,2750,3652,3088, 262,1158,1254, 389,1641,1812, 526,1719, 923,2073,1073,1902, 468, 489,4625,1140, 857,2375,3070, 3319,2863, 380, 116,1328,2693,1161,2244, 273,1212,1884,2769,3011,1775,1142, 461, 3066,1200,2147,2212, 790, 702,2695,4222,1601,1058, 434,2338,5153,3640, 67,2360, 4099,2502, 618,3472,1329, 416,1132, 830,2782,1807,2653,3211,3510,1662, 192,2124, 296,3979,1739,1611,3684, 23, 118, 324, 446,1239,1225, 293,2520,3814,3795,2535, 3116, 17,1074, 467,2692,2201, 387,2922, 45,1326,3055,1645,3659,2817, 958, 243, 1903,2320,1339,2825,1784,3289, 356, 576, 865,2315,2381,3377,3916,1088,3122,1713, 1655, 935, 628,4689,1034,1327, 441, 800, 720, 894,1979,2183,1528,5289,2702,1071, 4046,3572,2399,1571,3281, 79, 761,1103, 327, 134, 758,1899,1371,1615, 879, 442, 215,2605,2579, 173,2048,2485,1057,2975,3317,1097,2253,3801,4263,1403,1650,2946, 814,4968,3487,1548,2644,1567,1285, 2, 295,2636, 97, 946,3576, 832, 141,4257, 3273, 760,3821,3521,3156,2607, 949,1024,1733,1516,1803,1920,2125,2283,2665,3180, 1501,2064,3560,2171,1592, 803,3518,1416, 732,3897,4258,1363,1362,2458, 119,1427, 602,1525,2608,1605,1639,3175, 694,3064, 10, 465, 76,2000,4846,4208, 444,3781, 1619,3353,2206,1273,3796, 740,2483, 320,1723,2377,3660,2619,1359,1137,1762,1724, 2345,2842,1850,1862, 912, 821,1866, 612,2625,1735,2573,3369,1093, 844, 89, 937, 930,1424,3564,2413,2972,1004,3046,3019,2011, 711,3171,1452,4178, 428, 801,1943, 432, 445,2811, 206,4136,1472, 730, 349, 73, 397,2802,2547, 998,1637,1167, 789, 396,3217, 154,1218, 716,1120,1780,2819,4826,1931,3334,3762,2139,1215,2627, 552, 3664,3628,3232,1405,2383,3111,1356,2652,3577,3320,3101,1703, 640,1045,1370,1246, 4996, 371,1575,2436,1621,2210, 984,4033,1734,2638, 16,4529, 663,2755,3255,1451, 3917,2257,1253,1955,2234,1263,2951, 214,1229, 617, 485, 359,1831,1969, 473,2310, 750,2058, 165, 80,2864,2419, 361,4344,2416,2479,1134, 796,3726,1266,2943, 860, 2715, 938, 390,2734,1313,1384, 248, 202, 877,1064,2854, 522,3907, 279,1602, 297, 2357, 395,3740, 137,2075, 944,4089,2584,1267,3802, 62,1533,2285, 178, 176, 780, 2440, 201,3707, 590, 478,1560,4354,2117,1075, 30, 74,4643,4004,1635,1441,2745, 776,2596, 238,1077,1692,1912,2844, 605, 499,1742,3947, 241,3053, 980,1749, 936, 2640,4511,2582, 515,1543,2162,5322,2892,2993, 890,2148,1924, 665,1827,3581,1032, 968,3163, 339,1044,1896, 270, 583,1791,1720,4367,1194,3488,3669, 43,2523,1657, 163,2167, 290,1209,1622,3378, 550, 634,2508,2510, 695,2634,2384,2512,1476,1414, 220,1469,2341,2138,2852,3183,2900,4939,2865,3502,1211,3680, 854,3227,1299,2976, 3172, 186,2998,1459, 443,1067,3251,1495, 321,1932,3054, 909, 753,1410,1828, 436, 2441,1119,1587,3164,2186,1258, 227, 231,1425,1890,3200,3942, 247, 959, 725,5254, 2741, 577,2158,2079, 929, 120, 174, 838,2813, 591,1115, 417,2024, 40,3240,1536, 1037, 291,4151,2354, 632,1298,2406,2500,3535,1825,1846,3451, 205,1171, 345,4238, 18,1163, 811, 685,2208,1217, 425,1312,1508,1175,4308,2552,1033, 587,1381,3059, 2984,3482, 340,1316,4023,3972, 792,3176, 519, 777,4690, 918, 933,4130,2981,3741, 90,3360,2911,2200,5184,4550, 609,3079,2030, 272,3379,2736, 363,3881,1130,1447, 286, 779, 357,1169,3350,3137,1630,1220,2687,2391, 747,1277,3688,2618,2682,2601, 1156,3196,5290,4034,3102,1689,3596,3128, 874, 219,2783, 798, 508,1843,2461, 269, 1658,1776,1392,1913,2983,3287,2866,2159,2372, 829,4076, 46,4253,2873,1889,1894, 915,1834,1631,2181,2318, 298, 664,2818,3555,2735, 954,3228,3117, 527,3511,2173, 681,2712,3033,2247,2346,3467,1652, 155,2164,3382, 113,1994, 450, 899, 494, 994, 1237,2958,1875,2336,1926,3727, 545,1577,1550, 633,3473, 204,1305,3072,2410,1956, 2471, 707,2134, 841,2195,2196,2663,3843,1026,4940, 990,3252,4997, 368,1092, 437, 3212,3258,1933,1829, 675,2977,2893, 412, 943,3723,4644,3294,3283,2230,2373,5154, 2389,2241,2661,2323,1404,2524, 593, 787, 677,3008,1275,2059, 438,2709,2609,2240, 2269,2246,1446, 36,1568,1373,3892,1574,2301,1456,3962, 693,2276,5216,2035,1143, 2720,1919,1797,1811,2763,4137,2597,1830,1699,1488,1198,2090, 424,1694, 312,3634, 3390,4179,3335,2252,1214, 561,1059,3243,2295,2561, 975,5155,2321,2751,3772, 472, 1537,3282,3398,1047,2077,2348,2878,1323,3340,3076, 690,2906, 51, 369, 170,3541, 1060,2187,2688,3670,2541,1083,1683, 928,3918, 459, 109,4427, 599,3744,4286, 143, 2101,2730,2490, 82,1588,3036,2121, 281,1860, 477,4035,1238,2812,3020,2716,3312, 1530,2188,2055,1317, 843, 636,1808,1173,3495, 649, 181,1002, 147,3641,1159,2414, 3750,2289,2795, 813,3123,2610,1136,4368, 5,3391,4541,2174, 420, 429,1728, 754, 1228,2115,2219, 347,2223,2733, 735,1518,3003,2355,3134,1764,3948,3329,1888,2424, 1001,1234,1972,3321,3363,1672,1021,1450,1584, 226, 765, 655,2526,3404,3244,2302, 3665, 731, 594,2184, 319,1576, 621, 658,2656,4299,2099,3864,1279,2071,2598,2739, 795,3086,3699,3908,1707,2352,2402,1382,3136,2475,1465,4847,3496,3865,1085,3004, 2591,1084, 213,2287,1963,3565,2250, 822, 793,4574,3187,1772,1789,3050, 595,1484, 1959,2770,1080,2650, 456, 422,2996, 940,3322,4328,4345,3092,2742, 965,2784, 739, 4124, 952,1358,2498,2949,2565, 332,2698,2378, 660,2260,2473,4194,3856,2919, 535, 1260,2651,1208,1428,1300,1949,1303,2942, 433,2455,2450,1251,1946, 614,1269, 641, 1306,1810,2737,3078,2912, 564,2365,1419,1415,1497,4460,2367,2185,1379,3005,1307, 3218,2175,1897,3063, 682,1157,4040,4005,1712,1160,1941,1399, 394, 402,2952,1573, 1151,2986,2404, 862, 299,2033,1489,3006, 346, 171,2886,3401,1726,2932, 168,2533, 47,2507,1030,3735,1145,3370,1395,1318,1579,3609,4560,2857,4116,1457,2529,1965, 504,1036,2690,2988,2405, 745,5871, 849,2397,2056,3081, 863,2359,3857,2096, 99, 1397,1769,2300,4428,1643,3455,1978,1757,3718,1440, 35,4879,3742,1296,4228,2280, 160,5063,1599,2013, 166, 520,3479,1646,3345,3012, 490,1937,1545,1264,2182,2505, 1096,1188,1369,1436,2421,1667,2792,2460,1270,2122, 727,3167,2143, 806,1706,1012, 1800,3037, 960,2218,1882, 805, 139,2456,1139,1521, 851,1052,3093,3089, 342,2039, 744,5097,1468,1502,1585,2087, 223, 939, 326,2140,2577, 892,2481,1623,4077, 982, 3708, 135,2131, 87,2503,3114,2326,1106, 876,1616, 547,2997,2831,2093,3441,4530, 4314, 9,3256,4229,4148, 659,1462,1986,1710,2046,2913,2231,4090,4880,5255,3392, 3274,1368,3689,4645,1477, 705,3384,3635,1068,1529,2941,1458,3782,1509, 100,1656, 2548, 718,2339, 408,1590,2780,3548,1838,4117,3719,1345,3530, 717,3442,2778,3220, 2898,1892,4590,3614,3371,2043,1998,1224,3483, 891, 635, 584,2559,3355, 733,1766, 1729,1172,3789,1891,2307, 781,2982,2271,1957,1580,5773,2633,2005,4195,3097,1535, 3213,1189,1934,5693,3262, 586,3118,1324,1598, 517,1564,2217,1868,1893,4445,3728, 2703,3139,1526,1787,1992,3882,2875,1549,1199,1056,2224,1904,2711,5098,4287, 338, 1993,3129,3489,2689,1809,2815,1997, 957,1855,3898,2550,3275,3057,1105,1319, 627, 1505,1911,1883,3526, 698,3629,3456,1833,1431, 746, 77,1261,2017,2296,1977,1885, 125,1334,1600, 525,1798,1109,2222,1470,1945, 559,2236,1186,3443,2476,1929,1411, 2411,3135,1777,3372,2621,1841,1613,3229, 668,1430,1839,2643,2916, 195,1989,2671, 2358,1387, 629,3205,2293,5256,4439, 123,1310, 888,1879,4300,3021,3605,1003,1162, 3192,2910,2010, 140,2395,2859, 55,1082,2012,2901, 662, 419,2081,1438, 680,2774, 4654,3912,1620,1731,1625,5035,4065,2328, 512,1344, 802,5443,2163,2311,2537, 524, 3399, 98,1155,2103,1918,2606,3925,2816,1393,2465,1504,3773,2177,3963,1478,4346, 180,1113,4655,3461,2028,1698, 833,2696,1235,1322,1594,4408,3623,3013,3225,2040, 3022, 541,2881, 607,3632,2029,1665,1219, 639,1385,1686,1099,2803,3231,1938,3188, 2858, 427, 676,2772,1168,2025, 454,3253,2486,3556, 230,1950, 580, 791,1991,1280, 1086,1974,2034, 630, 257,3338,2788,4903,1017, 86,4790, 966,2789,1995,1696,1131, 259,3095,4188,1308, 179,1463,5257, 289,4107,1248, 42,3413,1725,2288, 896,1947, 774,4474,4254, 604,3430,4264, 392,2514,2588, 452, 237,1408,3018, 988,4531,1970, 3034,3310, 540,2370,1562,1288,2990, 502,4765,1147, 4,1853,2708, 207, 294,2814, 4078,2902,2509, 684, 34,3105,3532,2551, 644, 709,2801,2344, 573,1727,3573,3557, 2021,1081,3100,4315,2100,3681, 199,2263,1837,2385, 146,3484,1195,2776,3949, 997, 1939,3973,1008,1091,1202,1962,1847,1149,4209,5444,1076, 493, 117,5400,2521, 972, 1490,2934,1796,4542,2374,1512,2933,2657, 413,2888,1135,2762,2314,2156,1355,2369, 766,2007,2527,2170,3124,2491,2593,2632,4757,2437, 234,3125,3591,1898,1750,1376, 1942,3468,3138, 570,2127,2145,3276,4131, 962, 132,1445,4196, 19, 941,3624,3480, 3366,1973,1374,4461,3431,2629, 283,2415,2275, 808,2887,3620,2112,2563,1353,3610, 955,1089,3103,1053, 96, 88,4097, 823,3808,1583, 399, 292,4091,3313, 421,1128, 642,4006, 903,2539,1877,2082, 596, 29,4066,1790, 722,2157, 130, 995,1569, 769, 1485, 464, 513,2213, 288,1923,1101,2453,4316, 133, 486,2445, 50, 625, 487,2207, 57, 423, 481,2962, 159,3729,1558, 491, 303, 482, 501, 240,2837, 112,3648,2392, 1783, 362, 8,3433,3422, 610,2793,3277,1390,1284,1654, 21,3823, 734, 367, 623, 193, 287, 374,1009,1483, 816, 476, 313,2255,2340,1262,2150,2899,1146,2581, 782, 2116,1659,2018,1880, 255,3586,3314,1110,2867,2137,2564, 986,2767,5185,2006, 650, 158, 926, 762, 881,3157,2717,2362,3587, 306,3690,3245,1542,3077,2427,1691,2478, 2118,2985,3490,2438, 539,2305, 983, 129,1754, 355,4201,2386, 827,2923, 104,1773, 2838,2771, 411,2905,3919, 376, 767, 122,1114, 828,2422,1817,3506, 266,3460,1007, 1609,4998, 945,2612,4429,2274, 726,1247,1964,2914,2199,2070,4002,4108, 657,3323, 1422, 579, 455,2764,4737,1222,2895,1670, 824,1223,1487,2525, 558, 861,3080, 598, 2659,2515,1967, 752,2583,2376,2214,4180, 977, 704,2464,4999,2622,4109,1210,2961, 819,1541, 142,2284, 44, 418, 457,1126,3730,4347,4626,1644,1876,3671,1864, 302, 1063,5694, 624, 723,1984,3745,1314,1676,2488,1610,1449,3558,3569,2166,2098, 409, 1011,2325,3704,2306, 818,1732,1383,1824,1844,3757, 999,2705,3497,1216,1423,2683, 2426,2954,2501,2726,2229,1475,2554,5064,1971,1794,1666,2014,1343, 783, 724, 191, 2434,1354,2220,5065,1763,2752,2472,4152, 131, 175,2885,3434, 92,1466,4920,2616, 3871,3872,3866, 128,1551,1632, 669,1854,3682,4691,4125,1230, 188,2973,3290,1302, 1213, 560,3266, 917, 763,3909,3249,1760, 868,1958, 764,1782,2097, 145,2277,3774, 4462, 64,1491,3062, 971,2132,3606,2442, 221,1226,1617, 218, 323,1185,3207,3147, 571, 619,1473,1005,1744,2281, 449,1887,2396,3685, 275, 375,3816,1743,3844,3731, 845,1983,2350,4210,1377, 773, 967,3499,3052,3743,2725,4007,1697,1022,3943,1464, 3264,2855,2722,1952,1029,2839,2467, 84,4383,2215, 820,1391,2015,2448,3672, 377, 1948,2168, 797,2545,3536,2578,2645, 94,2874,1678, 405,1259,3071, 771, 546,1315, 470,1243,3083, 895,2468, 981, 969,2037, 846,4181, 653,1276,2928, 14,2594, 557, 3007,2474, 156, 902,1338,1740,2574, 537,2518, 973,2282,2216,2433,1928, 138,2903, 1293,2631,1612, 646,3457, 839,2935, 111, 496,2191,2847, 589,3186, 149,3994,2060, 4031,2641,4067,3145,1870, 37,3597,2136,1025,2051,3009,3383,3549,1121,1016,3261, 1301, 251,2446,2599,2153, 872,3246, 637, 334,3705, 831, 884, 921,3065,3140,4092, 2198,1944, 246,2964, 108,2045,1152,1921,2308,1031, 203,3173,4170,1907,3890, 810, 1401,2003,1690, 506, 647,1242,2828,1761,1649,3208,2249,1589,3709,2931,5156,1708, 498, 666,2613, 834,3817,1231, 184,2851,1124, 883,3197,2261,3710,1765,1553,2658, 1178,2639,2351, 93,1193, 942,2538,2141,4402, 235,1821, 870,1591,2192,1709,1871, 3341,1618,4126,2595,2334, 603, 651, 69, 701, 268,2662,3411,2555,1380,1606, 503, 448, 254,2371,2646, 574,1187,2309,1770, 322,2235,1292,1801, 305, 566,1133, 229, 2067,2057, 706, 167, 483,2002,2672,3295,1820,3561,3067, 316, 378,2746,3452,1112, 136,1981, 507,1651,2917,1117, 285,4591, 182,2580,3522,1304, 335,3303,1835,2504, 1795,1792,2248, 674,1018,2106,2449,1857,2292,2845, 976,3047,1781,2600,2727,1389, 1281, 52,3152, 153, 265,3950, 672,3485,3951,4463, 430,1183, 365, 278,2169, 27, 1407,1336,2304, 209,1340,1730,2202,1852,2403,2883, 979,1737,1062, 631,2829,2542, 3876,2592, 825,2086,2226,3048,3625, 352,1417,3724, 542, 991, 431,1351,3938,1861, 2294, 826,1361,2927,3142,3503,1738, 463,2462,2723, 582,1916,1595,2808, 400,3845, 3891,2868,3621,2254, 58,2492,1123, 910,2160,2614,1372,1603,1196,1072,3385,1700, 3267,1980, 696, 480,2430, 920, 799,1570,2920,1951,2041,4047,2540,1321,4223,2469, 3562,2228,1271,2602, 401,2833,3351,2575,5157, 907,2312,1256, 410, 263,3507,1582, 996, 678,1849,2316,1480, 908,3545,2237, 703,2322, 667,1826,2849,1531,2604,2999, 2407,3146,2151,2630,1786,3711, 469,3542, 497,3899,2409, 858, 837,4446,3393,1274, 786, 620,1845,2001,3311, 484, 308,3367,1204,1815,3691,2332,1532,2557,1842,2020, 2724,1927,2333,4440, 567, 22,1673,2728,4475,1987,1858,1144,1597, 101,1832,3601, 12, 974,3783,4391, 951,1412, 1,3720, 453,4608,4041, 528,1041,1027,3230,2628, 1129, 875,1051,3291,1203,2262,1069,2860,2799,2149,2615,3278, 144,1758,3040, 31, 475,1680, 366,2685,3184, 311,1642,4008,2466,5036,1593,1493,2809, 216,1420,1668, 233, 304,2128,3284, 232,1429,1768,1040,2008,3407,2740,2967,2543, 242,2133, 778, 1565,2022,2620, 505,2189,2756,1098,2273, 372,1614, 708, 553,2846,2094,2278, 169, 3626,2835,4161, 228,2674,3165, 809,1454,1309, 466,1705,1095, 900,3423, 880,2667, 3751,5258,2317,3109,2571,4317,2766,1503,1342, 866,4447,1118, 63,2076, 314,1881, 1348,1061, 172, 978,3515,1747, 532, 511,3970, 6, 601, 905,2699,3300,1751, 276, 1467,3725,2668, 65,4239,2544,2779,2556,1604, 578,2451,1802, 992,2331,2624,1320, 3446, 713,1513,1013, 103,2786,2447,1661, 886,1702, 916, 654,3574,2031,1556, 751, 2178,2821,2179,1498,1538,2176, 271, 914,2251,2080,1325, 638,1953,2937,3877,2432, 2754, 95,3265,1716, 260,1227,4083, 775, 106,1357,3254, 426,1607, 555,2480, 772, 1985, 244,2546, 474, 495,1046,2611,1851,2061, 71,2089,1675,2590, 742,3758,2843, 3222,1433, 267,2180,2576,2826,2233,2092,3913,2435, 956,1745,3075, 856,2113,1116, 451, 3,1988,2896,1398, 993,2463,1878,2049,1341,2718,2721,2870,2108, 712,2904, 4363,2753,2324, 277,2872,2349,2649, 384, 987, 435, 691,3000, 922, 164,3939, 652, 1500,1184,4153,2482,3373,2165,4848,2335,3775,3508,3154,2806,2830,1554,2102,1664, 2530,1434,2408, 893,1547,2623,3447,2832,2242,2532,3169,2856,3223,2078, 49,3770, 3469, 462, 318, 656,2259,3250,3069, 679,1629,2758, 344,1138,1104,3120,1836,1283, 3115,2154,1437,4448, 934, 759,1999, 794,2862,1038, 533,2560,1722,2342, 855,2626, 1197,1663,4476,3127, 85,4240,2528, 25,1111,1181,3673, 407,3470,4561,2679,2713, 768,1925,2841,3986,1544,1165, 932, 373,1240,2146,1930,2673, 721,4766, 354,4333, 391,2963, 187, 61,3364,1442,1102, 330,1940,1767, 341,3809,4118, 393,2496,2062, 2211, 105, 331, 300, 439, 913,1332, 626, 379,3304,1557, 328, 689,3952, 309,1555, 931, 317,2517,3027, 325, 569, 686,2107,3084, 60,1042,1333,2794, 264,3177,4014, 1628, 258,3712, 7,4464,1176,1043,1778, 683, 114,1975, 78,1492, 383,1886, 510, 386, 645,5291,2891,2069,3305,4138,3867,2939,2603,2493,1935,1066,1848,3588,1015, 1282,1289,4609, 697,1453,3044,2666,3611,1856,2412, 54, 719,1330, 568,3778,2459, 1748, 788, 492, 551,1191,1000, 488,3394,3763, 282,1799, 348,2016,1523,3155,2390, 1049, 382,2019,1788,1170, 729,2968,3523, 897,3926,2785,2938,3292, 350,2319,3238, 1718,1717,2655,3453,3143,4465, 161,2889,2980,2009,1421, 56,1908,1640,2387,2232, 1917,1874,2477,4921, 148, 83,3438, 592,4245,2882,1822,1055, 741, 115,1496,1624, 381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189, 852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, //last 512 /*************************************************************************************** *Everything below is of no interest for detection purpose * *************************************************************************************** 5508,6484,3900,3414,3974,4441,4024,3537,4037,5628,5099,3633,6485,3148,6486,3636, 5509,3257,5510,5973,5445,5872,4941,4403,3174,4627,5873,6276,2286,4230,5446,5874, 5122,6102,6103,4162,5447,5123,5323,4849,6277,3980,3851,5066,4246,5774,5067,6278, 3001,2807,5695,3346,5775,5974,5158,5448,6487,5975,5976,5776,3598,6279,5696,4806, 4211,4154,6280,6488,6489,6490,6281,4212,5037,3374,4171,6491,4562,4807,4722,4827, 5977,6104,4532,4079,5159,5324,5160,4404,3858,5359,5875,3975,4288,4610,3486,4512, 5325,3893,5360,6282,6283,5560,2522,4231,5978,5186,5449,2569,3878,6284,5401,3578, 4415,6285,4656,5124,5979,2506,4247,4449,3219,3417,4334,4969,4329,6492,4576,4828, 4172,4416,4829,5402,6286,3927,3852,5361,4369,4830,4477,4867,5876,4173,6493,6105, 4657,6287,6106,5877,5450,6494,4155,4868,5451,3700,5629,4384,6288,6289,5878,3189, 4881,6107,6290,6495,4513,6496,4692,4515,4723,5100,3356,6497,6291,3810,4080,5561, 3570,4430,5980,6498,4355,5697,6499,4724,6108,6109,3764,4050,5038,5879,4093,3226, 6292,5068,5217,4693,3342,5630,3504,4831,4377,4466,4309,5698,4431,5777,6293,5778, 4272,3706,6110,5326,3752,4676,5327,4273,5403,4767,5631,6500,5699,5880,3475,5039, 6294,5562,5125,4348,4301,4482,4068,5126,4593,5700,3380,3462,5981,5563,3824,5404, 4970,5511,3825,4738,6295,6501,5452,4516,6111,5881,5564,6502,6296,5982,6503,4213, 4163,3454,6504,6112,4009,4450,6113,4658,6297,6114,3035,6505,6115,3995,4904,4739, 4563,4942,4110,5040,3661,3928,5362,3674,6506,5292,3612,4791,5565,4149,5983,5328, 5259,5021,4725,4577,4564,4517,4364,6298,5405,4578,5260,4594,4156,4157,5453,3592, 3491,6507,5127,5512,4709,4922,5984,5701,4726,4289,6508,4015,6116,5128,4628,3424, 4241,5779,6299,4905,6509,6510,5454,5702,5780,6300,4365,4923,3971,6511,5161,3270, 3158,5985,4100, 867,5129,5703,6117,5363,3695,3301,5513,4467,6118,6512,5455,4232, 4242,4629,6513,3959,4478,6514,5514,5329,5986,4850,5162,5566,3846,4694,6119,5456, 4869,5781,3779,6301,5704,5987,5515,4710,6302,5882,6120,4392,5364,5705,6515,6121, 6516,6517,3736,5988,5457,5989,4695,2457,5883,4551,5782,6303,6304,6305,5130,4971, 6122,5163,6123,4870,3263,5365,3150,4871,6518,6306,5783,5069,5706,3513,3498,4409, 5330,5632,5366,5458,5459,3991,5990,4502,3324,5991,5784,3696,4518,5633,4119,6519, 4630,5634,4417,5707,4832,5992,3418,6124,5993,5567,4768,5218,6520,4595,3458,5367, 6125,5635,6126,4202,6521,4740,4924,6307,3981,4069,4385,6308,3883,2675,4051,3834, 4302,4483,5568,5994,4972,4101,5368,6309,5164,5884,3922,6127,6522,6523,5261,5460, 5187,4164,5219,3538,5516,4111,3524,5995,6310,6311,5369,3181,3386,2484,5188,3464, 5569,3627,5708,6524,5406,5165,4677,4492,6312,4872,4851,5885,4468,5996,6313,5709, 5710,6128,2470,5886,6314,5293,4882,5785,3325,5461,5101,6129,5711,5786,6525,4906, 6526,6527,4418,5887,5712,4808,2907,3701,5713,5888,6528,3765,5636,5331,6529,6530, 3593,5889,3637,4943,3692,5714,5787,4925,6315,6130,5462,4405,6131,6132,6316,5262, 6531,6532,5715,3859,5716,5070,4696,5102,3929,5788,3987,4792,5997,6533,6534,3920, 4809,5000,5998,6535,2974,5370,6317,5189,5263,5717,3826,6536,3953,5001,4883,3190, 5463,5890,4973,5999,4741,6133,6134,3607,5570,6000,4711,3362,3630,4552,5041,6318, 6001,2950,2953,5637,4646,5371,4944,6002,2044,4120,3429,6319,6537,5103,4833,6538, 6539,4884,4647,3884,6003,6004,4758,3835,5220,5789,4565,5407,6540,6135,5294,4697, 4852,6320,6321,3206,4907,6541,6322,4945,6542,6136,6543,6323,6005,4631,3519,6544, 5891,6545,5464,3784,5221,6546,5571,4659,6547,6324,6137,5190,6548,3853,6549,4016, 4834,3954,6138,5332,3827,4017,3210,3546,4469,5408,5718,3505,4648,5790,5131,5638, 5791,5465,4727,4318,6325,6326,5792,4553,4010,4698,3439,4974,3638,4335,3085,6006, 5104,5042,5166,5892,5572,6327,4356,4519,5222,5573,5333,5793,5043,6550,5639,5071, 4503,6328,6139,6551,6140,3914,3901,5372,6007,5640,4728,4793,3976,3836,4885,6552, 4127,6553,4451,4102,5002,6554,3686,5105,6555,5191,5072,5295,4611,5794,5296,6556, 5893,5264,5894,4975,5466,5265,4699,4976,4370,4056,3492,5044,4886,6557,5795,4432, 4769,4357,5467,3940,4660,4290,6141,4484,4770,4661,3992,6329,4025,4662,5022,4632, 4835,4070,5297,4663,4596,5574,5132,5409,5895,6142,4504,5192,4664,5796,5896,3885, 5575,5797,5023,4810,5798,3732,5223,4712,5298,4084,5334,5468,6143,4052,4053,4336, 4977,4794,6558,5335,4908,5576,5224,4233,5024,4128,5469,5225,4873,6008,5045,4729, 4742,4633,3675,4597,6559,5897,5133,5577,5003,5641,5719,6330,6560,3017,2382,3854, 4406,4811,6331,4393,3964,4946,6561,2420,3722,6562,4926,4378,3247,1736,4442,6332, 5134,6333,5226,3996,2918,5470,4319,4003,4598,4743,4744,4485,3785,3902,5167,5004, 5373,4394,5898,6144,4874,1793,3997,6334,4085,4214,5106,5642,4909,5799,6009,4419, 4189,3330,5899,4165,4420,5299,5720,5227,3347,6145,4081,6335,2876,3930,6146,3293, 3786,3910,3998,5900,5300,5578,2840,6563,5901,5579,6147,3531,5374,6564,6565,5580, 4759,5375,6566,6148,3559,5643,6336,6010,5517,6337,6338,5721,5902,3873,6011,6339, 6567,5518,3868,3649,5722,6568,4771,4947,6569,6149,4812,6570,2853,5471,6340,6341, 5644,4795,6342,6012,5723,6343,5724,6013,4349,6344,3160,6150,5193,4599,4514,4493, 5168,4320,6345,4927,3666,4745,5169,5903,5005,4928,6346,5725,6014,4730,4203,5046, 4948,3395,5170,6015,4150,6016,5726,5519,6347,5047,3550,6151,6348,4197,4310,5904, 6571,5581,2965,6152,4978,3960,4291,5135,6572,5301,5727,4129,4026,5905,4853,5728, 5472,6153,6349,4533,2700,4505,5336,4678,3583,5073,2994,4486,3043,4554,5520,6350, 6017,5800,4487,6351,3931,4103,5376,6352,4011,4321,4311,4190,5136,6018,3988,3233, 4350,5906,5645,4198,6573,5107,3432,4191,3435,5582,6574,4139,5410,6353,5411,3944, 5583,5074,3198,6575,6354,4358,6576,5302,4600,5584,5194,5412,6577,6578,5585,5413, 5303,4248,5414,3879,4433,6579,4479,5025,4854,5415,6355,4760,4772,3683,2978,4700, 3797,4452,3965,3932,3721,4910,5801,6580,5195,3551,5907,3221,3471,3029,6019,3999, 5908,5909,5266,5267,3444,3023,3828,3170,4796,5646,4979,4259,6356,5647,5337,3694, 6357,5648,5338,4520,4322,5802,3031,3759,4071,6020,5586,4836,4386,5048,6581,3571, 4679,4174,4949,6154,4813,3787,3402,3822,3958,3215,3552,5268,4387,3933,4950,4359, 6021,5910,5075,3579,6358,4234,4566,5521,6359,3613,5049,6022,5911,3375,3702,3178, 4911,5339,4521,6582,6583,4395,3087,3811,5377,6023,6360,6155,4027,5171,5649,4421, 4249,2804,6584,2270,6585,4000,4235,3045,6156,5137,5729,4140,4312,3886,6361,4330, 6157,4215,6158,3500,3676,4929,4331,3713,4930,5912,4265,3776,3368,5587,4470,4855, 3038,4980,3631,6159,6160,4132,4680,6161,6362,3923,4379,5588,4255,6586,4121,6587, 6363,4649,6364,3288,4773,4774,6162,6024,6365,3543,6588,4274,3107,3737,5050,5803, 4797,4522,5589,5051,5730,3714,4887,5378,4001,4523,6163,5026,5522,4701,4175,2791, 3760,6589,5473,4224,4133,3847,4814,4815,4775,3259,5416,6590,2738,6164,6025,5304, 3733,5076,5650,4816,5590,6591,6165,6592,3934,5269,6593,3396,5340,6594,5804,3445, 3602,4042,4488,5731,5732,3525,5591,4601,5196,6166,6026,5172,3642,4612,3202,4506, 4798,6366,3818,5108,4303,5138,5139,4776,3332,4304,2915,3415,4434,5077,5109,4856, 2879,5305,4817,6595,5913,3104,3144,3903,4634,5341,3133,5110,5651,5805,6167,4057, 5592,2945,4371,5593,6596,3474,4182,6367,6597,6168,4507,4279,6598,2822,6599,4777, 4713,5594,3829,6169,3887,5417,6170,3653,5474,6368,4216,2971,5228,3790,4579,6369, 5733,6600,6601,4951,4746,4555,6602,5418,5475,6027,3400,4665,5806,6171,4799,6028, 5052,6172,3343,4800,4747,5006,6370,4556,4217,5476,4396,5229,5379,5477,3839,5914, 5652,5807,4714,3068,4635,5808,6173,5342,4192,5078,5419,5523,5734,6174,4557,6175, 4602,6371,6176,6603,5809,6372,5735,4260,3869,5111,5230,6029,5112,6177,3126,4681, 5524,5915,2706,3563,4748,3130,6178,4018,5525,6604,6605,5478,4012,4837,6606,4534, 4193,5810,4857,3615,5479,6030,4082,3697,3539,4086,5270,3662,4508,4931,5916,4912, 5811,5027,3888,6607,4397,3527,3302,3798,2775,2921,2637,3966,4122,4388,4028,4054, 1633,4858,5079,3024,5007,3982,3412,5736,6608,3426,3236,5595,3030,6179,3427,3336, 3279,3110,6373,3874,3039,5080,5917,5140,4489,3119,6374,5812,3405,4494,6031,4666, 4141,6180,4166,6032,5813,4981,6609,5081,4422,4982,4112,3915,5653,3296,3983,6375, 4266,4410,5654,6610,6181,3436,5082,6611,5380,6033,3819,5596,4535,5231,5306,5113, 6612,4952,5918,4275,3113,6613,6376,6182,6183,5814,3073,4731,4838,5008,3831,6614, 4888,3090,3848,4280,5526,5232,3014,5655,5009,5737,5420,5527,6615,5815,5343,5173, 5381,4818,6616,3151,4953,6617,5738,2796,3204,4360,2989,4281,5739,5174,5421,5197, 3132,5141,3849,5142,5528,5083,3799,3904,4839,5480,2880,4495,3448,6377,6184,5271, 5919,3771,3193,6034,6035,5920,5010,6036,5597,6037,6378,6038,3106,5422,6618,5423, 5424,4142,6619,4889,5084,4890,4313,5740,6620,3437,5175,5307,5816,4199,5198,5529, 5817,5199,5656,4913,5028,5344,3850,6185,2955,5272,5011,5818,4567,4580,5029,5921, 3616,5233,6621,6622,6186,4176,6039,6379,6380,3352,5200,5273,2908,5598,5234,3837, 5308,6623,6624,5819,4496,4323,5309,5201,6625,6626,4983,3194,3838,4167,5530,5922, 5274,6381,6382,3860,3861,5599,3333,4292,4509,6383,3553,5481,5820,5531,4778,6187, 3955,3956,4324,4389,4218,3945,4325,3397,2681,5923,4779,5085,4019,5482,4891,5382, 5383,6040,4682,3425,5275,4094,6627,5310,3015,5483,5657,4398,5924,3168,4819,6628, 5925,6629,5532,4932,4613,6041,6630,4636,6384,4780,4204,5658,4423,5821,3989,4683, 5822,6385,4954,6631,5345,6188,5425,5012,5384,3894,6386,4490,4104,6632,5741,5053, 6633,5823,5926,5659,5660,5927,6634,5235,5742,5824,4840,4933,4820,6387,4859,5928, 4955,6388,4143,3584,5825,5346,5013,6635,5661,6389,5014,5484,5743,4337,5176,5662, 6390,2836,6391,3268,6392,6636,6042,5236,6637,4158,6638,5744,5663,4471,5347,3663, 4123,5143,4293,3895,6639,6640,5311,5929,5826,3800,6189,6393,6190,5664,5348,3554, 3594,4749,4603,6641,5385,4801,6043,5827,4183,6642,5312,5426,4761,6394,5665,6191, 4715,2669,6643,6644,5533,3185,5427,5086,5930,5931,5386,6192,6044,6645,4781,4013, 5745,4282,4435,5534,4390,4267,6045,5746,4984,6046,2743,6193,3501,4087,5485,5932, 5428,4184,4095,5747,4061,5054,3058,3862,5933,5600,6646,5144,3618,6395,3131,5055, 5313,6396,4650,4956,3855,6194,3896,5202,4985,4029,4225,6195,6647,5828,5486,5829, 3589,3002,6648,6397,4782,5276,6649,6196,6650,4105,3803,4043,5237,5830,6398,4096, 3643,6399,3528,6651,4453,3315,4637,6652,3984,6197,5535,3182,3339,6653,3096,2660, 6400,6654,3449,5934,4250,4236,6047,6401,5831,6655,5487,3753,4062,5832,6198,6199, 6656,3766,6657,3403,4667,6048,6658,4338,2897,5833,3880,2797,3780,4326,6659,5748, 5015,6660,5387,4351,5601,4411,6661,3654,4424,5935,4339,4072,5277,4568,5536,6402, 6662,5238,6663,5349,5203,6200,5204,6201,5145,4536,5016,5056,4762,5834,4399,4957, 6202,6403,5666,5749,6664,4340,6665,5936,5177,5667,6666,6667,3459,4668,6404,6668, 6669,4543,6203,6670,4276,6405,4480,5537,6671,4614,5205,5668,6672,3348,2193,4763, 6406,6204,5937,5602,4177,5669,3419,6673,4020,6205,4443,4569,5388,3715,3639,6407, 6049,4058,6206,6674,5938,4544,6050,4185,4294,4841,4651,4615,5488,6207,6408,6051, 5178,3241,3509,5835,6208,4958,5836,4341,5489,5278,6209,2823,5538,5350,5206,5429, 6675,4638,4875,4073,3516,4684,4914,4860,5939,5603,5389,6052,5057,3237,5490,3791, 6676,6409,6677,4821,4915,4106,5351,5058,4243,5539,4244,5604,4842,4916,5239,3028, 3716,5837,5114,5605,5390,5940,5430,6210,4332,6678,5540,4732,3667,3840,6053,4305, 3408,5670,5541,6410,2744,5240,5750,6679,3234,5606,6680,5607,5671,3608,4283,4159, 4400,5352,4783,6681,6411,6682,4491,4802,6211,6412,5941,6413,6414,5542,5751,6683, 4669,3734,5942,6684,6415,5943,5059,3328,4670,4144,4268,6685,6686,6687,6688,4372, 3603,6689,5944,5491,4373,3440,6416,5543,4784,4822,5608,3792,4616,5838,5672,3514, 5391,6417,4892,6690,4639,6691,6054,5673,5839,6055,6692,6056,5392,6212,4038,5544, 5674,4497,6057,6693,5840,4284,5675,4021,4545,5609,6418,4454,6419,6213,4113,4472, 5314,3738,5087,5279,4074,5610,4959,4063,3179,4750,6058,6420,6214,3476,4498,4716, 5431,4960,4685,6215,5241,6694,6421,6216,6695,5841,5945,6422,3748,5946,5179,3905, 5752,5545,5947,4374,6217,4455,6423,4412,6218,4803,5353,6696,3832,5280,6219,4327, 4702,6220,6221,6059,4652,5432,6424,3749,4751,6425,5753,4986,5393,4917,5948,5030, 5754,4861,4733,6426,4703,6697,6222,4671,5949,4546,4961,5180,6223,5031,3316,5281, 6698,4862,4295,4934,5207,3644,6427,5842,5950,6428,6429,4570,5843,5282,6430,6224, 5088,3239,6060,6699,5844,5755,6061,6431,2701,5546,6432,5115,5676,4039,3993,3327, 4752,4425,5315,6433,3941,6434,5677,4617,4604,3074,4581,6225,5433,6435,6226,6062, 4823,5756,5116,6227,3717,5678,4717,5845,6436,5679,5846,6063,5847,6064,3977,3354, 6437,3863,5117,6228,5547,5394,4499,4524,6229,4605,6230,4306,4500,6700,5951,6065, 3693,5952,5089,4366,4918,6701,6231,5548,6232,6702,6438,4704,5434,6703,6704,5953, 4168,6705,5680,3420,6706,5242,4407,6066,3812,5757,5090,5954,4672,4525,3481,5681, 4618,5395,5354,5316,5955,6439,4962,6707,4526,6440,3465,4673,6067,6441,5682,6708, 5435,5492,5758,5683,4619,4571,4674,4804,4893,4686,5493,4753,6233,6068,4269,6442, 6234,5032,4705,5146,5243,5208,5848,6235,6443,4963,5033,4640,4226,6236,5849,3387, 6444,6445,4436,4437,5850,4843,5494,4785,4894,6709,4361,6710,5091,5956,3331,6237, 4987,5549,6069,6711,4342,3517,4473,5317,6070,6712,6071,4706,6446,5017,5355,6713, 6714,4988,5436,6447,4734,5759,6715,4735,4547,4456,4754,6448,5851,6449,6450,3547, 5852,5318,6451,6452,5092,4205,6716,6238,4620,4219,5611,6239,6072,4481,5760,5957, 5958,4059,6240,6453,4227,4537,6241,5761,4030,4186,5244,5209,3761,4457,4876,3337, 5495,5181,6242,5959,5319,5612,5684,5853,3493,5854,6073,4169,5613,5147,4895,6074, 5210,6717,5182,6718,3830,6243,2798,3841,6075,6244,5855,5614,3604,4606,5496,5685, 5118,5356,6719,6454,5960,5357,5961,6720,4145,3935,4621,5119,5962,4261,6721,6455, 4786,5963,4375,4582,6245,6246,6247,6076,5437,4877,5856,3376,4380,6248,4160,6722, 5148,6456,5211,6457,6723,4718,6458,6724,6249,5358,4044,3297,6459,6250,5857,5615, 5497,5245,6460,5498,6725,6251,6252,5550,3793,5499,2959,5396,6461,6462,4572,5093, 5500,5964,3806,4146,6463,4426,5762,5858,6077,6253,4755,3967,4220,5965,6254,4989, 5501,6464,4352,6726,6078,4764,2290,5246,3906,5438,5283,3767,4964,2861,5763,5094, 6255,6256,4622,5616,5859,5860,4707,6727,4285,4708,4824,5617,6257,5551,4787,5212, 4965,4935,4687,6465,6728,6466,5686,6079,3494,4413,2995,5247,5966,5618,6729,5967, 5764,5765,5687,5502,6730,6731,6080,5397,6467,4990,6258,6732,4538,5060,5619,6733, 4719,5688,5439,5018,5149,5284,5503,6734,6081,4607,6259,5120,3645,5861,4583,6260, 4584,4675,5620,4098,5440,6261,4863,2379,3306,4585,5552,5689,4586,5285,6735,4864, 6736,5286,6082,6737,4623,3010,4788,4381,4558,5621,4587,4896,3698,3161,5248,4353, 4045,6262,3754,5183,4588,6738,6263,6739,6740,5622,3936,6741,6468,6742,6264,5095, 6469,4991,5968,6743,4992,6744,6083,4897,6745,4256,5766,4307,3108,3968,4444,5287, 3889,4343,6084,4510,6085,4559,6086,4898,5969,6746,5623,5061,4919,5249,5250,5504, 5441,6265,5320,4878,3242,5862,5251,3428,6087,6747,4237,5624,5442,6266,5553,4539, 6748,2585,3533,5398,4262,6088,5150,4736,4438,6089,6267,5505,4966,6749,6268,6750, 6269,5288,5554,3650,6090,6091,4624,6092,5690,6751,5863,4270,5691,4277,5555,5864, 6752,5692,4720,4865,6470,5151,4688,4825,6753,3094,6754,6471,3235,4653,6755,5213, 5399,6756,3201,4589,5865,4967,6472,5866,6473,5019,3016,6757,5321,4756,3957,4573, 6093,4993,5767,4721,6474,6758,5625,6759,4458,6475,6270,6760,5556,4994,5214,5252, 6271,3875,5768,6094,5034,5506,4376,5769,6761,2120,6476,5253,5770,6762,5771,5970, 3990,5971,5557,5558,5772,6477,6095,2787,4641,5972,5121,6096,6097,6272,6763,3703, 5867,5507,6273,4206,6274,4789,6098,6764,3619,3646,3833,3804,2394,3788,4936,3978, 4866,4899,6099,6100,5559,6478,6765,3599,5868,6101,5869,5870,6275,6766,4527,6767, *******************************************************************************/ }; ================================================ FILE: third_party/uchardet/uchardet/src/tables/GB2312Freq.tab ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // // TODO: until we don't have a better solution, we use GB18030's Table here // ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //GB2312 most frequently used character table //Char to FreqOrder table , from hz6763 /****************************************************************************** * 512 --> 0.79 -- 0.79 * 1024 --> 0.92 -- 0.13 * 2048 --> 0.98 -- 0.06 * 6768 --> 1.00 -- 0.02 * * Idea Distribution Ratio = 0.79135/(1-0.79135) = 3.79 * Random Distribution Ration = 512 / (3755 - 512) = 0.157 * * Typical Distribution Ratio about 25% of Ideal one, still much higher that RDR *****************************************************************************/ #define GB2312_TYPICAL_DISTRIBUTION_RATIO (float)0.79 #define GB2312_TABLE_SIZE 3760 constexpr PRInt16 GB2312CharToFreqOrder[] = { 1671, 749,1443,2364,3924,3807,2330,3921,1704,3463,2691,1511,1515, 572,3191,2205, 2361, 224,2558, 479,1711, 963,3162, 440,4060,1905,2966,2947,3580,2647,3961,3842, 2204, 869,4207, 970,2678,5626,2944,2956,1479,4048, 514,3595, 588,1346,2820,3409, 249,4088,1746,1873,2047,1774, 581,1813, 358,1174,3590,1014,1561,4844,2245, 670, 1636,3112, 889,1286, 953, 556,2327,3060,1290,3141, 613, 185,3477,1367, 850,3820, 1715,2428,2642,2303,2732,3041,2562,2648,3566,3946,1349, 388,3098,2091,1360,3585, 152,1687,1539, 738,1559, 59,1232,2925,2267,1388,1249,1741,1679,2960, 151,1566, 1125,1352,4271, 924,4296, 385,3166,4459, 310,1245,2850, 70,3285,2729,3534,3575, 2398,3298,3466,1960,2265, 217,3647, 864,1909,2084,4401,2773,1010,3269,5152, 853, 3051,3121,1244,4251,1895, 364,1499,1540,2313,1180,3655,2268, 562, 715,2417,3061, 544, 336,3768,2380,1752,4075, 950, 280,2425,4382, 183,2759,3272, 333,4297,2155, 1688,2356,1444,1039,4540, 736,1177,3349,2443,2368,2144,2225, 565, 196,1482,3406, 927,1335,4147, 692, 878,1311,1653,3911,3622,1378,4200,1840,2969,3149,2126,1816, 2534,1546,2393,2760, 737,2494, 13, 447, 245,2747, 38,2765,2129,2589,1079, 606, 360, 471,3755,2890, 404, 848, 699,1785,1236, 370,2221,1023,3746,2074,2026,2023, 2388,1581,2119, 812,1141,3091,2536,1519, 804,2053, 406,1596,1090, 784, 548,4414, 1806,2264,2936,1100, 343,4114,5096, 622,3358, 743,3668,1510,1626,5020,3567,2513, 3195,4115,5627,2489,2991, 24,2065,2697,1087,2719, 48,1634, 315, 68, 985,2052, 198,2239,1347,1107,1439, 597,2366,2172, 871,3307, 919,2487,2790,1867, 236,2570, 1413,3794, 906,3365,3381,1701,1982,1818,1524,2924,1205, 616,2586,2072,2004, 575, 253,3099, 32,1365,1182, 197,1714,2454,1201, 554,3388,3224,2748, 756,2587, 250, 2567,1507,1517,3529,1922,2761,2337,3416,1961,1677,2452,2238,3153, 615, 911,1506, 1474,2495,1265,1906,2749,3756,3280,2161, 898,2714,1759,3450,2243,2444, 563, 26, 3286,2266,3769,3344,2707,3677, 611,1402, 531,1028,2871,4548,1375, 261,2948, 835, 1190,4134, 353, 840,2684,1900,3082,1435,2109,1207,1674, 329,1872,2781,4055,2686, 2104, 608,3318,2423,2957,2768,1108,3739,3512,3271,3985,2203,1771,3520,1418,2054, 1681,1153, 225,1627,2929, 162,2050,2511,3687,1954, 124,1859,2431,1684,3032,2894, 585,4805,3969,2869,2704,2088,2032,2095,3656,2635,4362,2209, 256, 518,2042,2105, 3777,3657, 643,2298,1148,1779, 190, 989,3544, 414, 11,2135,2063,2979,1471, 403, 3678, 126, 770,1563, 671,2499,3216,2877, 600,1179, 307,2805,4937,1268,1297,2694, 252,4032,1448,1494,1331,1394, 127,2256, 222,1647,1035,1481,3056,1915,1048, 873, 3651, 210, 33,1608,2516, 200,1520, 415, 102, 0,3389,1287, 817, 91,3299,2940, 836,1814, 549,2197,1396,1669,2987,3582,2297,2848,4528,1070, 687, 20,1819, 121, 1552,1364,1461,1968,2617,3540,2824,2083, 177, 948,4938,2291, 110,4549,2066, 648, 3359,1755,2110,2114,4642,4845,1693,3937,3308,1257,1869,2123, 208,1804,3159,2992, 2531,2549,3361,2418,1350,2347,2800,2568,1291,2036,2680, 72, 842,1990, 212,1233, 1154,1586, 75,2027,3410,4900,1823,1337,2710,2676, 728,2810,1522,3026,4995, 157, 755,1050,4022, 710, 785,1936,2194,2085,1406,2777,2400, 150,1250,4049,1206, 807, 1910, 534, 529,3309,1721,1660, 274, 39,2827, 661,2670,1578, 925,3248,3815,1094, 4278,4901,4252, 41,1150,3747,2572,2227,4501,3658,4902,3813,3357,3617,2884,2258, 887, 538,4187,3199,1294,2439,3042,2329,2343,2497,1255, 107, 543,1527, 521,3478, 3568, 194,5062, 15, 961,3870,1241,1192,2664, 66,5215,3260,2111,1295,1127,2152, 3805,4135, 901,1164,1976, 398,1278, 530,1460, 748, 904,1054,1966,1426, 53,2909, 509, 523,2279,1534, 536,1019, 239,1685, 460,2353, 673,1065,2401,3600,4298,2272, 1272,2363, 284,1753,3679,4064,1695, 81, 815,2677,2757,2731,1386, 859, 500,4221, 2190,2566, 757,1006,2519,2068,1166,1455, 337,2654,3203,1863,1682,1914,3025,1252, 1409,1366, 847, 714,2834,2038,3209, 964,2970,1901, 885,2553,1078,1756,3049, 301, 1572,3326, 688,2130,1996,2429,1805,1648,2930,3421,2750,3652,3088, 262,1158,1254, 389,1641,1812, 526,1719, 923,2073,1073,1902, 468, 489,4625,1140, 857,2375,3070, 3319,2863, 380, 116,1328,2693,1161,2244, 273,1212,1884,2769,3011,1775,1142, 461, 3066,1200,2147,2212, 790, 702,2695,4222,1601,1058, 434,2338,5153,3640, 67,2360, 4099,2502, 618,3472,1329, 416,1132, 830,2782,1807,2653,3211,3510,1662, 192,2124, 296,3979,1739,1611,3684, 23, 118, 324, 446,1239,1225, 293,2520,3814,3795,2535, 3116, 17,1074, 467,2692,2201, 387,2922, 45,1326,3055,1645,3659,2817, 958, 243, 1903,2320,1339,2825,1784,3289, 356, 576, 865,2315,2381,3377,3916,1088,3122,1713, 1655, 935, 628,4689,1034,1327, 441, 800, 720, 894,1979,2183,1528,5289,2702,1071, 4046,3572,2399,1571,3281, 79, 761,1103, 327, 134, 758,1899,1371,1615, 879, 442, 215,2605,2579, 173,2048,2485,1057,2975,3317,1097,2253,3801,4263,1403,1650,2946, 814,4968,3487,1548,2644,1567,1285, 2, 295,2636, 97, 946,3576, 832, 141,4257, 3273, 760,3821,3521,3156,2607, 949,1024,1733,1516,1803,1920,2125,2283,2665,3180, 1501,2064,3560,2171,1592, 803,3518,1416, 732,3897,4258,1363,1362,2458, 119,1427, 602,1525,2608,1605,1639,3175, 694,3064, 10, 465, 76,2000,4846,4208, 444,3781, 1619,3353,2206,1273,3796, 740,2483, 320,1723,2377,3660,2619,1359,1137,1762,1724, 2345,2842,1850,1862, 912, 821,1866, 612,2625,1735,2573,3369,1093, 844, 89, 937, 930,1424,3564,2413,2972,1004,3046,3019,2011, 711,3171,1452,4178, 428, 801,1943, 432, 445,2811, 206,4136,1472, 730, 349, 73, 397,2802,2547, 998,1637,1167, 789, 396,3217, 154,1218, 716,1120,1780,2819,4826,1931,3334,3762,2139,1215,2627, 552, 3664,3628,3232,1405,2383,3111,1356,2652,3577,3320,3101,1703, 640,1045,1370,1246, 4996, 371,1575,2436,1621,2210, 984,4033,1734,2638, 16,4529, 663,2755,3255,1451, 3917,2257,1253,1955,2234,1263,2951, 214,1229, 617, 485, 359,1831,1969, 473,2310, 750,2058, 165, 80,2864,2419, 361,4344,2416,2479,1134, 796,3726,1266,2943, 860, 2715, 938, 390,2734,1313,1384, 248, 202, 877,1064,2854, 522,3907, 279,1602, 297, 2357, 395,3740, 137,2075, 944,4089,2584,1267,3802, 62,1533,2285, 178, 176, 780, 2440, 201,3707, 590, 478,1560,4354,2117,1075, 30, 74,4643,4004,1635,1441,2745, 776,2596, 238,1077,1692,1912,2844, 605, 499,1742,3947, 241,3053, 980,1749, 936, 2640,4511,2582, 515,1543,2162,5322,2892,2993, 890,2148,1924, 665,1827,3581,1032, 968,3163, 339,1044,1896, 270, 583,1791,1720,4367,1194,3488,3669, 43,2523,1657, 163,2167, 290,1209,1622,3378, 550, 634,2508,2510, 695,2634,2384,2512,1476,1414, 220,1469,2341,2138,2852,3183,2900,4939,2865,3502,1211,3680, 854,3227,1299,2976, 3172, 186,2998,1459, 443,1067,3251,1495, 321,1932,3054, 909, 753,1410,1828, 436, 2441,1119,1587,3164,2186,1258, 227, 231,1425,1890,3200,3942, 247, 959, 725,5254, 2741, 577,2158,2079, 929, 120, 174, 838,2813, 591,1115, 417,2024, 40,3240,1536, 1037, 291,4151,2354, 632,1298,2406,2500,3535,1825,1846,3451, 205,1171, 345,4238, 18,1163, 811, 685,2208,1217, 425,1312,1508,1175,4308,2552,1033, 587,1381,3059, 2984,3482, 340,1316,4023,3972, 792,3176, 519, 777,4690, 918, 933,4130,2981,3741, 90,3360,2911,2200,5184,4550, 609,3079,2030, 272,3379,2736, 363,3881,1130,1447, 286, 779, 357,1169,3350,3137,1630,1220,2687,2391, 747,1277,3688,2618,2682,2601, 1156,3196,5290,4034,3102,1689,3596,3128, 874, 219,2783, 798, 508,1843,2461, 269, 1658,1776,1392,1913,2983,3287,2866,2159,2372, 829,4076, 46,4253,2873,1889,1894, 915,1834,1631,2181,2318, 298, 664,2818,3555,2735, 954,3228,3117, 527,3511,2173, 681,2712,3033,2247,2346,3467,1652, 155,2164,3382, 113,1994, 450, 899, 494, 994, 1237,2958,1875,2336,1926,3727, 545,1577,1550, 633,3473, 204,1305,3072,2410,1956, 2471, 707,2134, 841,2195,2196,2663,3843,1026,4940, 990,3252,4997, 368,1092, 437, 3212,3258,1933,1829, 675,2977,2893, 412, 943,3723,4644,3294,3283,2230,2373,5154, 2389,2241,2661,2323,1404,2524, 593, 787, 677,3008,1275,2059, 438,2709,2609,2240, 2269,2246,1446, 36,1568,1373,3892,1574,2301,1456,3962, 693,2276,5216,2035,1143, 2720,1919,1797,1811,2763,4137,2597,1830,1699,1488,1198,2090, 424,1694, 312,3634, 3390,4179,3335,2252,1214, 561,1059,3243,2295,2561, 975,5155,2321,2751,3772, 472, 1537,3282,3398,1047,2077,2348,2878,1323,3340,3076, 690,2906, 51, 369, 170,3541, 1060,2187,2688,3670,2541,1083,1683, 928,3918, 459, 109,4427, 599,3744,4286, 143, 2101,2730,2490, 82,1588,3036,2121, 281,1860, 477,4035,1238,2812,3020,2716,3312, 1530,2188,2055,1317, 843, 636,1808,1173,3495, 649, 181,1002, 147,3641,1159,2414, 3750,2289,2795, 813,3123,2610,1136,4368, 5,3391,4541,2174, 420, 429,1728, 754, 1228,2115,2219, 347,2223,2733, 735,1518,3003,2355,3134,1764,3948,3329,1888,2424, 1001,1234,1972,3321,3363,1672,1021,1450,1584, 226, 765, 655,2526,3404,3244,2302, 3665, 731, 594,2184, 319,1576, 621, 658,2656,4299,2099,3864,1279,2071,2598,2739, 795,3086,3699,3908,1707,2352,2402,1382,3136,2475,1465,4847,3496,3865,1085,3004, 2591,1084, 213,2287,1963,3565,2250, 822, 793,4574,3187,1772,1789,3050, 595,1484, 1959,2770,1080,2650, 456, 422,2996, 940,3322,4328,4345,3092,2742, 965,2784, 739, 4124, 952,1358,2498,2949,2565, 332,2698,2378, 660,2260,2473,4194,3856,2919, 535, 1260,2651,1208,1428,1300,1949,1303,2942, 433,2455,2450,1251,1946, 614,1269, 641, 1306,1810,2737,3078,2912, 564,2365,1419,1415,1497,4460,2367,2185,1379,3005,1307, 3218,2175,1897,3063, 682,1157,4040,4005,1712,1160,1941,1399, 394, 402,2952,1573, 1151,2986,2404, 862, 299,2033,1489,3006, 346, 171,2886,3401,1726,2932, 168,2533, 47,2507,1030,3735,1145,3370,1395,1318,1579,3609,4560,2857,4116,1457,2529,1965, 504,1036,2690,2988,2405, 745,5871, 849,2397,2056,3081, 863,2359,3857,2096, 99, 1397,1769,2300,4428,1643,3455,1978,1757,3718,1440, 35,4879,3742,1296,4228,2280, 160,5063,1599,2013, 166, 520,3479,1646,3345,3012, 490,1937,1545,1264,2182,2505, 1096,1188,1369,1436,2421,1667,2792,2460,1270,2122, 727,3167,2143, 806,1706,1012, 1800,3037, 960,2218,1882, 805, 139,2456,1139,1521, 851,1052,3093,3089, 342,2039, 744,5097,1468,1502,1585,2087, 223, 939, 326,2140,2577, 892,2481,1623,4077, 982, 3708, 135,2131, 87,2503,3114,2326,1106, 876,1616, 547,2997,2831,2093,3441,4530, 4314, 9,3256,4229,4148, 659,1462,1986,1710,2046,2913,2231,4090,4880,5255,3392, 3274,1368,3689,4645,1477, 705,3384,3635,1068,1529,2941,1458,3782,1509, 100,1656, 2548, 718,2339, 408,1590,2780,3548,1838,4117,3719,1345,3530, 717,3442,2778,3220, 2898,1892,4590,3614,3371,2043,1998,1224,3483, 891, 635, 584,2559,3355, 733,1766, 1729,1172,3789,1891,2307, 781,2982,2271,1957,1580,5773,2633,2005,4195,3097,1535, 3213,1189,1934,5693,3262, 586,3118,1324,1598, 517,1564,2217,1868,1893,4445,3728, 2703,3139,1526,1787,1992,3882,2875,1549,1199,1056,2224,1904,2711,5098,4287, 338, 1993,3129,3489,2689,1809,2815,1997, 957,1855,3898,2550,3275,3057,1105,1319, 627, 1505,1911,1883,3526, 698,3629,3456,1833,1431, 746, 77,1261,2017,2296,1977,1885, 125,1334,1600, 525,1798,1109,2222,1470,1945, 559,2236,1186,3443,2476,1929,1411, 2411,3135,1777,3372,2621,1841,1613,3229, 668,1430,1839,2643,2916, 195,1989,2671, 2358,1387, 629,3205,2293,5256,4439, 123,1310, 888,1879,4300,3021,3605,1003,1162, 3192,2910,2010, 140,2395,2859, 55,1082,2012,2901, 662, 419,2081,1438, 680,2774, 4654,3912,1620,1731,1625,5035,4065,2328, 512,1344, 802,5443,2163,2311,2537, 524, 3399, 98,1155,2103,1918,2606,3925,2816,1393,2465,1504,3773,2177,3963,1478,4346, 180,1113,4655,3461,2028,1698, 833,2696,1235,1322,1594,4408,3623,3013,3225,2040, 3022, 541,2881, 607,3632,2029,1665,1219, 639,1385,1686,1099,2803,3231,1938,3188, 2858, 427, 676,2772,1168,2025, 454,3253,2486,3556, 230,1950, 580, 791,1991,1280, 1086,1974,2034, 630, 257,3338,2788,4903,1017, 86,4790, 966,2789,1995,1696,1131, 259,3095,4188,1308, 179,1463,5257, 289,4107,1248, 42,3413,1725,2288, 896,1947, 774,4474,4254, 604,3430,4264, 392,2514,2588, 452, 237,1408,3018, 988,4531,1970, 3034,3310, 540,2370,1562,1288,2990, 502,4765,1147, 4,1853,2708, 207, 294,2814, 4078,2902,2509, 684, 34,3105,3532,2551, 644, 709,2801,2344, 573,1727,3573,3557, 2021,1081,3100,4315,2100,3681, 199,2263,1837,2385, 146,3484,1195,2776,3949, 997, 1939,3973,1008,1091,1202,1962,1847,1149,4209,5444,1076, 493, 117,5400,2521, 972, 1490,2934,1796,4542,2374,1512,2933,2657, 413,2888,1135,2762,2314,2156,1355,2369, 766,2007,2527,2170,3124,2491,2593,2632,4757,2437, 234,3125,3591,1898,1750,1376, 1942,3468,3138, 570,2127,2145,3276,4131, 962, 132,1445,4196, 19, 941,3624,3480, 3366,1973,1374,4461,3431,2629, 283,2415,2275, 808,2887,3620,2112,2563,1353,3610, 955,1089,3103,1053, 96, 88,4097, 823,3808,1583, 399, 292,4091,3313, 421,1128, 642,4006, 903,2539,1877,2082, 596, 29,4066,1790, 722,2157, 130, 995,1569, 769, 1485, 464, 513,2213, 288,1923,1101,2453,4316, 133, 486,2445, 50, 625, 487,2207, 57, 423, 481,2962, 159,3729,1558, 491, 303, 482, 501, 240,2837, 112,3648,2392, 1783, 362, 8,3433,3422, 610,2793,3277,1390,1284,1654, 21,3823, 734, 367, 623, 193, 287, 374,1009,1483, 816, 476, 313,2255,2340,1262,2150,2899,1146,2581, 782, 2116,1659,2018,1880, 255,3586,3314,1110,2867,2137,2564, 986,2767,5185,2006, 650, 158, 926, 762, 881,3157,2717,2362,3587, 306,3690,3245,1542,3077,2427,1691,2478, 2118,2985,3490,2438, 539,2305, 983, 129,1754, 355,4201,2386, 827,2923, 104,1773, 2838,2771, 411,2905,3919, 376, 767, 122,1114, 828,2422,1817,3506, 266,3460,1007, 1609,4998, 945,2612,4429,2274, 726,1247,1964,2914,2199,2070,4002,4108, 657,3323, 1422, 579, 455,2764,4737,1222,2895,1670, 824,1223,1487,2525, 558, 861,3080, 598, 2659,2515,1967, 752,2583,2376,2214,4180, 977, 704,2464,4999,2622,4109,1210,2961, 819,1541, 142,2284, 44, 418, 457,1126,3730,4347,4626,1644,1876,3671,1864, 302, 1063,5694, 624, 723,1984,3745,1314,1676,2488,1610,1449,3558,3569,2166,2098, 409, 1011,2325,3704,2306, 818,1732,1383,1824,1844,3757, 999,2705,3497,1216,1423,2683, 2426,2954,2501,2726,2229,1475,2554,5064,1971,1794,1666,2014,1343, 783, 724, 191, 2434,1354,2220,5065,1763,2752,2472,4152, 131, 175,2885,3434, 92,1466,4920,2616, 3871,3872,3866, 128,1551,1632, 669,1854,3682,4691,4125,1230, 188,2973,3290,1302, 1213, 560,3266, 917, 763,3909,3249,1760, 868,1958, 764,1782,2097, 145,2277,3774, 4462, 64,1491,3062, 971,2132,3606,2442, 221,1226,1617, 218, 323,1185,3207,3147, 571, 619,1473,1005,1744,2281, 449,1887,2396,3685, 275, 375,3816,1743,3844,3731, 845,1983,2350,4210,1377, 773, 967,3499,3052,3743,2725,4007,1697,1022,3943,1464, 3264,2855,2722,1952,1029,2839,2467, 84,4383,2215, 820,1391,2015,2448,3672, 377, 1948,2168, 797,2545,3536,2578,2645, 94,2874,1678, 405,1259,3071, 771, 546,1315, 470,1243,3083, 895,2468, 981, 969,2037, 846,4181, 653,1276,2928, 14,2594, 557, 3007,2474, 156, 902,1338,1740,2574, 537,2518, 973,2282,2216,2433,1928, 138,2903, 1293,2631,1612, 646,3457, 839,2935, 111, 496,2191,2847, 589,3186, 149,3994,2060, 4031,2641,4067,3145,1870, 37,3597,2136,1025,2051,3009,3383,3549,1121,1016,3261, 1301, 251,2446,2599,2153, 872,3246, 637, 334,3705, 831, 884, 921,3065,3140,4092, 2198,1944, 246,2964, 108,2045,1152,1921,2308,1031, 203,3173,4170,1907,3890, 810, 1401,2003,1690, 506, 647,1242,2828,1761,1649,3208,2249,1589,3709,2931,5156,1708, 498, 666,2613, 834,3817,1231, 184,2851,1124, 883,3197,2261,3710,1765,1553,2658, 1178,2639,2351, 93,1193, 942,2538,2141,4402, 235,1821, 870,1591,2192,1709,1871, 3341,1618,4126,2595,2334, 603, 651, 69, 701, 268,2662,3411,2555,1380,1606, 503, 448, 254,2371,2646, 574,1187,2309,1770, 322,2235,1292,1801, 305, 566,1133, 229, 2067,2057, 706, 167, 483,2002,2672,3295,1820,3561,3067, 316, 378,2746,3452,1112, 136,1981, 507,1651,2917,1117, 285,4591, 182,2580,3522,1304, 335,3303,1835,2504, 1795,1792,2248, 674,1018,2106,2449,1857,2292,2845, 976,3047,1781,2600,2727,1389, 1281, 52,3152, 153, 265,3950, 672,3485,3951,4463, 430,1183, 365, 278,2169, 27, 1407,1336,2304, 209,1340,1730,2202,1852,2403,2883, 979,1737,1062, 631,2829,2542, 3876,2592, 825,2086,2226,3048,3625, 352,1417,3724, 542, 991, 431,1351,3938,1861, 2294, 826,1361,2927,3142,3503,1738, 463,2462,2723, 582,1916,1595,2808, 400,3845, 3891,2868,3621,2254, 58,2492,1123, 910,2160,2614,1372,1603,1196,1072,3385,1700, 3267,1980, 696, 480,2430, 920, 799,1570,2920,1951,2041,4047,2540,1321,4223,2469, 3562,2228,1271,2602, 401,2833,3351,2575,5157, 907,2312,1256, 410, 263,3507,1582, 996, 678,1849,2316,1480, 908,3545,2237, 703,2322, 667,1826,2849,1531,2604,2999, 2407,3146,2151,2630,1786,3711, 469,3542, 497,3899,2409, 858, 837,4446,3393,1274, 786, 620,1845,2001,3311, 484, 308,3367,1204,1815,3691,2332,1532,2557,1842,2020, 2724,1927,2333,4440, 567, 22,1673,2728,4475,1987,1858,1144,1597, 101,1832,3601, 12, 974,3783,4391, 951,1412, 1,3720, 453,4608,4041, 528,1041,1027,3230,2628, 1129, 875,1051,3291,1203,2262,1069,2860,2799,2149,2615,3278, 144,1758,3040, 31, 475,1680, 366,2685,3184, 311,1642,4008,2466,5036,1593,1493,2809, 216,1420,1668, 233, 304,2128,3284, 232,1429,1768,1040,2008,3407,2740,2967,2543, 242,2133, 778, 1565,2022,2620, 505,2189,2756,1098,2273, 372,1614, 708, 553,2846,2094,2278, 169, 3626,2835,4161, 228,2674,3165, 809,1454,1309, 466,1705,1095, 900,3423, 880,2667, 3751,5258,2317,3109,2571,4317,2766,1503,1342, 866,4447,1118, 63,2076, 314,1881, 1348,1061, 172, 978,3515,1747, 532, 511,3970, 6, 601, 905,2699,3300,1751, 276, 1467,3725,2668, 65,4239,2544,2779,2556,1604, 578,2451,1802, 992,2331,2624,1320, 3446, 713,1513,1013, 103,2786,2447,1661, 886,1702, 916, 654,3574,2031,1556, 751, 2178,2821,2179,1498,1538,2176, 271, 914,2251,2080,1325, 638,1953,2937,3877,2432, 2754, 95,3265,1716, 260,1227,4083, 775, 106,1357,3254, 426,1607, 555,2480, 772, 1985, 244,2546, 474, 495,1046,2611,1851,2061, 71,2089,1675,2590, 742,3758,2843, 3222,1433, 267,2180,2576,2826,2233,2092,3913,2435, 956,1745,3075, 856,2113,1116, 451, 3,1988,2896,1398, 993,2463,1878,2049,1341,2718,2721,2870,2108, 712,2904, 4363,2753,2324, 277,2872,2349,2649, 384, 987, 435, 691,3000, 922, 164,3939, 652, 1500,1184,4153,2482,3373,2165,4848,2335,3775,3508,3154,2806,2830,1554,2102,1664, 2530,1434,2408, 893,1547,2623,3447,2832,2242,2532,3169,2856,3223,2078, 49,3770, 3469, 462, 318, 656,2259,3250,3069, 679,1629,2758, 344,1138,1104,3120,1836,1283, 3115,2154,1437,4448, 934, 759,1999, 794,2862,1038, 533,2560,1722,2342, 855,2626, 1197,1663,4476,3127, 85,4240,2528, 25,1111,1181,3673, 407,3470,4561,2679,2713, 768,1925,2841,3986,1544,1165, 932, 373,1240,2146,1930,2673, 721,4766, 354,4333, 391,2963, 187, 61,3364,1442,1102, 330,1940,1767, 341,3809,4118, 393,2496,2062, 2211, 105, 331, 300, 439, 913,1332, 626, 379,3304,1557, 328, 689,3952, 309,1555, 931, 317,2517,3027, 325, 569, 686,2107,3084, 60,1042,1333,2794, 264,3177,4014, 1628, 258,3712, 7,4464,1176,1043,1778, 683, 114,1975, 78,1492, 383,1886, 510, 386, 645,5291,2891,2069,3305,4138,3867,2939,2603,2493,1935,1066,1848,3588,1015, 1282,1289,4609, 697,1453,3044,2666,3611,1856,2412, 54, 719,1330, 568,3778,2459, 1748, 788, 492, 551,1191,1000, 488,3394,3763, 282,1799, 348,2016,1523,3155,2390, 1049, 382,2019,1788,1170, 729,2968,3523, 897,3926,2785,2938,3292, 350,2319,3238, 1718,1717,2655,3453,3143,4465, 161,2889,2980,2009,1421, 56,1908,1640,2387,2232, 1917,1874,2477,4921, 148, 83,3438, 592,4245,2882,1822,1055, 741, 115,1496,1624, 381,1638,4592,1020, 516,3214, 458, 947,4575,1432, 211,1514,2926,1865,2142, 189, 852,1221,1400,1486, 882,2299,4036, 351, 28,1122, 700,6479,6480,6481,6482,6483, //last 512 /*************************************************************************************** *Everything below is of no interest for detection purpose * *************************************************************************************** 5508,6484,3900,3414,3974,4441,4024,3537,4037,5628,5099,3633,6485,3148,6486,3636, 5509,3257,5510,5973,5445,5872,4941,4403,3174,4627,5873,6276,2286,4230,5446,5874, 5122,6102,6103,4162,5447,5123,5323,4849,6277,3980,3851,5066,4246,5774,5067,6278, 3001,2807,5695,3346,5775,5974,5158,5448,6487,5975,5976,5776,3598,6279,5696,4806, 4211,4154,6280,6488,6489,6490,6281,4212,5037,3374,4171,6491,4562,4807,4722,4827, 5977,6104,4532,4079,5159,5324,5160,4404,3858,5359,5875,3975,4288,4610,3486,4512, 5325,3893,5360,6282,6283,5560,2522,4231,5978,5186,5449,2569,3878,6284,5401,3578, 4415,6285,4656,5124,5979,2506,4247,4449,3219,3417,4334,4969,4329,6492,4576,4828, 4172,4416,4829,5402,6286,3927,3852,5361,4369,4830,4477,4867,5876,4173,6493,6105, 4657,6287,6106,5877,5450,6494,4155,4868,5451,3700,5629,4384,6288,6289,5878,3189, 4881,6107,6290,6495,4513,6496,4692,4515,4723,5100,3356,6497,6291,3810,4080,5561, 3570,4430,5980,6498,4355,5697,6499,4724,6108,6109,3764,4050,5038,5879,4093,3226, 6292,5068,5217,4693,3342,5630,3504,4831,4377,4466,4309,5698,4431,5777,6293,5778, 4272,3706,6110,5326,3752,4676,5327,4273,5403,4767,5631,6500,5699,5880,3475,5039, 6294,5562,5125,4348,4301,4482,4068,5126,4593,5700,3380,3462,5981,5563,3824,5404, 4970,5511,3825,4738,6295,6501,5452,4516,6111,5881,5564,6502,6296,5982,6503,4213, 4163,3454,6504,6112,4009,4450,6113,4658,6297,6114,3035,6505,6115,3995,4904,4739, 4563,4942,4110,5040,3661,3928,5362,3674,6506,5292,3612,4791,5565,4149,5983,5328, 5259,5021,4725,4577,4564,4517,4364,6298,5405,4578,5260,4594,4156,4157,5453,3592, 3491,6507,5127,5512,4709,4922,5984,5701,4726,4289,6508,4015,6116,5128,4628,3424, 4241,5779,6299,4905,6509,6510,5454,5702,5780,6300,4365,4923,3971,6511,5161,3270, 3158,5985,4100, 867,5129,5703,6117,5363,3695,3301,5513,4467,6118,6512,5455,4232, 4242,4629,6513,3959,4478,6514,5514,5329,5986,4850,5162,5566,3846,4694,6119,5456, 4869,5781,3779,6301,5704,5987,5515,4710,6302,5882,6120,4392,5364,5705,6515,6121, 6516,6517,3736,5988,5457,5989,4695,2457,5883,4551,5782,6303,6304,6305,5130,4971, 6122,5163,6123,4870,3263,5365,3150,4871,6518,6306,5783,5069,5706,3513,3498,4409, 5330,5632,5366,5458,5459,3991,5990,4502,3324,5991,5784,3696,4518,5633,4119,6519, 4630,5634,4417,5707,4832,5992,3418,6124,5993,5567,4768,5218,6520,4595,3458,5367, 6125,5635,6126,4202,6521,4740,4924,6307,3981,4069,4385,6308,3883,2675,4051,3834, 4302,4483,5568,5994,4972,4101,5368,6309,5164,5884,3922,6127,6522,6523,5261,5460, 5187,4164,5219,3538,5516,4111,3524,5995,6310,6311,5369,3181,3386,2484,5188,3464, 5569,3627,5708,6524,5406,5165,4677,4492,6312,4872,4851,5885,4468,5996,6313,5709, 5710,6128,2470,5886,6314,5293,4882,5785,3325,5461,5101,6129,5711,5786,6525,4906, 6526,6527,4418,5887,5712,4808,2907,3701,5713,5888,6528,3765,5636,5331,6529,6530, 3593,5889,3637,4943,3692,5714,5787,4925,6315,6130,5462,4405,6131,6132,6316,5262, 6531,6532,5715,3859,5716,5070,4696,5102,3929,5788,3987,4792,5997,6533,6534,3920, 4809,5000,5998,6535,2974,5370,6317,5189,5263,5717,3826,6536,3953,5001,4883,3190, 5463,5890,4973,5999,4741,6133,6134,3607,5570,6000,4711,3362,3630,4552,5041,6318, 6001,2950,2953,5637,4646,5371,4944,6002,2044,4120,3429,6319,6537,5103,4833,6538, 6539,4884,4647,3884,6003,6004,4758,3835,5220,5789,4565,5407,6540,6135,5294,4697, 4852,6320,6321,3206,4907,6541,6322,4945,6542,6136,6543,6323,6005,4631,3519,6544, 5891,6545,5464,3784,5221,6546,5571,4659,6547,6324,6137,5190,6548,3853,6549,4016, 4834,3954,6138,5332,3827,4017,3210,3546,4469,5408,5718,3505,4648,5790,5131,5638, 5791,5465,4727,4318,6325,6326,5792,4553,4010,4698,3439,4974,3638,4335,3085,6006, 5104,5042,5166,5892,5572,6327,4356,4519,5222,5573,5333,5793,5043,6550,5639,5071, 4503,6328,6139,6551,6140,3914,3901,5372,6007,5640,4728,4793,3976,3836,4885,6552, 4127,6553,4451,4102,5002,6554,3686,5105,6555,5191,5072,5295,4611,5794,5296,6556, 5893,5264,5894,4975,5466,5265,4699,4976,4370,4056,3492,5044,4886,6557,5795,4432, 4769,4357,5467,3940,4660,4290,6141,4484,4770,4661,3992,6329,4025,4662,5022,4632, 4835,4070,5297,4663,4596,5574,5132,5409,5895,6142,4504,5192,4664,5796,5896,3885, 5575,5797,5023,4810,5798,3732,5223,4712,5298,4084,5334,5468,6143,4052,4053,4336, 4977,4794,6558,5335,4908,5576,5224,4233,5024,4128,5469,5225,4873,6008,5045,4729, 4742,4633,3675,4597,6559,5897,5133,5577,5003,5641,5719,6330,6560,3017,2382,3854, 4406,4811,6331,4393,3964,4946,6561,2420,3722,6562,4926,4378,3247,1736,4442,6332, 5134,6333,5226,3996,2918,5470,4319,4003,4598,4743,4744,4485,3785,3902,5167,5004, 5373,4394,5898,6144,4874,1793,3997,6334,4085,4214,5106,5642,4909,5799,6009,4419, 4189,3330,5899,4165,4420,5299,5720,5227,3347,6145,4081,6335,2876,3930,6146,3293, 3786,3910,3998,5900,5300,5578,2840,6563,5901,5579,6147,3531,5374,6564,6565,5580, 4759,5375,6566,6148,3559,5643,6336,6010,5517,6337,6338,5721,5902,3873,6011,6339, 6567,5518,3868,3649,5722,6568,4771,4947,6569,6149,4812,6570,2853,5471,6340,6341, 5644,4795,6342,6012,5723,6343,5724,6013,4349,6344,3160,6150,5193,4599,4514,4493, 5168,4320,6345,4927,3666,4745,5169,5903,5005,4928,6346,5725,6014,4730,4203,5046, 4948,3395,5170,6015,4150,6016,5726,5519,6347,5047,3550,6151,6348,4197,4310,5904, 6571,5581,2965,6152,4978,3960,4291,5135,6572,5301,5727,4129,4026,5905,4853,5728, 5472,6153,6349,4533,2700,4505,5336,4678,3583,5073,2994,4486,3043,4554,5520,6350, 6017,5800,4487,6351,3931,4103,5376,6352,4011,4321,4311,4190,5136,6018,3988,3233, 4350,5906,5645,4198,6573,5107,3432,4191,3435,5582,6574,4139,5410,6353,5411,3944, 5583,5074,3198,6575,6354,4358,6576,5302,4600,5584,5194,5412,6577,6578,5585,5413, 5303,4248,5414,3879,4433,6579,4479,5025,4854,5415,6355,4760,4772,3683,2978,4700, 3797,4452,3965,3932,3721,4910,5801,6580,5195,3551,5907,3221,3471,3029,6019,3999, 5908,5909,5266,5267,3444,3023,3828,3170,4796,5646,4979,4259,6356,5647,5337,3694, 6357,5648,5338,4520,4322,5802,3031,3759,4071,6020,5586,4836,4386,5048,6581,3571, 4679,4174,4949,6154,4813,3787,3402,3822,3958,3215,3552,5268,4387,3933,4950,4359, 6021,5910,5075,3579,6358,4234,4566,5521,6359,3613,5049,6022,5911,3375,3702,3178, 4911,5339,4521,6582,6583,4395,3087,3811,5377,6023,6360,6155,4027,5171,5649,4421, 4249,2804,6584,2270,6585,4000,4235,3045,6156,5137,5729,4140,4312,3886,6361,4330, 6157,4215,6158,3500,3676,4929,4331,3713,4930,5912,4265,3776,3368,5587,4470,4855, 3038,4980,3631,6159,6160,4132,4680,6161,6362,3923,4379,5588,4255,6586,4121,6587, 6363,4649,6364,3288,4773,4774,6162,6024,6365,3543,6588,4274,3107,3737,5050,5803, 4797,4522,5589,5051,5730,3714,4887,5378,4001,4523,6163,5026,5522,4701,4175,2791, 3760,6589,5473,4224,4133,3847,4814,4815,4775,3259,5416,6590,2738,6164,6025,5304, 3733,5076,5650,4816,5590,6591,6165,6592,3934,5269,6593,3396,5340,6594,5804,3445, 3602,4042,4488,5731,5732,3525,5591,4601,5196,6166,6026,5172,3642,4612,3202,4506, 4798,6366,3818,5108,4303,5138,5139,4776,3332,4304,2915,3415,4434,5077,5109,4856, 2879,5305,4817,6595,5913,3104,3144,3903,4634,5341,3133,5110,5651,5805,6167,4057, 5592,2945,4371,5593,6596,3474,4182,6367,6597,6168,4507,4279,6598,2822,6599,4777, 4713,5594,3829,6169,3887,5417,6170,3653,5474,6368,4216,2971,5228,3790,4579,6369, 5733,6600,6601,4951,4746,4555,6602,5418,5475,6027,3400,4665,5806,6171,4799,6028, 5052,6172,3343,4800,4747,5006,6370,4556,4217,5476,4396,5229,5379,5477,3839,5914, 5652,5807,4714,3068,4635,5808,6173,5342,4192,5078,5419,5523,5734,6174,4557,6175, 4602,6371,6176,6603,5809,6372,5735,4260,3869,5111,5230,6029,5112,6177,3126,4681, 5524,5915,2706,3563,4748,3130,6178,4018,5525,6604,6605,5478,4012,4837,6606,4534, 4193,5810,4857,3615,5479,6030,4082,3697,3539,4086,5270,3662,4508,4931,5916,4912, 5811,5027,3888,6607,4397,3527,3302,3798,2775,2921,2637,3966,4122,4388,4028,4054, 1633,4858,5079,3024,5007,3982,3412,5736,6608,3426,3236,5595,3030,6179,3427,3336, 3279,3110,6373,3874,3039,5080,5917,5140,4489,3119,6374,5812,3405,4494,6031,4666, 4141,6180,4166,6032,5813,4981,6609,5081,4422,4982,4112,3915,5653,3296,3983,6375, 4266,4410,5654,6610,6181,3436,5082,6611,5380,6033,3819,5596,4535,5231,5306,5113, 6612,4952,5918,4275,3113,6613,6376,6182,6183,5814,3073,4731,4838,5008,3831,6614, 4888,3090,3848,4280,5526,5232,3014,5655,5009,5737,5420,5527,6615,5815,5343,5173, 5381,4818,6616,3151,4953,6617,5738,2796,3204,4360,2989,4281,5739,5174,5421,5197, 3132,5141,3849,5142,5528,5083,3799,3904,4839,5480,2880,4495,3448,6377,6184,5271, 5919,3771,3193,6034,6035,5920,5010,6036,5597,6037,6378,6038,3106,5422,6618,5423, 5424,4142,6619,4889,5084,4890,4313,5740,6620,3437,5175,5307,5816,4199,5198,5529, 5817,5199,5656,4913,5028,5344,3850,6185,2955,5272,5011,5818,4567,4580,5029,5921, 3616,5233,6621,6622,6186,4176,6039,6379,6380,3352,5200,5273,2908,5598,5234,3837, 5308,6623,6624,5819,4496,4323,5309,5201,6625,6626,4983,3194,3838,4167,5530,5922, 5274,6381,6382,3860,3861,5599,3333,4292,4509,6383,3553,5481,5820,5531,4778,6187, 3955,3956,4324,4389,4218,3945,4325,3397,2681,5923,4779,5085,4019,5482,4891,5382, 5383,6040,4682,3425,5275,4094,6627,5310,3015,5483,5657,4398,5924,3168,4819,6628, 5925,6629,5532,4932,4613,6041,6630,4636,6384,4780,4204,5658,4423,5821,3989,4683, 5822,6385,4954,6631,5345,6188,5425,5012,5384,3894,6386,4490,4104,6632,5741,5053, 6633,5823,5926,5659,5660,5927,6634,5235,5742,5824,4840,4933,4820,6387,4859,5928, 4955,6388,4143,3584,5825,5346,5013,6635,5661,6389,5014,5484,5743,4337,5176,5662, 6390,2836,6391,3268,6392,6636,6042,5236,6637,4158,6638,5744,5663,4471,5347,3663, 4123,5143,4293,3895,6639,6640,5311,5929,5826,3800,6189,6393,6190,5664,5348,3554, 3594,4749,4603,6641,5385,4801,6043,5827,4183,6642,5312,5426,4761,6394,5665,6191, 4715,2669,6643,6644,5533,3185,5427,5086,5930,5931,5386,6192,6044,6645,4781,4013, 5745,4282,4435,5534,4390,4267,6045,5746,4984,6046,2743,6193,3501,4087,5485,5932, 5428,4184,4095,5747,4061,5054,3058,3862,5933,5600,6646,5144,3618,6395,3131,5055, 5313,6396,4650,4956,3855,6194,3896,5202,4985,4029,4225,6195,6647,5828,5486,5829, 3589,3002,6648,6397,4782,5276,6649,6196,6650,4105,3803,4043,5237,5830,6398,4096, 3643,6399,3528,6651,4453,3315,4637,6652,3984,6197,5535,3182,3339,6653,3096,2660, 6400,6654,3449,5934,4250,4236,6047,6401,5831,6655,5487,3753,4062,5832,6198,6199, 6656,3766,6657,3403,4667,6048,6658,4338,2897,5833,3880,2797,3780,4326,6659,5748, 5015,6660,5387,4351,5601,4411,6661,3654,4424,5935,4339,4072,5277,4568,5536,6402, 6662,5238,6663,5349,5203,6200,5204,6201,5145,4536,5016,5056,4762,5834,4399,4957, 6202,6403,5666,5749,6664,4340,6665,5936,5177,5667,6666,6667,3459,4668,6404,6668, 6669,4543,6203,6670,4276,6405,4480,5537,6671,4614,5205,5668,6672,3348,2193,4763, 6406,6204,5937,5602,4177,5669,3419,6673,4020,6205,4443,4569,5388,3715,3639,6407, 6049,4058,6206,6674,5938,4544,6050,4185,4294,4841,4651,4615,5488,6207,6408,6051, 5178,3241,3509,5835,6208,4958,5836,4341,5489,5278,6209,2823,5538,5350,5206,5429, 6675,4638,4875,4073,3516,4684,4914,4860,5939,5603,5389,6052,5057,3237,5490,3791, 6676,6409,6677,4821,4915,4106,5351,5058,4243,5539,4244,5604,4842,4916,5239,3028, 3716,5837,5114,5605,5390,5940,5430,6210,4332,6678,5540,4732,3667,3840,6053,4305, 3408,5670,5541,6410,2744,5240,5750,6679,3234,5606,6680,5607,5671,3608,4283,4159, 4400,5352,4783,6681,6411,6682,4491,4802,6211,6412,5941,6413,6414,5542,5751,6683, 4669,3734,5942,6684,6415,5943,5059,3328,4670,4144,4268,6685,6686,6687,6688,4372, 3603,6689,5944,5491,4373,3440,6416,5543,4784,4822,5608,3792,4616,5838,5672,3514, 5391,6417,4892,6690,4639,6691,6054,5673,5839,6055,6692,6056,5392,6212,4038,5544, 5674,4497,6057,6693,5840,4284,5675,4021,4545,5609,6418,4454,6419,6213,4113,4472, 5314,3738,5087,5279,4074,5610,4959,4063,3179,4750,6058,6420,6214,3476,4498,4716, 5431,4960,4685,6215,5241,6694,6421,6216,6695,5841,5945,6422,3748,5946,5179,3905, 5752,5545,5947,4374,6217,4455,6423,4412,6218,4803,5353,6696,3832,5280,6219,4327, 4702,6220,6221,6059,4652,5432,6424,3749,4751,6425,5753,4986,5393,4917,5948,5030, 5754,4861,4733,6426,4703,6697,6222,4671,5949,4546,4961,5180,6223,5031,3316,5281, 6698,4862,4295,4934,5207,3644,6427,5842,5950,6428,6429,4570,5843,5282,6430,6224, 5088,3239,6060,6699,5844,5755,6061,6431,2701,5546,6432,5115,5676,4039,3993,3327, 4752,4425,5315,6433,3941,6434,5677,4617,4604,3074,4581,6225,5433,6435,6226,6062, 4823,5756,5116,6227,3717,5678,4717,5845,6436,5679,5846,6063,5847,6064,3977,3354, 6437,3863,5117,6228,5547,5394,4499,4524,6229,4605,6230,4306,4500,6700,5951,6065, 3693,5952,5089,4366,4918,6701,6231,5548,6232,6702,6438,4704,5434,6703,6704,5953, 4168,6705,5680,3420,6706,5242,4407,6066,3812,5757,5090,5954,4672,4525,3481,5681, 4618,5395,5354,5316,5955,6439,4962,6707,4526,6440,3465,4673,6067,6441,5682,6708, 5435,5492,5758,5683,4619,4571,4674,4804,4893,4686,5493,4753,6233,6068,4269,6442, 6234,5032,4705,5146,5243,5208,5848,6235,6443,4963,5033,4640,4226,6236,5849,3387, 6444,6445,4436,4437,5850,4843,5494,4785,4894,6709,4361,6710,5091,5956,3331,6237, 4987,5549,6069,6711,4342,3517,4473,5317,6070,6712,6071,4706,6446,5017,5355,6713, 6714,4988,5436,6447,4734,5759,6715,4735,4547,4456,4754,6448,5851,6449,6450,3547, 5852,5318,6451,6452,5092,4205,6716,6238,4620,4219,5611,6239,6072,4481,5760,5957, 5958,4059,6240,6453,4227,4537,6241,5761,4030,4186,5244,5209,3761,4457,4876,3337, 5495,5181,6242,5959,5319,5612,5684,5853,3493,5854,6073,4169,5613,5147,4895,6074, 5210,6717,5182,6718,3830,6243,2798,3841,6075,6244,5855,5614,3604,4606,5496,5685, 5118,5356,6719,6454,5960,5357,5961,6720,4145,3935,4621,5119,5962,4261,6721,6455, 4786,5963,4375,4582,6245,6246,6247,6076,5437,4877,5856,3376,4380,6248,4160,6722, 5148,6456,5211,6457,6723,4718,6458,6724,6249,5358,4044,3297,6459,6250,5857,5615, 5497,5245,6460,5498,6725,6251,6252,5550,3793,5499,2959,5396,6461,6462,4572,5093, 5500,5964,3806,4146,6463,4426,5762,5858,6077,6253,4755,3967,4220,5965,6254,4989, 5501,6464,4352,6726,6078,4764,2290,5246,3906,5438,5283,3767,4964,2861,5763,5094, 6255,6256,4622,5616,5859,5860,4707,6727,4285,4708,4824,5617,6257,5551,4787,5212, 4965,4935,4687,6465,6728,6466,5686,6079,3494,4413,2995,5247,5966,5618,6729,5967, 5764,5765,5687,5502,6730,6731,6080,5397,6467,4990,6258,6732,4538,5060,5619,6733, 4719,5688,5439,5018,5149,5284,5503,6734,6081,4607,6259,5120,3645,5861,4583,6260, 4584,4675,5620,4098,5440,6261,4863,2379,3306,4585,5552,5689,4586,5285,6735,4864, 6736,5286,6082,6737,4623,3010,4788,4381,4558,5621,4587,4896,3698,3161,5248,4353, 4045,6262,3754,5183,4588,6738,6263,6739,6740,5622,3936,6741,6468,6742,6264,5095, 6469,4991,5968,6743,4992,6744,6083,4897,6745,4256,5766,4307,3108,3968,4444,5287, 3889,4343,6084,4510,6085,4559,6086,4898,5969,6746,5623,5061,4919,5249,5250,5504, 5441,6265,5320,4878,3242,5862,5251,3428,6087,6747,4237,5624,5442,6266,5553,4539, 6748,2585,3533,5398,4262,6088,5150,4736,4438,6089,6267,5505,4966,6749,6268,6750, 6269,5288,5554,3650,6090,6091,4624,6092,5690,6751,5863,4270,5691,4277,5555,5864, 6752,5692,4720,4865,6470,5151,4688,4825,6753,3094,6754,6471,3235,4653,6755,5213, 5399,6756,3201,4589,5865,4967,6472,5866,6473,5019,3016,6757,5321,4756,3957,4573, 6093,4993,5767,4721,6474,6758,5625,6759,4458,6475,6270,6760,5556,4994,5214,5252, 6271,3875,5768,6094,5034,5506,4376,5769,6761,2120,6476,5253,5770,6762,5771,5970, 3990,5971,5557,5558,5772,6477,6095,2787,4641,5972,5121,6096,6097,6272,6763,3703, 5867,5507,6273,4206,6274,4789,6098,6764,3619,3646,3833,3804,2394,3788,4936,3978, 4866,4899,6099,6100,5559,6478,6765,3599,5868,6101,5869,5870,6275,6766,4527,6767, *******************************************************************************/ }; ================================================ FILE: third_party/uchardet/uchardet/src/tables/JISFreq.tab ================================================ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //Sampling from about 20M text materials include literature and computer technology // Japanese frequency table, applied to both S-JIS and EUC-JP //They are sorted in order. /****************************************************************************** * 128 --> 0.77094 * 256 --> 0.85710 * 512 --> 0.92635 * 1024 --> 0.97130 * 2048 --> 0.99431 * * Idea Distribution Ratio = 0.92635 / (1-0.92635) = 12.58 * Random Distribution Ration = 512 / (2965+62+83+86-512) = 0.191 * * Typical Distribution Ratio, 25% of IDR *****************************************************************************/ #define JIS_TYPICAL_DISTRIBUTION_RATIO (float)0.93 //Char to FreqOrder table , #define JIS_TABLE_SIZE 4368 constexpr PRInt16 JISCharToFreqOrder[] = { 40, 1, 6, 182, 152, 180, 295,2127, 285, 381,3295,4304,3068,4606,3165,3510, // 16 3511,1822,2785,4607,1193,2226,5070,4608, 171,2996,1247, 18, 179,5071, 856,1661, // 32 1262,5072, 619, 127,3431,3512,3230,1899,1700, 232, 228,1294,1298, 284, 283,2041, // 48 2042,1061,1062, 48, 49, 44, 45, 433, 434,1040,1041, 996, 787,2997,1255,4305, // 64 2108,4609,1684,1648,5073,5074,5075,5076,5077,5078,3687,5079,4610,5080,3927,3928, // 80 5081,3296,3432, 290,2285,1471,2187,5082,2580,2825,1303,2140,1739,1445,2691,3375, // 96 1691,3297,4306,4307,4611, 452,3376,1182,2713,3688,3069,4308,5083,5084,5085,5086, // 112 5087,5088,5089,5090,5091,5092,5093,5094,5095,5096,5097,5098,5099,5100,5101,5102, // 128 5103,5104,5105,5106,5107,5108,5109,5110,5111,5112,4097,5113,5114,5115,5116,5117, // 144 5118,5119,5120,5121,5122,5123,5124,5125,5126,5127,5128,5129,5130,5131,5132,5133, // 160 5134,5135,5136,5137,5138,5139,5140,5141,5142,5143,5144,5145,5146,5147,5148,5149, // 176 5150,5151,5152,4612,5153,5154,5155,5156,5157,5158,5159,5160,5161,5162,5163,5164, // 192 5165,5166,5167,5168,5169,5170,5171,5172,5173,5174,5175,1472, 598, 618, 820,1205, // 208 1309,1412,1858,1307,1692,5176,5177,5178,5179,5180,5181,5182,1142,1452,1234,1172, // 224 1875,2043,2149,1793,1382,2973, 925,2404,1067,1241, 960,1377,2935,1491, 919,1217, // 240 1865,2030,1406,1499,2749,4098,5183,5184,5185,5186,5187,5188,2561,4099,3117,1804, // 256 2049,3689,4309,3513,1663,5189,3166,3118,3298,1587,1561,3433,5190,3119,1625,2998, // 272 3299,4613,1766,3690,2786,4614,5191,5192,5193,5194,2161, 26,3377, 2,3929, 20, // 288 3691, 47,4100, 50, 17, 16, 35, 268, 27, 243, 42, 155, 24, 154, 29, 184, // 304 4, 91, 14, 92, 53, 396, 33, 289, 9, 37, 64, 620, 21, 39, 321, 5, // 320 12, 11, 52, 13, 3, 208, 138, 0, 7, 60, 526, 141, 151,1069, 181, 275, // 336 1591, 83, 132,1475, 126, 331, 829, 15, 69, 160, 59, 22, 157, 55,1079, 312, // 352 109, 38, 23, 25, 10, 19, 79,5195, 61, 382,1124, 8, 30,5196,5197,5198, // 368 5199,5200,5201,5202,5203,5204,5205,5206, 89, 62, 74, 34,2416, 112, 139, 196, // 384 271, 149, 84, 607, 131, 765, 46, 88, 153, 683, 76, 874, 101, 258, 57, 80, // 400 32, 364, 121,1508, 169,1547, 68, 235, 145,2999, 41, 360,3027, 70, 63, 31, // 416 43, 259, 262,1383, 99, 533, 194, 66, 93, 846, 217, 192, 56, 106, 58, 565, // 432 280, 272, 311, 256, 146, 82, 308, 71, 100, 128, 214, 655, 110, 261, 104,1140, // 448 54, 51, 36, 87, 67,3070, 185,2618,2936,2020, 28,1066,2390,2059,5207,5208, // 464 5209,5210,5211,5212,5213,5214,5215,5216,4615,5217,5218,5219,5220,5221,5222,5223, // 480 5224,5225,5226,5227,5228,5229,5230,5231,5232,5233,5234,5235,5236,3514,5237,5238, // 496 5239,5240,5241,5242,5243,5244,2297,2031,4616,4310,3692,5245,3071,5246,3598,5247, // 512 4617,3231,3515,5248,4101,4311,4618,3808,4312,4102,5249,4103,4104,3599,5250,5251, // 528 5252,5253,5254,5255,5256,5257,5258,5259,5260,5261,5262,5263,5264,5265,5266,5267, // 544 5268,5269,5270,5271,5272,5273,5274,5275,5276,5277,5278,5279,5280,5281,5282,5283, // 560 5284,5285,5286,5287,5288,5289,5290,5291,5292,5293,5294,5295,5296,5297,5298,5299, // 576 5300,5301,5302,5303,5304,5305,5306,5307,5308,5309,5310,5311,5312,5313,5314,5315, // 592 5316,5317,5318,5319,5320,5321,5322,5323,5324,5325,5326,5327,5328,5329,5330,5331, // 608 5332,5333,5334,5335,5336,5337,5338,5339,5340,5341,5342,5343,5344,5345,5346,5347, // 624 5348,5349,5350,5351,5352,5353,5354,5355,5356,5357,5358,5359,5360,5361,5362,5363, // 640 5364,5365,5366,5367,5368,5369,5370,5371,5372,5373,5374,5375,5376,5377,5378,5379, // 656 5380,5381, 363, 642,2787,2878,2788,2789,2316,3232,2317,3434,2011, 165,1942,3930, // 672 3931,3932,3933,5382,4619,5383,4620,5384,5385,5386,5387,5388,5389,5390,5391,5392, // 688 5393,5394,5395,5396,5397,5398,5399,5400,5401,5402,5403,5404,5405,5406,5407,5408, // 704 5409,5410,5411,5412,5413,5414,5415,5416,5417,5418,5419,5420,5421,5422,5423,5424, // 720 5425,5426,5427,5428,5429,5430,5431,5432,5433,5434,5435,5436,5437,5438,5439,5440, // 736 5441,5442,5443,5444,5445,5446,5447,5448,5449,5450,5451,5452,5453,5454,5455,5456, // 752 5457,5458,5459,5460,5461,5462,5463,5464,5465,5466,5467,5468,5469,5470,5471,5472, // 768 5473,5474,5475,5476,5477,5478,5479,5480,5481,5482,5483,5484,5485,5486,5487,5488, // 784 5489,5490,5491,5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,5502,5503,5504, // 800 5505,5506,5507,5508,5509,5510,5511,5512,5513,5514,5515,5516,5517,5518,5519,5520, // 816 5521,5522,5523,5524,5525,5526,5527,5528,5529,5530,5531,5532,5533,5534,5535,5536, // 832 5537,5538,5539,5540,5541,5542,5543,5544,5545,5546,5547,5548,5549,5550,5551,5552, // 848 5553,5554,5555,5556,5557,5558,5559,5560,5561,5562,5563,5564,5565,5566,5567,5568, // 864 5569,5570,5571,5572,5573,5574,5575,5576,5577,5578,5579,5580,5581,5582,5583,5584, // 880 5585,5586,5587,5588,5589,5590,5591,5592,5593,5594,5595,5596,5597,5598,5599,5600, // 896 5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,5613,5614,5615,5616, // 912 5617,5618,5619,5620,5621,5622,5623,5624,5625,5626,5627,5628,5629,5630,5631,5632, // 928 5633,5634,5635,5636,5637,5638,5639,5640,5641,5642,5643,5644,5645,5646,5647,5648, // 944 5649,5650,5651,5652,5653,5654,5655,5656,5657,5658,5659,5660,5661,5662,5663,5664, // 960 5665,5666,5667,5668,5669,5670,5671,5672,5673,5674,5675,5676,5677,5678,5679,5680, // 976 5681,5682,5683,5684,5685,5686,5687,5688,5689,5690,5691,5692,5693,5694,5695,5696, // 992 5697,5698,5699,5700,5701,5702,5703,5704,5705,5706,5707,5708,5709,5710,5711,5712, // 1008 5713,5714,5715,5716,5717,5718,5719,5720,5721,5722,5723,5724,5725,5726,5727,5728, // 1024 5729,5730,5731,5732,5733,5734,5735,5736,5737,5738,5739,5740,5741,5742,5743,5744, // 1040 5745,5746,5747,5748,5749,5750,5751,5752,5753,5754,5755,5756,5757,5758,5759,5760, // 1056 5761,5762,5763,5764,5765,5766,5767,5768,5769,5770,5771,5772,5773,5774,5775,5776, // 1072 5777,5778,5779,5780,5781,5782,5783,5784,5785,5786,5787,5788,5789,5790,5791,5792, // 1088 5793,5794,5795,5796,5797,5798,5799,5800,5801,5802,5803,5804,5805,5806,5807,5808, // 1104 5809,5810,5811,5812,5813,5814,5815,5816,5817,5818,5819,5820,5821,5822,5823,5824, // 1120 5825,5826,5827,5828,5829,5830,5831,5832,5833,5834,5835,5836,5837,5838,5839,5840, // 1136 5841,5842,5843,5844,5845,5846,5847,5848,5849,5850,5851,5852,5853,5854,5855,5856, // 1152 5857,5858,5859,5860,5861,5862,5863,5864,5865,5866,5867,5868,5869,5870,5871,5872, // 1168 5873,5874,5875,5876,5877,5878,5879,5880,5881,5882,5883,5884,5885,5886,5887,5888, // 1184 5889,5890,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5901,5902,5903,5904, // 1200 5905,5906,5907,5908,5909,5910,5911,5912,5913,5914,5915,5916,5917,5918,5919,5920, // 1216 5921,5922,5923,5924,5925,5926,5927,5928,5929,5930,5931,5932,5933,5934,5935,5936, // 1232 5937,5938,5939,5940,5941,5942,5943,5944,5945,5946,5947,5948,5949,5950,5951,5952, // 1248 5953,5954,5955,5956,5957,5958,5959,5960,5961,5962,5963,5964,5965,5966,5967,5968, // 1264 5969,5970,5971,5972,5973,5974,5975,5976,5977,5978,5979,5980,5981,5982,5983,5984, // 1280 5985,5986,5987,5988,5989,5990,5991,5992,5993,5994,5995,5996,5997,5998,5999,6000, // 1296 6001,6002,6003,6004,6005,6006,6007,6008,6009,6010,6011,6012,6013,6014,6015,6016, // 1312 6017,6018,6019,6020,6021,6022,6023,6024,6025,6026,6027,6028,6029,6030,6031,6032, // 1328 6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045,6046,6047,6048, // 1344 6049,6050,6051,6052,6053,6054,6055,6056,6057,6058,6059,6060,6061,6062,6063,6064, // 1360 6065,6066,6067,6068,6069,6070,6071,6072,6073,6074,6075,6076,6077,6078,6079,6080, // 1376 6081,6082,6083,6084,6085,6086,6087,6088,6089,6090,6091,6092,6093,6094,6095,6096, // 1392 6097,6098,6099,6100,6101,6102,6103,6104,6105,6106,6107,6108,6109,6110,6111,6112, // 1408 6113,6114,2044,2060,4621, 997,1235, 473,1186,4622, 920,3378,6115,6116, 379,1108, // 1424 4313,2657,2735,3934,6117,3809, 636,3233, 573,1026,3693,3435,2974,3300,2298,4105, // 1440 854,2937,2463, 393,2581,2417, 539, 752,1280,2750,2480, 140,1161, 440, 708,1569, // 1456 665,2497,1746,1291,1523,3000, 164,1603, 847,1331, 537,1997, 486, 508,1693,2418, // 1472 1970,2227, 878,1220, 299,1030, 969, 652,2751, 624,1137,3301,2619, 65,3302,2045, // 1488 1761,1859,3120,1930,3694,3516, 663,1767, 852, 835,3695, 269, 767,2826,2339,1305, // 1504 896,1150, 770,1616,6118, 506,1502,2075,1012,2519, 775,2520,2975,2340,2938,4314, // 1520 3028,2086,1224,1943,2286,6119,3072,4315,2240,1273,1987,3935,1557, 175, 597, 985, // 1536 3517,2419,2521,1416,3029, 585, 938,1931,1007,1052,1932,1685,6120,3379,4316,4623, // 1552 804, 599,3121,1333,2128,2539,1159,1554,2032,3810, 687,2033,2904, 952, 675,1467, // 1568 3436,6121,2241,1096,1786,2440,1543,1924, 980,1813,2228, 781,2692,1879, 728,1918, // 1584 3696,4624, 548,1950,4625,1809,1088,1356,3303,2522,1944, 502, 972, 373, 513,2827, // 1600 586,2377,2391,1003,1976,1631,6122,2464,1084, 648,1776,4626,2141, 324, 962,2012, // 1616 2177,2076,1384, 742,2178,1448,1173,1810, 222, 102, 301, 445, 125,2420, 662,2498, // 1632 277, 200,1476,1165,1068, 224,2562,1378,1446, 450,1880, 659, 791, 582,4627,2939, // 1648 3936,1516,1274, 555,2099,3697,1020,1389,1526,3380,1762,1723,1787,2229, 412,2114, // 1664 1900,2392,3518, 512,2597, 427,1925,2341,3122,1653,1686,2465,2499, 697, 330, 273, // 1680 380,2162, 951, 832, 780, 991,1301,3073, 965,2270,3519, 668,2523,2636,1286, 535, // 1696 1407, 518, 671, 957,2658,2378, 267, 611,2197,3030,6123, 248,2299, 967,1799,2356, // 1712 850,1418,3437,1876,1256,1480,2828,1718,6124,6125,1755,1664,2405,6126,4628,2879, // 1728 2829, 499,2179, 676,4629, 557,2329,2214,2090, 325,3234, 464, 811,3001, 992,2342, // 1744 2481,1232,1469, 303,2242, 466,1070,2163, 603,1777,2091,4630,2752,4631,2714, 322, // 1760 2659,1964,1768, 481,2188,1463,2330,2857,3600,2092,3031,2421,4632,2318,2070,1849, // 1776 2598,4633,1302,2254,1668,1701,2422,3811,2905,3032,3123,2046,4106,1763,1694,4634, // 1792 1604, 943,1724,1454, 917, 868,2215,1169,2940, 552,1145,1800,1228,1823,1955, 316, // 1808 1080,2510, 361,1807,2830,4107,2660,3381,1346,1423,1134,4108,6127, 541,1263,1229, // 1824 1148,2540, 545, 465,1833,2880,3438,1901,3074,2482, 816,3937, 713,1788,2500, 122, // 1840 1575, 195,1451,2501,1111,6128, 859, 374,1225,2243,2483,4317, 390,1033,3439,3075, // 1856 2524,1687, 266, 793,1440,2599, 946, 779, 802, 507, 897,1081, 528,2189,1292, 711, // 1872 1866,1725,1167,1640, 753, 398,2661,1053, 246, 348,4318, 137,1024,3440,1600,2077, // 1888 2129, 825,4319, 698, 238, 521, 187,2300,1157,2423,1641,1605,1464,1610,1097,2541, // 1904 1260,1436, 759,2255,1814,2150, 705,3235, 409,2563,3304, 561,3033,2005,2564, 726, // 1920 1956,2343,3698,4109, 949,3812,3813,3520,1669, 653,1379,2525, 881,2198, 632,2256, // 1936 1027, 778,1074, 733,1957, 514,1481,2466, 554,2180, 702,3938,1606,1017,1398,6129, // 1952 1380,3521, 921, 993,1313, 594, 449,1489,1617,1166, 768,1426,1360, 495,1794,3601, // 1968 1177,3602,1170,4320,2344, 476, 425,3167,4635,3168,1424, 401,2662,1171,3382,1998, // 1984 1089,4110, 477,3169, 474,6130,1909, 596,2831,1842, 494, 693,1051,1028,1207,3076, // 2000 606,2115, 727,2790,1473,1115, 743,3522, 630, 805,1532,4321,2021, 366,1057, 838, // 2016 684,1114,2142,4322,2050,1492,1892,1808,2271,3814,2424,1971,1447,1373,3305,1090, // 2032 1536,3939,3523,3306,1455,2199, 336, 369,2331,1035, 584,2393, 902, 718,2600,6131, // 2048 2753, 463,2151,1149,1611,2467, 715,1308,3124,1268, 343,1413,3236,1517,1347,2663, // 2064 2093,3940,2022,1131,1553,2100,2941,1427,3441,2942,1323,2484,6132,1980, 872,2368, // 2080 2441,2943, 320,2369,2116,1082, 679,1933,3941,2791,3815, 625,1143,2023, 422,2200, // 2096 3816,6133, 730,1695, 356,2257,1626,2301,2858,2637,1627,1778, 937, 883,2906,2693, // 2112 3002,1769,1086, 400,1063,1325,3307,2792,4111,3077, 456,2345,1046, 747,6134,1524, // 2128 884,1094,3383,1474,2164,1059, 974,1688,2181,2258,1047, 345,1665,1187, 358, 875, // 2144 3170, 305, 660,3524,2190,1334,1135,3171,1540,1649,2542,1527, 927, 968,2793, 885, // 2160 1972,1850, 482, 500,2638,1218,1109,1085,2543,1654,2034, 876, 78,2287,1482,1277, // 2176 861,1675,1083,1779, 724,2754, 454, 397,1132,1612,2332, 893, 672,1237, 257,2259, // 2192 2370, 135,3384, 337,2244, 547, 352, 340, 709,2485,1400, 788,1138,2511, 540, 772, // 2208 1682,2260,2272,2544,2013,1843,1902,4636,1999,1562,2288,4637,2201,1403,1533, 407, // 2224 576,3308,1254,2071, 978,3385, 170, 136,1201,3125,2664,3172,2394, 213, 912, 873, // 2240 3603,1713,2202, 699,3604,3699, 813,3442, 493, 531,1054, 468,2907,1483, 304, 281, // 2256 4112,1726,1252,2094, 339,2319,2130,2639, 756,1563,2944, 748, 571,2976,1588,2425, // 2272 2715,1851,1460,2426,1528,1392,1973,3237, 288,3309, 685,3386, 296, 892,2716,2216, // 2288 1570,2245, 722,1747,2217, 905,3238,1103,6135,1893,1441,1965, 251,1805,2371,3700, // 2304 2601,1919,1078, 75,2182,1509,1592,1270,2640,4638,2152,6136,3310,3817, 524, 706, // 2320 1075, 292,3818,1756,2602, 317, 98,3173,3605,3525,1844,2218,3819,2502, 814, 567, // 2336 385,2908,1534,6137, 534,1642,3239, 797,6138,1670,1529, 953,4323, 188,1071, 538, // 2352 178, 729,3240,2109,1226,1374,2000,2357,2977, 731,2468,1116,2014,2051,6139,1261, // 2368 1593, 803,2859,2736,3443, 556, 682, 823,1541,6140,1369,2289,1706,2794, 845, 462, // 2384 2603,2665,1361, 387, 162,2358,1740, 739,1770,1720,1304,1401,3241,1049, 627,1571, // 2400 2427,3526,1877,3942,1852,1500, 431,1910,1503, 677, 297,2795, 286,1433,1038,1198, // 2416 2290,1133,1596,4113,4639,2469,1510,1484,3943,6141,2442, 108, 712,4640,2372, 866, // 2432 3701,2755,3242,1348, 834,1945,1408,3527,2395,3243,1811, 824, 994,1179,2110,1548, // 2448 1453, 790,3003, 690,4324,4325,2832,2909,3820,1860,3821, 225,1748, 310, 346,1780, // 2464 2470, 821,1993,2717,2796, 828, 877,3528,2860,2471,1702,2165,2910,2486,1789, 453, // 2480 359,2291,1676, 73,1164,1461,1127,3311, 421, 604, 314,1037, 589, 116,2487, 737, // 2496 837,1180, 111, 244, 735,6142,2261,1861,1362, 986, 523, 418, 581,2666,3822, 103, // 2512 855, 503,1414,1867,2488,1091, 657,1597, 979, 605,1316,4641,1021,2443,2078,2001, // 2528 1209, 96, 587,2166,1032, 260,1072,2153, 173, 94, 226,3244, 819,2006,4642,4114, // 2544 2203, 231,1744, 782, 97,2667, 786,3387, 887, 391, 442,2219,4326,1425,6143,2694, // 2560 633,1544,1202, 483,2015, 592,2052,1958,2472,1655, 419, 129,4327,3444,3312,1714, // 2576 1257,3078,4328,1518,1098, 865,1310,1019,1885,1512,1734, 469,2444, 148, 773, 436, // 2592 1815,1868,1128,1055,4329,1245,2756,3445,2154,1934,1039,4643, 579,1238, 932,2320, // 2608 353, 205, 801, 115,2428, 944,2321,1881, 399,2565,1211, 678, 766,3944, 335,2101, // 2624 1459,1781,1402,3945,2737,2131,1010, 844, 981,1326,1013, 550,1816,1545,2620,1335, // 2640 1008, 371,2881, 936,1419,1613,3529,1456,1395,2273,1834,2604,1317,2738,2503, 416, // 2656 1643,4330, 806,1126, 229, 591,3946,1314,1981,1576,1837,1666, 347,1790, 977,3313, // 2672 764,2861,1853, 688,2429,1920,1462, 77, 595, 415,2002,3034, 798,1192,4115,6144, // 2688 2978,4331,3035,2695,2582,2072,2566, 430,2430,1727, 842,1396,3947,3702, 613, 377, // 2704 278, 236,1417,3388,3314,3174, 757,1869, 107,3530,6145,1194, 623,2262, 207,1253, // 2720 2167,3446,3948, 492,1117,1935, 536,1838,2757,1246,4332, 696,2095,2406,1393,1572, // 2736 3175,1782, 583, 190, 253,1390,2230, 830,3126,3389, 934,3245,1703,1749,2979,1870, // 2752 2545,1656,2204, 869,2346,4116,3176,1817, 496,1764,4644, 942,1504, 404,1903,1122, // 2768 1580,3606,2945,1022, 515, 372,1735, 955,2431,3036,6146,2797,1110,2302,2798, 617, // 2784 6147, 441, 762,1771,3447,3607,3608,1904, 840,3037, 86, 939,1385, 572,1370,2445, // 2800 1336, 114,3703, 898, 294, 203,3315, 703,1583,2274, 429, 961,4333,1854,1951,3390, // 2816 2373,3704,4334,1318,1381, 966,1911,2322,1006,1155, 309, 989, 458,2718,1795,1372, // 2832 1203, 252,1689,1363,3177, 517,1936, 168,1490, 562, 193,3823,1042,4117,1835, 551, // 2848 470,4645, 395, 489,3448,1871,1465,2583,2641, 417,1493, 279,1295, 511,1236,1119, // 2864 72,1231,1982,1812,3004, 871,1564, 984,3449,1667,2696,2096,4646,2347,2833,1673, // 2880 3609, 695,3246,2668, 807,1183,4647, 890, 388,2333,1801,1457,2911,1765,1477,1031, // 2896 3316,3317,1278,3391,2799,2292,2526, 163,3450,4335,2669,1404,1802,6148,2323,2407, // 2912 1584,1728,1494,1824,1269, 298, 909,3318,1034,1632, 375, 776,1683,2061, 291, 210, // 2928 1123, 809,1249,1002,2642,3038, 206,1011,2132, 144, 975, 882,1565, 342, 667, 754, // 2944 1442,2143,1299,2303,2062, 447, 626,2205,1221,2739,2912,1144,1214,2206,2584, 760, // 2960 1715, 614, 950,1281,2670,2621, 810, 577,1287,2546,4648, 242,2168, 250,2643, 691, // 2976 123,2644, 647, 313,1029, 689,1357,2946,1650, 216, 771,1339,1306, 808,2063, 549, // 2992 913,1371,2913,2914,6149,1466,1092,1174,1196,1311,2605,2396,1783,1796,3079, 406, // 3008 2671,2117,3949,4649, 487,1825,2220,6150,2915, 448,2348,1073,6151,2397,1707, 130, // 3024 900,1598, 329, 176,1959,2527,1620,6152,2275,4336,3319,1983,2191,3705,3610,2155, // 3040 3706,1912,1513,1614,6153,1988, 646, 392,2304,1589,3320,3039,1826,1239,1352,1340, // 3056 2916, 505,2567,1709,1437,2408,2547, 906,6154,2672, 384,1458,1594,1100,1329, 710, // 3072 423,3531,2064,2231,2622,1989,2673,1087,1882, 333, 841,3005,1296,2882,2379, 580, // 3088 1937,1827,1293,2585, 601, 574, 249,1772,4118,2079,1120, 645, 901,1176,1690, 795, // 3104 2207, 478,1434, 516,1190,1530, 761,2080, 930,1264, 355, 435,1552, 644,1791, 987, // 3120 220,1364,1163,1121,1538, 306,2169,1327,1222, 546,2645, 218, 241, 610,1704,3321, // 3136 1984,1839,1966,2528, 451,6155,2586,3707,2568, 907,3178, 254,2947, 186,1845,4650, // 3152 745, 432,1757, 428,1633, 888,2246,2221,2489,3611,2118,1258,1265, 956,3127,1784, // 3168 4337,2490, 319, 510, 119, 457,3612, 274,2035,2007,4651,1409,3128, 970,2758, 590, // 3184 2800, 661,2247,4652,2008,3950,1420,1549,3080,3322,3951,1651,1375,2111, 485,2491, // 3200 1429,1156,6156,2548,2183,1495, 831,1840,2529,2446, 501,1657, 307,1894,3247,1341, // 3216 666, 899,2156,1539,2549,1559, 886, 349,2208,3081,2305,1736,3824,2170,2759,1014, // 3232 1913,1386, 542,1397,2948, 490, 368, 716, 362, 159, 282,2569,1129,1658,1288,1750, // 3248 2674, 276, 649,2016, 751,1496, 658,1818,1284,1862,2209,2087,2512,3451, 622,2834, // 3264 376, 117,1060,2053,1208,1721,1101,1443, 247,1250,3179,1792,3952,2760,2398,3953, // 3280 6157,2144,3708, 446,2432,1151,2570,3452,2447,2761,2835,1210,2448,3082, 424,2222, // 3296 1251,2449,2119,2836, 504,1581,4338, 602, 817, 857,3825,2349,2306, 357,3826,1470, // 3312 1883,2883, 255, 958, 929,2917,3248, 302,4653,1050,1271,1751,2307,1952,1430,2697, // 3328 2719,2359, 354,3180, 777, 158,2036,4339,1659,4340,4654,2308,2949,2248,1146,2232, // 3344 3532,2720,1696,2623,3827,6158,3129,1550,2698,1485,1297,1428, 637, 931,2721,2145, // 3360 914,2550,2587, 81,2450, 612, 827,2646,1242,4655,1118,2884, 472,1855,3181,3533, // 3376 3534, 569,1353,2699,1244,1758,2588,4119,2009,2762,2171,3709,1312,1531,6159,1152, // 3392 1938, 134,1830, 471,3710,2276,1112,1535,3323,3453,3535, 982,1337,2950, 488, 826, // 3408 674,1058,1628,4120,2017, 522,2399, 211, 568,1367,3454, 350, 293,1872,1139,3249, // 3424 1399,1946,3006,1300,2360,3324, 588, 736,6160,2606, 744, 669,3536,3828,6161,1358, // 3440 199, 723, 848, 933, 851,1939,1505,1514,1338,1618,1831,4656,1634,3613, 443,2740, // 3456 3829, 717,1947, 491,1914,6162,2551,1542,4121,1025,6163,1099,1223, 198,3040,2722, // 3472 370, 410,1905,2589, 998,1248,3182,2380, 519,1449,4122,1710, 947, 928,1153,4341, // 3488 2277, 344,2624,1511, 615, 105, 161,1212,1076,1960,3130,2054,1926,1175,1906,2473, // 3504 414,1873,2801,6164,2309, 315,1319,3325, 318,2018,2146,2157, 963, 631, 223,4342, // 3520 4343,2675, 479,3711,1197,2625,3712,2676,2361,6165,4344,4123,6166,2451,3183,1886, // 3536 2184,1674,1330,1711,1635,1506, 799, 219,3250,3083,3954,1677,3713,3326,2081,3614, // 3552 1652,2073,4657,1147,3041,1752, 643,1961, 147,1974,3955,6167,1716,2037, 918,3007, // 3568 1994, 120,1537, 118, 609,3184,4345, 740,3455,1219, 332,1615,3830,6168,1621,2980, // 3584 1582, 783, 212, 553,2350,3714,1349,2433,2082,4124, 889,6169,2310,1275,1410, 973, // 3600 166,1320,3456,1797,1215,3185,2885,1846,2590,2763,4658, 629, 822,3008, 763, 940, // 3616 1990,2862, 439,2409,1566,1240,1622, 926,1282,1907,2764, 654,2210,1607, 327,1130, // 3632 3956,1678,1623,6170,2434,2192, 686, 608,3831,3715, 903,3957,3042,6171,2741,1522, // 3648 1915,1105,1555,2552,1359, 323,3251,4346,3457, 738,1354,2553,2311,2334,1828,2003, // 3664 3832,1753,2351,1227,6172,1887,4125,1478,6173,2410,1874,1712,1847, 520,1204,2607, // 3680 264,4659, 836,2677,2102, 600,4660,3833,2278,3084,6174,4347,3615,1342, 640, 532, // 3696 543,2608,1888,2400,2591,1009,4348,1497, 341,1737,3616,2723,1394, 529,3252,1321, // 3712 983,4661,1515,2120, 971,2592, 924, 287,1662,3186,4349,2700,4350,1519, 908,1948, // 3728 2452, 156, 796,1629,1486,2223,2055, 694,4126,1259,1036,3392,1213,2249,2742,1889, // 3744 1230,3958,1015, 910, 408, 559,3617,4662, 746, 725, 935,4663,3959,3009,1289, 563, // 3760 867,4664,3960,1567,2981,2038,2626, 988,2263,2381,4351, 143,2374, 704,1895,6175, // 3776 1188,3716,2088, 673,3085,2362,4352, 484,1608,1921,2765,2918, 215, 904,3618,3537, // 3792 894, 509, 976,3043,2701,3961,4353,2837,2982, 498,6176,6177,1102,3538,1332,3393, // 3808 1487,1636,1637, 233, 245,3962, 383, 650, 995,3044, 460,1520,1206,2352, 749,3327, // 3824 530, 700, 389,1438,1560,1773,3963,2264, 719,2951,2724,3834, 870,1832,1644,1000, // 3840 839,2474,3717, 197,1630,3394, 365,2886,3964,1285,2133, 734, 922, 818,1106, 732, // 3856 480,2083,1774,3458, 923,2279,1350, 221,3086, 85,2233,2234,3835,1585,3010,2147, // 3872 1387,1705,2382,1619,2475, 133, 239,2802,1991,1016,2084,2383, 411,2838,1113, 651, // 3888 1985,1160,3328, 990,1863,3087,1048,1276,2647, 265,2627,1599,3253,2056, 150, 638, // 3904 2019, 656, 853, 326,1479, 680,1439,4354,1001,1759, 413,3459,3395,2492,1431, 459, // 3920 4355,1125,3329,2265,1953,1450,2065,2863, 849, 351,2678,3131,3254,3255,1104,1577, // 3936 227,1351,1645,2453,2193,1421,2887, 812,2121, 634, 95,2435, 201,2312,4665,1646, // 3952 1671,2743,1601,2554,2702,2648,2280,1315,1366,2089,3132,1573,3718,3965,1729,1189, // 3968 328,2679,1077,1940,1136, 558,1283, 964,1195, 621,2074,1199,1743,3460,3619,1896, // 3984 1916,1890,3836,2952,1154,2112,1064, 862, 378,3011,2066,2113,2803,1568,2839,6178, // 4000 3088,2919,1941,1660,2004,1992,2194, 142, 707,1590,1708,1624,1922,1023,1836,1233, // 4016 1004,2313, 789, 741,3620,6179,1609,2411,1200,4127,3719,3720,4666,2057,3721, 593, // 4032 2840, 367,2920,1878,6180,3461,1521, 628,1168, 692,2211,2649, 300, 720,2067,2571, // 4048 2953,3396, 959,2504,3966,3539,3462,1977, 701,6181, 954,1043, 800, 681, 183,3722, // 4064 1803,1730,3540,4128,2103, 815,2314, 174, 467, 230,2454,1093,2134, 755,3541,3397, // 4080 1141,1162,6182,1738,2039, 270,3256,2513,1005,1647,2185,3837, 858,1679,1897,1719, // 4096 2954,2324,1806, 402, 670, 167,4129,1498,2158,2104, 750,6183, 915, 189,1680,1551, // 4112 455,4356,1501,2455, 405,1095,2955, 338,1586,1266,1819, 570, 641,1324, 237,1556, // 4128 2650,1388,3723,6184,1368,2384,1343,1978,3089,2436, 879,3724, 792,1191, 758,3012, // 4144 1411,2135,1322,4357, 240,4667,1848,3725,1574,6185, 420,3045,1546,1391, 714,4358, // 4160 1967, 941,1864, 863, 664, 426, 560,1731,2680,1785,2864,1949,2363, 403,3330,1415, // 4176 1279,2136,1697,2335, 204, 721,2097,3838, 90,6186,2085,2505, 191,3967, 124,2148, // 4192 1376,1798,1178,1107,1898,1405, 860,4359,1243,1272,2375,2983,1558,2456,1638, 113, // 4208 3621, 578,1923,2609, 880, 386,4130, 784,2186,2266,1422,2956,2172,1722, 497, 263, // 4224 2514,1267,2412,2610, 177,2703,3542, 774,1927,1344, 616,1432,1595,1018, 172,4360, // 4240 2325, 911,4361, 438,1468,3622, 794,3968,2024,2173,1681,1829,2957, 945, 895,3090, // 4256 575,2212,2476, 475,2401,2681, 785,2744,1745,2293,2555,1975,3133,2865, 394,4668, // 4272 3839, 635,4131, 639, 202,1507,2195,2766,1345,1435,2572,3726,1908,1184,1181,2457, // 4288 3727,3134,4362, 843,2611, 437, 916,4669, 234, 769,1884,3046,3047,3623, 833,6187, // 4304 1639,2250,2402,1355,1185,2010,2047, 999, 525,1732,1290,1488,2612, 948,1578,3728, // 4320 2413,2477,1216,2725,2159, 334,3840,1328,3624,2921,1525,4132, 564,1056, 891,4363, // 4336 1444,1698,2385,2251,3729,1365,2281,2235,1717,6188, 864,3841,2515, 444, 527,2767, // 4352 2922,3625, 544, 461,6189, 566, 209,2437,3398,2098,1065,2068,3331,3626,3257,2137, // 4368 //last 512 /*************************************************************************************** *Everything below is of no interest for detection purpose * *************************************************************************************** 2138,2122,3730,2888,1995,1820,1044,6190,6191,6192,6193,6194,6195,6196,6197,6198, // 4384 6199,6200,6201,6202,6203,6204,6205,4670,6206,6207,6208,6209,6210,6211,6212,6213, // 4400 6214,6215,6216,6217,6218,6219,6220,6221,6222,6223,6224,6225,6226,6227,6228,6229, // 4416 6230,6231,6232,6233,6234,6235,6236,6237,3187,6238,6239,3969,6240,6241,6242,6243, // 4432 6244,4671,6245,6246,4672,6247,6248,4133,6249,6250,4364,6251,2923,2556,2613,4673, // 4448 4365,3970,6252,6253,6254,6255,4674,6256,6257,6258,2768,2353,4366,4675,4676,3188, // 4464 4367,3463,6259,4134,4677,4678,6260,2267,6261,3842,3332,4368,3543,6262,6263,6264, // 4480 3013,1954,1928,4135,4679,6265,6266,2478,3091,6267,4680,4369,6268,6269,1699,6270, // 4496 3544,4136,4681,6271,4137,6272,4370,2804,6273,6274,2593,3971,3972,4682,6275,2236, // 4512 4683,6276,6277,4684,6278,6279,4138,3973,4685,6280,6281,3258,6282,6283,6284,6285, // 4528 3974,4686,2841,3975,6286,6287,3545,6288,6289,4139,4687,4140,6290,4141,6291,4142, // 4544 6292,6293,3333,6294,6295,6296,4371,6297,3399,6298,6299,4372,3976,6300,6301,6302, // 4560 4373,6303,6304,3843,3731,6305,4688,4374,6306,6307,3259,2294,6308,3732,2530,4143, // 4576 6309,4689,6310,6311,6312,3048,6313,6314,4690,3733,2237,6315,6316,2282,3334,6317, // 4592 6318,3844,6319,6320,4691,6321,3400,4692,6322,4693,6323,3049,6324,4375,6325,3977, // 4608 6326,6327,6328,3546,6329,4694,3335,6330,4695,4696,6331,6332,6333,6334,4376,3978, // 4624 6335,4697,3979,4144,6336,3980,4698,6337,6338,6339,6340,6341,4699,4700,4701,6342, // 4640 6343,4702,6344,6345,4703,6346,6347,4704,6348,4705,4706,3135,6349,4707,6350,4708, // 4656 6351,4377,6352,4709,3734,4145,6353,2506,4710,3189,6354,3050,4711,3981,6355,3547, // 4672 3014,4146,4378,3735,2651,3845,3260,3136,2224,1986,6356,3401,6357,4712,2594,3627, // 4688 3137,2573,3736,3982,4713,3628,4714,4715,2682,3629,4716,6358,3630,4379,3631,6359, // 4704 6360,6361,3983,6362,6363,6364,6365,4147,3846,4717,6366,6367,3737,2842,6368,4718, // 4720 2628,6369,3261,6370,2386,6371,6372,3738,3984,4719,3464,4720,3402,6373,2924,3336, // 4736 4148,2866,6374,2805,3262,4380,2704,2069,2531,3138,2806,2984,6375,2769,6376,4721, // 4752 4722,3403,6377,6378,3548,6379,6380,2705,3092,1979,4149,2629,3337,2889,6381,3338, // 4768 4150,2557,3339,4381,6382,3190,3263,3739,6383,4151,4723,4152,2558,2574,3404,3191, // 4784 6384,6385,4153,6386,4724,4382,6387,6388,4383,6389,6390,4154,6391,4725,3985,6392, // 4800 3847,4155,6393,6394,6395,6396,6397,3465,6398,4384,6399,6400,6401,6402,6403,6404, // 4816 4156,6405,6406,6407,6408,2123,6409,6410,2326,3192,4726,6411,6412,6413,6414,4385, // 4832 4157,6415,6416,4158,6417,3093,3848,6418,3986,6419,6420,3849,6421,6422,6423,4159, // 4848 6424,6425,4160,6426,3740,6427,6428,6429,6430,3987,6431,4727,6432,2238,6433,6434, // 4864 4386,3988,6435,6436,3632,6437,6438,2843,6439,6440,6441,6442,3633,6443,2958,6444, // 4880 6445,3466,6446,2364,4387,3850,6447,4388,2959,3340,6448,3851,6449,4728,6450,6451, // 4896 3264,4729,6452,3193,6453,4389,4390,2706,3341,4730,6454,3139,6455,3194,6456,3051, // 4912 2124,3852,1602,4391,4161,3853,1158,3854,4162,3989,4392,3990,4731,4732,4393,2040, // 4928 4163,4394,3265,6457,2807,3467,3855,6458,6459,6460,3991,3468,4733,4734,6461,3140, // 4944 2960,6462,4735,6463,6464,6465,6466,4736,4737,4738,4739,6467,6468,4164,2403,3856, // 4960 6469,6470,2770,2844,6471,4740,6472,6473,6474,6475,6476,6477,6478,3195,6479,4741, // 4976 4395,6480,2867,6481,4742,2808,6482,2493,4165,6483,6484,6485,6486,2295,4743,6487, // 4992 6488,6489,3634,6490,6491,6492,6493,6494,6495,6496,2985,4744,6497,6498,4745,6499, // 5008 6500,2925,3141,4166,6501,6502,4746,6503,6504,4747,6505,6506,6507,2890,6508,6509, // 5024 6510,6511,6512,6513,6514,6515,6516,6517,6518,6519,3469,4167,6520,6521,6522,4748, // 5040 4396,3741,4397,4749,4398,3342,2125,4750,6523,4751,4752,4753,3052,6524,2961,4168, // 5056 6525,4754,6526,4755,4399,2926,4169,6527,3857,6528,4400,4170,6529,4171,6530,6531, // 5072 2595,6532,6533,6534,6535,3635,6536,6537,6538,6539,6540,6541,6542,4756,6543,6544, // 5088 6545,6546,6547,6548,4401,6549,6550,6551,6552,4402,3405,4757,4403,6553,6554,6555, // 5104 4172,3742,6556,6557,6558,3992,3636,6559,6560,3053,2726,6561,3549,4173,3054,4404, // 5120 6562,6563,3993,4405,3266,3550,2809,4406,6564,6565,6566,4758,4759,6567,3743,6568, // 5136 4760,3744,4761,3470,6569,6570,6571,4407,6572,3745,4174,6573,4175,2810,4176,3196, // 5152 4762,6574,4177,6575,6576,2494,2891,3551,6577,6578,3471,6579,4408,6580,3015,3197, // 5168 6581,3343,2532,3994,3858,6582,3094,3406,4409,6583,2892,4178,4763,4410,3016,4411, // 5184 6584,3995,3142,3017,2683,6585,4179,6586,6587,4764,4412,6588,6589,4413,6590,2986, // 5200 6591,2962,3552,6592,2963,3472,6593,6594,4180,4765,6595,6596,2225,3267,4414,6597, // 5216 3407,3637,4766,6598,6599,3198,6600,4415,6601,3859,3199,6602,3473,4767,2811,4416, // 5232 1856,3268,3200,2575,3996,3997,3201,4417,6603,3095,2927,6604,3143,6605,2268,6606, // 5248 3998,3860,3096,2771,6607,6608,3638,2495,4768,6609,3861,6610,3269,2745,4769,4181, // 5264 3553,6611,2845,3270,6612,6613,6614,3862,6615,6616,4770,4771,6617,3474,3999,4418, // 5280 4419,6618,3639,3344,6619,4772,4182,6620,2126,6621,6622,6623,4420,4773,6624,3018, // 5296 6625,4774,3554,6626,4183,2025,3746,6627,4184,2707,6628,4421,4422,3097,1775,4185, // 5312 3555,6629,6630,2868,6631,6632,4423,6633,6634,4424,2414,2533,2928,6635,4186,2387, // 5328 6636,4775,6637,4187,6638,1891,4425,3202,3203,6639,6640,4776,6641,3345,6642,6643, // 5344 3640,6644,3475,3346,3641,4000,6645,3144,6646,3098,2812,4188,3642,3204,6647,3863, // 5360 3476,6648,3864,6649,4426,4001,6650,6651,6652,2576,6653,4189,4777,6654,6655,6656, // 5376 2846,6657,3477,3205,4002,6658,4003,6659,3347,2252,6660,6661,6662,4778,6663,6664, // 5392 6665,6666,6667,6668,6669,4779,4780,2048,6670,3478,3099,6671,3556,3747,4004,6672, // 5408 6673,6674,3145,4005,3748,6675,6676,6677,6678,6679,3408,6680,6681,6682,6683,3206, // 5424 3207,6684,6685,4781,4427,6686,4782,4783,4784,6687,6688,6689,4190,6690,6691,3479, // 5440 6692,2746,6693,4428,6694,6695,6696,6697,6698,6699,4785,6700,6701,3208,2727,6702, // 5456 3146,6703,6704,3409,2196,6705,4429,6706,6707,6708,2534,1996,6709,6710,6711,2747, // 5472 6712,6713,6714,4786,3643,6715,4430,4431,6716,3557,6717,4432,4433,6718,6719,6720, // 5488 6721,3749,6722,4006,4787,6723,6724,3644,4788,4434,6725,6726,4789,2772,6727,6728, // 5504 6729,6730,6731,2708,3865,2813,4435,6732,6733,4790,4791,3480,6734,6735,6736,6737, // 5520 4436,3348,6738,3410,4007,6739,6740,4008,6741,6742,4792,3411,4191,6743,6744,6745, // 5536 6746,6747,3866,6748,3750,6749,6750,6751,6752,6753,6754,6755,3867,6756,4009,6757, // 5552 4793,4794,6758,2814,2987,6759,6760,6761,4437,6762,6763,6764,6765,3645,6766,6767, // 5568 3481,4192,6768,3751,6769,6770,2174,6771,3868,3752,6772,6773,6774,4193,4795,4438, // 5584 3558,4796,4439,6775,4797,6776,6777,4798,6778,4799,3559,4800,6779,6780,6781,3482, // 5600 6782,2893,6783,6784,4194,4801,4010,6785,6786,4440,6787,4011,6788,6789,6790,6791, // 5616 6792,6793,4802,6794,6795,6796,4012,6797,6798,6799,6800,3349,4803,3483,6801,4804, // 5632 4195,6802,4013,6803,6804,4196,6805,4014,4015,6806,2847,3271,2848,6807,3484,6808, // 5648 6809,6810,4441,6811,4442,4197,4443,3272,4805,6812,3412,4016,1579,6813,6814,4017, // 5664 6815,3869,6816,2964,6817,4806,6818,6819,4018,3646,6820,6821,4807,4019,4020,6822, // 5680 6823,3560,6824,6825,4021,4444,6826,4198,6827,6828,4445,6829,6830,4199,4808,6831, // 5696 6832,6833,3870,3019,2458,6834,3753,3413,3350,6835,4809,3871,4810,3561,4446,6836, // 5712 6837,4447,4811,4812,6838,2459,4448,6839,4449,6840,6841,4022,3872,6842,4813,4814, // 5728 6843,6844,4815,4200,4201,4202,6845,4023,6846,6847,4450,3562,3873,6848,6849,4816, // 5744 4817,6850,4451,4818,2139,6851,3563,6852,6853,3351,6854,6855,3352,4024,2709,3414, // 5760 4203,4452,6856,4204,6857,6858,3874,3875,6859,6860,4819,6861,6862,6863,6864,4453, // 5776 3647,6865,6866,4820,6867,6868,6869,6870,4454,6871,2869,6872,6873,4821,6874,3754, // 5792 6875,4822,4205,6876,6877,6878,3648,4206,4455,6879,4823,6880,4824,3876,6881,3055, // 5808 4207,6882,3415,6883,6884,6885,4208,4209,6886,4210,3353,6887,3354,3564,3209,3485, // 5824 2652,6888,2728,6889,3210,3755,6890,4025,4456,6891,4825,6892,6893,6894,6895,4211, // 5840 6896,6897,6898,4826,6899,6900,4212,6901,4827,6902,2773,3565,6903,4828,6904,6905, // 5856 6906,6907,3649,3650,6908,2849,3566,6909,3567,3100,6910,6911,6912,6913,6914,6915, // 5872 4026,6916,3355,4829,3056,4457,3756,6917,3651,6918,4213,3652,2870,6919,4458,6920, // 5888 2438,6921,6922,3757,2774,4830,6923,3356,4831,4832,6924,4833,4459,3653,2507,6925, // 5904 4834,2535,6926,6927,3273,4027,3147,6928,3568,6929,6930,6931,4460,6932,3877,4461, // 5920 2729,3654,6933,6934,6935,6936,2175,4835,2630,4214,4028,4462,4836,4215,6937,3148, // 5936 4216,4463,4837,4838,4217,6938,6939,2850,4839,6940,4464,6941,6942,6943,4840,6944, // 5952 4218,3274,4465,6945,6946,2710,6947,4841,4466,6948,6949,2894,6950,6951,4842,6952, // 5968 4219,3057,2871,6953,6954,6955,6956,4467,6957,2711,6958,6959,6960,3275,3101,4843, // 5984 6961,3357,3569,6962,4844,6963,6964,4468,4845,3570,6965,3102,4846,3758,6966,4847, // 6000 3878,4848,4849,4029,6967,2929,3879,4850,4851,6968,6969,1733,6970,4220,6971,6972, // 6016 6973,6974,6975,6976,4852,6977,6978,6979,6980,6981,6982,3759,6983,6984,6985,3486, // 6032 3487,6986,3488,3416,6987,6988,6989,6990,6991,6992,6993,6994,6995,6996,6997,4853, // 6048 6998,6999,4030,7000,7001,3211,7002,7003,4221,7004,7005,3571,4031,7006,3572,7007, // 6064 2614,4854,2577,7008,7009,2965,3655,3656,4855,2775,3489,3880,4222,4856,3881,4032, // 6080 3882,3657,2730,3490,4857,7010,3149,7011,4469,4858,2496,3491,4859,2283,7012,7013, // 6096 7014,2365,4860,4470,7015,7016,3760,7017,7018,4223,1917,7019,7020,7021,4471,7022, // 6112 2776,4472,7023,7024,7025,7026,4033,7027,3573,4224,4861,4034,4862,7028,7029,1929, // 6128 3883,4035,7030,4473,3058,7031,2536,3761,3884,7032,4036,7033,2966,2895,1968,4474, // 6144 3276,4225,3417,3492,4226,2105,7034,7035,1754,2596,3762,4227,4863,4475,3763,4864, // 6160 3764,2615,2777,3103,3765,3658,3418,4865,2296,3766,2815,7036,7037,7038,3574,2872, // 6176 3277,4476,7039,4037,4477,7040,7041,4038,7042,7043,7044,7045,7046,7047,2537,7048, // 6192 7049,7050,7051,7052,7053,7054,4478,7055,7056,3767,3659,4228,3575,7057,7058,4229, // 6208 7059,7060,7061,3660,7062,3212,7063,3885,4039,2460,7064,7065,7066,7067,7068,7069, // 6224 7070,7071,7072,7073,7074,4866,3768,4867,7075,7076,7077,7078,4868,3358,3278,2653, // 6240 7079,7080,4479,3886,7081,7082,4869,7083,7084,7085,7086,7087,7088,2538,7089,7090, // 6256 7091,4040,3150,3769,4870,4041,2896,3359,4230,2930,7092,3279,7093,2967,4480,3213, // 6272 4481,3661,7094,7095,7096,7097,7098,7099,7100,7101,7102,2461,3770,7103,7104,4231, // 6288 3151,7105,7106,7107,4042,3662,7108,7109,4871,3663,4872,4043,3059,7110,7111,7112, // 6304 3493,2988,7113,4873,7114,7115,7116,3771,4874,7117,7118,4232,4875,7119,3576,2336, // 6320 4876,7120,4233,3419,4044,4877,4878,4482,4483,4879,4484,4234,7121,3772,4880,1045, // 6336 3280,3664,4881,4882,7122,7123,7124,7125,4883,7126,2778,7127,4485,4486,7128,4884, // 6352 3214,3887,7129,7130,3215,7131,4885,4045,7132,7133,4046,7134,7135,7136,7137,7138, // 6368 7139,7140,7141,7142,7143,4235,7144,4886,7145,7146,7147,4887,7148,7149,7150,4487, // 6384 4047,4488,7151,7152,4888,4048,2989,3888,7153,3665,7154,4049,7155,7156,7157,7158, // 6400 7159,7160,2931,4889,4890,4489,7161,2631,3889,4236,2779,7162,7163,4891,7164,3060, // 6416 7165,1672,4892,7166,4893,4237,3281,4894,7167,7168,3666,7169,3494,7170,7171,4050, // 6432 7172,7173,3104,3360,3420,4490,4051,2684,4052,7174,4053,7175,7176,7177,2253,4054, // 6448 7178,7179,4895,7180,3152,3890,3153,4491,3216,7181,7182,7183,2968,4238,4492,4055, // 6464 7184,2990,7185,2479,7186,7187,4493,7188,7189,7190,7191,7192,4896,7193,4897,2969, // 6480 4494,4898,7194,3495,7195,7196,4899,4495,7197,3105,2731,7198,4900,7199,7200,7201, // 6496 4056,7202,3361,7203,7204,4496,4901,4902,7205,4497,7206,7207,2315,4903,7208,4904, // 6512 7209,4905,2851,7210,7211,3577,7212,3578,4906,7213,4057,3667,4907,7214,4058,2354, // 6528 3891,2376,3217,3773,7215,7216,7217,7218,7219,4498,7220,4908,3282,2685,7221,3496, // 6544 4909,2632,3154,4910,7222,2337,7223,4911,7224,7225,7226,4912,4913,3283,4239,4499, // 6560 7227,2816,7228,7229,7230,7231,7232,7233,7234,4914,4500,4501,7235,7236,7237,2686, // 6576 7238,4915,7239,2897,4502,7240,4503,7241,2516,7242,4504,3362,3218,7243,7244,7245, // 6592 4916,7246,7247,4505,3363,7248,7249,7250,7251,3774,4506,7252,7253,4917,7254,7255, // 6608 3284,2991,4918,4919,3219,3892,4920,3106,3497,4921,7256,7257,7258,4922,7259,4923, // 6624 3364,4507,4508,4059,7260,4240,3498,7261,7262,4924,7263,2992,3893,4060,3220,7264, // 6640 7265,7266,7267,7268,7269,4509,3775,7270,2817,7271,4061,4925,4510,3776,7272,4241, // 6656 4511,3285,7273,7274,3499,7275,7276,7277,4062,4512,4926,7278,3107,3894,7279,7280, // 6672 4927,7281,4513,7282,7283,3668,7284,7285,4242,4514,4243,7286,2058,4515,4928,4929, // 6688 4516,7287,3286,4244,7288,4517,7289,7290,7291,3669,7292,7293,4930,4931,4932,2355, // 6704 4933,7294,2633,4518,7295,4245,7296,7297,4519,7298,7299,4520,4521,4934,7300,4246, // 6720 4522,7301,7302,7303,3579,7304,4247,4935,7305,4936,7306,7307,7308,7309,3777,7310, // 6736 4523,7311,7312,7313,4248,3580,7314,4524,3778,4249,7315,3581,7316,3287,7317,3221, // 6752 7318,4937,7319,7320,7321,7322,7323,7324,4938,4939,7325,4525,7326,7327,7328,4063, // 6768 7329,7330,4940,7331,7332,4941,7333,4526,7334,3500,2780,1741,4942,2026,1742,7335, // 6784 7336,3582,4527,2388,7337,7338,7339,4528,7340,4250,4943,7341,7342,7343,4944,7344, // 6800 7345,7346,3020,7347,4945,7348,7349,7350,7351,3895,7352,3896,4064,3897,7353,7354, // 6816 7355,4251,7356,7357,3898,7358,3779,7359,3780,3288,7360,7361,4529,7362,4946,4530, // 6832 2027,7363,3899,4531,4947,3222,3583,7364,4948,7365,7366,7367,7368,4949,3501,4950, // 6848 3781,4951,4532,7369,2517,4952,4252,4953,3155,7370,4954,4955,4253,2518,4533,7371, // 6864 7372,2712,4254,7373,7374,7375,3670,4956,3671,7376,2389,3502,4065,7377,2338,7378, // 6880 7379,7380,7381,3061,7382,4957,7383,7384,7385,7386,4958,4534,7387,7388,2993,7389, // 6896 3062,7390,4959,7391,7392,7393,4960,3108,4961,7394,4535,7395,4962,3421,4536,7396, // 6912 4963,7397,4964,1857,7398,4965,7399,7400,2176,3584,4966,7401,7402,3422,4537,3900, // 6928 3585,7403,3782,7404,2852,7405,7406,7407,4538,3783,2654,3423,4967,4539,7408,3784, // 6944 3586,2853,4540,4541,7409,3901,7410,3902,7411,7412,3785,3109,2327,3903,7413,7414, // 6960 2970,4066,2932,7415,7416,7417,3904,3672,3424,7418,4542,4543,4544,7419,4968,7420, // 6976 7421,4255,7422,7423,7424,7425,7426,4067,7427,3673,3365,4545,7428,3110,2559,3674, // 6992 7429,7430,3156,7431,7432,3503,7433,3425,4546,7434,3063,2873,7435,3223,4969,4547, // 7008 4548,2898,4256,4068,7436,4069,3587,3786,2933,3787,4257,4970,4971,3788,7437,4972, // 7024 3064,7438,4549,7439,7440,7441,7442,7443,4973,3905,7444,2874,7445,7446,7447,7448, // 7040 3021,7449,4550,3906,3588,4974,7450,7451,3789,3675,7452,2578,7453,4070,7454,7455, // 7056 7456,4258,3676,7457,4975,7458,4976,4259,3790,3504,2634,4977,3677,4551,4260,7459, // 7072 7460,7461,7462,3907,4261,4978,7463,7464,7465,7466,4979,4980,7467,7468,2213,4262, // 7088 7469,7470,7471,3678,4981,7472,2439,7473,4263,3224,3289,7474,3908,2415,4982,7475, // 7104 4264,7476,4983,2655,7477,7478,2732,4552,2854,2875,7479,7480,4265,7481,4553,4984, // 7120 7482,7483,4266,7484,3679,3366,3680,2818,2781,2782,3367,3589,4554,3065,7485,4071, // 7136 2899,7486,7487,3157,2462,4072,4555,4073,4985,4986,3111,4267,2687,3368,4556,4074, // 7152 3791,4268,7488,3909,2783,7489,2656,1962,3158,4557,4987,1963,3159,3160,7490,3112, // 7168 4988,4989,3022,4990,4991,3792,2855,7491,7492,2971,4558,7493,7494,4992,7495,7496, // 7184 7497,7498,4993,7499,3426,4559,4994,7500,3681,4560,4269,4270,3910,7501,4075,4995, // 7200 4271,7502,7503,4076,7504,4996,7505,3225,4997,4272,4077,2819,3023,7506,7507,2733, // 7216 4561,7508,4562,7509,3369,3793,7510,3590,2508,7511,7512,4273,3113,2994,2616,7513, // 7232 7514,7515,7516,7517,7518,2820,3911,4078,2748,7519,7520,4563,4998,7521,7522,7523, // 7248 7524,4999,4274,7525,4564,3682,2239,4079,4565,7526,7527,7528,7529,5000,7530,7531, // 7264 5001,4275,3794,7532,7533,7534,3066,5002,4566,3161,7535,7536,4080,7537,3162,7538, // 7280 7539,4567,7540,7541,7542,7543,7544,7545,5003,7546,4568,7547,7548,7549,7550,7551, // 7296 7552,7553,7554,7555,7556,5004,7557,7558,7559,5005,7560,3795,7561,4569,7562,7563, // 7312 7564,2821,3796,4276,4277,4081,7565,2876,7566,5006,7567,7568,2900,7569,3797,3912, // 7328 7570,7571,7572,4278,7573,7574,7575,5007,7576,7577,5008,7578,7579,4279,2934,7580, // 7344 7581,5009,7582,4570,7583,4280,7584,7585,7586,4571,4572,3913,7587,4573,3505,7588, // 7360 5010,7589,7590,7591,7592,3798,4574,7593,7594,5011,7595,4281,7596,7597,7598,4282, // 7376 5012,7599,7600,5013,3163,7601,5014,7602,3914,7603,7604,2734,4575,4576,4577,7605, // 7392 7606,7607,7608,7609,3506,5015,4578,7610,4082,7611,2822,2901,2579,3683,3024,4579, // 7408 3507,7612,4580,7613,3226,3799,5016,7614,7615,7616,7617,7618,7619,7620,2995,3290, // 7424 7621,4083,7622,5017,7623,7624,7625,7626,7627,4581,3915,7628,3291,7629,5018,7630, // 7440 7631,7632,7633,4084,7634,7635,3427,3800,7636,7637,4582,7638,5019,4583,5020,7639, // 7456 3916,7640,3801,5021,4584,4283,7641,7642,3428,3591,2269,7643,2617,7644,4585,3592, // 7472 7645,4586,2902,7646,7647,3227,5022,7648,4587,7649,4284,7650,7651,7652,4588,2284, // 7488 7653,5023,7654,7655,7656,4589,5024,3802,7657,7658,5025,3508,4590,7659,7660,7661, // 7504 1969,5026,7662,7663,3684,1821,2688,7664,2028,2509,4285,7665,2823,1841,7666,2689, // 7520 3114,7667,3917,4085,2160,5027,5028,2972,7668,5029,7669,7670,7671,3593,4086,7672, // 7536 4591,4087,5030,3803,7673,7674,7675,7676,7677,7678,7679,4286,2366,4592,4593,3067, // 7552 2328,7680,7681,4594,3594,3918,2029,4287,7682,5031,3919,3370,4288,4595,2856,7683, // 7568 3509,7684,7685,5032,5033,7686,7687,3804,2784,7688,7689,7690,7691,3371,7692,7693, // 7584 2877,5034,7694,7695,3920,4289,4088,7696,7697,7698,5035,7699,5036,4290,5037,5038, // 7600 5039,7700,7701,7702,5040,5041,3228,7703,1760,7704,5042,3229,4596,2106,4089,7705, // 7616 4597,2824,5043,2107,3372,7706,4291,4090,5044,7707,4091,7708,5045,3025,3805,4598, // 7632 4292,4293,4294,3373,7709,4599,7710,5046,7711,7712,5047,5048,3806,7713,7714,7715, // 7648 5049,7716,7717,7718,7719,4600,5050,7720,7721,7722,5051,7723,4295,3429,7724,7725, // 7664 7726,7727,3921,7728,3292,5052,4092,7729,7730,7731,7732,7733,7734,7735,5053,5054, // 7680 7736,7737,7738,7739,3922,3685,7740,7741,7742,7743,2635,5055,7744,5056,4601,7745, // 7696 7746,2560,7747,7748,7749,7750,3923,7751,7752,7753,7754,7755,4296,2903,7756,7757, // 7712 7758,7759,7760,3924,7761,5057,4297,7762,7763,5058,4298,7764,4093,7765,7766,5059, // 7728 3925,7767,7768,7769,7770,7771,7772,7773,7774,7775,7776,3595,7777,4299,5060,4094, // 7744 7778,3293,5061,7779,7780,4300,7781,7782,4602,7783,3596,7784,7785,3430,2367,7786, // 7760 3164,5062,5063,4301,7787,7788,4095,5064,5065,7789,3374,3115,7790,7791,7792,7793, // 7776 7794,7795,7796,3597,4603,7797,7798,3686,3116,3807,5066,7799,7800,5067,7801,7802, // 7792 4604,4302,5068,4303,4096,7803,7804,3294,7805,7806,5069,4605,2690,7807,3026,7808, // 7808 7809,7810,7811,7812,7813,7814,7815,7816,7817,7818,7819,7820,7821,7822,7823,7824, // 7824 7825,7826,7827,7828,7829,7830,7831,7832,7833,7834,7835,7836,7837,7838,7839,7840, // 7840 7841,7842,7843,7844,7845,7846,7847,7848,7849,7850,7851,7852,7853,7854,7855,7856, // 7856 7857,7858,7859,7860,7861,7862,7863,7864,7865,7866,7867,7868,7869,7870,7871,7872, // 7872 7873,7874,7875,7876,7877,7878,7879,7880,7881,7882,7883,7884,7885,7886,7887,7888, // 7888 7889,7890,7891,7892,7893,7894,7895,7896,7897,7898,7899,7900,7901,7902,7903,7904, // 7904 7905,7906,7907,7908,7909,7910,7911,7912,7913,7914,7915,7916,7917,7918,7919,7920, // 7920 7921,7922,7923,7924,3926,7925,7926,7927,7928,7929,7930,7931,7932,7933,7934,7935, // 7936 7936,7937,7938,7939,7940,7941,7942,7943,7944,7945,7946,7947,7948,7949,7950,7951, // 7952 7952,7953,7954,7955,7956,7957,7958,7959,7960,7961,7962,7963,7964,7965,7966,7967, // 7968 7968,7969,7970,7971,7972,7973,7974,7975,7976,7977,7978,7979,7980,7981,7982,7983, // 7984 7984,7985,7986,7987,7988,7989,7990,7991,7992,7993,7994,7995,7996,7997,7998,7999, // 8000 8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8011,8012,8013,8014,8015, // 8016 8016,8017,8018,8019,8020,8021,8022,8023,8024,8025,8026,8027,8028,8029,8030,8031, // 8032 8032,8033,8034,8035,8036,8037,8038,8039,8040,8041,8042,8043,8044,8045,8046,8047, // 8048 8048,8049,8050,8051,8052,8053,8054,8055,8056,8057,8058,8059,8060,8061,8062,8063, // 8064 8064,8065,8066,8067,8068,8069,8070,8071,8072,8073,8074,8075,8076,8077,8078,8079, // 8080 8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8091,8092,8093,8094,8095, // 8096 8096,8097,8098,8099,8100,8101,8102,8103,8104,8105,8106,8107,8108,8109,8110,8111, // 8112 8112,8113,8114,8115,8116,8117,8118,8119,8120,8121,8122,8123,8124,8125,8126,8127, // 8128 8128,8129,8130,8131,8132,8133,8134,8135,8136,8137,8138,8139,8140,8141,8142,8143, // 8144 8144,8145,8146,8147,8148,8149,8150,8151,8152,8153,8154,8155,8156,8157,8158,8159, // 8160 8160,8161,8162,8163,8164,8165,8166,8167,8168,8169,8170,8171,8172,8173,8174,8175, // 8176 8176,8177,8178,8179,8180,8181,8182,8183,8184,8185,8186,8187,8188,8189,8190,8191, // 8192 8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207, // 8208 8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223, // 8224 8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239, // 8240 8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255, // 8256 8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271, // 8272 ****************************************************************************************/ }; ================================================ FILE: third_party/uchardet/uchardet/src/tools/CMakeLists.txt ================================================ set( UCHARDET_SOURCES uchardet.cpp ) include(CheckSymbolExists) check_symbol_exists(getopt_long "getopt.h" HAVE_GETOPT_LONG) # On Windows with MSVC, `getopt_long` is not available by default. # But some third-party libraries can be used. For example, in `vcpkg`, # we can find a port named `getopt-win32`. if (NOT HAVE_GETOPT_LONG) find_path(GETOPT_INCLUDE_DIR NAMES getopt.h) find_library(GETOPT_LIBRARY NAMES getopt) endif (NOT HAVE_GETOPT_LONG) set(UCHARDET_BINARY uchardet) add_executable( ${UCHARDET_BINARY} ${UCHARDET_SOURCES} ) if (GETOPT_INCLUDE_DIR AND GETOPT_LIBRARY) target_include_directories(${UCHARDET_BINARY} PRIVATE ${GETOPT_INCLUDE_DIR}) target_link_libraries(${UCHARDET_BINARY} PRIVATE ${GETOPT_LIBRARY}) endif (GETOPT_INCLUDE_DIR AND GETOPT_LIBRARY) target_link_libraries( ${UCHARDET_BINARY} ${UCHARDET_LIBRARY} ) install( TARGETS ${UCHARDET_BINARY} EXPORT UchardetTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) ================================================ FILE: third_party/uchardet/uchardet/src/tools/uchardet.cpp ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * BYVoid * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "../uchardet.h" #include #include #include #include #include #include #ifndef VERSION #define VERSION "Unknown" #endif #define BUFFER_SIZE 65536 char buffer[BUFFER_SIZE]; void detect(FILE * fp) { uchardet_t handle = uchardet_new(); while (!feof(fp)) { size_t len = fread(buffer, 1, BUFFER_SIZE, fp); int retval = uchardet_handle_data(handle, buffer, len); if (retval == HANDLE_DATA_RESULT_ERROR) { fprintf(stderr, "Handle data error.\n"); exit(1); } } uchardet_data_end(handle); const char * charset = uchardet_get_charset(handle); float confidence = uchardet_get_confidence(handle); if (*charset) printf("{ encoding=%s, confidence=%f }\n", charset, confidence); else printf("unknown\n"); uchardet_delete(handle); } void show_version() { printf("\n"); printf("uchardet Command Line Tool\n"); printf("Version %s\n", VERSION); printf("\n"); printf("Authors: %s\n", "BYVoid, Jehan"); printf("Bug Report: %s\n", "https://gitlab.freedesktop.org/uchardet/uchardet/-/issues"); printf("\n"); } void show_usage() { show_version(); printf("Usage:\n"); printf(" uchardet [Options] [File]...\n"); printf("\n"); printf("Options:\n"); printf(" -v, --version Print version and build information.\n"); printf(" -h, --help Print this help.\n"); printf("\n"); } int main(int argc, char ** argv) { static struct option longopts[] = { { "version", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { 0, 0, 0, 0 }, }; bool end_options = false; static int oc; while((oc = getopt_long(argc, argv, "vh", longopts, NULL)) != -1) { switch (oc) { case 'v': show_version(); return 0; case 'h': show_usage(); return 0; case '?': printf("Please use %s --help.\n", argv[0]); return 1; } } FILE * f = stdin; int error_seen = 0; if (argc < 2 || (argc == 2 && strcmp(argv[1], "--") == 0)) { // No file arg, use stdin by default detect(f); } for (int i = 1; i < argc; i++) { const char *filename = argv[i]; if (! end_options && strcmp(filename, "--") == 0) { end_options = true; continue; } f = fopen(filename, "r"); if (f == NULL) { perror(filename); error_seen = 1; continue; } if (argc > 2) { printf("%s: ", filename); } detect(f); } return error_seen; } ================================================ FILE: third_party/uchardet/uchardet/src/uchardet.cpp ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * BYVoid * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "uchardet.h" #include #include #include "nscore.h" #include "nsUniversalDetector.h" class HandleUniversalDetector : public nsUniversalDetector { protected: char* m_charset; float m_confidence; public: HandleUniversalDetector() : nsUniversalDetector(NS_FILTER_ALL) , m_charset(nullptr) , m_confidence(0.0f) { } virtual ~HandleUniversalDetector() { if (m_charset) { free(m_charset); m_confidence = 0.0; } } void Report(const char* charset, float confidence) override { if (m_charset) { free(m_charset); } m_charset = strdup(charset); m_confidence = confidence; } void Reset() override { nsUniversalDetector::Reset(); if (m_charset) { free(m_charset); } m_charset = strdup(""); m_confidence = 0.0; } const char* GetCharset() const { return m_charset ? m_charset : ""; } float GetConfidence() const { return m_confidence; } PRBool HasDone() const { return mDone; } }; uchardet_t uchardet_new(void) { return reinterpret_cast(new HandleUniversalDetector()); } void uchardet_delete(uchardet_t ud) { delete reinterpret_cast(ud); } int uchardet_handle_data(uchardet_t ud, const char * data, size_t len) { nsresult const ret = reinterpret_cast(ud)->HandleData(data, (PRUint32)len); if (ret == NS_ERROR_OUT_OF_MEMORY) { return HANDLE_DATA_RESULT_ERROR; } if (reinterpret_cast(ud)->HasDone()) { return HANDLE_DATA_RESULT_DETECTED; } return HANDLE_DATA_RESULT_NEED_MORE_DATA; } void uchardet_data_end(uchardet_t ud) { reinterpret_cast(ud)->DataEnd(); } void uchardet_reset(uchardet_t ud) { reinterpret_cast(ud)->Reset(); } const char* uchardet_get_charset(uchardet_t ud) { return reinterpret_cast(ud)->GetCharset(); } float uchardet_get_confidence(uchardet_t ud) { return reinterpret_cast(ud)->GetConfidence(); } ================================================ FILE: third_party/uchardet/uchardet/src/uchardet.h ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Universal charset detector code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * BYVoid * Jehan * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef UCHARDET_H___ #define UCHARDET_H___ #ifdef __cplusplus extern "C" { #endif #include /** * A handle for a uchardet encoding detector. */ typedef struct uchardet * uchardet_t; /** * Create an encoding detector. * @return an instance of uchardet_t. */ uchardet_t uchardet_new(void); /** * Delete an encoding detector. * @param ud [in] the uchardet_t handle to delete. */ void uchardet_delete(uchardet_t ud); #define HANDLE_DATA_RESULT_ERROR -1 #define HANDLE_DATA_RESULT_DETECTED 0 #define HANDLE_DATA_RESULT_NEED_MORE_DATA 1 /** * Feed data to an encoding detector. * The detector is able to shortcut processing when it reaches certainty * for an encoding, so you should not worry about limiting input data. * As far as you should be concerned: the more the better. * * @param ud [in] handle of an instance of uchardet * @param data [in] data * @param len [in] number of byte of data * @return non-zero number on failure. */ int uchardet_handle_data(uchardet_t ud, const char * data, size_t len); /** * Notify an end of data to an encoding detector. * @param ud [in] handle of an instance of uchardet */ void uchardet_data_end(uchardet_t ud); /** * Reset an encoding detector. * @param ud [in] handle of an instance of uchardet */ void uchardet_reset(uchardet_t ud); /** * Get an iconv-compatible name of the encoding that was detected. * @param ud [in] handle of an instance of uchardet * @return name of charset on success and "" on failure. */ const char * uchardet_get_charset(uchardet_t ud); float uchardet_get_confidence(uchardet_t ud); #ifdef __cplusplus } #endif #endif ================================================ FILE: third_party/uchardet/uchardet/uchardet.doap ================================================ uchardet Universal Charset Detector uchardet is an encoding detector library, which takes a sequence of bytes in an unknown character encoding without any additional information, and attempts to determine the encoding of the text. Returned encoding names are iconv-compatible. uchardet started as a C language binding of the original C++ implementation of the universal charset detection library by Mozilla. It can now detect more charsets, and more reliably than the original implementation. uchardet est une bibliothèque de détection de codage, prenant une séquence d'octets en entrée, représentant un texte, et tente d'en déterminer le codage. Le nom du codage retourné est compatible iconv. uchardet était originellement un binding en C de l'implémentation originelle en C++ par Mozilla. L'implémentation actuelle peut détecter plus de codages de caractères que l'originale. C C++ Python Jehan jehanp ================================================ FILE: third_party/uchardet/uchardet/uchardet.pc.in ================================================ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: uchardet Description: An encoding detector library ported from Mozilla Version: @UCHARDET_VERSION@ Requires: Libs: -L${libdir} -luchardet Libs.private: -lstdc++ Cflags: -I${includedir}/uchardet ================================================ FILE: third_party/uchardet/version.txt ================================================ 2018.09.27 ================================================ FILE: vcpkg.json ================================================ { "dependencies": [ "icu", "nlohmann-json", "gtest", "fmt", { "name": "imgui", "features": [ "glfw-binding", "win32-binding", "opengl3-binding", "freetype", "wchar32" ] }, "spdlog", "bshoshany-thread-pool", "boost-thread" ], "builtin-baseline": "9b5cb8e554487f3edb5d50b80188883846f81e14" }